mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-31 12:30:40 +00:00
use FTranslationID in the model code.
This commit is contained in:
parent
4cb3b96ddf
commit
0265d37fdb
17 changed files with 19 additions and 18 deletions
|
@ -4,6 +4,7 @@
|
||||||
#include "textureid.h"
|
#include "textureid.h"
|
||||||
#include "i_modelvertexbuffer.h"
|
#include "i_modelvertexbuffer.h"
|
||||||
#include "matrix.h"
|
#include "matrix.h"
|
||||||
|
#include "palettecontainer.h"
|
||||||
#include "TRS.h"
|
#include "TRS.h"
|
||||||
|
|
||||||
class DBoneComponents;
|
class DBoneComponents;
|
||||||
|
@ -72,7 +73,7 @@ public:
|
||||||
|
|
||||||
virtual bool Load(const char * fn, int lumpnum, const char * buffer, int length) = 0;
|
virtual bool Load(const char * fn, int lumpnum, const char * buffer, int length) = 0;
|
||||||
virtual int FindFrame(const char * name, bool nodefault = false) = 0;
|
virtual int FindFrame(const char * name, bool nodefault = false) = 0;
|
||||||
virtual void RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frame, int frame2, double inter, int translation, const FTextureID* surfaceskinids, const TArray<VSMatrix>& boneData, int boneStartPosition) = 0;
|
virtual void RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frame, int frame2, double inter, FTranslationID translation, const FTextureID* surfaceskinids, const TArray<VSMatrix>& boneData, int boneStartPosition) = 0;
|
||||||
virtual void BuildVertexBuffer(FModelRenderer *renderer) = 0;
|
virtual void BuildVertexBuffer(FModelRenderer *renderer) = 0;
|
||||||
virtual void AddSkins(uint8_t *hitlist, const FTextureID* surfaceskinids) = 0;
|
virtual void AddSkins(uint8_t *hitlist, const FTextureID* surfaceskinids) = 0;
|
||||||
virtual float getAspectFactor(float vscale) { return 1.f; }
|
virtual float getAspectFactor(float vscale) { return 1.f; }
|
||||||
|
|
|
@ -112,7 +112,7 @@ public:
|
||||||
|
|
||||||
bool Load(const char* fn, int lumpnum, const char* buffer, int length) override;
|
bool Load(const char* fn, int lumpnum, const char* buffer, int length) override;
|
||||||
int FindFrame(const char* name, bool nodefault) override;
|
int FindFrame(const char* name, bool nodefault) override;
|
||||||
void RenderFrame(FModelRenderer* renderer, FGameTexture* skin, int frame, int frame2, double inter, int translation, const FTextureID* surfaceskinids, const TArray<VSMatrix>& boneData, int boneStartPosition) override;
|
void RenderFrame(FModelRenderer* renderer, FGameTexture* skin, int frame, int frame2, double inter, FTranslationID translation, const FTextureID* surfaceskinids, const TArray<VSMatrix>& boneData, int boneStartPosition) override;
|
||||||
void BuildVertexBuffer(FModelRenderer* renderer) override;
|
void BuildVertexBuffer(FModelRenderer* renderer) override;
|
||||||
void AddSkins(uint8_t* hitlist, const FTextureID* surfaceskinids) override;
|
void AddSkins(uint8_t* hitlist, const FTextureID* surfaceskinids) override;
|
||||||
const TArray<TRS>* AttachAnimationData() override;
|
const TArray<TRS>* AttachAnimationData() override;
|
||||||
|
|
|
@ -59,7 +59,7 @@ public:
|
||||||
bool Load(const char * fn, int lumpnum, const char * buffer, int length) override;
|
bool Load(const char * fn, int lumpnum, const char * buffer, int length) override;
|
||||||
void Initialize();
|
void Initialize();
|
||||||
virtual int FindFrame(const char* name, bool nodefault) override;
|
virtual int FindFrame(const char* name, bool nodefault) override;
|
||||||
virtual void RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frame, int frame2, double inter, int translation, const FTextureID* surfaceskinids, const TArray<VSMatrix>& boneData, int boneStartPosition) override;
|
virtual void RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frame, int frame2, double inter, FTranslationID translation, const FTextureID* surfaceskinids, const TArray<VSMatrix>& boneData, int boneStartPosition) override;
|
||||||
virtual void AddSkins(uint8_t *hitlist, const FTextureID* surfaceskinids) override;
|
virtual void AddSkins(uint8_t *hitlist, const FTextureID* surfaceskinids) override;
|
||||||
FTextureID GetPaletteTexture() const { return mPalette; }
|
FTextureID GetPaletteTexture() const { return mPalette; }
|
||||||
void BuildVertexBuffer(FModelRenderer *renderer) override;
|
void BuildVertexBuffer(FModelRenderer *renderer) override;
|
||||||
|
|
|
@ -113,7 +113,7 @@ public:
|
||||||
|
|
||||||
virtual bool Load(const char * fn, int lumpnum, const char * buffer, int length) override;
|
virtual bool Load(const char * fn, int lumpnum, const char * buffer, int length) override;
|
||||||
virtual int FindFrame(const char* name, bool nodefault) override;
|
virtual int FindFrame(const char* name, bool nodefault) override;
|
||||||
virtual void RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frame, int frame2, double inter, int translation, const FTextureID* surfaceskinids, const TArray<VSMatrix>& boneData, int boneStartPosition) override;
|
virtual void RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frame, int frame2, double inter, FTranslationID translation, const FTextureID* surfaceskinids, const TArray<VSMatrix>& boneData, int boneStartPosition) override;
|
||||||
virtual void LoadGeometry();
|
virtual void LoadGeometry();
|
||||||
virtual void AddSkins(uint8_t *hitlist, const FTextureID* surfaceskinids) override;
|
virtual void AddSkins(uint8_t *hitlist, const FTextureID* surfaceskinids) override;
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ public:
|
||||||
|
|
||||||
virtual bool Load(const char * fn, int lumpnum, const char * buffer, int length) override;
|
virtual bool Load(const char * fn, int lumpnum, const char * buffer, int length) override;
|
||||||
virtual int FindFrame(const char* name, bool nodefault) override;
|
virtual int FindFrame(const char* name, bool nodefault) override;
|
||||||
virtual void RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frame, int frame2, double inter, int translation, const FTextureID* surfaceskinids, const TArray<VSMatrix>& boneData, int boneStartPosition) override;
|
virtual void RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frame, int frame2, double inter, FTranslationID translation, const FTextureID* surfaceskinids, const TArray<VSMatrix>& boneData, int boneStartPosition) override;
|
||||||
void LoadGeometry();
|
void LoadGeometry();
|
||||||
void BuildVertexBuffer(FModelRenderer *renderer);
|
void BuildVertexBuffer(FModelRenderer *renderer);
|
||||||
virtual void AddSkins(uint8_t *hitlist, const FTextureID* surfaceskinids) override;
|
virtual void AddSkins(uint8_t *hitlist, const FTextureID* surfaceskinids) override;
|
||||||
|
|
|
@ -98,7 +98,7 @@ public:
|
||||||
~FOBJModel();
|
~FOBJModel();
|
||||||
bool Load(const char* fn, int lumpnum, const char* buffer, int length) override;
|
bool Load(const char* fn, int lumpnum, const char* buffer, int length) override;
|
||||||
int FindFrame(const char* name, bool nodefault) override;
|
int FindFrame(const char* name, bool nodefault) override;
|
||||||
void RenderFrame(FModelRenderer* renderer, FGameTexture* skin, int frame, int frame2, double inter, int translation, const FTextureID* surfaceskinids, const TArray<VSMatrix>& boneData, int boneStartPosition) override;
|
void RenderFrame(FModelRenderer* renderer, FGameTexture* skin, int frame, int frame2, double inter, FTranslationID translation, const FTextureID* surfaceskinids, const TArray<VSMatrix>& boneData, int boneStartPosition) override;
|
||||||
void BuildVertexBuffer(FModelRenderer* renderer) override;
|
void BuildVertexBuffer(FModelRenderer* renderer) override;
|
||||||
void AddSkins(uint8_t* hitlist, const FTextureID* surfaceskinids) override;
|
void AddSkins(uint8_t* hitlist, const FTextureID* surfaceskinids) override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -26,7 +26,7 @@ public:
|
||||||
|
|
||||||
bool Load(const char * fn, int lumpnum, const char * buffer, int length) override;
|
bool Load(const char * fn, int lumpnum, const char * buffer, int length) override;
|
||||||
int FindFrame(const char* name, bool nodefault) override;
|
int FindFrame(const char* name, bool nodefault) override;
|
||||||
void RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frame, int frame2, double inter, int translation, const FTextureID* surfaceskinids, const TArray<VSMatrix>& boneData, int boneStartPosition) override;
|
void RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frame, int frame2, double inter, FTranslationID translation, const FTextureID* surfaceskinids, const TArray<VSMatrix>& boneData, int boneStartPosition) override;
|
||||||
void BuildVertexBuffer(FModelRenderer *renderer) override;
|
void BuildVertexBuffer(FModelRenderer *renderer) override;
|
||||||
void AddSkins(uint8_t *hitlist, const FTextureID* surfaceskinids) override;
|
void AddSkins(uint8_t *hitlist, const FTextureID* surfaceskinids) override;
|
||||||
void LoadGeometry();
|
void LoadGeometry();
|
||||||
|
|
|
@ -21,7 +21,7 @@ public:
|
||||||
virtual void EndDrawHUDModel(FRenderStyle style, FSpriteModelFrame *smf) = 0;
|
virtual void EndDrawHUDModel(FRenderStyle style, FSpriteModelFrame *smf) = 0;
|
||||||
|
|
||||||
virtual void SetInterpolation(double interpolation) = 0;
|
virtual void SetInterpolation(double interpolation) = 0;
|
||||||
virtual void SetMaterial(FGameTexture *skin, bool clampNoFilter, int translation) = 0;
|
virtual void SetMaterial(FGameTexture *skin, bool clampNoFilter, FTranslationID translation) = 0;
|
||||||
virtual void DrawArrays(int start, int count) = 0;
|
virtual void DrawArrays(int start, int count) = 0;
|
||||||
virtual void DrawElements(int numIndices, size_t offset) = 0;
|
virtual void DrawElements(int numIndices, size_t offset) = 0;
|
||||||
virtual int SetupFrame(FModel* model, unsigned int frame1, unsigned int frame2, unsigned int size, const TArray<VSMatrix>& bones, int boneStartIndex) { return -1; };
|
virtual int SetupFrame(FModel* model, unsigned int frame1, unsigned int frame2, unsigned int size, const TArray<VSMatrix>& bones, int boneStartIndex) { return -1; };
|
||||||
|
|
|
@ -445,7 +445,7 @@ int IQMModel::FindFrame(const char* name, bool nodefault)
|
||||||
return FErr_NotFound;
|
return FErr_NotFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IQMModel::RenderFrame(FModelRenderer* renderer, FGameTexture* skin, int frame1, int frame2, double inter, int translation, const FTextureID* surfaceskinids, const TArray<VSMatrix>& boneData, int boneStartPosition)
|
void IQMModel::RenderFrame(FModelRenderer* renderer, FGameTexture* skin, int frame1, int frame2, double inter, FTranslationID translation, const FTextureID* surfaceskinids, const TArray<VSMatrix>& boneData, int boneStartPosition)
|
||||||
{
|
{
|
||||||
renderer->SetupFrame(this, 0, 0, NumVertices, boneData, boneStartPosition);
|
renderer->SetupFrame(this, 0, 0, NumVertices, boneData, boneStartPosition);
|
||||||
|
|
||||||
|
|
|
@ -364,7 +364,7 @@ int FDMDModel::FindFrame(const char* name, bool nodefault)
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
void FDMDModel::RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frameno, int frameno2, double inter, int translation, const FTextureID*, const TArray<VSMatrix>& boneData, int boneStartPosition)
|
void FDMDModel::RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frameno, int frameno2, double inter, FTranslationID translation, const FTextureID*, const TArray<VSMatrix>& boneData, int boneStartPosition)
|
||||||
{
|
{
|
||||||
if (frameno >= info.numFrames || frameno2 >= info.numFrames) return;
|
if (frameno >= info.numFrames || frameno2 >= info.numFrames) return;
|
||||||
|
|
||||||
|
|
|
@ -345,7 +345,7 @@ int FMD3Model::FindFrame(const char* name, bool nodefault)
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
void FMD3Model::RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frameno, int frameno2, double inter, int translation, const FTextureID* surfaceskinids, const TArray<VSMatrix>& boneData, int boneStartPosition)
|
void FMD3Model::RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frameno, int frameno2, double inter, FTranslationID translation, const FTextureID* surfaceskinids, const TArray<VSMatrix>& boneData, int boneStartPosition)
|
||||||
{
|
{
|
||||||
if ((unsigned)frameno >= Frames.Size() || (unsigned)frameno2 >= Frames.Size()) return;
|
if ((unsigned)frameno >= Frames.Size() || (unsigned)frameno2 >= Frames.Size()) return;
|
||||||
|
|
||||||
|
|
|
@ -630,7 +630,7 @@ int FOBJModel::FindFrame(const char* name, bool nodefault)
|
||||||
* @param inter The amount to interpolate the two frames.
|
* @param inter The amount to interpolate the two frames.
|
||||||
* @param translation The translation for the skin
|
* @param translation The translation for the skin
|
||||||
*/
|
*/
|
||||||
void FOBJModel::RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frameno, int frameno2, double inter, int translation, const FTextureID* surfaceskinids, const TArray<VSMatrix>& boneData, int boneStartPosition)
|
void FOBJModel::RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frameno, int frameno2, double inter, FTranslationID translation, const FTextureID* surfaceskinids, const TArray<VSMatrix>& boneData, int boneStartPosition)
|
||||||
{
|
{
|
||||||
// Prevent the model from rendering if the frame number is < 0
|
// Prevent the model from rendering if the frame number is < 0
|
||||||
if (frameno < 0 || frameno2 < 0) return;
|
if (frameno < 0 || frameno2 < 0) return;
|
||||||
|
|
|
@ -232,7 +232,7 @@ int FUE1Model::FindFrame(const char* name, bool nodefault)
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FUE1Model::RenderFrame( FModelRenderer *renderer, FGameTexture *skin, int frame, int frame2, double inter, int translation, const FTextureID* surfaceskinids, const TArray<VSMatrix>& boneData, int boneStartPosition)
|
void FUE1Model::RenderFrame( FModelRenderer *renderer, FGameTexture *skin, int frame, int frame2, double inter, FTranslationID translation, const FTextureID* surfaceskinids, const TArray<VSMatrix>& boneData, int boneStartPosition)
|
||||||
{
|
{
|
||||||
// the moment of magic
|
// the moment of magic
|
||||||
if ( (frame < 0) || (frame2 < 0) || (frame >= numFrames) || (frame2 >= numFrames) ) return;
|
if ( (frame < 0) || (frame2 < 0) || (frame >= numFrames) || (frame2 >= numFrames) ) return;
|
||||||
|
|
|
@ -400,7 +400,7 @@ float FVoxelModel::getAspectFactor(float stretch)
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
void FVoxelModel::RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frame, int frame2, double inter, int translation, const FTextureID*, const TArray<VSMatrix>& boneData, int boneStartPosition)
|
void FVoxelModel::RenderFrame(FModelRenderer *renderer, FGameTexture * skin, int frame, int frame2, double inter, FTranslationID translation, const FTextureID*, const TArray<VSMatrix>& boneData, int boneStartPosition)
|
||||||
{
|
{
|
||||||
renderer->SetMaterial(skin, true, translation);
|
renderer->SetMaterial(skin, true, translation);
|
||||||
renderer->SetupFrame(this, 0, 0, 0, {}, -1);
|
renderer->SetupFrame(this, 0, 0, 0, {}, -1);
|
||||||
|
|
|
@ -87,9 +87,9 @@ void FHWModelRenderer::SetInterpolation(double inter)
|
||||||
state.SetInterpolationFactor((float)inter);
|
state.SetInterpolationFactor((float)inter);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FHWModelRenderer::SetMaterial(FGameTexture *skin, bool clampNoFilter, int translation)
|
void FHWModelRenderer::SetMaterial(FGameTexture *skin, bool clampNoFilter, FTranslationID translation)
|
||||||
{
|
{
|
||||||
state.SetMaterial(skin, UF_Skin, 0, clampNoFilter ? CLAMP_NOFILTER : CLAMP_NONE, translation, -1);
|
state.SetMaterial(skin, UF_Skin, 0, clampNoFilter ? CLAMP_NOFILTER : CLAMP_NONE, translation.index(), -1);
|
||||||
state.SetLightIndex(modellightindex);
|
state.SetLightIndex(modellightindex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ public:
|
||||||
void BeginDrawHUDModel(FRenderStyle style, const VSMatrix &objectToWorldMatrix, bool mirrored, FSpriteModelFrame* smf) override;
|
void BeginDrawHUDModel(FRenderStyle style, const VSMatrix &objectToWorldMatrix, bool mirrored, FSpriteModelFrame* smf) override;
|
||||||
void EndDrawHUDModel(FRenderStyle style, FSpriteModelFrame* smf) override;
|
void EndDrawHUDModel(FRenderStyle style, FSpriteModelFrame* smf) override;
|
||||||
void SetInterpolation(double interpolation) override;
|
void SetInterpolation(double interpolation) override;
|
||||||
void SetMaterial(FGameTexture *skin, bool clampNoFilter, int translation) override;
|
void SetMaterial(FGameTexture *skin, bool clampNoFilter, FTranslationID translation) override;
|
||||||
void DrawArrays(int start, int count) override;
|
void DrawArrays(int start, int count) override;
|
||||||
void DrawElements(int numIndices, size_t offset) override;
|
void DrawElements(int numIndices, size_t offset) override;
|
||||||
int SetupFrame(FModel* model, unsigned int frame1, unsigned int frame2, unsigned int size, const TArray<VSMatrix>& bones, int boneStartIndex) override;
|
int SetupFrame(FModel* model, unsigned int frame1, unsigned int frame2, unsigned int size, const TArray<VSMatrix>& bones, int boneStartIndex) override;
|
||||||
|
|
|
@ -157,7 +157,7 @@ void HWSprite::DrawSprite(HWDrawInfo* di, FRenderState& state, bool translucent)
|
||||||
mr.BeginDrawModel(RenderStyle, nullptr, rotmat, mirrored);
|
mr.BeginDrawModel(RenderStyle, nullptr, rotmat, mirrored);
|
||||||
TArray<VSMatrix> a;
|
TArray<VSMatrix> a;
|
||||||
mr.SetupFrame(model, 0, 0, 0, a, 0);
|
mr.SetupFrame(model, 0, 0, 0, a, 0);
|
||||||
model->RenderFrame(&mr, TexMan.GetGameTexture(model->GetPaletteTexture()), 0, 0, 0.f, TRANSLATION(Translation_Remap + curbasepal, palette).index(), nullptr, a, 0);
|
model->RenderFrame(&mr, TexMan.GetGameTexture(model->GetPaletteTexture()), 0, 0, 0.f, TRANSLATION(Translation_Remap + curbasepal, palette), nullptr, a, 0);
|
||||||
mr.EndDrawModel(RenderStyle, nullptr);
|
mr.EndDrawModel(RenderStyle, nullptr);
|
||||||
state.SetDepthFunc(DF_Less);
|
state.SetDepthFunc(DF_Less);
|
||||||
state.SetVertexBuffer(screen->mVertexData);
|
state.SetVertexBuffer(screen->mVertexData);
|
||||||
|
|
Loading…
Reference in a new issue