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