Skip to content

Commit 81bfd0c

Browse files
committed
Revert "MD3: Reuse state of last frame if animation didn't change"
This reverts commit c43cd9e. but keeps the clamping of the frame numbers caching doesn't work like this: The idRenderModelMD3 is shared between multiple instances, so lastFrame, lastOldFrame and lastBackLerp would have to be saved in staticModel/cachedModel or the renderEntity_s otherwise animations don't work when there's more than one MD3 model of a kind in the level. refs dhewm#727 - still doesn't fix the animation speed issues mentioned there, they are caused by "Recalculate gameLocal.msec each frame so 60 frames add up to 1000ms" (sys.waitFrame() in scripts waits for gameLocal.msec but that's the length of the current frame, not the next, so when sleeping for 17ms and the next frame is a 16ms frame one might sleep for two frames instead of one)
1 parent 0f4be4f commit 81bfd0c

File tree

2 files changed

+3
-19
lines changed

2 files changed

+3
-19
lines changed

neo/renderer/Model_local.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,6 @@ class idRenderModelMD3 : public idRenderModelStatic {
231231
int dataSize; // just for listing purposes
232232
struct md3Header_s * md3; // only if type == MOD_MESH
233233
int numLods;
234-
235-
int lastFrame;
236-
int lastOldFrame;
237-
float lastBackLerp;
238234
idList<const idMaterial*> shaders; // DG: md3Shader_t::shaderIndex indexes into this array
239235

240236
// DG: added the following so we can generate/store sil edges for shadows

neo/renderer/Model_md3.cpp

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ If you have questions concerning this license or the applicable additional terms
3939
***********************************************************************/
4040

4141
// DG: added constructor to make sure all members are initialized
42-
idRenderModelMD3::idRenderModelMD3() : index(-1), dataSize(0), md3(NULL), numLods(0),
43-
lastFrame(-1), lastOldFrame(0), lastBackLerp(0.0f)
42+
idRenderModelMD3::idRenderModelMD3() : index(-1), dataSize(0), md3(NULL), numLods(0)
4443
{}
4544

4645
// DG: added destructor to clean up the newly added silInfos (and md3 which used to leak)
@@ -329,21 +328,10 @@ idRenderModel *idRenderModelMD3::InstantiateDynamicModel( const struct renderEnt
329328
backlerp = ent->shaderParms[SHADERPARM_MD3_BACKLERP];
330329

331330
if ( cachedModel ) {
332-
if ( !r_useCachedDynamicModels.GetBool() || frame != lastFrame
333-
|| oldframe != lastOldFrame || backlerp != lastBackLerp ) {
334-
delete cachedModel;
335-
cachedModel = NULL;
336-
} else {
337-
// if we're still in the same animation frame etc, just use the existing model
338-
return cachedModel;
339-
}
331+
delete cachedModel;
332+
cachedModel = NULL;
340333
}
341334

342-
// DG: remember (old)frame and backlerp for the check above if the cached model can be reused
343-
lastFrame = frame;
344-
lastOldFrame = oldframe;
345-
lastBackLerp = backlerp;
346-
347335
staticModel = new idRenderModelStatic;
348336
staticModel->InitEmpty("_MD3_Snapshot_");
349337
staticModel->bounds.Clear();

0 commit comments

Comments
 (0)