source: trunk/packages/vizservers/nanovis/NvLIC.h @ 2951

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

Remove unused FlowVisRenderer? from build. Remove some unused globals from
nanovis.h, make Tcl command buffer a local. LIC renderer only needs a single
plane offset, not a vector, so change ctor.

  • Property svn:eol-style set to native
File size: 3.1 KB
Line 
1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/*
3 * ----------------------------------------------------------------------
4 * NvLIC.h: line integral convolution class
5 *
6 * ======================================================================
7 *  AUTHOR:  Wei Qiao <qiaow@purdue.edu>
8 *           Purdue Rendering and Perceptualization Lab (PURPL)
9 *
10 *  Copyright (c) 2004-2006  Purdue Research Foundation
11 *
12 *  See the file "license.terms" for information on usage and
13 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
14 * ======================================================================
15 */
16#ifndef NV_LIC_H
17#define NV_LIC_H
18
19#include <GL/glew.h>
20#include <Cg/cg.h>
21
22#include "config.h"
23#include "nanovis.h"
24
25#include "Renderable.h"
26#include "Vector3.h"
27#include "Volume.h"
28#include "NvShader.h"
29
30class NvLIC : public Renderable
31{
32public:
33    NvLIC(int size, int width, int height, int axis,
34          float offset);
35    ~NvLIC();
36
37    /// project 3D vectors to a 2D slice for line integral convolution
38    void convolve();
39
40    /// Display the convolution result
41    void render();
42
43    void makePatterns();
44
45    void makeMagnitudes();
46
47    void getVelocity(float x, float y, float *px, float *py);
48
49    void getSlice();
50
51    void setOffset(float v);
52
53    /**
54     * @brief Specify the perpendicular axis
55     *
56     * 0 : x axis<br>
57     * 1 : y axis<br>
58     * 2 : z axis<br>
59     */
60    void setAxis(int axis);
61
62    void setVectorField(unsigned int texID, const Vector3& origin,
63                        float scaleX, float scaleY, float scaleZ, float max);
64
65    void reset();
66
67    void visible(bool state)
68    {
69        _isHidden = !state;
70    }
71
72    bool visible() const
73    {
74        return (!_isHidden);
75    }
76
77    void active(bool state)
78    {
79        _activate = state;
80    }
81
82    bool active() const
83    {
84        return _activate;
85    }
86
87private:
88    /**
89     * @brief the normal vector of the NvLIC plane,
90     * the inherited Vector3 location is its center
91     */
92    Vector3 _normal;
93
94    int _width, _height;
95    int _size;                          // The lic is a square of size, it can
96                                        // be stretched
97    float *_sliceVector;                // Storage for the per slice vectors
98                                        // driving the follow.
99    Vector3 _scale;                     // Scaling factor stretching the lic
100                                        // plane to fit the actual dimensions
101    Vector3 _origin;
102    float _offset;                      // [0,1] offset of _axis plane
103    int _axis;
104
105    //some convolve variables. They can pretty much stay fixed
106    int _iframe;
107    int _Npat;
108    int _alpha;
109    float _sa;
110    float _tmax;
111    float _dmax;
112    float _max;
113
114    GLuint _disListID;
115
116    NvShader *_renderVelShader;
117    //CG shader parameters
118    CGparameter _velTexParam;
119    CGparameter _velTexParamRenderVel;
120    CGparameter _planeNormalParamRenderVel;
121    CGparameter _maxParam;
122 
123    GLuint _colorTex, _patternTex, _magTex;
124    GLuint _fbo, _velFbo, _sliceVectorTex;  // For projecting 3d vector to 2d
125                                            // vector on a plane.
126    GLuint _vectorFieldId;
127
128    Volume *_vectorField;
129    /**
130     * flag for rendering
131     */
132    bool _activate;
133    bool _isHidden;                     // Indicates if LIC plane is displayed.
134};
135
136#endif
Note: See TracBrowser for help on using the repository browser.