- re-doubled the model rotation code

This commit is contained in:
Rachael Alexanderson 2017-11-23 21:27:16 -05:00
parent 16e6fbf5bf
commit 1f00810f40
4 changed files with 7 additions and 7 deletions

View file

@ -102,7 +102,7 @@ void FModelRenderer::RenderModel(float x, float y, float z, FSpriteModelFrame *s
if (smf->flags & MDL_ROTATING) if (smf->flags & MDL_ROTATING)
{ {
const float time = smf->rotationSpeed*GetTimeFloat() / 200.f; const double time = smf->rotationSpeed*GetTimeFloat() / 200.f;
rotateOffset = float((time - xs_FloorToInt(time)) *360.f); rotateOffset = float((time - xs_FloorToInt(time)) *360.f);
} }
@ -225,7 +225,7 @@ void FModelRenderer::RenderFrameModels(const FSpriteModelFrame *smf,
// [BB] In case the tic counter is frozen we have to leave ticFraction at zero. // [BB] In case the tic counter is frozen we have to leave ticFraction at zero.
if (ConsoleState == c_up && menuactive != MENU_On && !(level.flags2 & LEVEL2_FROZEN)) if (ConsoleState == c_up && menuactive != MENU_On && !(level.flags2 & LEVEL2_FROZEN))
{ {
float time = GetTimeFloat(); double time = GetTimeFloat();
ticFraction = (time - static_cast<int>(time)); ticFraction = (time - static_cast<int>(time));
} }
inter = static_cast<double>(curState->Tics - curTics - ticFraction) / static_cast<double>(curState->Tics); inter = static_cast<double>(curState->Tics - curTics - ticFraction) / static_cast<double>(curState->Tics);
@ -382,7 +382,7 @@ void FGLModelRenderer::DrawElements(int primitiveType, int numIndices, int eleme
glDrawElements(primitiveType, numIndices, elementType, (void*)(intptr_t)offset); glDrawElements(primitiveType, numIndices, elementType, (void*)(intptr_t)offset);
} }
float FGLModelRenderer::GetTimeFloat() double FGLModelRenderer::GetTimeFloat()
{ {
return (float)I_msTime() * (float)TICRATE / 1000.0f; return (float)I_msTime() * (float)TICRATE / 1000.0f;
} }

View file

@ -71,7 +71,7 @@ public:
virtual void DrawArrays(int primitiveType, int start, int count) = 0; virtual void DrawArrays(int primitiveType, int start, int count) = 0;
virtual void DrawElements(int primitiveType, int numIndices, int elementType, size_t offset) = 0; virtual void DrawElements(int primitiveType, int numIndices, int elementType, size_t offset) = 0;
virtual float GetTimeFloat() = 0; virtual double GetTimeFloat() = 0;
private: private:
void RenderFrameModels(const FSpriteModelFrame *smf, const FState *curState, const int curTics, const PClass *ti, Matrix3x4 *normaltransform, int translation); void RenderFrameModels(const FSpriteModelFrame *smf, const FState *curState, const int curTics, const PClass *ti, Matrix3x4 *normaltransform, int translation);
@ -92,7 +92,7 @@ public:
void SetMaterial(FTexture *skin, int clampmode, int translation) override; void SetMaterial(FTexture *skin, int clampmode, int translation) override;
void DrawArrays(int primitiveType, int start, int count) override; void DrawArrays(int primitiveType, int start, int count) override;
void DrawElements(int primitiveType, int numIndices, int elementType, size_t offset) override; void DrawElements(int primitiveType, int numIndices, int elementType, size_t offset) override;
float GetTimeFloat() override; double GetTimeFloat() override;
}; };
class FModel class FModel

View file

@ -175,7 +175,7 @@ void PolyModelRenderer::DrawElements(int primitiveType, int numIndices, int elem
args.DrawElements(Thread, VertexBuffer, IndexBuffer + offset / sizeof(unsigned int), numIndices); args.DrawElements(Thread, VertexBuffer, IndexBuffer + offset / sizeof(unsigned int), numIndices);
} }
float PolyModelRenderer::GetTimeFloat() double PolyModelRenderer::GetTimeFloat()
{ {
return 0.0f; // (float)gl_frameMS * (float)TICRATE / 1000.0f; return 0.0f; // (float)gl_frameMS * (float)TICRATE / 1000.0f;
} }

View file

@ -46,7 +46,7 @@ public:
void SetMaterial(FTexture *skin, int clampmode, int translation) override; void SetMaterial(FTexture *skin, int clampmode, int translation) override;
void DrawArrays(int primitiveType, int start, int count) override; void DrawArrays(int primitiveType, int start, int count) override;
void DrawElements(int primitiveType, int numIndices, int elementType, size_t offset) override; void DrawElements(int primitiveType, int numIndices, int elementType, size_t offset) override;
float GetTimeFloat() override; double GetTimeFloat() override;
PolyRenderThread *Thread = nullptr; PolyRenderThread *Thread = nullptr;
const TriMatrix &WorldToClip; const TriMatrix &WorldToClip;