public CreateVertexMorphKeyFrame ( float time ) : |
||
time | float | The time from which this KeyFrame will apply. |
return |
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; }
protected void ReadMorphKeyframe(BinaryMemoryReader reader, VertexAnimationTrack track) { float time = ReadFloat(reader); VertexMorphKeyFrame mkf = track.CreateVertexMorphKeyFrame(time); int vertexCount = track.TargetVertexData.vertexCount; // create/populate vertex buffer HardwareVertexBuffer buffer = HardwareBufferManager.Instance.CreateVertexBuffer( VertexElement.GetTypeSize(VertexElementType.Float3), vertexCount, BufferUsage.Static, true); // lock the buffer for editing IntPtr 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; }