Changeset 285 for trunk/src/formats/assimp_loader.cc
- Timestamp:
- 07/21/14 02:19:34 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/formats/assimp_loader.cc
r284 r285 367 367 if (this_id == 0) 368 368 a_data.transform = mat4(); 369 a_data. channel_count = 0;369 a_data.data = nullptr; 370 370 371 371 if (anode) … … 394 394 size_t max_keys = glm::max( node->mNumPositionKeys, node->mNumRotationKeys ); 395 395 396 data->channel_count = 1; 397 data->channels[0] = key_raw_channel::create<assimp_key_tr>( max_keys ); 398 assimp_key_tr* channel = ((assimp_key_tr*)(data->channels[0]->data)); 396 key_raw_channel* raw_channel = key_raw_channel::create<assimp_key_tr>( max_keys ); 397 data->data = new key_data; 398 data->data->add_channel( raw_channel ); 399 assimp_key_tr* channel = ((assimp_key_tr*)(raw_channel->data)); 399 400 400 401 for ( unsigned n = 0; n < max_keys; ++n ) … … 406 407 // TODO: only do the calculation when a rotate transform is present! 407 408 nv::transform ptr; 408 if ( parent )409 { 410 key_raw_channel* pchannel = parent->channels[0];411 if ( p arent->channels[0] && parent->channels[0]->count > 0 )412 { 413 ptr = ((assimp_key_tr*)pchannel->data)[ glm::min( n, p arent->channels[0]->count-1 ) ].tform;409 if ( parent && parent->data ) 410 { 411 const key_raw_channel* pchannel = parent->data->get_channel(0); 412 if ( pchannel && pchannel->count > 0 ) 413 { 414 ptr = ((assimp_key_tr*)pchannel->data)[ glm::min( n, pchannel->count-1 ) ].tform; 414 415 } 415 416 } … … 422 423 void nv::assimp_loader::create_direct_keys( assimp_animated_node_data* data, const void* vnode ) 423 424 { 424 data->channel_count = 0;425 425 const aiNodeAnim* node = (const aiNodeAnim*)vnode; 426 426 if ( node->mNumPositionKeys == 0 && node->mNumRotationKeys == 0 && node->mNumScalingKeys == 0 ) … … 429 429 } 430 430 431 data->channel_count = 3; 432 data->channels[0] = key_raw_channel::create<assimp_key_p>( node->mNumPositionKeys ); 433 data->channels[1] = key_raw_channel::create<assimp_key_r>( node->mNumRotationKeys ); 434 data->channels[2] = key_raw_channel::create<assimp_key_s>( node->mNumScalingKeys ); 435 assimp_key_p* pchannel = ((assimp_key_p*)(data->channels[0]->data)); 436 assimp_key_r* rchannel = ((assimp_key_r*)(data->channels[1]->data)); 437 assimp_key_s* schannel = ((assimp_key_s*)(data->channels[2]->data)); 431 data->data = new key_data; 432 key_raw_channel* raw_pchannel = key_raw_channel::create<assimp_key_p>( node->mNumPositionKeys ); 433 key_raw_channel* raw_rchannel = key_raw_channel::create<assimp_key_r>( node->mNumRotationKeys ); 434 key_raw_channel* raw_schannel = key_raw_channel::create<assimp_key_s>( node->mNumScalingKeys ); 435 data->data->add_channel( raw_pchannel ); 436 data->data->add_channel( raw_rchannel ); 437 data->data->add_channel( raw_schannel ); 438 assimp_key_p* pchannel = ((assimp_key_p*)(raw_pchannel->data)); 439 assimp_key_r* rchannel = ((assimp_key_r*)(raw_rchannel->data)); 440 assimp_key_s* schannel = ((assimp_key_s*)(raw_schannel->data)); 438 441 439 442 for ( unsigned np = 0; np < node->mNumPositionKeys; ++np )
Note: See TracChangeset
for help on using the changeset viewer.