added: travMask to csm viewport
[opensg.git] / Source / Base / Base / OSGNormalQuantifier.h
blob52aecec5863dd9afdb1136dce197985d131200d5
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2003 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
18 * *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
23 * *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGNORMALQUANTIFIER_H_
40 #define _OSGNORMALQUANTIFIER_H_
41 #ifdef __sgi
42 #pragma once
43 #endif
45 #include "OSGBaseTypes.h"
46 #include "OSGVector.h"
48 #include <vector>
50 OSG_BEGIN_NAMESPACE
52 /*! \ingroup GrpBaseBase
53 \ingroup GrpBaseBaseHelper
54 \ingroup GrpLibOSGBase
55 \nohierarchy
58 class OSG_BASE_DLLMAPPING NormalQuantifier
60 /*========================== PUBLIC =================================*/
62 public:
64 /*---------------------------------------------------------------------*/
65 /*! \name Constructors */
66 /*! \{ */
68 NormalQuantifier(UInt32 numberSubdivisions = 0);
70 /*! \} */
71 /*---------------------------------------------------------------------*/
72 /*! \name Destructor */
73 /*! \{ */
75 virtual ~NormalQuantifier(void);
77 /*! \} */
78 /*---------------------------------------------------------------------*/
79 /*! \name Get */
80 /*! \{ */
82 UInt32 getIndex (Vec3f &normal,
83 UInt32 numberSubdivisions = 0) const;
85 const Vec3f &getNormal (UInt32 index ) const;
87 SizeT getNormalCount(void ) const;
89 /*! \} */
90 /*---------------------------------------------------------------------*/
91 /*! \name Init */
92 /*! \{ */
94 void build(UInt32 numberSubdivisions = 4);
96 /*! \} */
97 /*========================= PROTECTED ===============================*/
99 protected:
101 /*---------------------------------------------------------------------*/
102 /*! \name Member */
103 /*! \{ */
105 UInt32 _numberSubdivisions;
107 std::vector<Vec3f> _normalTable;
109 /*! \} */
110 /*---------------------------------------------------------------------*/
111 /*! \name Helper */
112 /*! \{ */
114 void subdivide (Vec3f point1,
115 Vec3f point2,
116 Vec3f point3,
117 UInt32 number,
118 UInt32 &index );
120 bool rayTriangle ( const Vec3f & dir,
121 const Vec3f & vert0,
122 const Vec3f & vert1,
123 const Vec3f & vert2) const;
125 UInt32 getSubIndex(Vec3f point,
126 Vec3f point1,
127 Vec3f point2,
128 Vec3f point3,
129 UInt32 number) const;
131 /*! \} */
132 /*========================== PRIVATE ================================*/
134 private:
136 /*!\brief prohibit default function (move to 'public' if needed) */
137 NormalQuantifier(const NormalQuantifier &source);
138 /*!\brief prohibit default function (move to 'public' if needed) */
139 NormalQuantifier &operator =(const NormalQuantifier &source);
142 OSG_END_NAMESPACE
144 #include "OSGNormalQuantifier.inl"
146 #endif /* _OSGNORMALQUANTIFIER_H_ */