Ignore:
Timestamp:
01/02/14 20:52:34 (11 years ago)
Author:
epyon
Message:
  • universal mesh format
  • removed keyframed_mesh_data
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gfx/keyframed_mesh.cc

    r223 r224  
    1515using namespace nv;
    1616
    17 keyframed_mesh::keyframed_mesh( context* a_context, keyframed_mesh_data* a_data, program* a_program )
     17keyframed_mesh::keyframed_mesh( context* a_context, mesh_data* a_data, program* a_program )
    1818        : m_context( a_context )
    1919        , m_data( a_data )
     
    112112}
    113113
    114 keyframed_mesh_gpu::keyframed_mesh_gpu( context* a_context, keyframed_mesh_data* a_data, program* a_program )
     114keyframed_mesh_gpu::keyframed_mesh_gpu( context* a_context, mesh_data* a_data, program* a_program )
    115115        : keyframed_mesh( a_context, a_data, a_program )
    116116        , m_loc_next_position( 0 )
     
    133133        vb = m_context->get_device()->create_vertex_buffer( nv::STATIC_DRAW, m_data->get_vertex_count() * sizeof( nv::vec2 ), (void*)m_data->get_texcoords().data() );
    134134        m_va->add_vertex_buffer( nv::slot::TEXCOORD, vb, nv::FLOAT, 2 );
    135         nv::index_buffer* ib = m_context->get_device()->create_index_buffer( nv::STATIC_DRAW, m_data->get_index_count() * sizeof( nv::uint16 ), (void*)m_data->get_indices().data() );
    136         m_va->set_index_buffer( ib, nv::USHORT, true );
     135        nv::index_buffer* ib = m_context->get_device()->create_index_buffer( nv::STATIC_DRAW, m_data->get_index_count() * sizeof( nv::uint32 ), (void*)m_data->get_indices().data() );
     136        m_va->set_index_buffer( ib, nv::UINT, true );
    137137}
    138138
     
    156156
    157157
    158 nv::keyframed_mesh_cpu::keyframed_mesh_cpu( context* a_context, keyframed_mesh_data* a_data, program* a_program )
     158nv::keyframed_mesh_cpu::keyframed_mesh_cpu( context* a_context, mesh_data* a_data, program* a_program )
    159159        : keyframed_mesh( a_context, a_data, a_program )
    160160{
    161         m_vb_position = m_context->get_device()->create_vertex_buffer( nv::STATIC_DRAW, m_data->get_vertex_count() * sizeof( nv::vec3 ) * m_data->get_frame_count(), (void*)m_data->get_position_data(0) );
     161        m_vb_position = m_context->get_device()->create_vertex_buffer( nv::STATIC_DRAW, m_data->get_vertex_count() * sizeof( nv::vec3 ), (void*)m_data->get_position_frame(0) );
    162162        m_va->add_vertex_buffer( nv::slot::POSITION, m_vb_position, nv::FLOAT, 3 );
    163163
    164         m_vb_normal   = m_context->get_device()->create_vertex_buffer( nv::STATIC_DRAW, m_data->get_vertex_count() * sizeof( nv::vec3 ) * m_data->get_frame_count(), (void*)m_data->get_normal_data(0) );
     164        m_vb_normal   = m_context->get_device()->create_vertex_buffer( nv::STATIC_DRAW, m_data->get_vertex_count() * sizeof( nv::vec3 ), (void*)m_data->get_normal_frame(0) );
    165165        m_va->add_vertex_buffer( nv::slot::NORMAL, m_vb_normal, nv::FLOAT, 3 );
    166166
     
    169169        m_va->add_vertex_buffer( nv::slot::TEXCOORD, vb, nv::FLOAT, 2 );
    170170
    171         nv::index_buffer* ib = m_context->get_device()->create_index_buffer( nv::STATIC_DRAW, m_data->get_index_count() * sizeof( nv::uint16 ), (void*)m_data->get_indices().data() );
    172         m_va->set_index_buffer( ib, nv::USHORT, true );
     171        nv::index_buffer* ib = m_context->get_device()->create_index_buffer( nv::STATIC_DRAW, m_data->get_index_count() * sizeof( nv::uint32 ), (void*)m_data->get_indices().data() );
     172        m_va->set_index_buffer( ib, nv::UINT, true );
    173173
    174174        m_position.resize( m_data->get_vertex_count() );
     
    181181
    182182        size_t vtx_count = m_data->get_vertex_count();
    183         const vec3* prev_position = m_data->get_position_data( m_last_frame );
    184         const vec3* next_position = m_data->get_position_data( m_next_frame );
    185         const vec3* prev_normal   = m_data->get_normal_data( m_last_frame );
    186         const vec3* next_normal   = m_data->get_normal_data( m_next_frame );
     183        const vec3* prev_position = m_data->get_position_frame( m_last_frame );
     184        const vec3* next_position = m_data->get_position_frame( m_next_frame );
     185        const vec3* prev_normal   = m_data->get_normal_frame( m_last_frame );
     186        const vec3* next_normal   = m_data->get_normal_frame( m_next_frame );
    187187
    188188        for ( size_t i = 0; i < vtx_count; ++i )
Note: See TracChangeset for help on using the changeset viewer.