1 | /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ |
---|
2 | /* |
---|
3 | * ---------------------------------------------------------------------- |
---|
4 | * PlaneRenderer.h : PlaneRenderer class for 2D visualization |
---|
5 | * |
---|
6 | * ====================================================================== |
---|
7 | * AUTHOR: Wei Qiao <qiaow@purdue.edu> |
---|
8 | * Purdue Rendering and Perceptualization Lab (PURPL) |
---|
9 | * |
---|
10 | * Copyright (c) 2004-2006 Purdue Research Foundation |
---|
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 PLANE_RENDERER_H |
---|
17 | #define PLANE_RENDERER_H |
---|
18 | |
---|
19 | #include <math.h> |
---|
20 | #include <stdio.h> |
---|
21 | #include <assert.h> |
---|
22 | #include <float.h> |
---|
23 | |
---|
24 | #include <vector> |
---|
25 | |
---|
26 | #include <GL/glew.h> |
---|
27 | #include <Cg/cgGL.h> |
---|
28 | |
---|
29 | #include "NvColorTableShader.h" |
---|
30 | #include "TransferFunction.h" |
---|
31 | #include "Texture2D.h" |
---|
32 | |
---|
33 | class PlaneRenderer |
---|
34 | { |
---|
35 | public: |
---|
36 | PlaneRenderer(int width, int height); |
---|
37 | |
---|
38 | ~PlaneRenderer(); |
---|
39 | |
---|
40 | /// Add a plane and its transfer function. |
---|
41 | int addPlane(Texture2D *p, TransferFunction *tf); |
---|
42 | |
---|
43 | void removePlane(int index); |
---|
44 | |
---|
45 | /// Set the active plane to be rendered |
---|
46 | void setActivePlane(int index); |
---|
47 | |
---|
48 | /// Change the rendering size |
---|
49 | void setScreenSize(int w, int h); |
---|
50 | |
---|
51 | void render(); |
---|
52 | |
---|
53 | private: |
---|
54 | std::vector<Texture2D *> _plane; ///< Array of images |
---|
55 | std::vector<TransferFunction *> _tf; ///< Array of corresponding transfer functions |
---|
56 | int _activePlane; ///< The active plane, only one is rendered |
---|
57 | int _numPlanes; |
---|
58 | |
---|
59 | int _renderWidth; |
---|
60 | int _renderHeight; |
---|
61 | |
---|
62 | NvColorTableShader *_shader; |
---|
63 | }; |
---|
64 | |
---|
65 | #endif |
---|