[2798] | 1 | /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ |
---|
[953] | 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 | * |
---|
[3502] | 10 | * Copyright (c) 2004-2013 HUBzero Foundation, LLC |
---|
[953] | 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 | */ |
---|
[2834] | 16 | #ifndef PLANE_RENDERER_H |
---|
| 17 | #define PLANE_RENDERER_H |
---|
[953] | 18 | |
---|
| 19 | #include <vector> |
---|
| 20 | |
---|
[2863] | 21 | #include "NvColorTableShader.h" |
---|
[953] | 22 | #include "TransferFunction.h" |
---|
| 23 | #include "Texture2D.h" |
---|
| 24 | |
---|
[2800] | 25 | class PlaneRenderer |
---|
| 26 | { |
---|
[953] | 27 | public: |
---|
[2863] | 28 | PlaneRenderer(int width, int height); |
---|
[2834] | 29 | |
---|
[953] | 30 | ~PlaneRenderer(); |
---|
| 31 | |
---|
[2930] | 32 | /// Add a plane and its transfer function. |
---|
| 33 | int addPlane(Texture2D *p, TransferFunction *tf); |
---|
[2834] | 34 | |
---|
[2930] | 35 | void removePlane(int index); |
---|
[2834] | 36 | |
---|
[2930] | 37 | /// Set the active plane to be rendered |
---|
| 38 | void setActivePlane(int index); |
---|
[2834] | 39 | |
---|
[2930] | 40 | /// Change the rendering size |
---|
| 41 | void setScreenSize(int w, int h); |
---|
[2834] | 42 | |
---|
[953] | 43 | void render(); |
---|
[2834] | 44 | |
---|
| 45 | private: |
---|
[2930] | 46 | std::vector<Texture2D *> _plane; ///< Array of images |
---|
| 47 | std::vector<TransferFunction *> _tf; ///< Array of corresponding transfer functions |
---|
| 48 | int _activePlane; ///< The active plane, only one is rendered |
---|
| 49 | int _numPlanes; |
---|
[2834] | 50 | |
---|
[2930] | 51 | int _renderWidth; |
---|
| 52 | int _renderHeight; |
---|
[2834] | 53 | |
---|
[2863] | 54 | NvColorTableShader *_shader; |
---|
[953] | 55 | }; |
---|
| 56 | |
---|
| 57 | #endif |
---|