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

Last change on this file since 3492 was 3492, checked in by ldelgass, 11 years ago

Fix camera reset for nanovis. Includes refactoring of vector/matrix classes
in nanovis to consolidate into vrmath library. Also add preliminary canonical
view control to clients for testing.

  • Property svn:eol-style set to native
File size: 2.1 KB
Line 
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 <vrmath/Vector3f.h>
9#include <vrmath/Vector4f.h>
10
11#include "Volume.h"
12#include "NvParticleRenderer.h"
13
14class NvDeviceShape
15{
16public:
17    NvDeviceShape() :
18        visible(true)
19    {
20    }
21
22    vrmath::Vector3f min;
23    vrmath::Vector3f max;
24    vrmath::Vector4f color;
25    bool visible;
26};
27
28class NvVectorField
29{
30public :
31    NvVectorField();
32
33    ~NvVectorField();
34
35    void setVectorField(Volume *vol, const vrmath::Vector3f& origin,
36                        float scaleX, float scaleY, float scaleZ, float max);
37
38    bool active()
39    {
40        return _activated;
41    }
42
43    void active(bool state)
44    {
45        _activated = state;
46    }
47
48    void activateDeviceShape()
49    {
50        _deviceVisible = true;
51    }
52
53    void deactivateDeviceShape()
54    {
55        _deviceVisible = false;
56    }
57
58    void addDeviceShape(const std::string& name, const NvDeviceShape& shape);
59
60    void removeDeviceShape(const std::string& name);
61
62    void activateDeviceShape(const std::string& name);
63
64    void deactivateDeviceShape(const std::string& name);
65
66    void initialize();
67
68    void reset();
69   
70    void addPlane(const std::string& name);
71
72    void removePlane(const std::string& name);
73   
74    void advect();
75
76    void render();
77   
78    void drawDeviceShape();
79
80    void activatePlane(const std::string& name);
81
82    void deactivatePlane(const std::string& name);
83
84    void setPlaneAxis(const std::string& name, int axis);
85
86    void setPlanePos(const std::string& name, float pos);
87
88    void setParticleColor(const std::string& name, float r, float g, float b, float a);
89
90    void setParticleColor(const std::string& name, const vrmath::Vector4f& color);
91
92private:
93    GLuint _vectorFieldId;
94    Volume *_volPtr;
95    std::map<std::string, NvParticleRenderer *> _particleRendererMap;
96    std::map<std::string, NvDeviceShape> _shapeMap;
97
98    /**
99     * @brief Specify the visibility
100     */
101    bool _activated;
102
103    vrmath::Vector3f _origin;
104    float _scaleX;
105    float _scaleY;
106    float _scaleZ;
107    float _max;
108
109    bool _deviceVisible;
110};
111
112#endif
Note: See TracBrowser for help on using the repository browser.