source: trunk/packages/vizservers/nanovis/LIC.h @ 3611

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

Use nv namespace for classes in nanovis rather than prefixing class names with
Nv (still need to convert shader classes).

  • Property svn:eol-style set to native
File size: 3.0 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-2013  HUBzero Foundation, LLC
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
21#include <vrmath/Vector3f.h>
22
23#include "Volume.h"
24#include "NvShader.h"
25
26namespace nv {
27
28class LIC
29{
30public:
31    LIC(int size, int width, int height, int axis, float offset);
32    ~LIC();
33
34    /// project 3D vectors to a 2D slice for line integral convolution
35    void convolve();
36
37    /// Display the convolution result
38    void render();
39
40    void makePatterns();
41
42    void makeMagnitudes();
43
44    void getVelocity(float x, float y, float *px, float *py);
45
46    void getSlice();
47
48    void setOffset(float offset);
49
50    /**
51     * @brief Specify the perpendicular axis
52     *
53     * 0 : x axis<br>
54     * 1 : y axis<br>
55     * 2 : z axis<br>
56     */
57    void setAxis(int axis);
58
59    void setVectorField(unsigned int texID, const vrmath::Vector3f& origin,
60                        float scaleX, float scaleY, float scaleZ, float max);
61
62    void reset();
63
64    void visible(bool state)
65    {
66        _isHidden = !state;
67    }
68
69    bool visible() const
70    {
71        return (!_isHidden);
72    }
73
74    void active(bool state)
75    {
76        _activate = state;
77    }
78
79    bool active() const
80    {
81        return _activate;
82    }
83
84private:
85    /**
86     * @brief the normal vector of the NvLIC plane,
87     * the inherited Vector3 location is its center
88     */
89    vrmath::Vector3f _normal;
90
91    int _width, _height;
92    int _size;                  /**< The lic is a square of size, it can
93                                   be stretched */
94    float *_sliceVector;        /**< Storage for the per slice vectors
95                                   driving the flow */
96    vrmath::Vector3f _scale;             /**< Scaling factor stretching the lic
97                                   plane to fit the actual dimensions */
98    vrmath::Vector3f _origin;
99    float _offset;            ///< [0,1] offset of slice plane
100    int _axis;                ///< Axis normal to slice plane
101
102    //some convolve variables. They can pretty much stay fixed
103    int _iframe;
104    int _Npat;
105    int _alpha;
106    float _sa;
107    float _tmax;
108    float _dmax;
109    float _max;
110
111    GLuint _disListID;
112
113    NvShader *_renderVelShader;
114
115    GLuint _colorTex, _patternTex, _magTex;
116    GLuint _fbo, _velFbo, _sliceVectorTex;  // For projecting 3d vector to 2d
117                                            // vector on a plane.
118    GLuint _vectorFieldId;
119
120    Volume *_vectorField;
121    /**
122     * flag for rendering
123     */
124    bool _activate;
125    bool _isHidden;                     // Indicates if LIC plane is displayed.
126};
127
128}
129
130#endif
Note: See TracBrowser for help on using the repository browser.