1 | |
---|
2 | #ifndef _NVFLOWVISRENDERER_H |
---|
3 | #define _NVFLOWVISRENDERER_H |
---|
4 | #pragma once |
---|
5 | |
---|
6 | #include "GL/glew.h" |
---|
7 | #include "Cg/cgGL.h" |
---|
8 | |
---|
9 | #include "define.h" |
---|
10 | #include "config.h" |
---|
11 | #include "global.h" |
---|
12 | |
---|
13 | #include "Renderable.h" |
---|
14 | #include "RenderVertexArray.h" |
---|
15 | #include "Vector3.h" |
---|
16 | |
---|
17 | #include <vector> |
---|
18 | #include <map> |
---|
19 | #include <string> |
---|
20 | |
---|
21 | #include "NvParticleAdvectionShader.h" |
---|
22 | #include "NvVectorField.h" |
---|
23 | |
---|
24 | class NvParticleRenderer; |
---|
25 | |
---|
26 | class NvFlowVisRenderer { |
---|
27 | enum { |
---|
28 | MAX_PARTICLE_RENDERER = 4, |
---|
29 | }; |
---|
30 | |
---|
31 | int _psys_width; |
---|
32 | int _psys_height; |
---|
33 | CGcontext context; |
---|
34 | |
---|
35 | std::map<std::string, NvVectorField*> _vectorFieldMap; |
---|
36 | |
---|
37 | bool _activated; |
---|
38 | |
---|
39 | //NvLIC* licRenderer[3]; |
---|
40 | public: |
---|
41 | NvFlowVisRenderer(int w, int h, CGcontext context); |
---|
42 | ~NvFlowVisRenderer(); |
---|
43 | |
---|
44 | void initialize(); |
---|
45 | void initialize(const std::string& vfName); |
---|
46 | void advect(); |
---|
47 | void reset(); |
---|
48 | void render(); |
---|
49 | |
---|
50 | void addVectorField(Volume* volPtr, const Vector3& ori, float scaleX, |
---|
51 | float scaleY, float scaleZ, float max); |
---|
52 | |
---|
53 | void addVectorField(const std::string& vfName, Volume* volPtr, const Vector3& ori, float scaleX, float scaleY, float scaleZ, float max); |
---|
54 | void removeVectorField(const std::string& vfName); |
---|
55 | |
---|
56 | void addPlane(const std::string& vfName, const std::string& name); |
---|
57 | void removePlane(const std::string& vfName, const std::string& name); |
---|
58 | |
---|
59 | /** |
---|
60 | * @brief Specify the axis of the index plane |
---|
61 | * @param index the index of the array of injection planes |
---|
62 | */ |
---|
63 | void setPlaneAxis(const std::string& vfName, const std::string& name, int axis); |
---|
64 | |
---|
65 | /** |
---|
66 | * @param pos : Specify the position of slice |
---|
67 | */ |
---|
68 | void setPlanePos(const std::string& vfName, const std::string& name, float pos); |
---|
69 | void setParticleColor(const std::string& vfName, const std::string& name, const Vector4& color); |
---|
70 | void activatePlane(const std::string& vfName, const std::string& name); |
---|
71 | void deactivatePlane(const std::string& vfName, const std::string& name); |
---|
72 | |
---|
73 | void activateVectorField(const std::string& vfName); |
---|
74 | void deactivateVectorField(const std::string& vfName); |
---|
75 | |
---|
76 | //////////////////// |
---|
77 | // DEVICE SHAPE |
---|
78 | void addDeviceShape(const std::string& vfName, const std::string& name, const NvDeviceShape& shape); |
---|
79 | void removeDeviceShape(const std::string& vfName, const std::string& name); |
---|
80 | void activateDeviceShape(const std::string& vfName); |
---|
81 | void deactivateDeviceShape(const std::string& vfName); |
---|
82 | void activateDeviceShape(const std::string& vfName, const std::string& name); |
---|
83 | void deactivateDeviceShape(const std::string& vfName, const std::string& name); |
---|
84 | bool active(void) { |
---|
85 | return _activated; |
---|
86 | } |
---|
87 | void active(bool state) { |
---|
88 | _activated = state; |
---|
89 | } |
---|
90 | }; |
---|
91 | |
---|
92 | |
---|
93 | #endif /* _NVFLOWVISRENDERER_H */ |
---|