source: trunk/packages/vizservers/nanovis/ContourLineFilter.h @ 3452

Last change on this file since 3452 was 2877, checked in by ldelgass, 12 years ago

Some minor refactoring, also add some more fine grained config.h defines
(e.g. replace NV40 define with feature defines). Add tests for some required
OpenGL extensions (should always check for extensions or base version before
calling entry points from the extension). Also, clamp diffuse and specular
values on input and warn when they are out of range.

  • Property svn:eol-style set to native
File size: 1.4 KB
Line 
1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2#ifndef CONTOURLINEFILTER_H
3#define CONTOURLINEFILTER_H
4
5#include <list>
6
7#include <R2/graphics/R2Geometry.h>
8
9#include "Vector3.h"
10#include "Vector4.h"
11
12class ContourLineFilter
13{
14public:
15    class ContourLine
16    {
17    public:
18        ContourLine(float value);
19
20        /**
21         * @return Returns the number of points
22         */
23        int createLine(int width, int height, Vector3 *vertices, bool top);
24        int createLine(int width, int height, Vector4 *vertices, bool top);
25
26        float _value;
27        std::list<Vector3> _points;
28
29    private:
30        bool isValueWithIn(float v1, float v2)
31        {
32            return ((_value >= v1 && _value <= v2) ||
33                    (_value >= v2 && _value <= v1));
34        }
35        void getContourPoint(int vertexIndex1, int vertexIndex2, Vector3 *vertices, int width, bool top);
36        void getContourPoint(int vertexIndex1, int vertexIndex2, Vector4 *vertices, int width, bool top);
37    };
38
39    typedef std::list<ContourLine *> ContourLineList;
40
41    ContourLineFilter();
42
43    R2Geometry *create(float min, float max, int linecount, Vector3 *vertices, int width, int height);
44    R2Geometry *create(float min, float max, int linecount, Vector4 *vertices, int width, int height);
45
46    void setColorMap(Vector3Array *colorMap);
47   
48    void setHeightTop(bool top)
49    {
50        _top = top;
51    }
52
53private:
54    void clear();
55
56    ContourLineList _lines;
57    Vector3Array *_colorMap;
58    bool _top;
59};
60
61#endif
Note: See TracBrowser for help on using the repository browser.