- GetTimeFloat is not renderer specific

This commit is contained in:
Magnus Norddahl 2018-05-07 00:40:12 +02:00
parent bfe6bffd33
commit 49c9de350f
8 changed files with 7 additions and 20 deletions

View File

@ -146,11 +146,6 @@ void FGLModelRenderer::DrawElements(int numIndices, size_t offset)
glDrawElements(GL_TRIANGLES, numIndices, GL_UNSIGNED_INT, (void*)(intptr_t)offset); glDrawElements(GL_TRIANGLES, numIndices, GL_UNSIGNED_INT, (void*)(intptr_t)offset);
} }
double FGLModelRenderer::GetTimeFloat()
{
return (double)I_msTime() * (double)TICRATE / 1000.;
}
//=========================================================================== //===========================================================================
// //
// Uses a hardware buffer if either single frame (i.e. no interpolation needed) // Uses a hardware buffer if either single frame (i.e. no interpolation needed)

View File

@ -48,7 +48,6 @@ public:
void SetMaterial(FTexture *skin, bool clampNoFilter, int translation) override; void SetMaterial(FTexture *skin, bool clampNoFilter, int 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;
double GetTimeFloat() override;
}; };
void gl_RenderModel(GLSprite * spr, int mli); void gl_RenderModel(GLSprite * spr, int mli);

View File

@ -181,11 +181,6 @@ void PolyModelRenderer::DrawElements(int numIndices, size_t offset)
args.DrawElements(Thread->DrawQueue, VertexBuffer, IndexBuffer + offset / sizeof(unsigned int), numIndices); args.DrawElements(Thread->DrawQueue, VertexBuffer, IndexBuffer + offset / sizeof(unsigned int), numIndices);
} }
double PolyModelRenderer::GetTimeFloat()
{
return (double)I_msTime() * (double)TICRATE / 1000.;
}
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
PolyModelVertexBuffer::PolyModelVertexBuffer(bool needindex, bool singleframe) PolyModelVertexBuffer::PolyModelVertexBuffer(bool needindex, bool singleframe)

View File

@ -46,7 +46,6 @@ public:
void SetMaterial(FTexture *skin, bool clampNoFilter, int translation) override; void SetMaterial(FTexture *skin, bool clampNoFilter, int 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;
double GetTimeFloat() override;
void SetTransform(); void SetTransform();

View File

@ -39,6 +39,7 @@
#include "g_levellocals.h" #include "g_levellocals.h"
#include "r_utility.h" #include "r_utility.h"
#include "r_data/models/models.h" #include "r_data/models/models.h"
#include "i_time.h"
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(disable:4244) // warning C4244: conversion from 'double' to 'float', possible loss of data #pragma warning(disable:4244) // warning C4244: conversion from 'double' to 'float', possible loss of data
@ -277,6 +278,11 @@ void FModelRenderer::RenderFrameModels(const FSpriteModelFrame *smf,
} }
} }
double FModelRenderer::GetTimeFloat()
{
return (double)I_msTime() * (double)TICRATE / 1000.;
}
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
void gl_LoadModels() void gl_LoadModels()

View File

@ -72,10 +72,9 @@ public:
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 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);
static double GetTimeFloat();
}; };
struct FModelVertex struct FModelVertex

View File

@ -239,11 +239,6 @@ namespace swrenderer
args.DrawElements(Thread->DrawQueue, VertexBuffer, IndexBuffer + offset / sizeof(unsigned int), numIndices); args.DrawElements(Thread->DrawQueue, VertexBuffer, IndexBuffer + offset / sizeof(unsigned int), numIndices);
} }
double SWModelRenderer::GetTimeFloat()
{
return (double)I_msTime() * (double)TICRATE / 1000.;
}
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
SWModelVertexBuffer::SWModelVertexBuffer(bool needindex, bool singleframe) SWModelVertexBuffer::SWModelVertexBuffer(bool needindex, bool singleframe)

View File

@ -66,7 +66,6 @@ namespace swrenderer
void SetMaterial(FTexture *skin, bool clampNoFilter, int translation) override; void SetMaterial(FTexture *skin, bool clampNoFilter, int 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;
double GetTimeFloat() override;
void SetTransform(); void SetTransform();