Changeset 430


Ignore:
Timestamp:
07/20/15 15:24:51 (10 years ago)
Author:
epyon
Message:
  • mesh_data -> data_channel_set rename
  • keyframed_mesh doesn't store full data_channel_set anymore
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/nv/gfx/keyframed_mesh.hh

    r419 r430  
    1919        {
    2020        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 );
    2222                virtual vertex_array get_vertex_array() const { return m_va; }
    2323                virtual size_t get_index_count() const { return m_index_count; }
     
    5050                context*     m_context;
    5151
    52                 const mesh_data*        m_mesh_data;
    5352                const mesh_nodes_data*  m_tag_map;
    5453
     
    7372        {
    7473        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 );
    7675                void update_animation( animation_entry* anim, uint32 a_anim_time );
    7776                virtual void update( program a_program );
     
    8887        {
    8988        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 );
    9190                void update_animation( animation_entry* anim, uint32 a_anim_time );
    9291                ~keyframed_mesh_cpu();
    9392        private:
     93                const uint8* m_model_data;
    9494                uint8*  m_data;
    9595        };
  • trunk/nv/gfx/mesh_creator.hh

    r418 r430  
    1818        {
    1919        public:
    20                 mesh_data_creator( mesh_data* data ) : m_data( data ) {}
     20                mesh_data_creator( data_channel_set* data ) : m_data( data ) {}
    2121                // assumes that position and normal is vec3, tangent is vec4
    2222                void transform( float scale, const mat3& r33 );
     
    2424                void generate_tangents();
    2525                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 );
    2828        private:
    2929                raw_data_channel merge_channels( const raw_data_channel& a, const raw_data_channel& b );
    3030                raw_data_channel append_channels( const raw_data_channel& a, const raw_data_channel& b, uint32 frame_count = 1 );
    3131
    32                 mesh_data* m_data;
     32                data_channel_set* m_data;
    3333        };
    3434
  • trunk/nv/gfx/skeletal_mesh.hh

    r423 r430  
    5858        {
    5959        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 );
    6161                virtual size_t get_index_count() const { return m_indices; }
    6262                virtual void update_animation( animation_entry* a_anim, uint32 a_anim_time );
     
    108108        {
    109109        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 );
    111111                virtual size_t get_index_count() const { return m_index_count; }
    112112                virtual void update( program a_program );
  • trunk/nv/interface/context.hh

    r418 r430  
    297297
    298298                // 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 )
    300300                {
    301301                        vertex_array  va = create_vertex_array();
  • trunk/nv/interface/mesh_data.hh

    r428 r430  
    2020        struct index_u32 { uint32 index; };
    2121
    22         using mesh_data = data_channel_set;
     22        //using mesh_data = data_channel_set;
    2323
    2424        // TODO : attribute/property implementation and read/write on every nmd::command
     
    106106                friend class mesh_creator;
    107107        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 )
    109109                {
    110110                        m_count  = a_count;
     
    112112                        m_nodes  = a_nodes;
    113113                }
    114                 const mesh_data* get_mesh( uint32 index ) const
     114                const data_channel_set* get_mesh( uint32 index ) const
    115115                {
    116116                        if ( index >= m_count ) return nullptr;
     
    126126                }
    127127        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;
    131131        };
    132132}
  • trunk/src/gfx/keyframed_mesh.cc

    r428 r430  
    1313using namespace nv;
    1414
    15 nv::keyframed_mesh::keyframed_mesh( context* a_context, const mesh_data* a_data, const mesh_nodes_data* a_tag_map )
     15nv::keyframed_mesh::keyframed_mesh( context* a_context, const data_channel_set* a_data, const mesh_nodes_data* a_tag_map )
    1616        : animated_mesh()
    1717        , m_context( a_context )
    18         , m_mesh_data( a_data )
    1918        , m_tag_map( a_tag_map )
    2019        , m_last_frame( 0 )
     
    2322        , m_active( false )
    2423{
    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>();
    2827        if ( pos_size == 0 )
    2928        {
    30                 pos_size      = m_mesh_data->get_channel_size<vertex_pn>();
     29                pos_size      = a_data->get_channel_size<vertex_pn>();
    3130                m_has_tangent = false;
    3231                m_vsize       = sizeof( vertex_pn );
     
    127126}
    128127
    129 nv::keyframed_mesh_gpu::keyframed_mesh_gpu( context* a_context, const mesh_data* a_data, const mesh_nodes_data* a_tag_map )
     128nv::keyframed_mesh_gpu::keyframed_mesh_gpu( context* a_context, const data_channel_set* a_data, const mesh_nodes_data* a_tag_map )
    130129        : keyframed_mesh( a_context, a_data, a_tag_map )
    131130        , m_loc_next_position( -1 )
     
    186185}
    187186
    188 nv::keyframed_mesh_cpu::keyframed_mesh_cpu( context* a_context, const mesh_data* a_data, const mesh_nodes_data* a_tag_map )
     187nv::keyframed_mesh_cpu::keyframed_mesh_cpu( context* a_context, const data_channel_set* a_data, const mesh_nodes_data* a_tag_map )
    189188        : keyframed_mesh( a_context, a_data, a_tag_map )
    190189{
     
    194193        m_context->add_vertex_buffers( m_va, m_pbuffer, vchannel->descriptor() );
    195194
    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 );
    200199        buffer  ib = m_context->get_device()->create_buffer( INDEX_BUFFER, STATIC_DRAW, index_channel->raw_size(), index_channel->raw_data() );
    201200        m_context->set_index_buffer( m_va, ib, index_channel->descriptor()[0].etype, true );
    202201
    203202        m_data = new uint8[ m_vertex_count * m_vsize ];
     203
     204        m_model_data = vchannel->raw_data();
    204205}
    205206
     
    210211        if ( m_has_tangent )
    211212        {
    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 );
    213214                const vertex_pnt* prev = data + m_vertex_count * m_last_frame;
    214215                const vertex_pnt* next = data + m_vertex_count * m_next_frame;
     
    223224        else
    224225        {
    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 );
    226227                const vertex_pn* prev = data + m_vertex_count * m_last_frame;
    227228                const vertex_pn* next = data + m_vertex_count * m_next_frame;
  • trunk/src/gfx/mesh_creator.cc

    r428 r430  
    385385
    386386
    387 bool nv::mesh_data_creator::is_same_format( mesh_data* other )
     387bool nv::mesh_data_creator::is_same_format( data_channel_set* other )
    388388{
    389389        if ( m_data->size() != other->size() ) return false;
     
    396396}
    397397
    398 void nv::mesh_data_creator::merge( mesh_data* other )
     398void nv::mesh_data_creator::merge( data_channel_set* other )
    399399{
    400400        if ( !is_same_format( other ) ) return;
  • trunk/src/gfx/skeletal_mesh.cc

    r428 r430  
    1111#include "nv/stl/unordered_map.hh"
    1212
    13 nv::skeletal_mesh_cpu::skeletal_mesh_cpu( context* a_context, const mesh_data* a_mesh_data, const mesh_nodes_data* bones )
     13nv::skeletal_mesh_cpu::skeletal_mesh_cpu( context* a_context, const data_channel_set* a_mesh_data, const mesh_nodes_data* bones )
    1414        : skeletal_mesh( a_context )
    1515{
     
    234234}
    235235
    236 nv::skeletal_mesh_gpu::skeletal_mesh_gpu( context* a_context, const mesh_data* a_mesh, const mesh_nodes_data* a_bone_data )
     236nv::skeletal_mesh_gpu::skeletal_mesh_gpu( context* a_context, const data_channel_set* a_mesh, const mesh_nodes_data* a_bone_data )
    237237        : skeletal_mesh( a_context ), m_bone_data( a_bone_data ), m_transform( nullptr )
    238238{
Note: See TracChangeset for help on using the changeset viewer.