Axiom.Animating.VertexAnimationTrack.CreateVertexMorphKeyFrame C# (CSharp) Method

CreateVertexMorphKeyFrame() public method

Creates a new morph KeyFrame and adds it to this animation at the given time index.
It is better to create KeyFrames in time order. Creating them out of order can result in expensive reordering processing. Note that a KeyFrame at time index 0.0 is always created for you, so you don't need to create this one, just access it using getKeyFrame(0);
public CreateVertexMorphKeyFrame ( float time ) : VertexMorphKeyFrame
time float The time from which this KeyFrame will apply.
return VertexMorphKeyFrame
		public VertexMorphKeyFrame CreateVertexMorphKeyFrame( float time )
		{
			if ( animationType != VertexAnimationType.Morph )
				throw new Exception( "Morph keyframes can only be created on vertex tracks of type morph; in VertexAnimationTrack::createVertexMorphKeyFrame" );
			return (VertexMorphKeyFrame)CreateKeyFrame( time );
		}

Usage Example

Esempio n. 1
0
		protected void ReadMorphKeyframe( BinaryReader reader, VertexAnimationTrack track )
		{
			var time = ReadFloat( reader );
			var mkf = track.CreateVertexMorphKeyFrame( time );
			var vertexCount = track.TargetVertexData.vertexCount;
			// create/populate vertex buffer
			var decl = HardwareBufferManager.Instance.CreateVertexDeclaration();
			decl.AddElement( 0, 0, VertexElementType.Float3, VertexElementSemantic.Position );

			var buffer = HardwareBufferManager.Instance.CreateVertexBuffer( decl, vertexCount, BufferUsage.Static, true );
			// lock the buffer for editing
			var vertices = buffer.Lock( BufferLocking.Discard );
			// stuff the floats into the normal buffer
			ReadFloats( reader, vertexCount*3, vertices );
			// unlock the buffer to commit
			buffer.Unlock();
			mkf.VertexBuffer = buffer;
		}
All Usage Examples Of Axiom.Animating.VertexAnimationTrack::CreateVertexMorphKeyFrame