Ignore:
Timestamp:
01/02/14 16:50:01 (11 years ago)
Author:
epyon
Message:
  • keyframed_mesh can be animated either cpu or gpu side
File:
1 edited

Legend:

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

    r204 r223  
    1818        public:
    1919                keyframed_mesh( context* a_context, keyframed_mesh_data* a_data, program* a_program );
     20                size_t get_max_frames() const;
    2021                mat4 get_tag( const std::string& tag ) const;
    21                 size_t get_max_frames() const;
    22                 void set_frame( uint32 frame );
    23                 void setup_animation( uint32 start, uint32 count, uint32 fps, bool loop );
    24                 void update( uint32 ms );
    25                 void draw( render_state& rstate );
     22                virtual void setup_animation( uint32 start, uint32 count, uint32 fps, bool loop );
     23                virtual void set_frame( uint32 frame );
     24                virtual void update( uint32 ms );
     25                virtual void draw( render_state& rstate );
    2626                program* get_program() { return m_program; }
    27                 ~keyframed_mesh();
    28         private:
     27                virtual ~keyframed_mesh();
     28        protected:
    2929                context*             m_context;
    3030                keyframed_mesh_data* m_data;
     
    3232                vertex_array*        m_va;
    3333
     34                uint32 m_start_frame;
     35                uint32 m_stop_frame;
     36                uint32 m_last_frame;
     37                uint32 m_next_frame;
     38                uint32 m_time;
     39                uint32 m_fps;
     40                f32    m_interpolation;
     41                bool   m_looping;
     42                bool   m_active;
     43        };
     44
     45
     46        class keyframed_mesh_gpu : public keyframed_mesh
     47        {
     48        public:
     49                keyframed_mesh_gpu( context* a_context, keyframed_mesh_data* a_data, program* a_program );
     50                void draw( render_state& rstate );
     51        private:
    3452                int m_loc_next_position;
    3553                int m_loc_next_normal;
    3654
    37                 uint32 m_last_frame;
    38                 uint32 m_next_frame;
    3955                uint32 m_gpu_last_frame;
    4056                uint32 m_gpu_next_frame;
    41                 f32    m_interpolation;
    42                 uint32 m_start_frame;
    43                 uint32 m_stop_frame;
    44                 uint32 m_time;
    45                 uint32 m_fps;
    46                 bool   m_looping;
    47                 bool   m_active;
     57        };
     58
     59        class keyframed_mesh_cpu : public keyframed_mesh
     60        {
     61        public:
     62                keyframed_mesh_cpu( context* a_context, keyframed_mesh_data* a_data, program* a_program );
     63                void update( uint32 ms );
     64        private:
     65                std::vector<vec3> m_position;
     66                std::vector<vec3> m_normal;
     67                vertex_buffer* m_vb_position;
     68                vertex_buffer* m_vb_normal;
    4869        };
    4970
Note: See TracChangeset for help on using the changeset viewer.