source: trunk/packages/vizservers/nanovis/VelocityArrowsSlice.h @ 2974

Last change on this file since 2974 was 2964, checked in by ldelgass, 12 years ago

Convert arrow glyph shaders to new NvShader? API. Fix velocity arrow glpyh and
line implementation, add arrow head to line arrows. Alpha channel of arrow
texture atlas still needs cleanup -- should probably just create a utility to
generate the texture to allow changes in lighting, FOV, etc. Note that volumes
and flows are currently not scaled properly -- the aspect ratios of the number
of samples is used rather than the physical lengths of the volumes/flows. This will be fixed for volumes, flows and the grid in a future commit. Also, client doesn't currently enable arrows, this will also be enabled in another commit.

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