Changeset 430
- Timestamp:
- 07/20/15 15:24:51 (10 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nv/gfx/keyframed_mesh.hh
r419 r430 19 19 { 20 20 public: 21 keyframed_mesh( context* a_context, const mesh_data* a_data, const mesh_nodes_data* a_tag_map );21 keyframed_mesh( context* a_context, const data_channel_set* a_data, const mesh_nodes_data* a_tag_map ); 22 22 virtual vertex_array get_vertex_array() const { return m_va; } 23 23 virtual size_t get_index_count() const { return m_index_count; } … … 50 50 context* m_context; 51 51 52 const mesh_data* m_mesh_data;53 52 const mesh_nodes_data* m_tag_map; 54 53 … … 73 72 { 74 73 public: 75 keyframed_mesh_gpu( context* a_context, const mesh_data* a_data, const mesh_nodes_data* a_tag_map );74 keyframed_mesh_gpu( context* a_context, const data_channel_set* a_data, const mesh_nodes_data* a_tag_map ); 76 75 void update_animation( animation_entry* anim, uint32 a_anim_time ); 77 76 virtual void update( program a_program ); … … 88 87 { 89 88 public: 90 keyframed_mesh_cpu( context* a_context, const mesh_data* a_data, const mesh_nodes_data* a_tag_map );89 keyframed_mesh_cpu( context* a_context, const data_channel_set* a_data, const mesh_nodes_data* a_tag_map ); 91 90 void update_animation( animation_entry* anim, uint32 a_anim_time ); 92 91 ~keyframed_mesh_cpu(); 93 92 private: 93 const uint8* m_model_data; 94 94 uint8* m_data; 95 95 }; -
trunk/nv/gfx/mesh_creator.hh
r418 r430 18 18 { 19 19 public: 20 mesh_data_creator( mesh_data* data ) : m_data( data ) {}20 mesh_data_creator( data_channel_set* data ) : m_data( data ) {} 21 21 // assumes that position and normal is vec3, tangent is vec4 22 22 void transform( float scale, const mat3& r33 ); … … 24 24 void generate_tangents(); 25 25 void flip_normals(); 26 bool is_same_format( mesh_data* other );27 void merge( mesh_data* other );26 bool is_same_format( data_channel_set* other ); 27 void merge( data_channel_set* other ); 28 28 private: 29 29 raw_data_channel merge_channels( const raw_data_channel& a, const raw_data_channel& b ); 30 30 raw_data_channel append_channels( const raw_data_channel& a, const raw_data_channel& b, uint32 frame_count = 1 ); 31 31 32 mesh_data* m_data;32 data_channel_set* m_data; 33 33 }; 34 34 -
trunk/nv/gfx/skeletal_mesh.hh
r423 r430 58 58 { 59 59 public: 60 skeletal_mesh_cpu( context* a_context, const mesh_data* a_mesh_data, const mesh_nodes_data* bones );60 skeletal_mesh_cpu( context* a_context, const data_channel_set* a_mesh_data, const mesh_nodes_data* bones ); 61 61 virtual size_t get_index_count() const { return m_indices; } 62 62 virtual void update_animation( animation_entry* a_anim, uint32 a_anim_time ); … … 108 108 { 109 109 public: 110 skeletal_mesh_gpu( context* a_context, const mesh_data* a_mesh, const mesh_nodes_data* a_bone_data );110 skeletal_mesh_gpu( context* a_context, const data_channel_set* a_mesh, const mesh_nodes_data* a_bone_data ); 111 111 virtual size_t get_index_count() const { return m_index_count; } 112 112 virtual void update( program a_program ); -
trunk/nv/interface/context.hh
r418 r430 297 297 298 298 // TODO: HINTS ARE DIFFERENT! 299 vertex_array create_vertex_array( const mesh_data* data, buffer_hint hint )299 vertex_array create_vertex_array( const data_channel_set* data, buffer_hint hint ) 300 300 { 301 301 vertex_array va = create_vertex_array(); -
trunk/nv/interface/mesh_data.hh
r428 r430 20 20 struct index_u32 { uint32 index; }; 21 21 22 using mesh_data = data_channel_set;22 //using mesh_data = data_channel_set; 23 23 24 24 // TODO : attribute/property implementation and read/write on every nmd::command … … 106 106 friend class mesh_creator; 107 107 public: 108 explicit mesh_data_pack( uint32 a_count, mesh_data* a_meshes, mesh_nodes_data* a_nodes = nullptr )108 explicit mesh_data_pack( uint32 a_count, data_channel_set* a_meshes, mesh_nodes_data* a_nodes = nullptr ) 109 109 { 110 110 m_count = a_count; … … 112 112 m_nodes = a_nodes; 113 113 } 114 const mesh_data* get_mesh( uint32 index ) const114 const data_channel_set* get_mesh( uint32 index ) const 115 115 { 116 116 if ( index >= m_count ) return nullptr; … … 126 126 } 127 127 private: 128 uint32 m_count;129 mesh_data*m_meshes;130 mesh_nodes_data* m_nodes;128 uint32 m_count; 129 data_channel_set* m_meshes; 130 mesh_nodes_data* m_nodes; 131 131 }; 132 132 } -
trunk/src/gfx/keyframed_mesh.cc
r428 r430 13 13 using namespace nv; 14 14 15 nv::keyframed_mesh::keyframed_mesh( context* a_context, const mesh_data* a_data, const mesh_nodes_data* a_tag_map )15 nv::keyframed_mesh::keyframed_mesh( context* a_context, const data_channel_set* a_data, const mesh_nodes_data* a_tag_map ) 16 16 : animated_mesh() 17 17 , m_context( a_context ) 18 , m_mesh_data( a_data )19 18 , m_tag_map( a_tag_map ) 20 19 , m_last_frame( 0 ) … … 23 22 , m_active( false ) 24 23 { 25 m_index_count = m_mesh_data->get_channel_size( slot::INDEX );26 m_vertex_count = m_mesh_data->get_channel_size<vertex_t>();27 uint32 pos_size = m_mesh_data->get_channel_size<vertex_pnt>();24 m_index_count = a_data->get_channel_size( slot::INDEX ); 25 m_vertex_count = a_data->get_channel_size<vertex_t>(); 26 uint32 pos_size = a_data->get_channel_size<vertex_pnt>(); 28 27 if ( pos_size == 0 ) 29 28 { 30 pos_size = m_mesh_data->get_channel_size<vertex_pn>();29 pos_size = a_data->get_channel_size<vertex_pn>(); 31 30 m_has_tangent = false; 32 31 m_vsize = sizeof( vertex_pn ); … … 127 126 } 128 127 129 nv::keyframed_mesh_gpu::keyframed_mesh_gpu( context* a_context, const mesh_data* a_data, const mesh_nodes_data* a_tag_map )128 nv::keyframed_mesh_gpu::keyframed_mesh_gpu( context* a_context, const data_channel_set* a_data, const mesh_nodes_data* a_tag_map ) 130 129 : keyframed_mesh( a_context, a_data, a_tag_map ) 131 130 , m_loc_next_position( -1 ) … … 186 185 } 187 186 188 nv::keyframed_mesh_cpu::keyframed_mesh_cpu( context* a_context, const mesh_data* a_data, const mesh_nodes_data* a_tag_map )187 nv::keyframed_mesh_cpu::keyframed_mesh_cpu( context* a_context, const data_channel_set* a_data, const mesh_nodes_data* a_tag_map ) 189 188 : keyframed_mesh( a_context, a_data, a_tag_map ) 190 189 { … … 194 193 m_context->add_vertex_buffers( m_va, m_pbuffer, vchannel->descriptor() ); 195 194 196 buffer vb = m_context->get_device()->create_buffer( VERTEX_BUFFER, STATIC_DRAW, m_vertex_count * sizeof( vec2 ), m_mesh_data->get_channel_data<vertex_t>() );197 m_context->add_vertex_buffers( m_va, vb, m_mesh_data->get_channel<vertex_t>()->descriptor() );198 199 const raw_data_channel* index_channel = m_mesh_data->get_channel( slot::INDEX );195 buffer vb = m_context->get_device()->create_buffer( VERTEX_BUFFER, STATIC_DRAW, m_vertex_count * sizeof( vec2 ), a_data->get_channel_data<vertex_t>() ); 196 m_context->add_vertex_buffers( m_va, vb, a_data->get_channel<vertex_t>()->descriptor() ); 197 198 const raw_data_channel* index_channel = a_data->get_channel( slot::INDEX ); 200 199 buffer ib = m_context->get_device()->create_buffer( INDEX_BUFFER, STATIC_DRAW, index_channel->raw_size(), index_channel->raw_data() ); 201 200 m_context->set_index_buffer( m_va, ib, index_channel->descriptor()[0].etype, true ); 202 201 203 202 m_data = new uint8[ m_vertex_count * m_vsize ]; 203 204 m_model_data = vchannel->raw_data(); 204 205 } 205 206 … … 210 211 if ( m_has_tangent ) 211 212 { 212 const vertex_pnt* data = m_mesh_data->get_channel_data<vertex_pnt>();213 const vertex_pnt* data = reinterpret_cast< const vertex_pnt* >( m_model_data ); 213 214 const vertex_pnt* prev = data + m_vertex_count * m_last_frame; 214 215 const vertex_pnt* next = data + m_vertex_count * m_next_frame; … … 223 224 else 224 225 { 225 const vertex_pn* data = m_mesh_data->get_channel_data<vertex_pn>();226 const vertex_pn* data = reinterpret_cast< const vertex_pn* >( m_model_data ); 226 227 const vertex_pn* prev = data + m_vertex_count * m_last_frame; 227 228 const vertex_pn* next = data + m_vertex_count * m_next_frame; -
trunk/src/gfx/mesh_creator.cc
r428 r430 385 385 386 386 387 bool nv::mesh_data_creator::is_same_format( mesh_data* other )387 bool nv::mesh_data_creator::is_same_format( data_channel_set* other ) 388 388 { 389 389 if ( m_data->size() != other->size() ) return false; … … 396 396 } 397 397 398 void nv::mesh_data_creator::merge( mesh_data* other )398 void nv::mesh_data_creator::merge( data_channel_set* other ) 399 399 { 400 400 if ( !is_same_format( other ) ) return; -
trunk/src/gfx/skeletal_mesh.cc
r428 r430 11 11 #include "nv/stl/unordered_map.hh" 12 12 13 nv::skeletal_mesh_cpu::skeletal_mesh_cpu( context* a_context, const mesh_data* a_mesh_data, const mesh_nodes_data* bones )13 nv::skeletal_mesh_cpu::skeletal_mesh_cpu( context* a_context, const data_channel_set* a_mesh_data, const mesh_nodes_data* bones ) 14 14 : skeletal_mesh( a_context ) 15 15 { … … 234 234 } 235 235 236 nv::skeletal_mesh_gpu::skeletal_mesh_gpu( context* a_context, const mesh_data* a_mesh, const mesh_nodes_data* a_bone_data )236 nv::skeletal_mesh_gpu::skeletal_mesh_gpu( context* a_context, const data_channel_set* a_mesh, const mesh_nodes_data* a_bone_data ) 237 237 : skeletal_mesh( a_context ), m_bone_data( a_bone_data ), m_transform( nullptr ) 238 238 {
Note: See TracChangeset
for help on using the changeset viewer.