- Timestamp:
- 07/09/15 12:19:30 (10 years ago)
- Location:
- trunk/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/formats/assimp_loader.cc
r410 r411 118 118 119 119 bool skinned = mesh->mNumBones > 0; 120 mesh_raw_channel* channel = nullptr;120 raw_data_channel* channel = nullptr; 121 121 if ( skinned ) 122 channel = mesh_raw_channel::create< assimp_skinned_vtx >( mesh->mNumVertices );122 channel = raw_data_channel::create< assimp_skinned_vtx >( mesh->mNumVertices ); 123 123 else 124 channel = mesh_raw_channel::create< assimp_plain_vtx >( mesh->mNumVertices );124 channel = raw_data_channel::create< assimp_plain_vtx >( mesh->mNumVertices ); 125 125 126 126 data->add_channel( channel ); … … 169 169 } 170 170 171 mesh_raw_channel* ichannel = mesh_raw_channel::create_index( USHORT, mesh->mNumFaces * 3 );171 raw_data_channel* ichannel = raw_data_channel::create_index( USHORT, mesh->mNumFaces * 3 ); 172 172 data->add_channel( ichannel ); 173 173 uint16* indices = reinterpret_cast<uint16*>( ichannel->data ); … … 315 315 if ( m > 0 && bones.size() > 0 ) 316 316 { 317 mesh_raw_channel* channel = meshes[m].get_raw_channels()[0];317 raw_data_channel* channel = meshes[m].get_raw_channels()[0]; 318 318 assimp_skinned_vtx* va = reinterpret_cast< assimp_skinned_vtx* >( channel->data ); 319 319 for ( unsigned v = 0; v < channel->count; ++v ) … … 418 418 419 419 data->data = new key_data; 420 key_raw_channel* raw_pchannel = key_raw_channel::create<assimp_key_p>( node->mNumPositionKeys );421 key_raw_channel* raw_rchannel = key_raw_channel::create<assimp_key_r>( node->mNumRotationKeys );422 // key_raw_channel* raw_schannel = key_raw_channel::create<assimp_key_s>( node->mNumScalingKeys );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 423 data->data->add_channel( raw_pchannel ); 424 424 data->data->add_channel( raw_rchannel ); -
trunk/src/formats/md2_loader.cc
r406 r411 324 324 size_t frame_count = ( frame == -1 ? num_frames : 1 ); 325 325 326 mesh_raw_channel* mc_pn = mesh_raw_channel::create< vtx_md2_pn >( num_verts * frame_count );326 raw_data_channel* mc_pn = raw_data_channel::create< vtx_md2_pn >( num_verts * frame_count ); 327 327 vtx_md2_pn* vtx_pn = reinterpret_cast< vtx_md2_pn* >( mc_pn->data ); 328 328 … … 347 347 } 348 348 349 mesh_raw_channel* mc_t = mesh_raw_channel::create< vtx_md2_t >( num_verts );349 raw_data_channel* mc_t = raw_data_channel::create< vtx_md2_t >( num_verts ); 350 350 vtx_md2_t* vtx_t = reinterpret_cast< vtx_md2_t* >( mc_t->data ); 351 351 … … 357 357 } 358 358 359 mesh_raw_channel* ic = mesh_raw_channel::create_index< uint16 >( m_new_indexes.size() );359 raw_data_channel* ic = raw_data_channel::create_index< uint16 >( m_new_indexes.size() ); 360 360 if ( m_new_indexes.size() > 0 ) 361 361 { -
trunk/src/formats/md3_loader.cc
r406 r411 286 286 } 287 287 288 nv:: key_raw_channel* nv::md3_loader::load_tags( const string_view& tag )288 nv::raw_data_channel* nv::md3_loader::load_tags( const string_view& tag ) 289 289 { 290 290 md3_t* md3 = reinterpret_cast< md3_t* >( m_md3 ); 291 key_raw_channel* result = key_raw_channel::create<md3_key>( uint32( md3->header.num_frames ) );291 raw_data_channel* result = raw_data_channel::create<md3_key>( uint32( md3->header.num_frames ) ); 292 292 // TODO: is this brain damaged in efficiency (loop nest order) or what? 293 293 for ( sint32 f = 0; f < md3->header.num_frames; ++f ) … … 352 352 } 353 353 354 mesh_raw_channel* mc_pn = mesh_raw_channel::create< vtx_md3_pn >( uint32( num_verts * frame_count ) );355 mesh_raw_channel* mc_t = mesh_raw_channel::create< vtx_md3_t >( uint32( num_verts ) );356 mesh_raw_channel* ic = mesh_raw_channel::create_index< uint16 >( uint32( index_count ) );354 raw_data_channel* mc_pn = raw_data_channel::create< vtx_md3_pn >( uint32( num_verts * frame_count ) ); 355 raw_data_channel* mc_t = raw_data_channel::create< vtx_md3_t >( uint32( num_verts ) ); 356 raw_data_channel* ic = raw_data_channel::create_index< uint16 >( uint32( index_count ) ); 357 357 vtx_md3_pn* vtx_pn = reinterpret_cast< vtx_md3_pn* >( mc_pn->data ); 358 358 vtx_md3_t* vtx_t = reinterpret_cast< vtx_md3_t* >( mc_t->data ); … … 435 435 nodes[i].data = new key_data; 436 436 437 key_raw_channel* keys = load_tags( name );437 raw_data_channel* keys = load_tags( name ); 438 438 nodes[i].data->add_channel( keys ); 439 439 } -
trunk/src/formats/md5_loader.cc
r406 r411 159 159 md5_vtx_t* tdata = nullptr; 160 160 { 161 mesh_raw_channel* ch_pnt = mesh_raw_channel::create<md5_vtx_pnt>( num_verts );162 mesh_raw_channel* ch_t = mesh_raw_channel::create<md5_vtx_t>( num_verts );163 mesh_raw_channel* ch_pntiw = mesh_raw_channel::create<md5_vtx_pntiw>( num_verts );161 raw_data_channel* ch_pnt = raw_data_channel::create<md5_vtx_pnt>( num_verts ); 162 raw_data_channel* ch_t = raw_data_channel::create<md5_vtx_t>( num_verts ); 163 raw_data_channel* ch_pntiw = raw_data_channel::create<md5_vtx_pntiw>( num_verts ); 164 164 tdata = reinterpret_cast< md5_vtx_t* >( ch_t->data ); 165 165 mesh->add_channel( ch_pnt ); … … 190 190 sstream >> num_tris; 191 191 192 mesh_raw_channel* ch_i = mesh_raw_channel::create_index<uint32>( num_tris * 3 );192 raw_data_channel* ch_i = raw_data_channel::create_index<uint32>( num_tris * 3 ); 193 193 uint32* vtx_i = reinterpret_cast< uint32* >( ch_i->data ); 194 194 uint32 idx = 0; … … 256 256 nodes[i].target_id = -1; 257 257 nodes[i].data = new key_data; 258 nodes[i].data->add_channel( key_raw_channel::create< md5_key_t >( num_frames ) );258 nodes[i].data->add_channel( raw_data_channel::create< md5_key_t >( num_frames ) ); 259 259 next_line( sstream ); 260 260 } -
trunk/src/formats/nmd_loader.cc
r410 r411 43 43 nmd_stream_header stream_header; 44 44 source.read( &stream_header, sizeof( stream_header ), 1 ); 45 mesh_raw_channel* channel = mesh_raw_channel::create( stream_header.format, stream_header.count );45 raw_data_channel* channel = raw_data_channel::create( stream_header.format, stream_header.count ); 46 46 source.read( channel->data, stream_header.format.element_size(), stream_header.count ); 47 47 mesh->add_channel( channel ); … … 128 128 nv::nmd_stream_header cheader; 129 129 source.read( &cheader, sizeof( cheader ), 1 ); 130 key_raw_channel* channel = key_raw_channel::create( cheader.format, cheader.count );130 raw_data_channel* channel = raw_data_channel::create( cheader.format, cheader.count ); 131 131 source.read( channel->data, channel->desc.element_size(), channel->count ); 132 132 kdata->add_channel( channel ); … … 162 162 static void nmd_dump_mesh( const mesh_data* mesh, stream& stream_out ) 163 163 { 164 array_view< mesh_raw_channel* > data = mesh->get_raw_channels();164 array_view< raw_data_channel* > data = mesh->get_raw_channels(); 165 165 166 166 uint32 size = sizeof( nmd_element_header ); … … 248 248 for ( uint32 c = 0; c < chan_count; ++c ) 249 249 { 250 const key_raw_channel* channel = node->data->get_channel(c);250 const raw_data_channel* channel = node->data->get_channel(c); 251 251 252 252 eheader.type = nmd_type::KEY_CHANNEL; -
trunk/src/formats/obj_loader.cc
r406 r411 324 324 } 325 325 326 mesh_raw_channel* channel = new mesh_raw_channel();326 raw_data_channel* channel = new raw_data_channel(); 327 327 nv::uint8* data = nullptr; 328 328 -
trunk/src/gfx/mesh_creator.cc
r410 r411 19 19 key_data* keys = m_data->m_nodes[i].data; 20 20 key_data* pkeys = ( parent_id != -1 ? m_data->m_nodes[parent_id].data : nullptr ); 21 size_t count = ( keys ? keys->get_channel(0)-> count: 0 );22 size_t pcount = ( pkeys ? pkeys->get_channel(0)-> count: 0 );21 size_t count = ( keys ? keys->get_channel(0)->element_count() : 0 ); 22 size_t pcount = ( pkeys ? pkeys->get_channel(0)->element_count() : 0 ); 23 23 max_frames = nv::max<uint32>( count, max_frames ); 24 24 if ( pkeys && pkeys->get_channel_count() > 0 && keys && keys->get_channel_count() > 0 ) … … 66 66 } 67 67 68 key_raw_channel* raw_channel = key_raw_channel::create<nv_key_transform>( max_keys );68 raw_data_channel* raw_channel = raw_data_channel::create<nv_key_transform>( max_keys ); 69 69 key_data* new_keys = new key_data; 70 70 new_keys->add_channel( raw_channel ); … … 80 80 { 81 81 size_t idx = nv::min( old_keys->get_channel(c)->count - 1, n ); 82 pkey += old_keys->get_ channel(c)->get_raw(idx, pkey );82 pkey += old_keys->get_raw( old_keys->get_channel(c), idx, pkey ); 83 83 } 84 84 channel[n].tform = extract_transform_raw( final_key, key ); … … 106 106 for ( size_t c = 0; c < kdata->get_channel_count(); ++c ) 107 107 { 108 const key_raw_channel* channel = kdata->get_channel(c);108 const raw_data_channel* channel = kdata->get_channel(c); 109 109 size_t key_size = channel->desc.element_size(); 110 110 for ( size_t n = 0; n < channel->count; ++n ) … … 125 125 for ( uint32 c = 0; c < m_data->get_channel_count(); ++c ) 126 126 { 127 const mesh_raw_channel* channel = m_data->get_channel(c);127 const raw_data_channel* channel = m_data->get_channel(c); 128 128 const data_descriptor& desc = channel->desc; 129 129 uint8* raw_data = channel->data; … … 173 173 size_t n_offset = 0; 174 174 if ( ch_n == -1 ) return; 175 mesh_raw_channel* channel = m_data->m_channels[ unsigned( ch_n ) ];175 raw_data_channel* channel = m_data->m_channels[ unsigned( ch_n ) ]; 176 176 for ( const auto& cslot : channel->desc ) 177 177 if ( cslot.vslot == slot::NORMAL ) … … 196 196 uint32 n_channel_index = 0; 197 197 198 const mesh_raw_channel* p_channel = nullptr;199 mesh_raw_channel* n_channel = nullptr;200 const mesh_raw_channel* t_channel = nullptr;201 const mesh_raw_channel* i_channel = nullptr;198 const raw_data_channel* p_channel = nullptr; 199 raw_data_channel* n_channel = nullptr; 200 const raw_data_channel* t_channel = nullptr; 201 const raw_data_channel* i_channel = nullptr; 202 202 203 203 for ( uint32 c = 0; c < m_data->get_channel_count(); ++c ) 204 204 { 205 const mesh_raw_channel* channel = m_data->get_channel(c);205 const raw_data_channel* channel = m_data->get_channel(c); 206 206 207 207 for ( const auto& cslot : channel->desc ) … … 247 247 } 248 248 249 mesh_raw_channel* g_channel = mesh_raw_channel::create<vertex_g>( p_channel->count );249 raw_data_channel* g_channel = raw_data_channel::create<vertex_g>( p_channel->count ); 250 250 vec4* tangents = reinterpret_cast<vec4*>( g_channel->data ); 251 251 vec3* tangents2 = new vec3[ p_channel->count ]; … … 334 334 } 335 335 336 nv:: mesh_raw_channel* nv::mesh_data_creator::merge_channels( mesh_raw_channel* a, mesh_raw_channel* b )336 nv::raw_data_channel* nv::mesh_data_creator::merge_channels( raw_data_channel* a, raw_data_channel* b ) 337 337 { 338 338 NV_ASSERT( a->count == b->count, "merge_channel - bad channels!" ); … … 352 352 raw_copy_n( b->data + i * bdesc.element_size(), bdesc.element_size(), data + i*desc.element_size() + adesc.element_size() ); 353 353 } 354 mesh_raw_channel* result = new mesh_raw_channel;354 raw_data_channel* result = new raw_data_channel; 355 355 result->count = count; 356 356 result->desc = desc; … … 359 359 } 360 360 361 nv:: mesh_raw_channel* nv::mesh_data_creator::append_channels( mesh_raw_channel* a, mesh_raw_channel* b, uint32 frame_count )361 nv::raw_data_channel* nv::mesh_data_creator::append_channels( raw_data_channel* a, raw_data_channel* b, uint32 frame_count ) 362 362 { 363 363 if ( a->desc != b->desc ) return nullptr; … … 391 391 } 392 392 393 mesh_raw_channel* result = new mesh_raw_channel;394 result->count = a-> count + b->count;395 result->desc = a->desc ;393 raw_data_channel* result = new raw_data_channel; 394 result->count = a->element_count() + b->element_count(); 395 result->desc = a->descriptor(); 396 396 result->data = data; 397 397 return result; … … 405 405 for ( uint32 c = 0; c < m_data->get_channel_count(); ++c ) 406 406 { 407 if ( m_data->get_channel(c)->desc != other->get_channel(c)->desc)407 if ( m_data->get_channel(c)->descriptor() != other->get_channel(c)->descriptor() ) 408 408 return false; 409 409 } … … 419 419 int och_ti = other->get_channel_index( slot::TEXCOORD ); 420 420 if ( ch_pi == -1 || ch_ti == -1 ) return; 421 size_t size = m_data->m_channels[ unsigned(ch_ti) ]-> count;422 size_t osize = other->m_channels[ unsigned(och_ti) ]-> count;423 size_t count = m_data->m_channels[ unsigned(ch_pi) ]-> count;424 size_t ocount = other->m_channels[ unsigned(och_pi) ]-> count;421 size_t size = m_data->m_channels[ unsigned(ch_ti) ]->element_count(); 422 size_t osize = other->m_channels[ unsigned(och_ti) ]->element_count(); 423 size_t count = m_data->m_channels[ unsigned(ch_pi) ]->element_count(); 424 size_t ocount = other->m_channels[ unsigned(och_pi) ]->element_count(); 425 425 if ( count % size != 0 || ocount % osize != 0 ) return; 426 426 if ( count / size != ocount / osize ) return; … … 428 428 for ( uint32 c = 0; c < m_data->get_channel_count(); ++c ) 429 429 { 430 mesh_raw_channel* old = m_data->m_channels[c];431 size_t frame_count = ( old->get_buffer_type() == INDEX_BUFFER ? 1 : old-> count/ size );430 raw_data_channel* old = m_data->m_channels[c]; 431 size_t frame_count = ( old->get_buffer_type() == INDEX_BUFFER ? 1 : old->element_count() / size ); 432 432 m_data->m_channels[c] = append_channels( old, other->m_channels[c], frame_count ); 433 433 NV_ASSERT( m_data->m_channels[c], "Merge problem!" ); … … 440 440 NV_ASSERT( size + osize < uint16(-1), "Index out of range!" ); 441 441 uint16* indexes = reinterpret_cast<uint16*>( m_data->m_channels[c]->data ); 442 for ( uint16 i = uint16( old-> count ); i < m_data->m_channels[c]->count; ++i )442 for ( uint16 i = uint16( old->element_count() ); i < m_data->m_channels[c]->element_count(); ++i ) 443 443 indexes[i] += uint16( size ); 444 444 … … 448 448 { 449 449 uint32* indexes = reinterpret_cast<uint32*>( m_data->m_channels[c]->data ); 450 for ( uint32 i = old-> count; i < m_data->m_channels[c]->count; ++i )450 for ( uint32 i = old->element_count(); i < m_data->m_channels[c]->element_count(); ++i ) 451 451 indexes[i] += size; 452 452 } -
trunk/src/gfx/skeletal_mesh.cc
r406 r411 15 15 , m_data( a_mesh_data ) 16 16 { 17 const mesh_raw_channel* pnt_chan = a_mesh_data->get_channel<md5_vtx_pnt>();17 const raw_data_channel* pnt_chan = a_mesh_data->get_channel<md5_vtx_pnt>(); 18 18 m_pntdata.assign( reinterpret_cast<const md5_vtx_pnt*>( pnt_chan->data ), pnt_chan->count ); 19 19 m_bone_offset.resize( bones->get_count() );
Note: See TracChangeset
for help on using the changeset viewer.