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

Last change on this file since 2921 was 2870, checked in by ldelgass, 12 years ago

remove global.h header. Move global Cg context handle into NvShader? as a
static member. Move LoadCgSourceProgram? to NvShader?.cpp, but make shader
classes use the methods NvShader::loadVertex/FragmentProgram instead.
There are still some users of LoadCgSourceProgram? left that need the context
handle.

  • Property svn:eol-style set to native
File size: 2.5 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 <Cg/cg.h>
8#include <Cg/cgGL.h>
9
10#include "Texture2D.h"
11#include "Vector3.h"
12
13class VelocityArrowsSlice
14{
15public:
16    enum RenderMode {
17        LINES,
18        GLYPHS,
19    };
20
21    VelocityArrowsSlice();
22
23    ~VelocityArrowsSlice();
24
25    void vectorField(unsigned int vfGraphicsID, float xScale, float yScale, float zScale);
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 Vector3& 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    unsigned int _vectorFieldGraphicsID;
87    float _vfXscale;
88    float _vfYscale;
89    float _vfZscale;
90    float _slicePos;
91    int _axis;
92
93    unsigned int _fbo;
94    unsigned int _tex;
95    float _maxPointSize;
96
97    CGcontext _context;
98    CGprogram _queryVelocityFP;
99    CGparameter _qvVectorFieldParam;
100
101    int _renderTargetWidth;
102    int _renderTargetHeight;
103    Vector3 *_velocities;
104    std::vector<Vector3> _samplingPositions;
105    Vector3 _projectionVector;
106
107    int _tickCountForMinSizeAxis;
108    int _tickCountX;
109    int _tickCountY;
110    int _tickCountZ;
111
112    int _pointCount;
113
114    Vector3 _maxVelocityScale;
115    Vector3 _arrowColor;
116
117    bool _enabled;
118    bool _dirty;
119    bool _dirtySamplingPosition;
120    bool _dirtyRenderTarget;
121
122    unsigned int _vertexBufferGraphicsID;
123
124    CGprogram _particleVP;
125    CGparameter _mvpParticleParam;
126    CGparameter _mvParticleParam;
127    CGparameter _mvTanHalfFOVParam;
128    CGparameter _mvCurrentTimeParam;
129
130    CGprogram _particleFP;
131    CGparameter _vectorParticleParam;
132
133    Texture2D *_arrowsTex;
134
135    RenderMode _renderMode;
136
137    void createRenderTarget();
138
139    void computeSamplingTicks();
140};
141
142#endif
Note: See TracBrowser for help on using the repository browser.