[395] | 1 | // Copyright (C) 2012-2015 ChaosForge Ltd
|
---|
[158] | 2 | // http://chaosforge.org/
|
---|
| 3 | //
|
---|
[395] | 4 | // This file is part of Nova libraries.
|
---|
| 5 | // For conditions of distribution and use, see copying.txt file in root folder.
|
---|
[158] | 6 |
|
---|
[395] | 7 | #ifndef NV_GFX_KEYFRAMED_MESH_HH
|
---|
| 8 | #define NV_GFX_KEYFRAMED_MESH_HH
|
---|
[158] | 9 |
|
---|
[395] | 10 | #include <nv/common.hh>
|
---|
[224] | 11 | #include <nv/interface/context.hh>
|
---|
[230] | 12 | #include <nv/interface/animated_mesh.hh>
|
---|
[158] | 13 |
|
---|
| 14 | namespace nv
|
---|
| 15 | {
|
---|
| 16 |
|
---|
[480] | 17 | #if 0
|
---|
| 18 |
|
---|
[230] | 19 | class keyframed_mesh : public animated_mesh
|
---|
| 20 | {
|
---|
| 21 | public:
|
---|
[430] | 22 | keyframed_mesh( context* a_context, const data_channel_set* a_data, const mesh_nodes_data* a_tag_map );
|
---|
[302] | 23 | virtual vertex_array get_vertex_array() const { return m_va; }
|
---|
[239] | 24 | virtual size_t get_index_count() const { return m_index_count; }
|
---|
[230] | 25 | virtual void run_animation( animation_entry* a_anim );
|
---|
[223] | 26 | size_t get_max_frames() const;
|
---|
[287] | 27 | virtual transform get_node_transform( uint32 node_id ) const;
|
---|
| 28 | virtual mat4 get_node_matrix( uint32 node_id ) const;
|
---|
[470] | 29 | virtual void update_animation( animation_entry*, uint32 a_ms_anim_time );
|
---|
[303] | 30 | virtual void update( program a_program );
|
---|
[223] | 31 | virtual ~keyframed_mesh();
|
---|
| 32 | protected:
|
---|
[288] | 33 | virtual void set_frame( uint32 frame );
|
---|
| 34 |
|
---|
[239] | 35 | struct vertex_pn
|
---|
| 36 | {
|
---|
| 37 | vec3 position;
|
---|
| 38 | vec3 normal;
|
---|
| 39 | };
|
---|
[294] | 40 | struct vertex_pnt
|
---|
| 41 | {
|
---|
| 42 | vec3 position;
|
---|
| 43 | vec3 normal;
|
---|
| 44 | vec4 tangent;
|
---|
| 45 | };
|
---|
[280] | 46 | struct vertex_t
|
---|
| 47 | {
|
---|
| 48 | vec2 texcoord;
|
---|
| 49 | };
|
---|
[158] | 50 |
|
---|
[323] | 51 | context* m_context;
|
---|
| 52 |
|
---|
[294] | 53 | const mesh_nodes_data* m_tag_map;
|
---|
[239] | 54 |
|
---|
[419] | 55 | data_descriptor m_interpolation_key;
|
---|
[302] | 56 | buffer m_pbuffer;
|
---|
| 57 | vertex_array m_va;
|
---|
| 58 |
|
---|
[158] | 59 | uint32 m_last_frame;
|
---|
| 60 | uint32 m_next_frame;
|
---|
[294] | 61 | uint32 m_vsize;
|
---|
[223] | 62 | f32 m_interpolation;
|
---|
[294] | 63 | bool m_has_tangent;
|
---|
[158] | 64 | bool m_active;
|
---|
[239] | 65 |
|
---|
| 66 | uint32 m_index_count;
|
---|
| 67 | uint32 m_frame_count;
|
---|
| 68 | uint32 m_vertex_count;
|
---|
[158] | 69 | };
|
---|
| 70 |
|
---|
[223] | 71 |
|
---|
| 72 | class keyframed_mesh_gpu : public keyframed_mesh
|
---|
| 73 | {
|
---|
| 74 | public:
|
---|
[430] | 75 | keyframed_mesh_gpu( context* a_context, const data_channel_set* a_data, const mesh_nodes_data* a_tag_map );
|
---|
[314] | 76 | void update_animation( animation_entry* anim, uint32 a_anim_time );
|
---|
[303] | 77 | virtual void update( program a_program );
|
---|
[223] | 78 | private:
|
---|
| 79 | int m_loc_next_position;
|
---|
| 80 | int m_loc_next_normal;
|
---|
[294] | 81 | int m_loc_next_tangent;
|
---|
[223] | 82 |
|
---|
| 83 | uint32 m_gpu_last_frame;
|
---|
| 84 | uint32 m_gpu_next_frame;
|
---|
| 85 | };
|
---|
| 86 |
|
---|
| 87 | class keyframed_mesh_cpu : public keyframed_mesh
|
---|
| 88 | {
|
---|
| 89 | public:
|
---|
[430] | 90 | keyframed_mesh_cpu( context* a_context, const data_channel_set* a_data, const mesh_nodes_data* a_tag_map );
|
---|
[314] | 91 | void update_animation( animation_entry* anim, uint32 a_anim_time );
|
---|
[294] | 92 | ~keyframed_mesh_cpu();
|
---|
[223] | 93 | private:
|
---|
[430] | 94 | const uint8* m_model_data;
|
---|
[302] | 95 | uint8* m_data;
|
---|
[223] | 96 | };
|
---|
| 97 |
|
---|
[480] | 98 | #endif
|
---|
| 99 |
|
---|
[158] | 100 | } // namespace nv
|
---|
| 101 |
|
---|
[395] | 102 | #endif // NV_GFX_KEYFRAMED_MESH_HH
|
---|