source: trunk/gui/vizservers/nanovis/Lic.h @ 401

Last change on this file since 401 was 401, checked in by qiaow, 18 years ago

Added Renderable class, the superclass of every class that can be drawn.

File size: 2.4 KB
Line 
1/*
2 * ----------------------------------------------------------------------
3 * Lic.h: line integral convolution class
4 *
5 * ======================================================================
6 *  AUTHOR:  Wei Qiao <qiaow@purdue.edu>
7 *           Purdue Rendering and Perceptualization Lab (PURPL)
8 *
9 *  Copyright (c) 2004-2006  Purdue Research Foundation
10 *
11 *  See the file "license.terms" for information on usage and
12 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13 * ======================================================================
14 */
15
16
17#ifndef _LIC_H_
18#define _LIC_H_
19
20#include "GL/glew.h"
21#include "Cg/cgGL.h"
22
23#include "define.h"
24#include "config.h"
25#include "global.h"
26
27#include "Renderable.h"
28#include "Vector3.h"
29#include "Volume.h"
30
31#define NPN 256   //resolution of background pattern
32#define NMESH 256 //resolution of flow mesh
33#define DM ((float) (1.0/(NMESH-1.0))) //distance in world coords between mesh lines
34#define NPIX  512 //display size 
35#define SCALE 3.0 //scale for background pattern. small value -> fine texture
36
37class Lic : public Renderable {
38
39private:
40  int width, height;
41  int size;             //the lic is a square of size, it can be stretched
42  float* slice_vector; //storage for the per slice vectors driving the follow
43  Vector3 scale;        //scaling factor stretching the lic plane to fit the actual dimensions
44  float offset;         //[0,1] offset could be x, y, or z direction
45
46  //some convolve variables. They can pretty much stay fixed
47  int iframe;
48  int Npat;
49  int alpha;
50  float sa;
51  float tmax;
52  float dmax;
53
54  //CG shader parameters
55  CGcontext m_g_context;
56  CGparameter m_vel_tex_param;
57  CGparameter m_vel_tex_param_render_vel, m_plane_normal_param_render_vel;
58  CGprogram m_render_vel_fprog;
59
60  NVISid color_tex, pattern_tex, mag_tex;
61  NVISid fbo, vel_fbo, slice_vector_tex;  //for projecting 3d vector to 2d vector on a plane
62
63  Volume* vector_field;
64
65public:
66  Vector3 normal; //the normal vector of the Lic plane,
67                // the inherited Vector3 location is its center
68  Lic(int _size, int _width, int _height, float _offset,
69          CGcontext _context, NVISid _vector_field,
70          float scalex, float scaley, float scalez);
71  ~Lic();
72
73  void convolve();
74  void display();       //display the convolution result
75  void render();
76  void make_patterns();
77  void make_magnitudes();
78  void get_velocity(float x, float y, float* px, float* py);
79  void get_slice();
80  void set_offset(float v);
81
82};
83
84#endif
Note: See TracBrowser for help on using the repository browser.