protected void RestoreBuffersForUnusedAnimation( bool hardwareAnimation )
{
// Rebind original positions if:
// We didn't apply any animation and
// We're morph animated (hardware binds keyframe, software is missing)
// or we're pose animated and software (hardware is fine, still bound)
if ( this.mesh.SharedVertexData != null &&
!this.vertexAnimationAppliedThisFrame &&
( !hardwareAnimation || this.mesh.SharedVertexDataAnimationType == VertexAnimationType.Morph ) )
{
VertexElement srcPosElem =
this.mesh.SharedVertexData.vertexDeclaration.FindElementBySemantic(
VertexElementSemantic.Position );
HardwareVertexBuffer srcBuf =
this.mesh.SharedVertexData.vertexBufferBinding.GetBuffer( srcPosElem.Source );
// Bind to software
VertexElement destPosElem =
this.softwareVertexAnimVertexData.vertexDeclaration.FindElementBySemantic(
VertexElementSemantic.Position );
this.softwareVertexAnimVertexData.vertexBufferBinding.SetBinding( destPosElem.Source, srcBuf );
}
foreach ( SubEntity subEntity in this.subEntityList )
{
subEntity.RestoreBuffersForUnusedAnimation( hardwareAnimation );
}
}