Ignore:
Timestamp:
07/10/15 14:16:42 (10 years ago)
Author:
epyon
Message:
  • mesh_data and key_data are data_channel_set (WIP)
  • massive cleanup of privacy in data_channels
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/formats/md5_loader.cc

    r415 r416  
    1010#include "nv/stl/vector.hh"
    1111#include "nv/io/std_stream.hh"
     12#include "nv/interface/data_channel_access.hh"
    1213
    1314#include <stdio.h>  // sscanf
     
    136137                {
    137138                        assert( m_type == MESH );
    138                         mesh_data* mesh = new mesh_data("md5_mesh");
     139                        data_channel_set_creator mesh;
    139140
    140141                        uint32 num_verts   = 0;
     
    163164                                                data_channel_creator<md5_vtx_pntiw> ch_pntiw( num_verts );
    164165                                                tdata = ch_t.data();
    165                                                 mesh->add_channel( ch_pnt.release() );
    166                                                 mesh->add_channel( ch_t.release() );
     166                                                mesh.add_channel( ch_pnt.release() );
     167                                                mesh.add_channel( ch_t.release() );
    167168                                                // TODO: hack to prevent rendering
    168169                                                //ch_pntiw->m_count = 0;
    169                                                 mesh->add_channel( ch_pntiw.release() );
     170                                                mesh.add_channel( ch_pntiw.release() );
    170171                                        }
    171172                                        weight_info.resize( num_verts );
     
    210211                                        }             
    211212
    212                                         mesh->add_channel( ch_i.release() );
     213                                        mesh.add_channel( ch_i.release() );
    213214                                }
    214215                                else if ( command == "numweights" )
     
    235236                        }
    236237
    237                         prepare_mesh( nodes, weight_info.size(), mesh, weights.data(), weight_info.data() );
    238 
    239                         m_meshes[ num_meshes ] = mesh;
     238                        data_channel_set* mdata = mesh.release();
     239                        prepare_mesh( nodes, weight_info.size(), mdata, weights.data(), weight_info.data() );
     240
     241                        m_meshes[ num_meshes ] = mdata;
    240242                        num_meshes++;
    241243                } // mesh
     
    258260                                nodes[i].data      = new key_data;
    259261                                data_channel_creator< md5_key_t > fc( num_frames );
    260                                 nodes[i].data->add_channel( fc.release() );
     262                                nodes[i].data->add_key_channel( fc.release() );
    261263                                next_line( sstream );
    262264                        }
     
    335337}
    336338
    337 bool md5_loader::prepare_mesh( mesh_node_data* nodes, uint32 vtx_count, mesh_data* mdata, md5_weight* weights, md5_weight_info* weight_info )
     339bool md5_loader::prepare_mesh( mesh_node_data* nodes, uint32 vtx_count, data_channel_set* mdata, md5_weight* weights, md5_weight_info* weight_info )
    338340{
    339341        assert( m_type == MESH );
     
    400402        }
    401403
    402         const uint32*    idata = reinterpret_cast< uint32* >( const_cast< uint8* >( mdata->get_index_channel()->raw_data() ) );
     404        const uint32*    idata = reinterpret_cast< uint32* >( const_cast< uint8* >( mdata->get_channel( slot::INDEX )->raw_data() ) );
    403405        const md5_vtx_t* tdata = mdata->get_channel_data<md5_vtx_t>();
    404406
    405407        // Prepare normals
    406         uint32 tri_count = mdata->get_count() / 3;
     408        uint32 tri_count = mdata->get_channel_size( slot::INDEX ) / 3;
    407409        for ( unsigned int i = 0; i < tri_count; ++i )
    408410        {
     
    503505}
    504506
    505 mesh_data* nv::md5_loader::release_mesh_data( size_t index )
    506 {
    507         mesh_data* result = m_meshes[ index ];
     507data_channel_set* nv::md5_loader::release_mesh_data( size_t index )
     508{
     509        data_channel_set* result = m_meshes[ index ];
    508510        m_meshes[ index ] = nullptr;
    509511        return result;
     
    520522{
    521523        uint32 size = m_meshes.size();
    522         mesh_data* meshes = new mesh_data[ size ];
     524        data_channel_set* meshes = data_channel_set_creator::create_array( size, 4 );
    523525        for ( uint32 i = 0; i < size; ++i )
    524526        {
    525                 m_meshes[i]->move_to( meshes[i] );
     527                data_channel_set_creator( m_meshes[i] ).move_to( meshes[i] );
    526528                delete m_meshes[i];
    527529                m_meshes[i] = nullptr;
Note: See TracChangeset for help on using the changeset viewer.