[2798] | 1 | /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ |
---|
[4889] | 2 | #ifndef NV_CONTOURLINEFILTER_H |
---|
| 3 | #define NV_CONTOURLINEFILTER_H |
---|
[776] | 4 | |
---|
[2827] | 5 | #include <list> |
---|
[3492] | 6 | #include <vector> |
---|
[2827] | 7 | |
---|
[3465] | 8 | #include <graphics/Geometry.h> |
---|
[3492] | 9 | #include <vrmath/Vector3f.h> |
---|
| 10 | #include <vrmath/Vector4f.h> |
---|
[2827] | 11 | |
---|
[4889] | 12 | namespace nv { |
---|
| 13 | |
---|
[2827] | 14 | class ContourLineFilter |
---|
| 15 | { |
---|
| 16 | public: |
---|
| 17 | class ContourLine |
---|
| 18 | { |
---|
| 19 | public: |
---|
[1984] | 20 | ContourLine(float value); |
---|
[2827] | 21 | |
---|
| 22 | /** |
---|
[2877] | 23 | * @return Returns the number of points |
---|
[2827] | 24 | */ |
---|
[3492] | 25 | int createLine(int width, int height, vrmath::Vector3f *vertices, bool top); |
---|
| 26 | int createLine(int width, int height, vrmath::Vector4f *vertices, bool top); |
---|
[2827] | 27 | |
---|
[2877] | 28 | float _value; |
---|
[3492] | 29 | std::list<vrmath::Vector3f> _points; |
---|
[2877] | 30 | |
---|
[2827] | 31 | private: |
---|
| 32 | bool isValueWithIn(float v1, float v2) |
---|
| 33 | { |
---|
[1984] | 34 | return ((_value >= v1 && _value <= v2) || |
---|
| 35 | (_value >= v2 && _value <= v1)); |
---|
| 36 | } |
---|
[3492] | 37 | void getContourPoint(int vertexIndex1, int vertexIndex2, vrmath::Vector3f *vertices, int width, bool top); |
---|
| 38 | void getContourPoint(int vertexIndex1, int vertexIndex2, vrmath::Vector4f *vertices, int width, bool top); |
---|
[1984] | 39 | }; |
---|
[2827] | 40 | |
---|
| 41 | typedef std::list<ContourLine *> ContourLineList; |
---|
[3492] | 42 | typedef std::vector<vrmath::Vector3f> Vector3fArray; |
---|
[2827] | 43 | |
---|
[1984] | 44 | ContourLineFilter(); |
---|
[2827] | 45 | |
---|
[3492] | 46 | nv::graphics::Geometry *create(float min, float max, int linecount, vrmath::Vector3f *vertices, int width, int height); |
---|
| 47 | nv::graphics::Geometry *create(float min, float max, int linecount, vrmath::Vector4f *vertices, int width, int height); |
---|
[2827] | 48 | |
---|
[3492] | 49 | void setColorMap(Vector3fArray *colorMap); |
---|
[1984] | 50 | |
---|
[1000] | 51 | void setHeightTop(bool top) |
---|
| 52 | { |
---|
[1984] | 53 | _top = top; |
---|
[1000] | 54 | } |
---|
[2827] | 55 | |
---|
| 56 | private: |
---|
| 57 | void clear(); |
---|
| 58 | |
---|
| 59 | ContourLineList _lines; |
---|
[3492] | 60 | Vector3fArray *_colorMap; |
---|
[2827] | 61 | bool _top; |
---|
[776] | 62 | }; |
---|
| 63 | |
---|
[4889] | 64 | } |
---|
| 65 | |
---|
[776] | 66 | #endif |
---|