Changeset 413 for trunk/src/formats/assimp_loader.cc
- Timestamp:
- 07/09/15 18:53:08 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/formats/assimp_loader.cc
r412 r413 7 7 #include "nv/formats/assimp_loader.hh" 8 8 #include "nv/stl/unordered_map.hh" 9 #include "nv/gfx/mesh_creator.hh"10 9 #include "nv/lib/assimp.hh" 11 10 … … 123 122 else 124 123 channel = raw_data_channel::create< assimp_plain_vtx >( mesh->mNumVertices ); 124 uint8* cdata = const_cast< uint8*>( channel->raw_data() ); 125 125 126 126 data->add_channel( channel ); … … 139 139 nv::vec4 vt ( t_i[0], t_i[1], t_i[2], det ); 140 140 if ( skinned ) 141 reinterpret_cast< assimp_skinned_vtx* >( channel->data)[i] = assimp_skinned_vtx( v, s, n, vt );141 reinterpret_cast< assimp_skinned_vtx* >( cdata )[i] = assimp_skinned_vtx( v, s, n, vt ); 142 142 else 143 reinterpret_cast< assimp_plain_vtx* >( channel->data)[i] = assimp_plain_vtx( v, s, n, vt );143 reinterpret_cast< assimp_plain_vtx* >( cdata )[i] = assimp_plain_vtx( v, s, n, vt ); 144 144 } 145 145 146 146 if ( skinned ) 147 147 { 148 assimp_skinned_vtx* vtx = reinterpret_cast< assimp_skinned_vtx* >( c hannel->data );148 assimp_skinned_vtx* vtx = reinterpret_cast< assimp_skinned_vtx* >( cdata ); 149 149 for (unsigned int m=0; m<mesh->mNumBones; m++) 150 150 { … … 169 169 } 170 170 171 raw_data_channel* ichannel = raw_data_channel::create< index_u16 >( mesh->mNumFaces * 3 ); 172 data->add_channel( ichannel ); 173 uint16* indices = reinterpret_cast<uint16*>( ichannel->data ); 171 data_channel_creator< index_u16 > ichannel( mesh->mNumFaces * 3 ); 172 uint16* indices = reinterpret_cast<uint16*>( ichannel.raw_data() ); 174 173 for (unsigned int i=0; i<mesh->mNumFaces; i++) 175 174 { … … 180 179 } 181 180 } 181 data->add_channel( ichannel.release() ); 182 182 } 183 183 … … 315 315 if ( m > 0 && bones.size() > 0 ) 316 316 { 317 raw_data_channel* channel = meshes[m].get_raw_channels()[0]; 318 assimp_skinned_vtx* va = reinterpret_cast< assimp_skinned_vtx* >( channel->data ); 319 for ( unsigned v = 0; v < channel->element_count(); ++v ) 317 data_channel_creator< assimp_skinned_vtx > channel( meshes[m].get_raw_channels()[0] ); 318 for ( unsigned v = 0; v < channel.size(); ++v ) 320 319 { 321 assimp_skinned_vtx& vertex = va[v];320 assimp_skinned_vtx& vertex = channel.data()[v]; 322 321 323 322 for ( int i = 0 ; i < 4; ++i) … … 418 417 419 418 data->data = new key_data; 420 raw_data_channel* raw_pchannel = raw_data_channel::create<assimp_key_p>( node->mNumPositionKeys ); 421 raw_data_channel* raw_rchannel = raw_data_channel::create<assimp_key_r>( node->mNumRotationKeys ); 422 //raw_data_channel* raw_schannel = raw_data_channel::create<assimp_key_s>( node->mNumScalingKeys ); 423 data->data->add_channel( raw_pchannel ); 424 data->data->add_channel( raw_rchannel ); 425 //data->data->add_channel( raw_schannel ); 426 assimp_key_p* pchannel = reinterpret_cast< assimp_key_p* >( raw_pchannel->data ); 427 assimp_key_r* rchannel = reinterpret_cast< assimp_key_r* >( raw_rchannel->data ); 419 data_channel_creator< assimp_key_p > pchannel_creator( node->mNumPositionKeys ); 420 data_channel_creator< assimp_key_r > rchannel_creator( node->mNumRotationKeys ); 421 // data_channel_creator< assimp_key_s > schannel_creator( node->mNumScalingKeys ); 422 423 assimp_key_p* pchannel = pchannel_creator.data(); 424 assimp_key_r* rchannel = rchannel_creator.data(); 428 425 //assimp_key_s* schannel = ((assimp_key_s*)(raw_schannel->data)); 429 426 … … 457 454 // } 458 455 // } 459 456 data->data->add_channel( pchannel_creator.release() ); 457 data->data->add_channel( rchannel_creator.release() ); 458 // data->data->add_channel( schannel_creator.release() ); 460 459 } 461 460
Note: See TracChangeset
for help on using the changeset viewer.