Changeset 299 for trunk/src/gfx/keyframed_mesh.cc
- Timestamp:
- 08/07/14 10:10:24 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gfx/keyframed_mesh.cc
r296 r299 15 15 using namespace nv; 16 16 17 nv::keyframed_mesh::keyframed_mesh( device* a_device,const mesh_data* a_data, const mesh_nodes_data* a_tag_map )17 nv::keyframed_mesh::keyframed_mesh( const mesh_data* a_data, const mesh_nodes_data* a_tag_map ) 18 18 : animated_mesh() 19 19 , m_mesh_data( a_data ) … … 24 24 , m_active( false ) 25 25 { 26 m_va = a_device->create_vertex_array();27 28 26 m_index_count = m_mesh_data->get_index_channel()->count; 29 27 m_vertex_count = m_mesh_data->get_channel<vertex_t>()->count; … … 123 121 } 124 122 125 nv::keyframed_mesh_gpu::keyframed_mesh_gpu( device* a_device, const mesh_data* a_data, const mesh_nodes_data* a_tag_map )126 : keyframed_mesh( a_d evice, a_data, a_tag_map )123 nv::keyframed_mesh_gpu::keyframed_mesh_gpu( context* a_context, const mesh_data* a_data, const mesh_nodes_data* a_tag_map ) 124 : keyframed_mesh( a_data, a_tag_map ) 127 125 , m_loc_next_position( -1 ) 128 126 , m_loc_next_normal( -1 ) … … 131 129 , m_gpu_next_frame( 0xFFFFFFFF ) 132 130 { 133 m_va = a_ device->create_vertex_array( a_data, STATIC_DRAW );131 m_va = a_context->get_device()->create_vertex_array( a_data, STATIC_DRAW ); 134 132 } 135 133 … … 177 175 } 178 176 179 nv::keyframed_mesh_cpu::keyframed_mesh_cpu( device* a_device, const mesh_data* a_data, const mesh_nodes_data* a_tag_map ) 180 : keyframed_mesh( a_device, a_data, a_tag_map ) 181 { 182 m_vb = a_device->create_vertex_buffer( nv::STATIC_DRAW, m_vertex_count * m_vsize, (void*)m_vchannel->data ); 177 nv::keyframed_mesh_cpu::keyframed_mesh_cpu( context* a_context, const mesh_data* a_data, const mesh_nodes_data* a_tag_map ) 178 : keyframed_mesh( a_data, a_tag_map ) 179 , m_context( a_context ) 180 { 181 m_va = m_context->get_device()->create_vertex_array(); 182 m_vb = m_context->get_device()->create_vertex_buffer( nv::STATIC_DRAW, m_vertex_count * m_vsize, (void*)m_vchannel->data ); 183 183 m_va->add_vertex_buffers( m_vb, m_vchannel ); 184 184 185 nv::vertex_buffer* vb = a_device->create_vertex_buffer( nv::STATIC_DRAW, m_vertex_count * sizeof( nv::vec2 ), (void*)m_mesh_data->get_channel<vertex_t>()->data );185 nv::vertex_buffer* vb = m_context->get_device()->create_vertex_buffer( nv::STATIC_DRAW, m_vertex_count * sizeof( nv::vec2 ), (void*)m_mesh_data->get_channel<vertex_t>()->data ); 186 186 m_va->add_vertex_buffers( vb, m_mesh_data->get_channel<vertex_t>() ); 187 187 188 nv::index_buffer* ib = a_device->create_index_buffer( nv::STATIC_DRAW, m_mesh_data->get_index_channel()->size(), (void*)m_mesh_data->get_index_channel()->data );188 nv::index_buffer* ib = m_context->get_device()->create_index_buffer( nv::STATIC_DRAW, m_mesh_data->get_index_channel()->size(), (void*)m_mesh_data->get_index_channel()->data ); 189 189 m_va->set_index_buffer( ib, m_mesh_data->get_index_channel()->desc.slots[0].etype, true ); 190 190 … … 224 224 } 225 225 226 m_vb->bind(); 227 m_vb->update( m_data, 0, m_vertex_count * m_vsize ); 228 m_vb->unbind(); 226 m_context->update( m_vb, m_data, 0, m_vertex_count * m_vsize ); 229 227 } 230 228
Note: See TracChangeset
for help on using the changeset viewer.