Changeset 224 for trunk/src/gfx/keyframed_mesh.cc
- Timestamp:
- 01/02/14 20:52:34 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gfx/keyframed_mesh.cc
r223 r224 15 15 using namespace nv; 16 16 17 keyframed_mesh::keyframed_mesh( context* a_context, keyframed_mesh_data* a_data, program* a_program )17 keyframed_mesh::keyframed_mesh( context* a_context, mesh_data* a_data, program* a_program ) 18 18 : m_context( a_context ) 19 19 , m_data( a_data ) … … 112 112 } 113 113 114 keyframed_mesh_gpu::keyframed_mesh_gpu( context* a_context, keyframed_mesh_data* a_data, program* a_program )114 keyframed_mesh_gpu::keyframed_mesh_gpu( context* a_context, mesh_data* a_data, program* a_program ) 115 115 : keyframed_mesh( a_context, a_data, a_program ) 116 116 , m_loc_next_position( 0 ) … … 133 133 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() ); 134 134 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::uint 16), (void*)m_data->get_indices().data() );136 m_va->set_index_buffer( ib, nv::U SHORT, 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 ); 137 137 } 138 138 … … 156 156 157 157 158 nv::keyframed_mesh_cpu::keyframed_mesh_cpu( context* a_context, keyframed_mesh_data* a_data, program* a_program )158 nv::keyframed_mesh_cpu::keyframed_mesh_cpu( context* a_context, mesh_data* a_data, program* a_program ) 159 159 : keyframed_mesh( a_context, a_data, a_program ) 160 160 { 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) ); 162 162 m_va->add_vertex_buffer( nv::slot::POSITION, m_vb_position, nv::FLOAT, 3 ); 163 163 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) ); 165 165 m_va->add_vertex_buffer( nv::slot::NORMAL, m_vb_normal, nv::FLOAT, 3 ); 166 166 … … 169 169 m_va->add_vertex_buffer( nv::slot::TEXCOORD, vb, nv::FLOAT, 2 ); 170 170 171 nv::index_buffer* ib = m_context->get_device()->create_index_buffer( nv::STATIC_DRAW, m_data->get_index_count() * sizeof( nv::uint 16), (void*)m_data->get_indices().data() );172 m_va->set_index_buffer( ib, nv::U SHORT, 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 ); 173 173 174 174 m_position.resize( m_data->get_vertex_count() ); … … 181 181 182 182 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 ); 187 187 188 188 for ( size_t i = 0; i < vtx_count; ++i )
Note: See TracChangeset
for help on using the changeset viewer.