Changeset 161 for trunk/src/gfx/keyframed_mesh.cc
- Timestamp:
- 07/15/13 02:48:06 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gfx/keyframed_mesh.cc
r159 r161 21 21 , m_va( nullptr ) 22 22 , m_loc_next_position( 0 ) 23 , m_loc_last_position( 0 )24 23 , m_loc_next_normal( 0 ) 25 , m_loc_last_normal( 0 )26 24 , m_last_frame( 0 ) 27 25 , m_next_frame( 0 ) … … 37 35 38 36 nv::vertex_buffer* vb; 39 m_loc_next_position = m_program->get_attribute( "next_position" )->get_location(); 40 m_loc_last_position = m_program->get_attribute( "last_position" )->get_location(); 41 m_loc_next_normal = m_program->get_attribute( "next_normal" )->get_location(); 42 m_loc_last_normal = m_program->get_attribute( "last_normal" )->get_location(); 37 m_loc_next_position = m_program->get_attribute( "nv_next_position" )->get_location(); 38 m_loc_next_normal = m_program->get_attribute( "nv_next_normal" )->get_location(); 43 39 44 40 vb = 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_positions().data() ); 45 41 m_va->add_vertex_buffer( m_loc_next_position, vb, nv::FLOAT, 3, 0, 0, false ); 46 m_va->add_vertex_buffer( m_loc_last_position, vb, nv::FLOAT, 3 );42 m_va->add_vertex_buffer( nv::POSITION, vb, nv::FLOAT, 3 ); 47 43 48 44 vb = 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_normals().data() ); 49 45 m_va->add_vertex_buffer( m_loc_next_normal, vb, nv::FLOAT, 3, 0, 0, false ); 50 m_va->add_vertex_buffer( m_loc_last_normal, vb, nv::FLOAT, 3 );46 m_va->add_vertex_buffer( nv::NORMAL, vb, nv::FLOAT, 3 ); 51 47 52 48 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() ); 53 m_va->add_vertex_buffer( m_program->get_attribute( "texcoord" )->get_location(), vb, nv::FLOAT, 2 );49 m_va->add_vertex_buffer( nv::slot::TEXCOORD, vb, nv::FLOAT, 2 ); 54 50 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() ); 55 51 m_va->set_index_buffer( ib, nv::USHORT, true ); … … 129 125 if ( m_gpu_last_frame != m_last_frame ) 130 126 { 131 m_va->update_vertex_buffer( m_loc_last_position, m_last_frame * vtx_count * sizeof( nv::vec3 ) );132 m_va->update_vertex_buffer( m_loc_last_normal, m_last_frame * vtx_count * sizeof( nv::vec3 ) );127 m_va->update_vertex_buffer( slot::POSITION, m_last_frame * vtx_count * sizeof( nv::vec3 ) ); 128 m_va->update_vertex_buffer( slot::NORMAL, m_last_frame * vtx_count * sizeof( nv::vec3 ) ); 133 129 m_gpu_last_frame = m_last_frame; 134 130 } … … 139 135 m_gpu_next_frame = m_next_frame; 140 136 } 141 m_program->set_uniform( " interpolate", m_interpolation );137 m_program->set_uniform( "nv_interpolate", m_interpolation ); 142 138 m_context->draw( nv::TRIANGLES, rstate, m_program, m_va, m_data->get_index_count() ); 143 139 }
Note: See TracChangeset
for help on using the changeset viewer.