source: trunk/packages/vizservers/nanovis/NvVectorField.h @ 1380

Last change on this file since 1380 was 1370, checked in by vrinside, 15 years ago

improving the flow vis engine

  • particle advection for multiple vector field
  • specifying multiple advection planes
  • specifying the position of a particle injection plane
  • specifying the axis of a particle injection plane
  • specifying the visibility of particle injection planes
  • specifying the particle color for each particle injection plane
  • rendering device shapes

[NOTE] Currently, I commented out with the MACRO NEW_FLOW_ENGINE in config
To use this, please comment NEW_FLOW_ENGINE in

File size: 2.1 KB
Line 
1#pragma once
2
3#include "Volume.h"
4#include "Vector3.h"
5#include "NvParticleRenderer.h"
6
7#include <string>
8#include <map>
9
10class NvDeviceShape {
11public :
12        Vector3 min;
13        Vector3 max;
14        Vector4 color;
15        bool visible;
16public :
17        NvDeviceShape()
18        : visible(true)
19        {
20        }
21};
22
23class 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;
44public :
45        NvVectorField();
46        ~NvVectorField();
47
48        void setVectorField(Volume* vol, const Vector3& ori, float scaleX, float scaleY, float scaleZ, float max);
49
50        void activate();
51        void deactivate();
52        bool isActivated() const;
53
54        /////////////////////////////
55        // DEVICE
56        void addDeviceShape(const std::string& name, const NvDeviceShape& shape);
57        void removeDeviceShape(const std::string& name);
58        void activateDeviceShape();
59        void deactivateDeviceShape();
60        void activateDeviceShape(const std::string& name);
61        void deactivateDeviceShape(const std::string& name);
62
63        void initialize();
64        void reset();
65
66        void addPlane(const std::string& name);
67        void removePlane(const std::string& name);
68
69        void advect();
70        void render();
71
72        void drawDeviceShape();
73        void activatePlane(const std::string& name);
74        void deactivatePlane(const std::string& name);
75        void setPlaneAxis(const std::string& name, int axis);
76        void setPlanePos(const std::string& name, float pos);
77        void setParticleColor(const std::string& name, float r, float g, float b, float a);
78        void setParticleColor(const std::string& name, const Vector4& color);
79};
80
81inline void NvVectorField::activate()
82{
83        _activated = true;
84}
85
86inline void NvVectorField::deactivate()
87{
88        _activated = false;
89}
90
91inline bool NvVectorField::isActivated() const
92{
93        return _activated;
94}
95
96inline void NvVectorField::activateDeviceShape()
97{
98        _deviceVisible = true;
99}
100
101inline void NvVectorField::deactivateDeviceShape()
102{
103        _deviceVisible = false;
104}
105
Note: See TracBrowser for help on using the repository browser.