1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2003 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
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. *
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. *
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. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGNORMALQUANTIFIER_H_
40 #define _OSGNORMALQUANTIFIER_H_
45 #include "OSGBaseTypes.h"
46 #include "OSGVector.h"
52 /*! \ingroup GrpBaseBase
53 \ingroup GrpBaseBaseHelper
54 \ingroup GrpLibOSGBase
58 class OSG_BASE_DLLMAPPING NormalQuantifier
60 /*========================== PUBLIC =================================*/
64 /*---------------------------------------------------------------------*/
65 /*! \name Constructors */
68 NormalQuantifier(UInt32 numberSubdivisions
= 0);
71 /*---------------------------------------------------------------------*/
72 /*! \name Destructor */
75 virtual ~NormalQuantifier(void);
78 /*---------------------------------------------------------------------*/
82 UInt32
getIndex (Vec3f
&normal
,
83 UInt32 numberSubdivisions
= 0) const;
85 const Vec3f
&getNormal (UInt32 index
) const;
87 SizeT
getNormalCount(void ) const;
90 /*---------------------------------------------------------------------*/
94 void build(UInt32 numberSubdivisions
= 4);
97 /*========================= PROTECTED ===============================*/
101 /*---------------------------------------------------------------------*/
105 UInt32 _numberSubdivisions
;
107 std::vector
<Vec3f
> _normalTable
;
110 /*---------------------------------------------------------------------*/
114 void subdivide (Vec3f point1
,
120 bool rayTriangle ( const Vec3f
& dir
,
123 const Vec3f
& vert2
) const;
125 UInt32
getSubIndex(Vec3f point
,
129 UInt32 number
) const;
132 /*========================== 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
);
144 #include "OSGNormalQuantifier.inl"
146 #endif /* _OSGNORMALQUANTIFIER_H_ */