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