root/OpenSceneGraph/branches/OpenSceneGraph-3.2/src/osgPlugins/3ds/WriterCompareTriangle.h @ 14038

Revision 14038, 1.6 kB (checked in by robert, 4 days ago)

Added shaders to support experimental shader based displacement mapping technique osgTerrain::ShaderTerrain?.

  • Property svn:eol-style set to native
Line 
1#ifndef _3DS_WRITER_COMPARE_TRIANGLE_HEADER__
2#define _3DS_WRITER_COMPARE_TRIANGLE_HEADER__
3
4#include <osg/Geode>
5#include <osg/Geometry>
6#include <iostream>
7
8struct Triangle
9{
10    unsigned int t1;
11    unsigned int t2;
12    unsigned int t3;
13    unsigned int material;
14};
15
16class WriterCompareTriangle {
17public:
18    WriterCompareTriangle(const osg::Geode & geode, unsigned int nbVertices);
19
20    bool operator()(const std::pair<Triangle, int>    &    t1,
21                    const std::pair<Triangle, int>    &    t2) const;
22private:
23    void // This function prevent from cut scene in too many blocs
24        setMaxMin(int & nbVerticesX,
25                  int & nbVerticesY,
26                  int & nbVerticesZ) const;
27
28    /**
29    *  Cut the scene in different bloc to sort.
30    *  \param nbVertices is the number of vertice in mesh.
31    *  \param sceneBox contain the size of the scene.
32    */
33    void
34    cutscene(int                        nbVertices,
35             const osg::BoundingBox   &    sceneBox);
36
37    /**
38    *  Find in which box those points are.
39    *  \return the place of the box in the vector.
40    *  \sa See cutScene() about the definition of the boxes for faces sorting.
41    */
42    int inWhichBox(const osg::BoundingBox::value_type x,
43                   const osg::BoundingBox::value_type y,
44                   const osg::BoundingBox::value_type z) const;
45    int inWhichBox(const osg::BoundingBox::vec_type & point) const;
46
47    const osg::Geode                  &    geode;
48    std::vector<osg::BoundingBox>        boxList;
49};
50
51#endif // _3DS_WRITER_COMPARE_TRIANGLE_HEADER__
Note: See TracBrowser for help on using the browser.