From debfd9b780568d4abdc7fc4366b3c01158a4111e Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 13 Sep 2017 14:58:54 -0500 Subject: [PATCH] Sanity check to ensure detail levels shift in tandem for skinned meshes --- Engine/source/ts/tsShapeInstance.cpp | 10 +++++----- Engine/source/ts/tsShapeInstance.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Engine/source/ts/tsShapeInstance.cpp b/Engine/source/ts/tsShapeInstance.cpp index c90636336..98d6b39ea 100644 --- a/Engine/source/ts/tsShapeInstance.cpp +++ b/Engine/source/ts/tsShapeInstance.cpp @@ -811,7 +811,7 @@ void TSShapeInstance::MeshObjectInstance::render( S32 objectDetail, // skin is dirty and needs to be updated. This should result // in the skin only updating once per frame in most cases. const U32 currTime = Sim::getCurrentTime(); - bool isSkinDirty = currTime != mLastTime; + bool isSkinDirty = (currTime != mLastTime) || (objectDetail != mLastObjectDetail); // Update active transform list for bones for GPU skinning if ( mesh->getMeshType() == TSMesh::SkinMeshType ) @@ -832,7 +832,7 @@ void TSShapeInstance::MeshObjectInstance::render( S32 objectDetail, // Update the last render time. mLastTime = currTime; - + mLastObjectDetail = objectDetail; GFX->popWorldMatrix(); } @@ -863,9 +863,9 @@ bool TSShapeInstance::MeshObjectInstance::bufferNeedsUpdate( S32 objectDetail ) return mesh && mesh->getMeshType() == TSMesh::SkinMeshType && currTime != mLastTime; } -TSShapeInstance::MeshObjectInstance::MeshObjectInstance() - : meshList(0), object(0), frame(0), matFrame(0), - visible(1.0f), forceHidden(false), mLastTime( 0 ) +TSShapeInstance::MeshObjectInstance::MeshObjectInstance() + : meshList(0), object(0), frame(0), matFrame(0), + visible(1.0f), forceHidden(false), mLastTime(0), mLastObjectDetail(0) { } diff --git a/Engine/source/ts/tsShapeInstance.h b/Engine/source/ts/tsShapeInstance.h index 48b253358..292eb9302 100644 --- a/Engine/source/ts/tsShapeInstance.h +++ b/Engine/source/ts/tsShapeInstance.h @@ -157,7 +157,7 @@ class TSShapeInstance S32 frame; S32 matFrame; F32 visible; - + S32 mLastObjectDetail; /// If true this mesh is forced to be hidden /// regardless of the animation state. bool forceHidden;