00001 /*---------------------------------------------------------------------------*\ 00002 * OpenSG * 00003 * * 00004 * * 00005 * Copyright (C) 2000-2002 by the OpenSG Forum * 00006 * * 00007 * www.opensg.org * 00008 * * 00009 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de * 00010 * * 00011 \*---------------------------------------------------------------------------*/ 00012 /*---------------------------------------------------------------------------*\ 00013 * License * 00014 * * 00015 * This library is free software; you can redistribute it and/or modify it * 00016 * under the terms of the GNU Library General Public License as published * 00017 * by the Free Software Foundation, version 2. * 00018 * * 00019 * This library is distributed in the hope that it will be useful, but * 00020 * WITHOUT ANY WARRANTY; without even the implied warranty of * 00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00022 * Library General Public License for more details. * 00023 * * 00024 * You should have received a copy of the GNU Library General Public * 00025 * License along with this library; if not, write to the Free Software * 00026 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 00027 * * 00028 \*---------------------------------------------------------------------------*/ 00029 /*---------------------------------------------------------------------------*\ 00030 * Changes * 00031 * * 00032 * * 00033 * * 00034 * * 00035 * * 00036 * * 00037 \*---------------------------------------------------------------------------*/ 00038 00039 #ifndef _OSGNORMALQUANTIFIER_H_ 00040 #define _OSGNORMALQUANTIFIER_H_ 00041 #ifdef __sgi 00042 #pragma once 00043 #endif 00044 00045 #include <OSGBaseTypes.h> 00046 #include <OSGVector.h> 00047 00048 #include <vector> 00049 00050 OSG_BEGIN_NAMESPACE 00051 00055 class OSG_BASE_DLLMAPPING NormalQuantifier 00056 { 00057 /*========================== PUBLIC =================================*/ 00058 00059 public: 00060 00061 /*---------------------------------------------------------------------*/ 00065 NormalQuantifier(UInt32 numberSubdivisions = 0); 00066 00068 /*---------------------------------------------------------------------*/ 00072 virtual ~NormalQuantifier(void); 00073 00075 /*---------------------------------------------------------------------*/ 00079 UInt32 getIndex (Vec3f &normal, 00080 UInt32 numberSubdivisions = 0) const; 00081 00082 const Vec3f &getNormal (UInt32 index ) const; 00083 00084 UInt32 getNormalCount(void ) const; 00085 00087 /*---------------------------------------------------------------------*/ 00091 void build(UInt32 numberSubdivisions = 4); 00092 00094 /*========================= PROTECTED ===============================*/ 00095 00096 protected: 00097 00098 /*---------------------------------------------------------------------*/ 00102 UInt32 _numberSubdivisions; 00103 00104 std::vector<Vec3f> _normalTable; 00105 00107 /*---------------------------------------------------------------------*/ 00111 void subdivide (Vec3f point1, 00112 Vec3f point2, 00113 Vec3f point3, 00114 UInt32 number, 00115 UInt32 &index ); 00116 00117 bool rayTriangle ( const Vec3f & dir, 00118 const Vec3f & vert0, 00119 const Vec3f & vert1, 00120 const Vec3f & vert2) const; 00121 00122 UInt32 getSubIndex(Vec3f point, 00123 Vec3f point1, 00124 Vec3f point2, 00125 Vec3f point3, 00126 UInt32 number) const; 00127 00129 /*========================== PRIVATE ================================*/ 00130 00131 private: 00132 00134 NormalQuantifier(const NormalQuantifier &source); 00136 NormalQuantifier &operator =(const NormalQuantifier &source); 00137 }; 00138 00139 OSG_END_NAMESPACE 00140 00141 #define OSG_HEADER_CVSID "@(#)$Id: $" 00142 00143 #include "OSGNormalQuantifier.inl" 00144 00145 #endif /* _NormalQuantifier_H_ */
1.5.5