source: nanovis/trunk/VelocityArrowsSlice.h @ 6666

Last change on this file since 6666 was 3630, checked in by ldelgass, 12 years ago

Nanovis refactoring to fix problems with scaling and multiple results.
Do rendering in world space to properly place and scale multiple data sets.
Also fix flows to reduce resets of animations. More work toward removing
Cg dependency. Fix panning to convert viewport coords to world coords.

  • Property svn:eol-style set to native
File size: 2.4 KB
Line 
1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/*
3 * Copyright (C) 2004-2013  HUBzero Foundation, LLC
4 *
5 */
6#ifndef NV_VELOCITY_ARROW_SLICE_H
7#define NV_VELOCITY_ARROW_SLICE_H
8
9#include <vector>
10
11#include <vrmath/Vector3f.h>
12
13#include "FlowTypes.h"
14#include "Volume.h"
15#include "Texture2D.h"
16#include "Shader.h"
17
18namespace nv {
19
20class VelocityArrowsSlice
21{
22public:
23    enum RenderMode {
24        LINES,
25        GLYPHS,
26    };
27
28    VelocityArrowsSlice();
29
30    ~VelocityArrowsSlice();
31
32    void setVectorField(Volume *volume);
33
34    void setSliceAxis(FlowSliceAxis axis);
35
36    int getSliceAxis() const
37    {
38        return _axis;
39    }
40
41    void setSlicePosition(float pos)
42    {
43        _slicePos = pos;
44        _dirty = true;
45    }
46
47    float getSlicePosition() const
48    {
49        return _slicePos;
50    }
51
52    void render();
53
54    void visible(bool visible)
55    {
56        _visible = visible;
57    }
58
59    bool visible() const
60    {
61        return _visible;
62    }
63
64    void tickCountForMinSizeAxis(int tickCount)
65    {
66        _tickCountForMinSizeAxis = tickCount;
67    }
68
69    int tickCountForMinSizeAxis() const
70    {
71        return _tickCountForMinSizeAxis;
72    }
73
74    void arrowColor(const vrmath::Vector3f& color)
75    {
76        _arrowColor = color;
77    }
78
79    void renderMode(RenderMode mode)
80    {
81        _renderMode = mode;
82        _dirty = true;
83    }
84
85    RenderMode renderMode() const
86    {
87        return _renderMode;
88    }
89
90private:
91    void queryVelocity();
92
93    void createRenderTarget();
94
95    void computeSamplingTicks();
96
97    unsigned int _vectorFieldGraphicsID;
98    vrmath::Vector3f _origin;
99    vrmath::Vector3f _scale;
100
101    float _slicePos;
102    FlowSliceAxis _axis;
103
104    unsigned int _fbo;
105    unsigned int _tex;
106    float _maxPointSize;
107
108    Shader _queryVelocityFP;
109    Shader _particleShader;
110
111    int _renderTargetWidth;
112    int _renderTargetHeight;
113    vrmath::Vector3f *_velocities;
114    std::vector<vrmath::Vector3f> _samplingPositions;
115    vrmath::Vector3f _projectionVector;
116
117    int _tickCountForMinSizeAxis;
118    int _tickCountX;
119    int _tickCountY;
120    int _tickCountZ;
121
122    int _pointCount;
123
124    vrmath::Vector3f _maxVelocityScale;
125    vrmath::Vector3f _arrowColor;
126
127    bool _visible;
128    bool _dirty;
129    bool _dirtySamplingPosition;
130    bool _dirtyRenderTarget;
131
132    unsigned int _vertexBufferGraphicsID;
133
134    Texture2D *_arrowsTex;
135
136    RenderMode _renderMode;
137};
138
139}
140
141#endif
Note: See TracBrowser for help on using the repository browser.