Changeset 477
- Timestamp:
- 10/23/15 19:35:39 (10 years ago)
- Location:
- trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nv/core/resource.hh
r474 r477 73 73 resource() : m_id(0), m_handler( nullptr ) {} 74 74 bool is_valid() const { return m_id.valid() && m_handler != nullptr; } 75 resource_id id() const { return m_id; } 75 76 ~resource() 76 77 { -
trunk/nv/engine/program_manager.hh
r474 r477 20 20 { 21 21 22 class program_manager : public resource_manager< program>22 class program_manager : public lua_resource_manager< program, false > 23 23 { 24 24 public: … … 27 27 virtual string_view get_resource_name() const { return "program"; } 28 28 protected: 29 virtual res_id load_resource( lua::table_guard& table);29 virtual bool load_resource( lua::table_guard& table, shash64 id ); 30 30 string_buffer load_source( lua::table_guard& table, const string_view& append ); 31 virtual void release( program *p );31 virtual void release( program p ); 32 32 private: 33 33 context* m_context; -
trunk/nv/engine/resource_system.hh
r474 r477 24 24 { 25 25 26 typedef uint32 res_id; 27 typedef uint32 res_type_id; 26 template < typename T, bool Heap = true > 27 struct resource_storage_policy; 28 29 template < typename T > 30 struct resource_storage_policy< T, true > 31 { 32 typedef T* type; 33 static void free( T* value ) { delete value; } 34 static T* to_pointer( T* value ) { return value; } 35 }; 36 37 template < typename T > 38 struct resource_storage_policy< T, false > 39 { 40 typedef T type; 41 static void free( T ) {} 42 static T* to_pointer( T& value ) { return &value; } 43 }; 28 44 29 45 class resource_system; 30 46 31 class resource_manager_base : public resource_handler47 class custom_resource_manager_base : public resource_handler 32 48 { 33 public: 34 resource_manager_base() : m_lua( nullptr ) {} 49 public: 50 custom_resource_manager_base() {} 51 virtual void clear() = 0; 52 virtual bool load_resource( const string_view& id ) = 0; 53 protected: 54 virtual void unlock( resource_id, resource_type_id ) {}; 55 virtual void release( resource_id, resource_type_id ) {}; 56 }; 57 58 class lua_resource_manager_base : public resource_handler 59 { 60 public: 61 lua_resource_manager_base() : m_lua( nullptr ) {} 35 62 void initialize( lua::state* state ); 36 63 virtual string_view get_storage_name() const = 0; 37 64 virtual string_view get_resource_name() const = 0; 38 virtual void clear() { m_names.clear(); }65 virtual void clear() = 0; 39 66 void load_all(); 40 res_idload_resource( const string_view& id );41 virtual ~ resource_manager_base() {}67 bool load_resource( const string_view& id ); 68 virtual ~lua_resource_manager_base() {} 42 69 protected: 43 virtual res_id load_resource( lua::table_guard& table ) = 0; 44 45 // virtual const void* lock( resource_id id, resource_type_id ); 70 virtual bool load_resource( lua::table_guard& table, shash64 id ) = 0; 71 // virtual const void* lock( resource_id id, resource_type_id ); 46 72 virtual void unlock( resource_id, resource_type_id ) {}; 47 73 virtual void release( resource_id, resource_type_id ) {}; 48 74 49 75 lua::state* m_lua; 50 hash_store< shash64, res_id > m_names;51 76 }; 52 77 53 template < typename T >54 class resource_manager : public resource_manager_base78 template < typename T, bool Heap = true, typename Base = custom_resource_manager_base > 79 class custom_resource_manager : public Base 55 80 { 56 81 public: 57 resource_manager() { m_data.push_back(nullptr); } 58 T* get_resource( res_id id ) 82 typedef resource_storage_policy< T, Heap > policy_type; 83 typedef T value_type; 84 typedef resource< T > resource_type; 85 typedef typename policy_type::type stored_type; 86 87 custom_resource_manager() {} 88 resource_type get( const string_view& id ) 59 89 { 60 return ( id < m_data.size() ? m_data[ id ] : nullptr ); 61 } 62 T* get_resource( const string_view& id ) 63 { 64 auto m = m_names.find( id ); 65 if ( m != m_names.end() ) 66 { 67 return get_resource( m->second ); 68 } 69 return get_resource( load_resource( id ) ); 70 } 71 resource< T > get( const string_view& id ) 72 { 73 auto m = m_names.find( id ); 74 if ( m != m_names.end() ) 90 auto m = m_store.find( id ); 91 if ( m != m_store.end() ) 75 92 { 76 93 return create< T >( id ); … … 78 95 else 79 96 { 80 if ( get_resource( id ) != nullptr)97 if ( this->load_resource( id ) ) 81 98 { 82 99 return create< T >( id ); 83 100 } 84 101 } 85 //NV_ASSERT( false, "resource_manager.get failed!" );86 return resource <T>();102 // NV_ASSERT( false, "resource_manager.get failed!" ); 103 return resource_type(); 87 104 } 105 106 resource_type get( uint64 id ) 107 { 108 auto m = m_store.find( shash64( id ) ); 109 if ( m != m_store.end() ) 110 { 111 return create< T >( shash64( id ) ); 112 } 113 // NV_ASSERT( false, "resource_manager.get failed!" ); 114 return resource_type(); 115 } 116 117 88 118 virtual void clear() 89 119 { 90 resource_manager_base::clear(); 91 for ( uint32 i = 1; i < m_data.size(); ++i ) 92 release( m_data[i] ); 93 m_data.clear(); 94 m_data.push_back( nullptr ); 120 for ( auto data : m_store ) 121 { 122 release( data.second ); 123 policy_type::free( data.second ); 124 } 125 m_store.clear(); 95 126 } 96 127 97 virtual ~ resource_manager()128 virtual ~custom_resource_manager() 98 129 { 99 130 clear(); … … 102 133 virtual const void* lock( resource_id id, resource_type_id ) 103 134 { 104 auto m = m_names.find( id ); 105 if ( m != m_names.end() ) 106 { 107 return m_data[m->second]; 108 } 109 return nullptr; 135 auto m = m_store.find( id ); 136 return m != m_store.end() ? policy_type::to_pointer( m->second ) : nullptr; 110 137 } 111 138 112 virtual void release( T*) {}139 virtual void release( stored_type ) {} 113 140 114 res_id add( T* resource)141 void add( stored_type resource, shash64 id ) 115 142 { 116 m_data.push_back( resource ); 117 return m_data.size() - 1; 143 m_store[id] = resource; 118 144 } 119 145 120 vector< T* > m_data;146 hash_store< shash64, stored_type > m_store; 121 147 }; 122 148 149 template < typename T, bool Heap = true > 150 using lua_resource_manager = custom_resource_manager< T, Heap, lua_resource_manager_base >; 151 123 152 } 124 153 -
trunk/nv/gfx/skeletal_mesh.hh
r475 r477 20 20 { 21 21 public: 22 skeletal_animation_entry( shash64 name, const mesh_nodes_data* anim, bool a_looping )23 : animation_entry( name, a_looping, anim->get_fps(), 0, anim->get_frame_count())24 , m_ data( anim )22 skeletal_animation_entry( shash64 name, const mesh_nodes_data* anim, uint32 fps, uint32 time_start, uint32 time_end, bool a_looping ) 23 : animation_entry( name, a_looping, fps, time_start, time_end ) 24 , m_temp_anim( anim ) 25 25 { 26 26 } 27 28 skeletal_animation_entry( shash64 name, const mesh_nodes_data* anim, uint32 time_start, uint32 time_end, bool a_looping ) 29 : animation_entry( name, a_looping, anim->get_fps(), time_start, time_end ) 30 , m_data( anim ) 31 32 { 33 } 34 27 const skeleton_binding& get_binding() const { return m_data; } 35 28 void prepare( const mesh_nodes_data* bones ); 36 void update_skeleton( mat4*tr, uint32 a_ms_time ) const;29 void update_skeleton( skeleton_instance& tr, uint32 a_ms_time ) const; 37 30 38 31 protected: 39 skeleton_instance m_data; 32 const mesh_nodes_data* m_temp_anim; 33 skeleton_binding m_data; 40 34 }; 41 35 … … 46 40 virtual vertex_array get_vertex_array() const { return m_va; } 47 41 virtual size_t get_index_count() const { return m_index_count; } 48 virtual void run_animation( animation_entry *a_anim )42 virtual void run_animation( animation_entry& a_anim ) 49 43 { 50 44 update_animation( a_anim, 0 ); 51 45 } 52 virtual void update ( program a_program );53 virtual void update_animation( animation_entry *a_anim, uint32 a_anim_time );46 virtual void update_program( program a_program ); 47 virtual void update_animation( animation_entry& a_anim, uint32 a_anim_time ); 54 48 virtual transform get_node_transform( uint32 node_id ) const; 55 49 virtual mat4 get_node_matrix( uint32 node_id ) const; 56 50 virtual sint16 get_parent_id() const { return m_parent_id; } 57 virtual uint32 get_node_count() const { return m_bone_data ? m_bone_data->size() : 0; } 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; } 58 55 ~skeletal_mesh() 59 56 { 60 57 m_context->release( m_va ); 61 delete[] m_transform;62 58 } 63 59 protected: 60 skeleton_instance m_skeleton; 64 61 vertex_array m_va; 62 uint32 m_index_count; 65 63 context* m_context; 66 data_descriptor m_interpolation_key;67 64 const mesh_nodes_data* m_bone_data; 68 uint32 m_index_count;69 mat4* m_transform;70 65 sint16 m_parent_id; 71 66 }; -
trunk/nv/gfx/skeleton_instance.hh
r475 r477 9 9 10 10 #include <nv/common.hh> 11 #include <nv/stl/array.hh> 11 12 #include <nv/interface/context.hh> 12 13 #include <nv/interface/mesh_data.hh> … … 15 16 { 16 17 17 class skeleton_ instance18 class skeleton_binding 18 19 { 19 20 public: 20 explicit skeleton_instance( const mesh_nodes_data* data ) 21 : m_data( data ) 22 , m_indices( nullptr ) 21 explicit skeleton_binding() 22 : m_indices( nullptr ) 23 23 , m_offsets( nullptr ) 24 24 { 25 25 } 26 void prepare( const mesh_nodes_data* data ); 27 void animate( mat4* data, float frame ) const; 28 ~skeleton_instance() 26 void prepare( const mesh_nodes_data* node_data, const mesh_nodes_data* bone_data ); 27 ~skeleton_binding() 29 28 { 30 29 delete[] m_indices; … … 32 31 } 33 32 protected: 34 void animate_rec( mat4* data, float frame, uint32 id, const mat4& parent ) const;35 void animate_flat( mat4* data, float frame ) const;36 37 const mesh_nodes_data* m_data;38 33 sint16* m_indices; 39 34 mat4* m_offsets; 40 35 data_descriptor m_key; 36 37 friend class skeleton_instance; 41 38 }; 39 40 class skeleton_instance 41 { 42 public: 43 explicit skeleton_instance( uint32 bone_count ) 44 { 45 initialize( bone_count ); 46 } 47 void initialize( uint32 bone_count ) 48 { 49 if ( bone_count > m_transform.size() ) 50 m_transform.resize( bone_count ); 51 } 52 const mat4* transforms() const { return m_transform.data(); } 53 size_t size() const { return m_transform.size(); } 54 55 void animate( const mesh_nodes_data* node_data, const skeleton_binding& binding, float frame ); 56 protected: 57 void animate_rec( const mesh_nodes_data* node_data, const skeleton_binding& binding, float frame, uint32 id, const mat4& parent ); 58 void animate_flat( const mesh_nodes_data* node_data, const skeleton_binding& binding, float frame ); 59 60 dynamic_array< mat4 > m_transform; 61 }; 62 42 63 43 64 } -
trunk/nv/interface/animated_mesh.hh
r471 r477 56 56 public: 57 57 animated_mesh() {} 58 virtual void update_animation( animation_entry *, uint32 ) {}59 virtual void run_animation( animation_entry *) {}58 virtual void update_animation( animation_entry&, uint32 ) {} 59 virtual void run_animation( animation_entry& ) {} 60 60 virtual transform get_node_transform( uint32 ) const { return transform(); } 61 61 virtual mat4 get_node_matrix( uint32 ) const { return mat4(); } -
trunk/nv/interface/context.hh
r473 r477 49 49 public: 50 50 mesh_interface() {} 51 virtual void update ( program ) {}51 virtual void update_program( program ) {} 52 52 virtual nv::vertex_array get_vertex_array() const = 0; 53 53 virtual size_t get_index_count() const = 0; -
trunk/nv/interface/mesh_data.hh
r475 r477 97 97 } 98 98 99 bool is_animated() const 100 { 101 for ( auto data : m_data ) 102 { 103 if ( data->size() > 0 ) return true; 104 } 105 return false; 106 } 107 99 108 const data_channel_set* get_by_hash( shash64 h ) const 100 109 { … … 168 177 } 169 178 uint32 get_count() const { return m_count; } 179 data_channel_set* release_meshes() { data_channel_set* meshes = m_meshes; m_meshes = nullptr; return meshes; } 180 mesh_nodes_data* release_nodes() { mesh_nodes_data* nodes = m_nodes; m_nodes = nullptr; return nodes; } 170 181 const mesh_nodes_data* get_nodes() const { return m_nodes; } 171 182 uint32 get_node_count() const { return m_nodes ? m_nodes->size() : 0; } -
trunk/src/engine/program_manager.cc
r474 r477 16 16 } 17 17 18 nv::res_id nv::program_manager::load_resource( lua::table_guard& table)18 bool nv::program_manager::load_resource( lua::table_guard& table, shash64 id ) 19 19 { 20 20 NV_LOG_DEBUG( table.get_string("id") ); … … 36 36 } 37 37 38 nv::program* program = new nv::program( m_context->get_device()->create_program( vsource, fsource ));39 return add( program );38 add( m_context->get_device()->create_program( vsource, fsource ), id ); 39 return true; 40 40 } 41 41 42 void nv::program_manager::release( program *p )42 void nv::program_manager::release( program p ) 43 43 { 44 m_context->get_device()->release( *p ); 45 delete p; 44 m_context->get_device()->release( p ); 46 45 } 47 46 -
trunk/src/engine/resource_system.cc
r474 r477 9 9 #include "nv/lua/lua_nova.hh" 10 10 11 void nv:: resource_manager_base::initialize( lua::state* a_lua_state )11 void nv::lua_resource_manager_base::initialize( lua::state* a_lua_state ) 12 12 { 13 13 m_lua = a_lua_state; … … 16 16 } 17 17 18 nv::res_id nv::resource_manager_base::load_resource( const string_view& id )18 bool nv::lua_resource_manager_base::load_resource( const string_view& id ) 19 19 { 20 20 lua::table_guard table( m_lua, lua::path( get_storage_name(), id ) ); 21 res_id rid = load_resource( table ); 22 if ( rid != 0 ) m_names[ id ] = rid; 23 return rid; 21 load_resource( table, id ); 22 return true; 24 23 } 25 24 26 void nv:: resource_manager_base::load_all()25 void nv::lua_resource_manager_base::load_all() 27 26 { 28 27 clear(); … … 31 30 for ( auto i : range( count ) ) 32 31 { 33 lua::table_guard sub_table( table, i+1 ); 34 res_id rid = load_resource( sub_table ); 35 if ( rid != 0 ) m_names[ sub_table.get_string_hash_64("id") ] = rid; 32 lua::table_guard sub_table( table, i + 1 ); 33 load_resource( sub_table, sub_table.get_string_hash_64( "id" ) ); 36 34 } 37 35 } 36 -
trunk/src/gfx/skeletal_mesh.cc
r475 r477 13 13 #include "nv/core/logging.hh" 14 14 15 void nv::skeletal_animation_entry::update_skeleton( mat4*data, uint32 a_ms_time ) const15 void nv::skeletal_animation_entry::update_skeleton( skeleton_instance& data, uint32 a_ms_time ) const 16 16 { 17 17 float fframe = ( a_ms_time * 0.001f ) * m_fps; … … 38 38 } 39 39 40 m_data.animate( data, fframe ); 40 if ( data.size() == 0 ) 41 data.initialize( m_temp_anim->size() ); 42 data.animate( m_temp_anim, m_data, fframe ); 41 43 } 42 44 43 45 void nv::skeletal_animation_entry::prepare( const mesh_nodes_data* bones ) 44 46 { 45 m_data.prepare( bones);47 m_data.prepare( m_temp_anim, bones ? bones : m_temp_anim ); 46 48 } 47 49 48 50 nv::skeletal_mesh::skeletal_mesh( context* a_context, const data_channel_set* a_mesh, const mesh_nodes_data* a_bone_data ) 49 : m_ context( a_context ), m_bone_data( a_bone_data ), m_index_count( 0 ), m_transform( nullptr), m_parent_id(-1)51 : 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) 50 52 { 51 53 if ( a_mesh ) … … 55 57 m_parent_id = a_mesh->get_parent_id(); 56 58 } 57 if ( m_bone_data )58 {59 m_transform = new mat4[ m_bone_data->size() ];60 }61 59 } 62 60 63 void nv::skeletal_mesh::update_animation( animation_entry *a_anim, uint32 a_anim_time )61 void nv::skeletal_mesh::update_animation( animation_entry& a_anim, uint32 a_anim_time ) 64 62 { 65 if ( m_bone_data && a_anim ) 66 { 67 skeletal_animation_entry * anim = static_cast<skeletal_animation_entry*>( a_anim ); 68 anim->prepare( m_bone_data ); 69 anim->update_skeleton( m_transform, a_anim_time ); 70 } 63 skeletal_animation_entry& anim = static_cast<skeletal_animation_entry&>( a_anim ); 64 anim.prepare( m_bone_data ); 65 anim.update_skeleton( m_skeleton, a_anim_time ); 71 66 } 72 67 73 void nv::skeletal_mesh::update ( program a_program )68 void nv::skeletal_mesh::update_program( program a_program ) 74 69 { 75 if ( m_bone_data ) 76 m_context->get_device()->set_opt_uniform_array( a_program, "nv_m_bones", m_transform, m_bone_data->size() ); 70 m_context->get_device()->set_opt_uniform_array( a_program, "nv_m_bones", m_skeleton.transforms(), m_skeleton.size() ); 77 71 } 78 72 79 73 nv::transform nv::skeletal_mesh::get_node_transform( uint32 node_id ) const 80 74 { 81 return transform( m_transform[ node_id ]);75 return transform( get_node_matrix( node_id ) ); 82 76 } 83 77 84 78 nv::mat4 nv::skeletal_mesh::get_node_matrix( uint32 node_id ) const 85 79 { 86 return m_ transform[ node_id ];80 return m_skeleton.transforms()[ node_id ]; 87 81 } -
trunk/src/gfx/skeleton_instance.cc
r475 r477 7 7 #include "nv/gfx/skeleton_instance.hh" 8 8 9 void nv::skeleton_ instance::prepare( const mesh_nodes_data* bones)9 void nv::skeleton_binding::prepare( const mesh_nodes_data* node_data, const mesh_nodes_data* bone_data ) 10 10 { 11 if ( m_offsets || m_indices ) return; 12 hash_store< shash64, uint16 > bone_names; 13 m_offsets = new mat4[bones->size()]; 14 m_indices = new sint16[m_data->size()]; 11 if ( !m_offsets || !m_indices ) 12 { 13 // TODO: either fixed size struct or static allocator 14 hash_store< shash64, uint16 > bone_names; 15 m_offsets = new mat4[bone_data->size()]; 16 m_indices = new sint16[node_data->size()]; 15 17 16 for ( nv::uint16 bi = 0; bi < bones->size(); ++bi ) 17 { 18 const data_channel_set* bone = ( *bones )[bi]; 19 bone_names[bone->get_name()] = bi; 20 m_offsets[bi] = bone->get_transform(); 18 for ( nv::uint16 bi = 0; bi < bone_data->size(); ++bi ) 19 { 20 const data_channel_set* bone = ( *bone_data )[bi]; 21 bone_names[bone->get_name()] = bi; 22 m_offsets[bi] = bone->get_transform(); 23 } 24 25 for ( uint32 n = 0; n < node_data->size(); ++n ) 26 { 27 const data_channel_set* node = ( *node_data )[n]; 28 sint16 bone_id = -1; 29 30 auto bi = bone_names.find( node->get_name() ); 31 if ( bi != bone_names.end() ) 32 { 33 bone_id = sint16( bi->second ); 34 } 35 m_indices[n] = bone_id; 36 37 } 21 38 } 22 39 23 for ( uint32 n = 0; n < m_data->size(); ++n)40 if ( m_key.size() == 0 ) 24 41 { 25 const data_channel_set* node = ( *m_data )[n]; 26 sint16 bone_id = -1; 42 for ( uint32 n = 0; n < node_data->size(); ++n ) 43 if ( ( *node_data )[n]->size() > 0 ) 44 { 45 m_key = ( *node_data )[n]->get_interpolation_key(); 46 break; 47 } 48 } 27 49 28 auto bi = bone_names.find( node->get_name() ); 29 if ( bi != bone_names.end() ) 50 } 51 52 void nv::skeleton_instance::animate( const mesh_nodes_data* node_data, const skeleton_binding& binding, float frame ) 53 { 54 if ( m_transform.size() > 0 ) 55 { 56 if ( node_data->is_flat() ) 30 57 { 31 bone_id = sint16( bi->second);58 animate_flat( node_data, binding, frame ); 32 59 } 33 m_indices[n] = bone_id; 34 35 if ( m_key.size() == 0 && node->size() > 0 ) 36 m_key = node->get_interpolation_key(); 60 else 61 { 62 for ( uint32 n = 0; n < node_data->size(); ++n ) 63 if ( ( *node_data )[n]->get_parent_id() == -1 ) 64 animate_rec( node_data, binding, frame, n, mat4() ); 65 } 37 66 } 38 67 } 39 68 40 void nv::skeleton_instance::animate( mat4* data, float frame ) const 41 { 42 if ( m_data->is_flat() ) 43 { 44 animate_flat( data, frame ); 45 } 46 else 47 { 48 for ( uint32 n = 0; n < m_data->size(); ++n ) 49 if ( ( *m_data )[n]->get_parent_id() == -1 ) 50 animate_rec( data, frame, n, mat4() ); 51 } 52 } 53 54 void nv::skeleton_instance::animate_flat( mat4* data, float frame ) const 55 { 56 for ( uint32 n = 0; n < m_data->size(); ++n ) 57 if ( m_indices[n] >= 0 ) 58 { 59 const data_channel_set* node = ( *m_data )[n]; 60 nv::mat4 node_mat( node->get_transform() ); 61 62 if ( node->size() > 0 ) 63 { 64 raw_channel_interpolator interpolator( node, m_key ); 65 node_mat = interpolator.get< mat4 >( frame ); 66 } 67 68 sint16 bone_id = m_indices[n]; 69 data[bone_id] = node_mat * m_offsets[bone_id]; 70 } 71 } 72 73 void nv::skeleton_instance::animate_rec( mat4* data, float frame, uint32 id, const mat4& parent ) const 69 void nv::skeleton_instance::animate_rec( const mesh_nodes_data* node_data, const skeleton_binding& binding, float frame, uint32 id, const mat4& parent ) 74 70 { 75 71 // TODO: fix transforms, which are now embedded, 76 72 // see note in assimp_loader.cc:load_node 77 const data_channel_set* node = ( * m_data )[id];73 const data_channel_set* node = ( *node_data )[id]; 78 74 mat4 node_mat( node->get_transform() ); 79 75 80 76 if ( node->size() > 0 ) 81 77 { 82 raw_channel_interpolator interpolator( node, m_key );78 raw_channel_interpolator interpolator( node, binding.m_key ); 83 79 node_mat = interpolator.get< mat4 >( frame ); 84 80 } … … 86 82 mat4 global_mat = parent * node_mat; 87 83 88 sint16 bone_id = m_indices[id];84 sint16 bone_id = binding.m_indices[id]; 89 85 if ( bone_id >= 0 ) 90 86 { 91 data[bone_id] = global_mat *m_offsets[bone_id];87 m_transform[bone_id] = global_mat * binding.m_offsets[bone_id]; 92 88 } 93 89 94 for ( auto child : m_data->children( id ) )90 for ( auto child : node_data->children( id ) ) 95 91 { 96 animate_rec( data, frame, child, global_mat );92 animate_rec( node_data, binding, frame, child, global_mat ); 97 93 } 98 94 } 95 96 void nv::skeleton_instance::animate_flat( const mesh_nodes_data* node_data, const skeleton_binding& binding, float frame ) 97 { 98 for ( uint32 n = 0; n < node_data->size(); ++n ) 99 if ( binding.m_indices[n] >= 0 ) 100 { 101 const data_channel_set* node = ( *node_data )[n]; 102 nv::mat4 node_mat( node->get_transform() ); 103 104 if ( node->size() > 0 ) 105 { 106 raw_channel_interpolator interpolator( node, binding.m_key ); 107 node_mat = interpolator.get< mat4 >( frame ); 108 } 109 110 sint16 bone_id = binding.m_indices[n]; 111 m_transform[bone_id] = node_mat * binding.m_offsets[bone_id]; 112 } 113 } -
trunk/src/gl/gl_device.cc
r473 r477 389 389 glGetProgramInfoLog( p->glid, buffer_size, &length, buffer ); 390 390 NV_LOG_ERROR( "Program #", p->glid, " validation error : ", buffer ); 391 return false;391 //return false; 392 392 } 393 393 load_attributes( p );
Note: See TracChangeset
for help on using the changeset viewer.