1 | /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ |
---|
2 | #ifndef NV_VECTOR_FIELD_H |
---|
3 | #define NV_VECTOR_FIELD_H |
---|
4 | |
---|
5 | #include <string> |
---|
6 | #include <map> |
---|
7 | |
---|
8 | #include "Volume.h" |
---|
9 | #include "Vector3.h" |
---|
10 | #include "NvParticleRenderer.h" |
---|
11 | |
---|
12 | class NvDeviceShape |
---|
13 | { |
---|
14 | public: |
---|
15 | NvDeviceShape() : |
---|
16 | visible(true) |
---|
17 | { |
---|
18 | } |
---|
19 | |
---|
20 | Vector3 min; |
---|
21 | Vector3 max; |
---|
22 | Vector4 color; |
---|
23 | bool visible; |
---|
24 | }; |
---|
25 | |
---|
26 | class NvVectorField |
---|
27 | { |
---|
28 | public : |
---|
29 | NvVectorField(); |
---|
30 | |
---|
31 | ~NvVectorField(); |
---|
32 | |
---|
33 | void setVectorField(Volume *vol, const Vector3& origin, |
---|
34 | float scaleX, float scaleY, float scaleZ, float max); |
---|
35 | |
---|
36 | bool active() |
---|
37 | { |
---|
38 | return _activated; |
---|
39 | } |
---|
40 | |
---|
41 | void active(bool state) |
---|
42 | { |
---|
43 | _activated = state; |
---|
44 | } |
---|
45 | |
---|
46 | void activateDeviceShape() |
---|
47 | { |
---|
48 | _deviceVisible = true; |
---|
49 | } |
---|
50 | |
---|
51 | void deactivateDeviceShape() |
---|
52 | { |
---|
53 | _deviceVisible = false; |
---|
54 | } |
---|
55 | |
---|
56 | void addDeviceShape(const std::string& name, const NvDeviceShape& shape); |
---|
57 | |
---|
58 | void removeDeviceShape(const std::string& name); |
---|
59 | |
---|
60 | void activateDeviceShape(const std::string& name); |
---|
61 | |
---|
62 | void deactivateDeviceShape(const std::string& name); |
---|
63 | |
---|
64 | void initialize(); |
---|
65 | |
---|
66 | void reset(); |
---|
67 | |
---|
68 | void addPlane(const std::string& name); |
---|
69 | |
---|
70 | void removePlane(const std::string& name); |
---|
71 | |
---|
72 | void advect(); |
---|
73 | |
---|
74 | void render(); |
---|
75 | |
---|
76 | void drawDeviceShape(); |
---|
77 | |
---|
78 | void activatePlane(const std::string& name); |
---|
79 | |
---|
80 | void deactivatePlane(const std::string& name); |
---|
81 | |
---|
82 | void setPlaneAxis(const std::string& name, int axis); |
---|
83 | |
---|
84 | void setPlanePos(const std::string& name, float pos); |
---|
85 | |
---|
86 | void setParticleColor(const std::string& name, float r, float g, float b, float a); |
---|
87 | |
---|
88 | void setParticleColor(const std::string& name, const Vector4& color); |
---|
89 | |
---|
90 | private: |
---|
91 | GLuint _vectorFieldId; |
---|
92 | Volume *_volPtr; |
---|
93 | std::map<std::string, NvParticleRenderer *> _particleRendererMap; |
---|
94 | std::map<std::string, NvDeviceShape> _shapeMap; |
---|
95 | |
---|
96 | /** |
---|
97 | * @brief Specify the visibility |
---|
98 | */ |
---|
99 | bool _activated; |
---|
100 | |
---|
101 | Vector3 _origin; |
---|
102 | float _scaleX; |
---|
103 | float _scaleY; |
---|
104 | float _scaleZ; |
---|
105 | float _max; |
---|
106 | |
---|
107 | bool _deviceVisible; |
---|
108 | }; |
---|
109 | |
---|
110 | #endif |
---|