MCPcopy Create free account
hub / github.com/OGRECave/ogre-next / readAnimation

Method readAnimation

OgreMain/src/OgreMeshSerializerImpl.cpp:2559–2613  ·  view source on GitHub ↗

---------------------------------------------------------------------

Source from the content-addressed store, hash-verified

2557 }
2558 //---------------------------------------------------------------------
2559 void MeshSerializerImpl::readAnimation( DataStreamPtr &stream, Mesh *pMesh )
2560 {
2561 // char* name
2562 String name = readString( stream );
2563 // float length
2564 float len;
2565 readFloats( stream, &len, 1 );
2566
2567 Animation *anim = pMesh->createAnimation( name, len );
2568
2569 // tracks
2570 if( !stream->eof() )
2571 {
2572 pushInnerChunk( stream );
2573 unsigned short streamID = readChunk( stream );
2574
2575 // Optional base info is possible
2576 if( streamID == M_ANIMATION_BASEINFO )
2577 {
2578 // char baseAnimationName
2579 String baseAnimName = readString( stream );
2580 // float baseKeyFrameTime
2581 float baseKeyTime;
2582 readFloats( stream, &baseKeyTime, 1 );
2583
2584 anim->setUseBaseKeyFrame( true, baseKeyTime, baseAnimName );
2585
2586 if( !stream->eof() )
2587 {
2588 // Get next stream
2589 streamID = readChunk( stream );
2590 }
2591 }
2592
2593 while( !stream->eof() && streamID == M_ANIMATION_TRACK )
2594 {
2595 switch( streamID )
2596 {
2597 case M_ANIMATION_TRACK:
2598 readAnimationTrack( stream, anim, pMesh );
2599 break;
2600 };
2601 if( !stream->eof() )
2602 {
2603 streamID = readChunk( stream );
2604 }
2605 }
2606 if( !stream->eof() )
2607 {
2608 // Backpedal back to start of stream
2609 backpedalChunkHeader( stream );
2610 }
2611 popInnerChunk( stream );
2612 }
2613 }
2614 //---------------------------------------------------------------------
2615 void MeshSerializerImpl::readAnimationTrack( DataStreamPtr &stream, Animation *anim,
2616 Mesh *pMesh )

Callers

nothing calls this directly

Calls 3

setUseBaseKeyFrameMethod · 0.80
createAnimationMethod · 0.45
eofMethod · 0.45

Tested by

no test coverage detected