Changeset 406 for trunk/src/formats/md5_loader.cc
- Timestamp:
- 06/20/15 00:05:17 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/formats/md5_loader.cc
r401 r406 162 162 mesh_raw_channel* ch_t = mesh_raw_channel::create<md5_vtx_t>( num_verts ); 163 163 mesh_raw_channel* ch_pntiw = mesh_raw_channel::create<md5_vtx_pntiw>( num_verts ); 164 tdata = (md5_vtx_t*)ch_t->data;164 tdata = reinterpret_cast< md5_vtx_t* >( ch_t->data ); 165 165 mesh->add_channel( ch_pnt ); 166 166 mesh->add_channel( ch_t ); … … 191 191 192 192 mesh_raw_channel* ch_i = mesh_raw_channel::create_index<uint32>( num_tris * 3 ); 193 uint32* vtx_i = (uint32*)ch_i->data;193 uint32* vtx_i = reinterpret_cast< uint32* >( ch_i->data ); 194 194 uint32 idx = 0; 195 195 mesh->add_channel( ch_i ); … … 199 199 for ( uint32 i = 0; i < num_tris; ++i ) 200 200 { 201 size_tti0;202 size_tti1;203 size_tti2;201 unsigned ti0; 202 unsigned ti1; 203 unsigned ti2; 204 204 205 205 std::getline( sstream, line ); 206 206 sscanf( line.c_str(), "%*s %*u %u %u %u )", &(ti0), &(ti1), &(ti2)); 207 207 208 vtx_i[idx++] = (uint32)ti0;209 vtx_i[idx++] = (uint32)ti1;210 vtx_i[idx++] = (uint32)ti2;208 vtx_i[idx++] = ti0; 209 vtx_i[idx++] = ti1; 210 vtx_i[idx++] = ti2; 211 211 } 212 212 } … … 244 244 assert( nodes == nullptr ); 245 245 nodes = new mesh_node_data[ num_joints ]; 246 m_nodes = new mesh_nodes_data( "md5_animation", num_joints, nodes, (nv::uint16)frame_rate, (float)num_frames, true );246 m_nodes = new mesh_nodes_data( "md5_animation", num_joints, nodes, static_cast< nv::uint16 >( frame_rate ), static_cast< float >( num_frames ), true ); 247 247 joint_infos.resize( num_joints ); 248 248 … … 318 318 { 319 319 sstream >> buf; 320 frame.push_back( (float)atof(buf));320 frame.push_back( static_cast< float >( atof(buf) ) ); 321 321 } 322 322 … … 336 336 { 337 337 assert( m_type == MESH ); 338 md5_vtx_pnt* vtcs = (md5_vtx_pnt*)mdata->get_channel< md5_vtx_pnt >()->data;339 md5_vtx_pntiw* vtx_data = (md5_vtx_pntiw*)mdata->get_channel< md5_vtx_pntiw >()->data;338 md5_vtx_pnt* vtcs = reinterpret_cast< md5_vtx_pnt* >( mdata->get_channel< md5_vtx_pnt >()->data ); 339 md5_vtx_pntiw* vtx_data = reinterpret_cast< md5_vtx_pntiw* >( mdata->get_channel< md5_vtx_pntiw >()->data ); 340 340 341 341 for ( uint32 i = 0; i < vtx_count; ++i ) … … 368 368 } 369 369 370 for ( size_t j = 0; j < 4; ++j )371 { 372 if ( j < weight_count)373 { 374 vdata.boneindex[j] = (int)weights[start_weight + j].joint_id;375 vdata.boneweight[j] = weights[ start_weight+ j].bias;370 for ( int j = 0; j < 4; ++j ) 371 { 372 if ( j < int(weight_count) ) 373 { 374 vdata.boneindex[j] = int( weights[int(start_weight) + j].joint_id ); 375 vdata.boneweight[j] = weights[int(start_weight) + j].bias; 376 376 } 377 377 else … … 396 396 } 397 397 398 const uint32* idata = (uint32*)mdata->get_index_channel()->data;398 const uint32* idata = reinterpret_cast< uint32* >( mdata->get_index_channel()->data ); 399 399 const md5_vtx_t* tdata = mdata->get_channel_data<md5_vtx_t>(); 400 400 … … 448 448 vdata.tangent = vec3(0); 449 449 450 for ( size_t j = 0; j < 4; ++j )450 for ( int j = 0; j < 4; ++j ) 451 451 { 452 452 const mesh_node_data& joint = nodes[vdata.boneindex[j]]; … … 484 484 { 485 485 const mesh_node_data& pjoint = nodes[parent_id]; 486 const transform* ptv = (const transform*)pjoint.data->get_channel(0)->data;486 const transform* ptv = reinterpret_cast< const transform* >( pjoint.data->get_channel(0)->data ); 487 487 transform ptr; 488 488 if ( pjoint.data->get_channel(0)->count > index ) ptr = ptv[ index ]; … … 495 495 } 496 496 497 ((transform*)joint.data->get_channel(0)->data)[index] = transform( pos, orient );497 reinterpret_cast< transform* >( joint.data->get_channel(0)->data )[index] = transform( pos, orient ); 498 498 } 499 499 }
Note: See TracChangeset
for help on using the changeset viewer.