From 1f00810f40f882fd3e0736b03323f3d53bb99fcf Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Thu, 23 Nov 2017 21:27:16 -0500 Subject: [PATCH] - re-doubled the model rotation code --- src/gl/models/gl_models.cpp | 6 +++--- src/gl/models/gl_models.h | 4 ++-- src/polyrenderer/scene/poly_model.cpp | 2 +- src/polyrenderer/scene/poly_model.h | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/gl/models/gl_models.cpp b/src/gl/models/gl_models.cpp index f05bd7d3c..989b6d6ab 100644 --- a/src/gl/models/gl_models.cpp +++ b/src/gl/models/gl_models.cpp @@ -102,7 +102,7 @@ void FModelRenderer::RenderModel(float x, float y, float z, FSpriteModelFrame *s 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); } @@ -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. if (ConsoleState == c_up && menuactive != MENU_On && !(level.flags2 & LEVEL2_FROZEN)) { - float time = GetTimeFloat(); + double time = GetTimeFloat(); ticFraction = (time - static_cast(time)); } inter = static_cast(curState->Tics - curTics - ticFraction) / static_cast(curState->Tics); @@ -382,7 +382,7 @@ void FGLModelRenderer::DrawElements(int primitiveType, int numIndices, int eleme glDrawElements(primitiveType, numIndices, elementType, (void*)(intptr_t)offset); } -float FGLModelRenderer::GetTimeFloat() +double FGLModelRenderer::GetTimeFloat() { return (float)I_msTime() * (float)TICRATE / 1000.0f; } diff --git a/src/gl/models/gl_models.h b/src/gl/models/gl_models.h index 84e331e31..cc41466db 100644 --- a/src/gl/models/gl_models.h +++ b/src/gl/models/gl_models.h @@ -71,7 +71,7 @@ public: virtual void DrawArrays(int primitiveType, int start, int count) = 0; virtual void DrawElements(int primitiveType, int numIndices, int elementType, size_t offset) = 0; - virtual float GetTimeFloat() = 0; + virtual double GetTimeFloat() = 0; private: 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 DrawArrays(int primitiveType, int start, int count) override; void DrawElements(int primitiveType, int numIndices, int elementType, size_t offset) override; - float GetTimeFloat() override; + double GetTimeFloat() override; }; class FModel diff --git a/src/polyrenderer/scene/poly_model.cpp b/src/polyrenderer/scene/poly_model.cpp index 88064ce97..f9d7b4887 100644 --- a/src/polyrenderer/scene/poly_model.cpp +++ b/src/polyrenderer/scene/poly_model.cpp @@ -175,7 +175,7 @@ void PolyModelRenderer::DrawElements(int primitiveType, int numIndices, int elem 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; } diff --git a/src/polyrenderer/scene/poly_model.h b/src/polyrenderer/scene/poly_model.h index 8585be44c..d80bed45f 100644 --- a/src/polyrenderer/scene/poly_model.h +++ b/src/polyrenderer/scene/poly_model.h @@ -46,7 +46,7 @@ public: void SetMaterial(FTexture *skin, int clampmode, int translation) override; void DrawArrays(int primitiveType, int start, int count) override; void DrawElements(int primitiveType, int numIndices, int elementType, size_t offset) override; - float GetTimeFloat() override; + double GetTimeFloat() override; PolyRenderThread *Thread = nullptr; const TriMatrix &WorldToClip;