source: nanovis/branches/1.1/LIC.h @ 4920

Last change on this file since 4920 was 4904, checked in by ldelgass, 9 years ago

Merge serveral changes from trunk. Does not include threading, world space
changes, etc.

  • 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/*
3 *  Copyright (c) 2004-2013  HUBzero Foundation, LLC
4 *
5 *  Authors:
6 *    Wei Qiao <qiaow@purdue.edu>
7 */
8#ifndef NV_LIC_H
9#define NV_LIC_H
10
11#include <GL/glew.h>
12
13#include <vrmath/Vector3f.h>
14
15#include "FlowTypes.h"
16#include "Volume.h"
17#include "Shader.h"
18
19namespace nv {
20
21class LIC
22{
23public:
24    LIC(FlowSliceAxis axis = AXIS_Z, float offset = 0.f);
25    ~LIC();
26
27    /// project 3D vectors to a 2D slice for line integral convolution
28    void convolve();
29
30    /// Display the convolution result
31    void render();
32
33    void setSlicePosition(float pos);
34
35    float getSlicePosition() const
36    {
37        return _offset;
38    }
39
40    /**
41     * \brief Specify the perpendicular axis
42     */
43    void setSliceAxis(FlowSliceAxis axis);
44
45    FlowSliceAxis getSliceAxis() const
46    {
47        return _axis;
48    }
49
50    void setVectorField(unsigned int texID, const vrmath::Vector3f& origin,
51                        float scaleX, float scaleY, float scaleZ, float max);
52
53    void reset();
54
55    void visible(bool state)
56    {
57        _visible = state;
58    }
59
60    bool visible() const
61    {
62        return _visible;
63    }
64
65private:
66    void getVelocity(float x, float y, float *px, float *py);
67
68    void getSlice();
69
70    void makePatterns();
71
72    void makeMagnitudes();
73
74    /**
75     * \brief the normal vector of the LIC plane,
76     * the inherited Vector3 location is its center
77     */
78    vrmath::Vector3f _normal;
79
80    int _width, _height;
81    int _size;                  /**< The lic is a square of size, it can
82                                   be stretched */
83    float *_sliceVector;        /**< Storage for the per slice vectors
84                                   driving the flow */
85    vrmath::Vector3f _scale;    /**< Scaling factor stretching the lic
86                                   plane to fit the actual dimensions */
87    vrmath::Vector3f _origin;
88    float _offset;              ///< [0,1] offset of slice plane
89    FlowSliceAxis _axis;        ///< Axis normal to slice plane
90
91    //some convolve variables. They can pretty much stay fixed
92    int _iframe;
93    int _Npat;
94    int _alpha;
95    float _sa;
96    float _tmax;
97    float _dmax;
98    float _max;
99
100    GLuint _disListID;
101
102    Shader *_renderVelShader;
103
104    GLuint _colorTex, _patternTex, _magTex;
105    GLuint _fbo, _velFbo, _sliceVectorTex;  // For projecting 3d vector to 2d
106                                            // vector on a plane.
107    GLuint _vectorFieldId;
108
109    Volume *_vectorField;
110    /**
111     * flag for rendering
112     */
113    bool _visible;                      // Indicates if LIC plane is displayed.
114};
115
116}
117
118#endif
Note: See TracBrowser for help on using the repository browser.