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 #include "OSGGeometry.h" 00046 00047 OSG_BEGIN_NAMESPACE 00048 00053 inline 00054 Int32 TriangleIterator::getIndex(void) const 00055 { 00056 return _triIndex; 00057 } 00058 00059 inline 00060 Int32 TriangleIterator::getPositionIndex(Int32 which) const 00061 { 00062 return Inherited::getPositionIndex(_triPntIndex[which]); 00063 } 00064 00065 inline 00066 Pnt3f TriangleIterator::getPosition(Int32 which) const 00067 { 00068 Int32 ind = getPositionIndex(which); 00069 00070 return getGeometry()->getPositions()->getValue(ind); 00071 } 00072 00073 inline 00074 Int32 TriangleIterator::getNormalIndex(Int32 which) const 00075 { 00076 return Inherited::getNormalIndex(_triPntIndex[which]); 00077 } 00078 00079 inline 00080 Vec3f TriangleIterator::getNormal(Int32 which) const 00081 { 00082 Int32 ind = getNormalIndex(which); 00083 00084 if(ind < 0) 00085 return Vec3f::Null; 00086 00087 return getGeometry()->getNormals()->getValue(ind); 00088 } 00089 00090 inline 00091 Int32 TriangleIterator::getColorIndex(Int32 which) const 00092 { 00093 return Inherited::getColorIndex(_triPntIndex[which]); 00094 } 00095 00096 inline 00097 Color3f TriangleIterator::getColor(Int32 which) const 00098 { 00099 Int32 ind = getColorIndex(which); 00100 00101 if(ind < 0) 00102 return Color3f::Null; 00103 00104 return getGeometry()->getColors()->getValue(ind); 00105 } 00106 00107 inline 00108 Int32 TriangleIterator::getSecondaryColorIndex(Int32 which) const 00109 { 00110 return Inherited::getSecondaryColorIndex(_triPntIndex[which]); 00111 } 00112 00113 inline 00114 Color3f TriangleIterator::getSecondaryColor(Int32 which) const 00115 { 00116 Int32 ind = getSecondaryColorIndex(which); 00117 00118 if(ind < 0) 00119 return Color3f::Null; 00120 00121 return getGeometry()->getSecondaryColors()->getValue(ind); 00122 } 00123 00124 00125 inline 00126 Int32 TriangleIterator::getTexCoordsIndex(Int32 which) const 00127 { 00128 return Inherited::getTexCoordsIndex(_triPntIndex[which]); 00129 } 00130 00131 inline 00132 Vec2f TriangleIterator::getTexCoords(Int32 which) const 00133 { 00134 Int32 ind = getTexCoordsIndex(which); 00135 00136 if(ind < 0) 00137 return Vec2f::Null; 00138 00139 return getGeometry()->getTexCoords()->getValue(ind); 00140 } 00141 00142 00143 inline 00144 Int32 TriangleIterator::getTexCoordsIndex1(Int32 which) const 00145 { 00146 return Inherited::getTexCoordsIndex1(_triPntIndex[which]); 00147 } 00148 00149 inline 00150 Vec2f TriangleIterator::getTexCoords1(Int32 which) const 00151 { 00152 Int32 ind = getTexCoordsIndex1(which); 00153 00154 if(ind < 0) 00155 return Vec2f::Null; 00156 00157 return getGeometry()->getTexCoords1()->getValue(ind); 00158 } 00159 00160 00161 inline 00162 Int32 TriangleIterator::getTexCoordsIndex2(Int32 which) const 00163 { 00164 return Inherited::getTexCoordsIndex2(_triPntIndex[which]); 00165 } 00166 00167 inline 00168 Vec2f TriangleIterator::getTexCoords2(Int32 which) const 00169 { 00170 Int32 ind = getTexCoordsIndex2(which); 00171 00172 if(ind < 0) 00173 return Vec2f::Null; 00174 00175 return getGeometry()->getTexCoords2()->getValue(ind); 00176 } 00177 00178 00179 inline 00180 Int32 TriangleIterator::getTexCoordsIndex3(Int32 which) const 00181 { 00182 return Inherited::getTexCoordsIndex3(_triPntIndex[which]); 00183 } 00184 00185 inline 00186 Vec2f TriangleIterator::getTexCoords3(Int32 which) const 00187 { 00188 Int32 ind = getTexCoordsIndex3(which); 00189 00190 if(ind < 0) 00191 return Vec2f::Null; 00192 00193 return getGeometry()->getTexCoords3()->getValue(ind); 00194 } 00195 00196 inline 00197 Int32 TriangleIterator::getTexCoordsIndex4(Int32 which) const 00198 { 00199 return Inherited::getTexCoordsIndex4(_triPntIndex[which]); 00200 } 00201 00202 inline 00203 Vec2f TriangleIterator::getTexCoords4(Int32 which) const 00204 { 00205 Int32 ind = getTexCoordsIndex4(which); 00206 00207 if(ind < 0) 00208 return Vec2f::Null; 00209 00210 return getGeometry()->getTexCoords4()->getValue(ind); 00211 } 00212 00213 inline 00214 Int32 TriangleIterator::getTexCoordsIndex5(Int32 which) const 00215 { 00216 return Inherited::getTexCoordsIndex5(_triPntIndex[which]); 00217 } 00218 00219 inline 00220 Vec2f TriangleIterator::getTexCoords5(Int32 which) const 00221 { 00222 Int32 ind = getTexCoordsIndex5(which); 00223 00224 if(ind < 0) 00225 return Vec2f::Null; 00226 00227 return getGeometry()->getTexCoords5()->getValue(ind); 00228 } 00229 00230 inline 00231 Int32 TriangleIterator::getTexCoordsIndex6(Int32 which) const 00232 { 00233 return Inherited::getTexCoordsIndex6(_triPntIndex[which]); 00234 } 00235 00236 inline 00237 Vec2f TriangleIterator::getTexCoords6(Int32 which) const 00238 { 00239 Int32 ind = getTexCoordsIndex6(which); 00240 00241 if(ind < 0) 00242 return Vec2f::Null; 00243 00244 return getGeometry()->getTexCoords6()->getValue(ind); 00245 } 00246 00247 inline 00248 Int32 TriangleIterator::getTexCoordsIndex7(Int32 which) const 00249 { 00250 return Inherited::getTexCoordsIndex7(_triPntIndex[which]); 00251 } 00252 00253 inline 00254 Vec2f TriangleIterator::getTexCoords7(Int32 which) const 00255 { 00256 Int32 ind = getTexCoordsIndex7(which); 00257 00258 if(ind < 0) 00259 return Vec2f::Null; 00260 00261 return getGeometry()->getTexCoords7()->getValue(ind); 00262 } 00263 00264 inline 00265 Int32 TriangleIterator::getIndexIndex(Int32 which) const 00266 { 00267 if(_triPntIndex[which] >= 0) 00268 return Inherited::getIndexIndex(_triPntIndex[which]); 00269 else 00270 return -1; 00271 } 00272 00273 00274 OSG_END_NAMESPACE 00275
1.5.5