00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #pragma once
00013
00015 #include "nvutil/Assert.h"
00016 #include "nvmath/Quatf.h"
00017 #include "nvmath/Vec2f.h"
00018 #include "nvsg/Object.h"
00019
00020 namespace nvsg
00021 {
00022 class DirectedLight;
00023 class GeoNode;
00024 class Group;
00025 class LOD;
00026 class Material;
00027 class Node;
00028 class PointLight;
00029 class Quads;
00030 class SpotLight;
00031 class StateSet;
00032 class Switch;
00033 class TextureAttribute;
00034 class Transform;
00035 class Triangles;
00036 }
00037
00038 namespace vrml
00039 {
00040
00041
00042 #if ! defined( DOXYGEN_IGNORE )
00043
00044 class Object : public nvsg::Object
00045 {
00046 public:
00047 virtual ~Object() {}
00048 virtual const std::string & getType( void ) const;
00049 };
00050
00051 typedef bool SFBool;
00052 typedef nvmath::Vec3f SFColor;
00053 typedef std::vector<SFColor> MFColor;
00054 typedef float SFFloat;
00055 typedef std::vector<SFFloat> MFFloat;
00056 typedef char SFInt8;
00057 typedef int SFInt32;
00058 typedef std::vector<SFInt32> MFInt32;
00059 typedef vrml::Object * SFNode;
00060 typedef std::vector<SFNode> MFNode;
00061 typedef std::string SFString;
00062 typedef std::vector<SFString> MFString;
00063 typedef double SFTime;
00064 typedef std::vector<SFTime> MFTime;
00065 typedef nvmath::Vec2f SFVec2f;
00066 typedef std::vector<SFVec2f> MFVec2f;
00067 typedef nvmath::Vec3f SFVec3f;
00068 typedef std::vector<SFVec3f> MFVec3f;
00069
00070 class SFImage
00071 {
00072 public:
00073 SFImage();
00074 ~SFImage();
00075
00076 public:
00077 SFInt32 width;
00078 SFInt32 height;
00079 SFInt32 numComponents;
00080 SFInt8 * pixelsValues;
00081 };
00082
00083 class SFRotation : public nvmath::Vec4f
00084 {
00085 public:
00086 SFRotation() {}
00087 SFRotation( const SFVec3f &axis, SFFloat angle );
00088 SFRotation( const nvmath::Vec4f &v )
00089 : nvmath::Vec4f( v )
00090 {
00091 }
00092 };
00093 typedef std::vector<SFRotation> MFRotation;
00094
00095 class Geometry : public Object
00096 {
00097 public:
00098 virtual ~Geometry() {}
00099 virtual const std::string & getType( void ) const;
00100 };
00101
00102 class Group : public Object
00103 {
00104 public:
00105 Group();
00106 virtual ~Group();
00107 virtual const std::string & getType( void ) const;
00108
00109 public:
00110 MFNode children;
00111
00112 const nvsg::Group * pGroup;
00113 };
00114
00115 class Interpolator : public Object
00116 {
00117 public:
00118 virtual ~Interpolator() {}
00119 virtual const std::string & getType( void ) const;
00120
00121 public:
00122 MFFloat key;
00123 };
00124
00125 class Light : public Object
00126 {
00127 public:
00128 Light();
00129 virtual ~Light() {}
00130 virtual const std::string & getType( void ) const;
00131
00132 public:
00133 SFFloat ambientIntensity;
00134 SFColor color;
00135 SFFloat intensity;
00136 SFBool on;
00137 };
00138
00139 class Sensor : public Object
00140 {
00141 public:
00142 Sensor();
00143 virtual ~Sensor() {}
00144 virtual const std::string & getType( void ) const;
00145
00146 public:
00147 SFBool enabled;
00148 };
00149
00150 class Texture : public Object
00151 {
00152 public:
00153 Texture();
00154 virtual ~Texture() {}
00155 virtual const std::string & getType( void ) const;
00156
00157 public:
00158 SFBool repeatS;
00159 SFBool repeatT;
00160 };
00161
00162 class Anchor : public Group
00163 {
00164 public:
00165 virtual ~Anchor() {}
00166 virtual const std::string & getType( void ) const;
00167
00168 public:
00169 SFString description;
00170 MFString parameter;
00171 MFString url;
00172 };
00173
00174 class Appearance : public Object
00175 {
00176 public:
00177 Appearance();
00178 virtual ~Appearance();
00179 virtual const std::string & getType( void ) const;
00180
00181 public:
00182 SFNode material;
00183 SFNode texture;
00184 SFNode textureTransform;
00185
00186 const nvsg::StateSet * pStateSet;
00187 };
00188
00189 class AudioClip : public Object
00190 {
00191 public:
00192 AudioClip();
00193 virtual ~AudioClip() {}
00194 virtual const std::string & getType( void ) const;
00195
00196 public:
00197 SFString description;
00198 SFBool loop;
00199 SFFloat pitch;
00200 SFTime startTime;
00201 SFTime stopTime;
00202 MFString url;
00203 };
00204
00205 class Background : public Object
00206 {
00207 public:
00208 Background();
00209 virtual ~Background() {}
00210 virtual const std::string & getType( void ) const;
00211
00212 public:
00213 MFFloat groundAngle;
00214 MFColor groundColor;
00215 MFString backUrl;
00216 MFString bottomUrl;
00217 MFString frontUrl;
00218 MFString leftUrl;
00219 MFString rightUrl;
00220 MFString topUrl;
00221 MFFloat skyAngle;
00222 MFColor skyColor;
00223 };
00224
00225 class Billboard : public Group
00226 {
00227 public:
00228 Billboard();
00229 virtual ~Billboard() {}
00230 virtual const std::string & getType( void ) const;
00231
00232 public:
00233 SFVec3f axisOfRotation;
00234 };
00235
00236 class Box : public Geometry
00237 {
00238 public:
00239 Box();
00240 virtual ~Box();
00241 virtual const std::string & getType( void ) const;
00242
00243 public:
00244 SFVec3f size;
00245
00246 const nvsg::Triangles * pTriangles;
00247 const nvsg::Quads * pQuads;
00248 };
00249
00250 class Collision : public Group
00251 {
00252 public:
00253 Collision();
00254 virtual ~Collision();
00255 virtual const std::string & getType( void ) const;
00256
00257 public:
00258 SFBool collide;
00259 SFNode proxy;
00260 };
00261
00262 class Color : public Object
00263 {
00264 public:
00265 virtual ~Color() {}
00266 virtual const std::string & getType( void ) const;
00267
00268 public:
00269 MFColor color;
00270 };
00271
00272 class ColorInterpolator : public Interpolator
00273 {
00274 public:
00275 virtual ~ColorInterpolator() {}
00276 virtual const std::string & getType( void ) const;
00277
00278 public:
00279 MFColor keyValue;
00280 };
00281
00282 class Cone : public Geometry
00283 {
00284 public:
00285 Cone();
00286 virtual ~Cone() {}
00287 virtual const std::string & getType( void ) const;
00288
00289 public:
00290 SFBool bottom;
00291 SFFloat bottomRadius;
00292 SFFloat height;
00293 SFBool side;
00294 };
00295
00296 class CoordinateInterpolator : public Interpolator
00297 {
00298 public:
00299 virtual ~CoordinateInterpolator() {}
00300 virtual const std::string & getType( void ) const;
00301
00302 public:
00303 MFVec3f keyValue;
00304 };
00305
00306 class Coordinate : public Object
00307 {
00308 public:
00309 Coordinate();
00310 virtual ~Coordinate();
00311 virtual const std::string & getType( void ) const;
00312
00313 public:
00314 MFVec3f point;
00315
00316 CoordinateInterpolator * set_point;
00317 };
00318
00319 class Cylinder : public Geometry
00320 {
00321 public:
00322 Cylinder();
00323 virtual ~Cylinder() {}
00324 virtual const std::string & getType( void ) const;
00325
00326 public:
00327 SFBool bottom;
00328 SFFloat height;
00329 SFFloat radius;
00330 SFBool side;
00331 SFBool top;
00332 };
00333
00334 class CylinderSensor : public Sensor
00335 {
00336 public:
00337 CylinderSensor();
00338 virtual ~CylinderSensor() {}
00339 virtual const std::string & getType( void ) const;
00340
00341 public:
00342 SFBool autoOffset;
00343 SFFloat diskAngle;
00344 SFFloat maxAngle;
00345 SFFloat minAngle;
00346 SFFloat offset;
00347 };
00348
00349 class DirectionalLight : public Light
00350 {
00351 public:
00352 DirectionalLight();
00353 virtual ~DirectionalLight();
00354 virtual const std::string & getType( void ) const;
00355
00356 public:
00357 SFVec3f direction;
00358
00359 const nvsg::DirectedLight * pDirectedLight;
00360 };
00361
00362 class ElevationGrid : public Geometry
00363 {
00364 public:
00365 ElevationGrid();
00366 virtual ~ElevationGrid();
00367 virtual const std::string & getType( void ) const;
00368
00369 public:
00370 SFNode color;
00371 SFNode normal;
00372 SFNode texCoord;
00373 MFFloat height;
00374 SFBool ccw;
00375 SFBool colorPerVertex;
00376 SFFloat creaseAngle;
00377 SFBool normalPerVertex;
00378 SFBool solid;
00379 SFInt32 xDimension;
00380 SFFloat xSpacing;
00381 SFInt32 zDimension;
00382 SFFloat zSpacing;
00383
00384 const nvsg::Triangles * pTriangles;
00385 const nvsg::Quads * pQuads;
00386 };
00387
00388 class Extrusion : public Geometry
00389 {
00390 public:
00391 Extrusion();
00392 virtual ~Extrusion() {}
00393 virtual const std::string & getType( void ) const;
00394
00395 public:
00396 SFBool beginCap;
00397 SFBool ccw;
00398 SFBool convex;
00399 SFFloat creaseAngle;
00400 MFVec2f crossSection;
00401 SFBool endCap;
00402 MFRotation orientation;
00403 MFVec2f scale;
00404 SFBool solid;
00405 MFVec3f spine;
00406 };
00407
00408 class Fog : public Object
00409 {
00410 public:
00411 Fog();
00412 virtual ~Fog() {}
00413 virtual const std::string & getType( void ) const;
00414
00415 public:
00416 SFColor color;
00417 SFString fogType;
00418 SFFloat visibilityRange;
00419 };
00420
00421 class FontStyle : public Object
00422 {
00423 public:
00424 FontStyle();
00425 virtual ~FontStyle() {}
00426 virtual const std::string & getType( void ) const;
00427
00428 public:
00429 MFString family;
00430 SFBool horizontal;
00431 MFString justify;
00432 SFString language;
00433 SFBool leftToRight;
00434 SFFloat size;
00435 SFFloat spacing;
00436 SFString style;
00437 SFBool topToBottom;
00438 };
00439
00440 class ImageTexture : public Texture
00441 {
00442 public:
00443 ImageTexture();
00444 virtual ~ImageTexture();
00445 virtual const std::string & getType( void ) const;
00446
00447 public:
00448 MFString url;
00449
00450 const nvsg::TextureAttribute * pTextureAttribute;
00451 };
00452
00453 class IndexedFaceSet : public Geometry
00454 {
00455 public:
00456 IndexedFaceSet();
00457 virtual ~IndexedFaceSet();
00458 virtual const std::string & getType( void ) const;
00459
00460 public:
00461 SFNode color;
00462 SFNode coord;
00463 SFNode normal;
00464 SFNode texCoord;
00465 SFBool ccw;
00466 MFInt32 colorIndex;
00467 SFBool colorPerVertex;
00468 SFBool convex;
00469 MFInt32 coordIndex;
00470 SFFloat creaseAngle;
00471 MFInt32 normalIndex;
00472 SFBool normalPerVertex;
00473 SFBool solid;
00474 MFInt32 texCoordIndex;
00475
00476 const nvsg::Triangles * pTriangles;
00477 const nvsg::Quads * pQuads;
00478 };
00479
00480 class IndexedLineSet : public Geometry
00481 {
00482 public:
00483 IndexedLineSet();
00484 virtual ~IndexedLineSet();
00485 virtual const std::string & getType( void ) const;
00486
00487 public:
00488 SFNode color;
00489 SFNode coord;
00490 MFInt32 colorIndex;
00491 SFBool colorPerVertex;
00492 MFInt32 coordIndex;
00493 };
00494
00495 class Inline : public Object
00496 {
00497 public:
00498 Inline();
00499 virtual ~Inline();
00500 virtual const std::string & getType( void ) const;
00501
00502 public:
00503 MFString url;
00504 SFVec3f bboxCenter;
00505 SFVec3f bboxSize;
00506
00507 const nvsg::Node * pNode;
00508 };
00509
00510 class LOD : public Group
00511 {
00512 public:
00513 LOD();
00514 virtual ~LOD();
00515 virtual const std::string & getType( void ) const;
00516
00517 public:
00518 SFVec3f center;
00519 MFFloat range;
00520
00521 const nvsg::LOD * pLOD;
00522 };
00523
00524 class Material : public Object
00525 {
00526 public:
00527 Material();
00528 virtual ~Material();
00529 virtual const std::string & getType( void ) const;
00530
00531 public:
00532 SFFloat ambientIntensity;
00533 SFColor diffuseColor;
00534 SFColor emissiveColor;
00535 SFFloat shininess;
00536 SFColor specularColor;
00537 SFFloat transparency;
00538
00539 const nvsg::Material *pMaterial;
00540 };
00541
00542 class MovieTexture : public Texture
00543 {
00544 public:
00545 MovieTexture();
00546 virtual ~MovieTexture() {}
00547 virtual const std::string & getType( void ) const;
00548
00549 public:
00550 SFBool loop;
00551 SFFloat speed;
00552 SFTime startTime;
00553 SFTime stopTime;
00554 MFString url;
00555 };
00556
00557 class NavigationInfo : public Object
00558 {
00559 public:
00560 NavigationInfo();
00561 virtual ~NavigationInfo() {}
00562 virtual const std::string & getType( void ) const;
00563
00564 public:
00565 MFFloat avatarSize;
00566 SFBool headlight;
00567 SFFloat speed;
00568 MFString type;
00569 SFFloat visibilityLimit;
00570 };
00571
00572 class NormalInterpolator : public Interpolator
00573 {
00574 public:
00575 virtual ~NormalInterpolator() {}
00576 virtual const std::string & getType( void ) const;
00577
00578 public:
00579 MFVec3f keyValue;
00580 };
00581
00582 class Normal : public Object
00583 {
00584 public:
00585 Normal();
00586 virtual ~Normal();
00587 virtual const std::string & getType( void ) const;
00588
00589 public:
00590 MFVec3f vector;
00591
00592 NormalInterpolator * set_vector;
00593 };
00594
00595 class OrientationInterpolator : public Interpolator
00596 {
00597 public:
00598 virtual ~OrientationInterpolator() {}
00599 virtual const std::string & getType( void ) const;
00600
00601 public:
00602 MFRotation keyValue;
00603
00604 std::vector<nvmath::Quatf> keyValueQuatf;
00605 };
00606
00607 class PixelTexture : public Texture
00608 {
00609 public:
00610 PixelTexture();
00611 virtual ~PixelTexture() {}
00612 virtual const std::string & getType( void ) const;
00613
00614 public:
00615 SFImage image;
00616 };
00617
00618 class PlaneSensor : public Sensor
00619 {
00620 public:
00621 PlaneSensor();
00622 virtual ~PlaneSensor() {}
00623 virtual const std::string & getType( void ) const;
00624
00625 public:
00626 SFBool autoOffset;
00627 SFVec2f maxPosition;
00628 SFVec2f minPosition;
00629 SFVec3f offset;
00630 };
00631
00632 class PointLight : public Light
00633 {
00634 public:
00635 PointLight();
00636 virtual ~PointLight();
00637 virtual const std::string & getType( void ) const;
00638
00639 public:
00640 SFVec3f attenuation;
00641 SFVec3f location;
00642 SFFloat radius;
00643
00644 const nvsg::PointLight * pPointLight;
00645 };
00646
00647 class PointSet : public Object
00648 {
00649 public:
00650 PointSet();
00651 virtual ~PointSet();
00652 virtual const std::string & getType( void ) const;
00653
00654 public:
00655 SFNode color;
00656 SFNode coord;
00657 };
00658
00659 class PositionInterpolator : public Interpolator
00660 {
00661 public:
00662 virtual ~PositionInterpolator() {}
00663 virtual const std::string & getType( void ) const;
00664
00665 public:
00666 MFVec3f keyValue;
00667 };
00668
00669 class ProximitySensor : public Sensor
00670 {
00671 public:
00672 ProximitySensor();
00673 virtual ~ProximitySensor() {}
00674 virtual const std::string & getType( void ) const;
00675
00676 public:
00677 SFVec3f center;
00678 SFVec3f size;
00679 };
00680
00681 class ScalarInterpolator : public Interpolator
00682 {
00683 public:
00684 virtual ~ScalarInterpolator() {}
00685 virtual const std::string & getType( void ) const;
00686
00687 public:
00688 MFFloat keyValue;
00689 };
00690
00691 class Script : public Object
00692 {
00693 public:
00694 Script();
00695 virtual ~Script() {}
00696 virtual const std::string & getType( void ) const;
00697
00698 public:
00699 MFString url;
00700 SFBool directOutput;
00701 SFBool mustEvaluate;
00702 };
00703
00704 class Shape : public Object
00705 {
00706 public:
00707 Shape();
00708 virtual ~Shape();
00709 virtual const std::string & getType( void ) const;
00710
00711 public:
00712 SFNode appearance;
00713 SFNode geometry;
00714
00715 const nvsg::GeoNode * pGeoNode;
00716 };
00717
00718 class Sound : public Object
00719 {
00720 public:
00721 Sound();
00722 virtual ~Sound();
00723 virtual const std::string & getType( void ) const;
00724
00725 public:
00726 SFVec3f direction;
00727 SFFloat intensity;
00728 SFVec3f location;
00729 SFFloat maxBack;
00730 SFFloat maxFront;
00731 SFFloat minBack;
00732 SFFloat minFront;
00733 SFFloat priority;
00734 SFNode source;
00735 SFBool spatialize;
00736 };
00737
00738 class Sphere : public Geometry
00739 {
00740 public:
00741 Sphere();
00742 virtual ~Sphere() {}
00743 virtual const std::string & getType( void ) const;
00744
00745 public:
00746 SFFloat radius;
00747 };
00748
00749 class SphereSensor : public Sensor
00750 {
00751 public:
00752 SphereSensor();
00753 virtual ~SphereSensor() {}
00754 virtual const std::string & getType( void ) const;
00755
00756 public:
00757 SFBool autoOffset;
00758 SFRotation offset;
00759 };
00760
00761 class SpotLight : public Light
00762 {
00763 public:
00764 SpotLight();
00765 virtual ~SpotLight();
00766 virtual const std::string & getType( void ) const;
00767
00768 public:
00769 SFVec3f attenuation;
00770 SFFloat beamWidth;
00771 SFFloat cutOffAngle;
00772 SFVec3f direction;
00773 SFVec3f location;
00774 SFFloat radius;
00775
00776 const nvsg::SpotLight * pSpotLight;
00777 };
00778
00779 class Switch : public Group
00780 {
00781 public:
00782 Switch();
00783 virtual ~Switch();
00784 virtual const std::string & getType( void ) const;
00785
00786 public:
00787 SFInt32 whichChoice;
00788
00789 const nvsg::Switch * pSwitch;
00790 };
00791
00792 class Text : public Geometry
00793 {
00794 public:
00795 Text();
00796 virtual ~Text();
00797 virtual const std::string & getType( void ) const;
00798
00799 public:
00800 MFString string;
00801 SFNode fontStyle;
00802 MFFloat length;
00803 SFFloat maxExtent;
00804 };
00805
00806 class TextureCoordinate : public Object
00807 {
00808 public:
00809 virtual ~TextureCoordinate() {}
00810 virtual const std::string & getType( void ) const;
00811
00812 public:
00813 MFVec2f point;
00814 };
00815
00816 class TextureTransform : public Object
00817 {
00818 public:
00819 TextureTransform();
00820 virtual ~TextureTransform() {}
00821 virtual const std::string & getType( void ) const;
00822
00823 public:
00824 SFVec2f center;
00825 SFFloat rotation;
00826 SFVec2f scale;
00827 SFVec2f translation;
00828 };
00829
00830 class TimeSensor : public Sensor
00831 {
00832 public:
00833 TimeSensor();
00834 virtual ~TimeSensor() {}
00835 virtual const std::string & getType( void ) const;
00836
00837 public:
00838 SFTime cycleInterval;
00839 SFBool loop;
00840 SFTime startTime;
00841 SFTime stopTime;
00842 };
00843
00844 class TouchSensor : public Sensor
00845 {
00846 public:
00847 virtual ~TouchSensor() {}
00848 virtual const std::string & getType( void ) const;
00849 };
00850
00851 class Transform : public Group
00852 {
00853 public:
00854 Transform();
00855 virtual ~Transform();
00856 virtual const std::string & getType( void ) const;
00857
00858 public:
00859 SFVec3f center;
00860 SFRotation rotation;
00861 SFVec3f scale;
00862 SFRotation scaleOrientation;
00863 SFVec3f translation;
00864
00865 PositionInterpolator * set_center;
00866 OrientationInterpolator * set_rotation;
00867 PositionInterpolator * set_scale;
00868 PositionInterpolator * set_translation;
00869
00870 const nvsg::Transform * pTransform;
00871 };
00872
00873 class Viewpoint : public Object
00874 {
00875 public:
00876 Viewpoint();
00877 virtual ~Viewpoint();
00878 virtual const std::string & getType( void ) const;
00879
00880 public:
00881 SFFloat fieldOfView;
00882 SFBool jump;
00883 SFRotation orientation;
00884 SFVec3f position;
00885 SFString description;
00886
00887 OrientationInterpolator * set_orientation;
00888 PositionInterpolator * set_position;
00889 };
00890
00891 class VisibilitySensor : public Sensor
00892 {
00893 public:
00894 VisibilitySensor();
00895 virtual ~VisibilitySensor() {}
00896 virtual const std::string & getType( void ) const;
00897
00898 public:
00899 SFVec3f center;
00900 SFVec3f size;
00901 };
00902
00903 class WorldInfo : public Object
00904 {
00905 public:
00906 virtual ~WorldInfo() {}
00907 virtual const std::string & getType( void ) const;
00908
00909 public:
00910 MFString info;
00911 SFString title;
00912 };
00913
00914
00915 class ROUTE
00916 {
00917 public:
00918 ROUTE();
00919 ~ROUTE();
00920
00921 public:
00922 SFNode fromNode;
00923 std::string fromAction;
00924 SFNode toNode;
00925 std::string toAction;
00926 };
00927
00928
00929 template <typename T> inline bool is( const Object *p )
00930 {
00931 return( dynamic_cast<const T *>( p ) != NULL );
00932 }
00933
00934 #endif // DOXYGEN_IGNORE
00935
00936 }