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

Last change on this file since 3492 was 3492, checked in by ldelgass, 6 years ago

Fix camera reset for nanovis. Includes refactoring of vector/matrix classes
in nanovis to consolidate into vrmath library. Also add preliminary canonical
view control to clients for testing.

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