00001 /*---------------------------------------------------------------------------*\ 00002 * OpenSG * 00003 * * 00004 * * 00005 * Copyright 2000-2002 by OpenSG Forum * 00006 * * 00007 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de * 00008 * * 00009 \*---------------------------------------------------------------------------*/ 00010 /*---------------------------------------------------------------------------*\ 00011 * License * 00012 * * 00013 * This library is free software; you can redistribute it and/or modify it * 00014 * under the terms of the GNU Library General Public License as published * 00015 * by the Free Software Foundation, version 2. * 00016 * * 00017 * This library is distributed in the hope that it will be useful, but * 00018 * WITHOUT ANY WARRANTY; without even the implied warranty of * 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00020 * Library General Public License for more details. * 00021 * * 00022 * You should have received a copy of the GNU Library General Public * 00023 * License along with this library; if not, write to the Free Software * 00024 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 00025 * * 00026 \*---------------------------------------------------------------------------*/ 00027 /*---------------------------------------------------------------------------*\ 00028 * Changes * 00029 * * 00030 * * 00031 * * 00032 * * 00033 * * 00034 * * 00035 \*---------------------------------------------------------------------------*/ 00036 00037 00038 #ifndef _OSGGEOPROPERTYINTERFACES_H_ 00039 #define _OSGGEOPROPERTYINTERFACES_H_ 00040 #ifdef __sgi 00041 #pragma once 00042 #endif 00043 00044 #include <OSGSystemDef.h> 00045 #include <OSGMFVecTypes.h> 00046 #include <OSGMFSysTypes.h> 00047 #include <OSGAttachment.h> 00048 #include <OSGAttachmentFieldDataType.h> 00049 00050 OSG_BEGIN_NAMESPACE 00051 00052 #ifndef OSG_SUPPORT_NO_GEO_INTERFACE 00053 00070 class GeoPropertyArrayInterface 00071 { 00072 /*========================== PUBLIC =================================*/ 00073 public: 00074 00075 /*---------------------------------------------------------------------*/ 00079 virtual UInt32 getFormat (void) const = 0; 00080 virtual UInt32 getFormatSize(void) const = 0; 00081 virtual UInt32 getStride (void) const = 0; 00082 virtual UInt32 getDimension (void) const = 0; 00083 virtual UInt32 getSize (void) const = 0; 00084 virtual UInt32 size (void) const = 0; 00085 virtual UInt8 *getData (void) const = 0; 00086 00088 /*---------------------------------------------------------------------*/ 00092 virtual void clear (void ) = 0; 00093 virtual void resize (size_t newsize) = 0; 00094 virtual void shrink (void ) = 0; 00095 00097 /*---------------------------------------------------------------------*/ 00101 GeoPropertyArrayInterface(void); 00102 GeoPropertyArrayInterface(const GeoPropertyArrayInterface &source); 00103 00105 /*---------------------------------------------------------------------*/ 00109 virtual ~GeoPropertyArrayInterface(void); 00110 00112 }; 00113 00114 00125 template <class GeoPropertyDesc> 00126 class GeoPropertyInterface : public GeoPropertyArrayInterface 00127 { 00128 /*========================== PUBLIC =================================*/ 00129 public: 00130 00131 typedef GeoPropertyInterface<GeoPropertyDesc> InterfaceType; 00132 00133 typedef typename GeoPropertyDesc::GenericType GenericType; 00134 00135 typedef GeoPropertyArrayInterface Inherited; 00136 00137 /*---------------------------------------------------------------------*/ 00141 virtual GenericType getValue (const UInt32 index ) = 0; 00142 00143 virtual GenericType getValue (const UInt32 index ) const = 0; 00144 00145 virtual void getValue ( GenericType &val, 00146 const UInt32 index ) = 0; 00147 00148 virtual void getValue ( GenericType &val, 00149 const UInt32 index ) const = 0; 00150 00151 00152 virtual void setValue (const GenericType &val, 00153 const UInt32 index ) = 0; 00154 00155 virtual void addValue (const GenericType &val ) = 0; 00156 00157 00158 virtual void push_back(const GenericType &val ) = 0; 00159 00161 /*---------------------------------------------------------------------*/ 00165 GeoPropertyInterface(void); 00166 GeoPropertyInterface(const GeoPropertyInterface &source); 00167 00169 /*---------------------------------------------------------------------*/ 00173 virtual ~GeoPropertyInterface(void); 00174 00176 }; 00177 #endif 00178 00179 00184 struct AttachmentPropertyDesc 00185 { 00186 /*---------------------------------------------------------------------*/ 00190 static const char *getTypeName (void) { return "Attachment"; } 00191 00193 }; 00194 00200 struct GeoPropertyDesc 00201 { 00202 }; 00203 00209 struct GeoPositionsPropertyDesc : public GeoPropertyDesc 00210 { 00211 /*---------------------------------------------------------------------*/ 00215 static const Char8 *getTypeName (void) { return "GeoPositions"; } 00216 00217 static const Char8 *getGroupName(void) { return "GeoPositions"; } 00218 static const Char8 *getClassName(void) { return "GeoPositionsProperty"; } 00219 00220 static InitContainerF getInitMethod(void) { return NULL; } 00221 00223 /*---------------------------------------------------------------------*/ 00227 typedef Attachment Inherited; 00228 typedef AttachmentPtr InheritedPtr; 00229 00230 typedef AttachmentPropertyDesc InheritedDesc; 00231 00232 typedef Pnt3f GenericType; 00233 00234 #ifndef OSG_SUPPORT_NO_GEO_INTERFACE 00235 typedef GeoPropertyInterface<GeoPositionsPropertyDesc> Interface; 00236 #endif 00237 00239 }; 00240 00241 #ifndef OSG_SUPPORT_NO_GEO_INTERFACE 00242 typedef GeoPositionsPropertyDesc::Interface GeoPositionsInterface; 00243 #endif 00244 00250 struct GeoNormalsPropertyDesc : public GeoPropertyDesc 00251 { 00252 /*---------------------------------------------------------------------*/ 00256 static const Char8 *getTypeName (void) { return "GeoNormals"; } 00257 static const Char8 *getGroupName(void) { return "GeoNormals"; } 00258 static const Char8 *getClassName(void) { return "GeoNormalsProperty"; } 00259 00260 static InitContainerF getInitMethod(void) { return NULL; } 00261 00263 /*---------------------------------------------------------------------*/ 00267 typedef Attachment Inherited; 00268 typedef AttachmentPtr InheritedPtr; 00269 00270 typedef AttachmentPropertyDesc InheritedDesc; 00271 00272 typedef Vec3f GenericType; 00273 00274 #ifndef OSG_SUPPORT_NO_GEO_INTERFACE 00275 typedef GeoPropertyInterface<GeoNormalsPropertyDesc> Interface; 00276 #endif 00277 00279 }; 00280 00281 #ifndef OSG_SUPPORT_NO_GEO_INTERFACE 00282 typedef GeoNormalsPropertyDesc::Interface GeoNormalsInterface; 00283 #endif 00284 00290 struct GeoColorsPropertyDesc : public GeoPropertyDesc 00291 { 00292 /*---------------------------------------------------------------------*/ 00296 static const Char8 *getTypeName (void) { return "GeoColors"; } 00297 static const Char8 *getGroupName(void) { return "GeoColors"; } 00298 static const Char8 *getClassName(void) { return "GeoColorsProperty"; } 00299 00300 static InitContainerF getInitMethod(void) { return NULL; } 00301 00303 /*---------------------------------------------------------------------*/ 00307 typedef Attachment Inherited; 00308 typedef AttachmentPtr InheritedPtr; 00309 00310 typedef AttachmentPropertyDesc InheritedDesc; 00311 00312 typedef Color3f GenericType; 00313 00314 #ifndef OSG_SUPPORT_NO_GEO_INTERFACE 00315 typedef GeoPropertyInterface<GeoColorsPropertyDesc> Interface; 00316 #endif 00317 00319 }; 00320 00321 #ifndef OSG_SUPPORT_NO_GEO_INTERFACE 00322 typedef GeoColorsPropertyDesc::Interface GeoColorsInterface; 00323 #endif 00324 00330 struct GeoTexCoordsPropertyDesc : public GeoPropertyDesc 00331 { 00332 /*---------------------------------------------------------------------*/ 00336 static const Char8 *getTypeName (void) { return "GeoTexCoords"; } 00337 static const Char8 *getGroupName(void) { return "GeoTexCoords"; } 00338 static const Char8 *getClassName(void) { return "GeoTexCoordsProperty"; } 00339 00340 static InitContainerF getInitMethod(void) { return NULL; } 00341 00343 /*---------------------------------------------------------------------*/ 00347 typedef Attachment Inherited; 00348 typedef AttachmentPtr InheritedPtr; 00349 00350 typedef AttachmentPropertyDesc InheritedDesc; 00351 00352 typedef Vec2f GenericType; 00353 00354 #ifndef OSG_SUPPORT_NO_GEO_INTERFACE 00355 typedef GeoPropertyInterface<GeoTexCoordsPropertyDesc> Interface; 00356 #endif 00357 00359 }; 00360 00361 #ifndef OSG_SUPPORT_NO_GEO_INTERFACE 00362 typedef GeoTexCoordsPropertyDesc::Interface GeoTexCoordsInterface; 00363 #endif 00364 00370 struct GeoIndicesPropertyDesc : public GeoPropertyDesc 00371 { 00372 /*---------------------------------------------------------------------*/ 00376 static const Char8 *getTypeName (void) { return "GeoIndices"; } 00377 static const Char8 *getGroupName(void) { return "GeoIndices"; } 00378 static const Char8 *getClassName(void) { return "GeoIndicesProperty"; } 00379 00380 static InitContainerF getInitMethod(void) { return NULL; } 00381 00383 /*---------------------------------------------------------------------*/ 00387 typedef Attachment Inherited; 00388 typedef AttachmentPtr InheritedPtr; 00389 00390 typedef AttachmentPropertyDesc InheritedDesc; 00391 00392 typedef UInt32 GenericType; 00393 00394 #ifndef OSG_SUPPORT_NO_GEO_INTERFACE 00395 typedef GeoPropertyInterface<GeoIndicesPropertyDesc> Interface; 00396 #endif 00397 00399 }; 00400 00401 #ifndef OSG_SUPPORT_NO_GEO_INTERFACE 00402 typedef GeoIndicesPropertyDesc::Interface GeoIndicesInterface; 00403 #endif 00404 00410 struct GeoPTypesPropertyDesc : public GeoPropertyDesc 00411 { 00412 /*---------------------------------------------------------------------*/ 00416 static const Char8 *getTypeName (void) { return "GeoPTypes"; } 00417 static const Char8 *getGroupName(void) { return "GeoPTypes"; } 00418 static const Char8 *getClassName(void) { return "GeoPTypesProperty"; } 00419 00420 static InitContainerF getInitMethod(void) { return NULL; } 00421 00423 /*---------------------------------------------------------------------*/ 00427 typedef Attachment Inherited; 00428 typedef AttachmentPropertyDesc InheritedDesc; 00429 00430 typedef AttachmentPtr InheritedPtr; 00431 00432 typedef UInt8 GenericType; 00433 00434 #ifndef OSG_SUPPORT_NO_GEO_INTERFACE 00435 typedef GeoPropertyInterface<GeoPTypesPropertyDesc> Interface; 00436 #endif 00437 00439 }; 00440 00441 00442 #ifndef OSG_SUPPORT_NO_GEO_INTERFACE 00443 typedef GeoPTypesPropertyDesc::Interface GeoPTypesInterface; 00444 #endif 00445 00451 struct GeoPLengthsPropertyDesc : public GeoPropertyDesc 00452 { 00453 /*---------------------------------------------------------------------*/ 00457 static const Char8 *getTypeName (void) { return "GeoPLengths"; } 00458 static const Char8 *getClassName(void) { return "GeoPLengthsProperty"; } 00459 static const Char8 *getGroupName(void) { return "GeoPLengths"; } 00460 00461 static InitContainerF getInitMethod(void) { return NULL; } 00462 00464 /*---------------------------------------------------------------------*/ 00468 typedef Attachment Inherited; 00469 typedef AttachmentPtr InheritedPtr; 00470 00471 typedef AttachmentPropertyDesc InheritedDesc; 00472 00473 typedef UInt32 GenericType; 00474 00475 #ifndef OSG_SUPPORT_NO_GEO_INTERFACE 00476 typedef GeoPropertyInterface<GeoPLengthsPropertyDesc> Interface; 00477 #endif 00478 00480 }; 00481 00482 #ifndef OSG_SUPPORT_NO_GEO_INTERFACE 00483 typedef GeoPLengthsPropertyDesc::Interface GeoPLengthsInterface; 00484 #endif 00485 00486 OSG_END_NAMESPACE 00487 00488 #include <OSGGeoPropertyInterface.inl> 00489 00490 #endif /* _OSGGEOPROPERTYINTERFACES_H_ */ 00491 00492 00493 00494 00495 00496 00497 00498 00499 00500 00501 00502 00503 00504
1.5.5