source: nanovis/branches/1.2/VelocityArrowsSlice.h @ 5314

Last change on this file since 5314 was 4904, checked in by ldelgass, 9 years ago

Merge serveral changes from trunk. Does not include threading, world space
changes, etc.

  • 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 "Texture2D.h"
15#include "Shader.h"
16
17namespace nv {
18
19class VelocityArrowsSlice
20{
21public:
22    enum RenderMode {
23        LINES,
24        GLYPHS,
25    };
26
27    VelocityArrowsSlice();
28
29    ~VelocityArrowsSlice();
30
31    void setVectorField(unsigned int vfGraphicsID, const vrmath::Vector3f& origin,
32                        float xScale, float yScale, float zScale, float max);
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 _scale;
99
100    float _slicePos;
101    FlowSliceAxis _axis;
102
103    unsigned int _fbo;
104    unsigned int _tex;
105    float _maxPointSize;
106
107    Shader _queryVelocityFP;
108    Shader _particleShader;
109
110    int _renderTargetWidth;
111    int _renderTargetHeight;
112    vrmath::Vector3f *_velocities;
113    std::vector<vrmath::Vector3f> _samplingPositions;
114    vrmath::Vector3f _projectionVector;
115
116    int _tickCountForMinSizeAxis;
117    int _tickCountX;
118    int _tickCountY;
119    int _tickCountZ;
120
121    int _pointCount;
122
123    vrmath::Vector3f _maxVelocityScale;
124    vrmath::Vector3f _arrowColor;
125
126    bool _visible;
127    bool _dirty;
128    bool _dirtySamplingPosition;
129    bool _dirtyRenderTarget;
130
131    unsigned int _vertexBufferGraphicsID;
132
133    Texture2D *_arrowsTex;
134
135    RenderMode _renderMode;
136};
137
138}
139
140#endif
Note: See TracBrowser for help on using the repository browser.