Axiom.Core.SubEntity.RestoreBuffersForUnusedAnimation C# (CSharp) Method

RestoreBuffersForUnusedAnimation() public method

public RestoreBuffersForUnusedAnimation ( bool hardwareAnimation ) : void
hardwareAnimation bool
return void
		public 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 ( subMesh.VertexAnimationType != VertexAnimationType.None &&
				!subMesh.useSharedVertices &&
				!vertexAnimationAppliedThisFrame &&
				( !hardwareAnimation || subMesh.VertexAnimationType == VertexAnimationType.Morph ) )
			{
				VertexElement srcPosElem =
					subMesh.vertexData.vertexDeclaration.FindElementBySemantic( VertexElementSemantic.Position );
				HardwareVertexBuffer srcBuf =
					subMesh.vertexData.vertexBufferBinding.GetBuffer( srcPosElem.Source );

				// Bind to software
				VertexElement destPosElem =
					softwareVertexAnimVertexData.vertexDeclaration.FindElementBySemantic( VertexElementSemantic.Position );
				softwareVertexAnimVertexData.vertexBufferBinding.SetBinding( destPosElem.Source, srcBuf );
			}
		}