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