Changeset 480 for trunk/legacy
- Timestamp:
- 11/03/15 19:06:23 (10 years ago)
- Location:
- trunk/legacy
- Files:
-
- 9 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/legacy/keyframed_mesh.cc
r470 r480 12 12 13 13 using namespace nv; 14 15 #if 0 14 16 15 17 nv::keyframed_mesh::keyframed_mesh( context* a_context, const data_channel_set* a_data, const mesh_nodes_data* a_tag_map ) … … 247 249 delete[] m_data; 248 250 } 251 252 #endif -
trunk/legacy/keyframed_mesh.hh
r470 r480 11 11 #include <nv/interface/context.hh> 12 12 #include <nv/interface/animated_mesh.hh> 13 #include <nv/formats/md3_loader.hh>14 13 15 14 namespace nv 16 15 { 16 17 #if 0 17 18 18 19 class keyframed_mesh : public animated_mesh … … 95 96 }; 96 97 98 #endif 99 97 100 } // namespace nv 98 101 -
trunk/legacy/md2_loader.cc
r453 r480 368 368 } 369 369 370 mesh_data_pack* nv::md2_loader::release_mesh_data_pack()371 {372 data_channel_set* data = data_channel_set_creator::create_set_array( 1, 3 );373 release_mesh_frame( &data[0], -1 );374 return new mesh_data_pack( 1, data );375 } -
trunk/legacy/md2_loader.hh
r453 r480 28 28 virtual bool load( stream& source ); 29 29 virtual data_channel_set* release_mesh_data( size_t index = 0 ); 30 virtual mesh_data_pack* release_mesh_data_pack();31 30 virtual size_t get_mesh_count() const { return 1; } 32 31 private: -
trunk/legacy/md3_loader.cc
r475 r480 435 435 } 436 436 437 mesh_data_pack* nv::md3_loader::release_mesh_data_pack()438 {439 md3_t* md3 = reinterpret_cast<md3_t*>( m_md3 );440 int count = 1;441 data_channel_set* data = nullptr;442 if ( m_merge_all )443 {444 data = data_channel_set_creator::create_set_array(1,3);445 release_mesh_frame( &data[0], -1, -1 );446 }447 else448 {449 count = md3->header.num_surfaces;450 data = data_channel_set_creator::create_set_array( count, 3 );451 for ( int i = 0; i < count; ++i )452 {453 release_mesh_frame( &data[i], -1, i );454 data_channel_set_creator( &data[i] ).set_name( make_name( reinterpret_cast< char* >( md3->surfaces[i].header.name ) ) );455 }456 }457 return new mesh_data_pack( uint32( count ), data, release_mesh_nodes_data() );458 }459 460 437 nv::size_t md3_loader::get_max_frames() const 461 438 { -
trunk/legacy/md3_loader.hh
r453 r480 34 34 virtual bool load( stream& source ); 35 35 virtual data_channel_set* release_mesh_data( size_t index = 0 ); 36 virtual mesh_data_pack* release_mesh_data_pack();37 36 virtual size_t get_mesh_count() const { return 1; } 38 37 size_t get_max_frames() const; -
trunk/legacy/skeletal_mesh.cc
r479 r480 12 12 13 13 #include "nv/core/logging.hh" 14 14 #if 0 15 15 void nv::skeletal_animation_entry::update_skeleton( skeleton_instance& data, uint32 a_ms_time ) const 16 16 { … … 39 39 m_data.prepare( m_temp_anim, bones ? bones : m_temp_anim ); 40 40 } 41 42 nv::skeletal_mesh::skeletal_mesh( context* a_context, const data_channel_set* a_mesh, const mesh_nodes_data* a_bone_data ) 43 : m_skeleton( a_bone_data ? a_bone_data->size() : 0 ), m_context( a_context ), m_bone_data( a_bone_data ), m_index_count( 0 ), m_parent_id(-1) 44 { 45 if ( a_mesh ) 46 { 47 m_va = a_context->create_vertex_array( a_mesh, nv::STATIC_DRAW ); 48 m_index_count = a_mesh->get_channel_size( slot::INDEX ); 49 m_parent_id = a_mesh->get_parent_id(); 50 } 51 } 52 53 void nv::skeletal_mesh::update_animation( animation_entry& a_anim, uint32 a_anim_time ) 54 { 55 skeletal_animation_entry& anim = static_cast<skeletal_animation_entry&>( a_anim ); 56 anim.prepare( m_bone_data ); 57 anim.update_skeleton( m_skeleton, a_anim_time ); 58 } 59 60 void nv::skeletal_mesh::update_program( program a_program ) 61 { 62 m_context->get_device()->set_opt_uniform_array( a_program, "nv_m_bones", m_skeleton.transforms(), m_skeleton.size() ); 63 } 64 65 nv::transform nv::skeletal_mesh::get_node_transform( uint32 node_id ) const 66 { 67 return transform( get_node_matrix( node_id ) ); 68 } 69 70 nv::mat4 nv::skeletal_mesh::get_node_matrix( uint32 node_id ) const 71 { 72 return m_skeleton.transforms()[ node_id ]; 73 } 41 #endif -
trunk/legacy/skeletal_mesh.hh
r477 r480 16 16 namespace nv 17 17 { 18 18 #if 0 19 19 class skeletal_animation_entry : public animation_entry 20 20 { … … 33 33 skeleton_binding m_data; 34 34 }; 35 36 class skeletal_mesh : public animated_mesh 37 { 38 public: 39 skeletal_mesh( context* a_context, const data_channel_set* a_mesh, const mesh_nodes_data* a_bone_data ); 40 virtual vertex_array get_vertex_array() const { return m_va; } 41 virtual size_t get_index_count() const { return m_index_count; } 42 virtual void run_animation( animation_entry& a_anim ) 43 { 44 update_animation( a_anim, 0 ); 45 } 46 virtual void update_program( program a_program ); 47 virtual void update_animation( animation_entry& a_anim, uint32 a_anim_time ); 48 virtual transform get_node_transform( uint32 node_id ) const; 49 virtual mat4 get_node_matrix( uint32 node_id ) const; 50 virtual sint16 get_parent_id() const { return m_parent_id; } 51 virtual uint32 get_node_count() const { return m_skeleton.size(); } 52 skeleton_instance& get_skeleton() { return m_skeleton; } 53 const mesh_nodes_data* get_bone_data() { return m_bone_data; } 54 context* get_context() { return m_context; } 55 ~skeletal_mesh() 56 { 57 m_context->release( m_va ); 58 } 59 protected: 60 skeleton_instance m_skeleton; 61 vertex_array m_va; 62 uint32 m_index_count; 63 context* m_context; 64 const mesh_nodes_data* m_bone_data; 65 sint16 m_parent_id; 66 }; 35 #endif 67 36 68 37 } // namespace nv
Note: See TracChangeset
for help on using the changeset viewer.