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 * * 00016 * This library is free software; you can redistribute it and/or modify it * 00017 * under the terms of the GNU Library General Public License as published * 00018 * by the Free Software Foundation, version 2. * 00019 * * 00020 * This library is distributed in the hope that it will be useful, but * 00021 * WITHOUT ANY WARRANTY; without even the implied warranty of * 00022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00023 * Library General Public License for more details. * 00024 * * 00025 * You should have received a copy of the GNU Library General Public * 00026 * License along with this library; if not, write to the Free Software * 00027 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 00028 * * 00029 * * 00030 \*---------------------------------------------------------------------------*/ 00031 /*---------------------------------------------------------------------------*\ 00032 * Changes * 00033 * * 00034 * * 00035 * * 00036 * * 00037 * * 00038 * * 00039 \*---------------------------------------------------------------------------*/ 00040 00041 #include <stdlib.h> 00042 #include <stdio.h> 00043 00044 #include "OSGConfig.h" 00045 00046 #include "OSGGeometry.h" 00047 00048 OSG_BEGIN_NAMESPACE 00049 00050 inline 00051 Int32 FaceIterator::getIndex(void) const 00052 { 00053 return _faceIndex; 00054 } 00055 00056 00061 inline 00062 UInt32 FaceIterator::getLength(void) const 00063 { 00064 return _facePntIndex[3] == -1 ? 3 : 4; 00065 } 00066 00067 inline 00068 Int32 FaceIterator::getPositionIndex(Int32 which) const 00069 { 00070 if(_facePntIndex[which] >= 0) 00071 return Inherited::getPositionIndex(_facePntIndex[which]); 00072 else 00073 return -1; 00074 } 00075 00076 inline Pnt3f FaceIterator::getPosition(Int32 which) const { Int32 ind = 00077 getPositionIndex(which); 00078 00079 if(ind < 0) 00080 return Pnt3f::Null; 00081 00082 return getGeometry()->getPositions()->getValue(ind); 00083 } 00084 00085 inline 00086 Int32 FaceIterator::getNormalIndex(Int32 which) const 00087 { 00088 if(_facePntIndex[which] >= 0) 00089 return Inherited::getNormalIndex(_facePntIndex[which]); 00090 else 00091 return -1; 00092 } 00093 00094 inline 00095 Vec3f FaceIterator::getNormal(Int32 which) const 00096 { 00097 Int32 ind = getNormalIndex(which); 00098 00099 if(ind < 0) 00100 return Vec3f::Null; 00101 00102 return getGeometry()->getNormals()->getValue(ind); 00103 } 00104 00105 inline 00106 Int32 FaceIterator::getColorIndex(Int32 which) const 00107 { 00108 if(_facePntIndex[which] >= 0) 00109 return Inherited::getColorIndex(_facePntIndex[which]); 00110 else 00111 return -1; 00112 } 00113 00114 inline 00115 Color3f FaceIterator::getColor(Int32 which) const 00116 { 00117 Int32 ind = getColorIndex(which); 00118 00119 if(ind < 0) 00120 return Color3f::Null; 00121 00122 return getGeometry()->getColors()->getValue(ind); 00123 } 00124 00125 inline 00126 Int32 FaceIterator::getSecondaryColorIndex(Int32 which) const 00127 { 00128 if(_facePntIndex[which] >= 0) 00129 return Inherited::getSecondaryColorIndex(_facePntIndex[which]); 00130 else 00131 return -1; 00132 } 00133 00134 inline 00135 Color3f FaceIterator::getSecondaryColor(Int32 which) const 00136 { 00137 Int32 ind = getSecondaryColorIndex(which); 00138 00139 if(ind < 0) 00140 return Color3f::Null; 00141 00142 return getGeometry()->getSecondaryColors()->getValue(ind); 00143 } 00144 00145 inline 00146 Int32 FaceIterator::getTexCoordsIndex(Int32 which) const 00147 { 00148 if(_facePntIndex[which] >= 0) 00149 return Inherited::getTexCoordsIndex(_facePntIndex[which]); 00150 else 00151 return -1; 00152 } 00153 00154 inline 00155 Vec2f FaceIterator::getTexCoords(Int32 which) const 00156 { 00157 Int32 ind = getTexCoordsIndex(which); 00158 00159 if(ind < 0) 00160 return Vec2f::Null; 00161 00162 return getGeometry()->getTexCoords()->getValue(ind); 00163 } 00164 00165 00166 inline 00167 Int32 FaceIterator::getTexCoordsIndex1(Int32 which) const 00168 { 00169 if(_facePntIndex[which] >= 0) 00170 return Inherited::getTexCoordsIndex1(_facePntIndex[which]); 00171 else 00172 return -1; 00173 } 00174 00175 inline 00176 Vec2f FaceIterator::getTexCoords1(Int32 which) const 00177 { 00178 Int32 ind = getTexCoordsIndex1(which); 00179 00180 if(ind < 0) 00181 return Vec2f::Null; 00182 00183 return getGeometry()->getTexCoords1()->getValue(ind); 00184 } 00185 00186 inline 00187 Int32 FaceIterator::getTexCoordsIndex2(Int32 which) const 00188 { 00189 if(_facePntIndex[which] >= 0) 00190 return Inherited::getTexCoordsIndex2(_facePntIndex[which]); 00191 else 00192 return -1; 00193 } 00194 00195 inline 00196 Vec2f FaceIterator::getTexCoords2(Int32 which) const 00197 { 00198 Int32 ind = getTexCoordsIndex2(which); 00199 00200 if(ind < 0) 00201 return Vec2f::Null; 00202 00203 return getGeometry()->getTexCoords2()->getValue(ind); 00204 } 00205 00206 inline 00207 Int32 FaceIterator::getTexCoordsIndex3(Int32 which) const 00208 { 00209 if(_facePntIndex[which] >= 0) 00210 return Inherited::getTexCoordsIndex3(_facePntIndex[which]); 00211 else 00212 return -1; 00213 } 00214 00215 inline 00216 Vec2f FaceIterator::getTexCoords3(Int32 which) const 00217 { 00218 Int32 ind = getTexCoordsIndex3(which); 00219 00220 if(ind < 0) 00221 return Vec2f::Null; 00222 00223 return getGeometry()->getTexCoords3()->getValue(ind); 00224 } 00225 00226 inline 00227 Int32 FaceIterator::getIndexIndex(Int32 which) const 00228 { 00229 if(_facePntIndex[which] >= 0) 00230 return Inherited::getIndexIndex(_facePntIndex[which]); 00231 else 00232 return -1; 00233 } 00234 00235 OSG_END_NAMESPACE
1.4.3