source: trunk/packages/vizservers/nanovis/VelocityArrowsSlice.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.3 KB
Line 
1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2#ifndef VELOCITY_ARROW_SLICE_H
3#define VELOCITY_ARROW_SLICE_H
4
5#include <vector>
6
7#include <vrmath/Vector3f.h>
8
9#include "Texture2D.h"
10#include "NvShader.h"
11
12class VelocityArrowsSlice
13{
14public:
15    enum RenderMode {
16        LINES,
17        GLYPHS,
18    };
19
20    VelocityArrowsSlice();
21
22    ~VelocityArrowsSlice();
23
24    void setVectorField(unsigned int vfGraphicsID, const vrmath::Vector3f& origin,
25                        float xScale, float yScale, float zScale, float max);
26
27    void axis(int axis);
28
29    int axis() const
30    {
31        return _axis;
32    }
33
34    void slicePos(float pos)
35    {
36        _slicePos = pos;
37        _dirty = true;
38    }
39
40    float slicePos() const
41    {
42        return _slicePos;
43    }
44
45    void queryVelocity();
46
47    void render();
48
49    void enabled(bool enabled)
50    {
51        _enabled = enabled;
52    }
53
54    bool enabled() const
55    {
56        return _enabled;
57    }
58
59    void tickCountForMinSizeAxis(int tickCount)
60    {
61        _tickCountForMinSizeAxis = tickCount;
62    }
63
64    int tickCountForMinSizeAxis() const
65    {
66        return _tickCountForMinSizeAxis;
67    }
68
69    void arrowColor(const vrmath::Vector3f& color)
70    {
71        _arrowColor = color;
72    }
73
74    void renderMode(RenderMode mode)
75    {
76        _renderMode = mode;
77        _dirty = true;
78    }
79
80    RenderMode renderMode() const
81    {
82        return _renderMode;
83    }
84
85private:
86    void createRenderTarget();
87
88    void computeSamplingTicks();
89
90    unsigned int _vectorFieldGraphicsID;
91    float _vfXscale;
92    float _vfYscale;
93    float _vfZscale;
94    float _slicePos;
95    int _axis;
96
97    unsigned int _fbo;
98    unsigned int _tex;
99    float _maxPointSize;
100
101    NvShader _queryVelocityFP;
102
103    NvShader _particleShader;
104
105    int _renderTargetWidth;
106    int _renderTargetHeight;
107    vrmath::Vector3f *_velocities;
108    std::vector<vrmath::Vector3f> _samplingPositions;
109    vrmath::Vector3f _projectionVector;
110
111    int _tickCountForMinSizeAxis;
112    int _tickCountX;
113    int _tickCountY;
114    int _tickCountZ;
115
116    int _pointCount;
117
118    vrmath::Vector3f _maxVelocityScale;
119    vrmath::Vector3f _arrowColor;
120
121    bool _enabled;
122    bool _dirty;
123    bool _dirtySamplingPosition;
124    bool _dirtyRenderTarget;
125
126    unsigned int _vertexBufferGraphicsID;
127
128    Texture2D *_arrowsTex;
129
130    RenderMode _renderMode;
131};
132
133#endif
Note: See TracBrowser for help on using the repository browser.