source: trunk/vizservers/nanovis/HeightMap.h @ 1000

Last change on this file since 1000 was 1000, checked in by vrinside, 16 years ago
File size: 3.2 KB
RevLine 
[776]1#ifndef _HEIGHT_MAP_H_
2#define _HEIGHT_MAP_H_
3
4#include <Cg/cgGL.h>
5#include <Cg/cg.h>
6#include <R2/graphics/R2Geometry.h>
7#include "TransferFunction.h"
8#include "NvShader.h"
9#include "Vector3.h"
[838]10#include <RenderContext.h>
[929]11#include "AxisRange.h"
[776]12
[838]13namespace graphics {
[934]14    class RenderContext;
15}
[838]16
[820]17/**
18 *@class HeightMap
19 *@brief Create a surface from height map and line contour of the generated surface
20 */
[776]21class HeightMap {
[835]22    unsigned int _vertexBufferObjectID;
23    unsigned int _textureBufferObjectID;
24   
25    int _vertexCount;
26    CGparameter _tf;
27    R2Geometry* _contour;
[1000]28    R2Geometry* _topContour;
[835]29    TransferFunction* _colorMap;
30    NvShader* _shader;
31    int* _indexBuffer;
32    int _indexCount;
[776]33    Vector3 _contourColor;
[835]34   
35    bool _contourVisible;
[1000]36    bool _topContourVisible;
[835]37    bool _visible;
38   
[776]39    Vector3 _scale;
[837]40    Vector3 _centerPoint;
[776]41
42public :
[932]43    AxisRange xAxis, yAxis, zAxis, wAxis;
44    static bool update_pending;
45    static double valueMin, valueMax;
46
[820]47    /**
48     *@brief Constructor
49     */
[776]50        HeightMap();
[820]51    /**
52     *@brief Destructor
53     */
[776]54        ~HeightMap();
55
56private :
[820]57        void createIndexBuffer(int xCount, int zCount, int*& indexBuffer, int& indexCount, float* heights);
[776]58        Vector3* createHeightVertices(float startX, float startY, float endX, float endY, int xCount, int yCount, float* height);
59        void reset();
60public :
[838]61        void render(graphics::RenderContext* renderContext);
[820]62    /**
63     *@brief Create a height map with heigh values
64     *@param startX a x position of the first height value
65     *@param startY a y position of the first height value
66     *@param endX a x position of the last height value
67     *@param endY a y position of the last height value
68     *@param xCount the number of columns of height values
69     *@param yCount the number of rows of height values
70     *@param height a pointer value adrressing xCount * yCount values of heights
71     */
[776]72        void setHeight(float startX, float startY, float endX, float endY, int xCount, int yCount, float* height);
[820]73
74    /**
75     *@brief Create a height map with a set of points
76     *@param xCount the number of columns of height values
77     *@param yCount the number of rows of height values
78     */
[776]79        void setHeight(int xCount, int yCount, Vector3* heights);
[820]80
81    /**
[834]82     *@brief Define a color map for color shading of heightmap
[820]83     */
[929]84    void setColorMap(TransferFunction* colorMap);
[776]85
[820]86    /**
[834]87     *@brief Get the color map defined for shading of this heightmap
88     */
[929]89    TransferFunction *getColorMap(void) {
90        return _colorMap;
91    }
[834]92    /**
[820]93     *@brief Set the visibility of the height map
94     */
[929]95    void setVisible(bool visible) {
96        _visible = visible;
97    }
[820]98
99    /**
100     *@brief Return the status of the visibility
101     */
[929]102    bool isVisible() const {
103        return _visible;
104    }
[820]105    /**
106     *@brief Set the visibility of the line contour
107     */
[929]108    void setLineContourVisible(bool visible) {
109        _contourVisible = visible;
110    }
[820]111
[1000]112    void setTopLineContourVisible(bool visible) {
113            _topContourVisible = visible;
114    }
115
[820]116    /**
117     *@brief Defind the color of the line contour
118     */
[929]119    void setLineContourColor(float *rgb) {
120        _contourColor.x = rgb[0];
121        _contourColor.y = rgb[1];
122        _contourColor.z = rgb[2];
123    }
[776]124};
125
126#endif
Note: See TracBrowser for help on using the repository browser.