source: nanovis/trunk/LIC.h @ 4795

Last change on this file since 4795 was 3630, checked in by ldelgass, 11 years ago

Nanovis refactoring to fix problems with scaling and multiple results.
Do rendering in world space to properly place and scale multiple data sets.
Also fix flows to reduce resets of animations. More work toward removing
Cg dependency. Fix panning to convert viewport coords to world coords.

  • Property svn:eol-style set to native
File size: 2.4 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(Volume *volume);
51
52    void reset();
53
54    void visible(bool state)
55    {
56        _visible = state;
57    }
58
59    bool visible() const
60    {
61        return _visible;
62    }
63
64private:
65    void getVelocity(float x, float y, float *px, float *py);
66
67    void getSlice();
68
69    void makePatterns();
70
71    void makeMagnitudes();
72
73    /**
74     * @brief the normal vector of the LIC plane,
75     * the inherited Vector3 location is its center
76     */
77    vrmath::Vector3f _normal;
78
79    int _width, _height;
80    int _size;                  /**< The lic is a square of size, it can
81                                   be stretched */
82    float *_sliceVector;        /**< Storage for the per slice vectors
83                                   driving the flow */
84    vrmath::Vector3f _scale;             /**< Scaling factor stretching the lic
85                                   plane to fit the actual dimensions */
86    vrmath::Vector3f _origin;
87    float _offset;              ///< [0,1] offset of slice plane
88    FlowSliceAxis _axis;        ///< Axis normal to slice plane
89
90    //some convolve variables. They can pretty much stay fixed
91    int _iframe;
92    int _Npat;
93    int _alpha;
94    float _sa;
95    float _tmax;
96    float _dmax;
97    float _max;
98
99    GLuint _disListID;
100
101    Shader *_renderVelShader;
102
103    GLuint _colorTex, _patternTex, _magTex;
104    GLuint _fbo, _velFbo, _sliceVectorTex;  // For projecting 3d vector to 2d
105                                            // vector on a plane.
106    GLuint _vectorFieldId;
107
108    Volume *_vectorField;
109    /**
110     * flag for rendering
111     */
112    bool _visible;                      // Indicates if LIC plane is displayed.
113};
114
115}
116
117#endif
Note: See TracBrowser for help on using the repository browser.