1 /* 2 Open Asset Import Library (assimp) 3 ---------------------------------------------------------------------- 4 5 Copyright (c) 2006-2017, assimp team 6 7 All rights reserved. 8 9 Redistribution and use of this software in source and binary forms, 10 with or without modification, are permitted provided that the 11 following conditions are met: 12 13 * Redistributions of source code must retain the above 14 copyright notice, this list of conditions and the 15 following disclaimer. 16 17 * Redistributions in binary form must reproduce the above 18 copyright notice, this list of conditions and the 19 following disclaimer in the documentation and/or other 20 materials provided with the distribution. 21 22 * Neither the name of the assimp team, nor the names of its 23 contributors may be used to endorse or promote products 24 derived from this software without specific prior 25 written permission of the assimp team. 26 27 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 30 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 31 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 32 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 33 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 34 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 35 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 36 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 37 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38 39 ---------------------------------------------------------------------- 40 */ 41 /// \file X3DImporter_Node.hpp 42 /// \brief Elements of scene graph. 43 /// \date 2015-2016 44 /// \author smal.root@gmail.com 45 46 #ifndef INCLUDED_AI_X3D_IMPORTER_NODE_H 47 #define INCLUDED_AI_X3D_IMPORTER_NODE_H 48 49 // Header files, Assimp. 50 #include <assimp/scene.h> 51 #include <assimp/types.h> 52 53 // Header files, stdlib. 54 #include <list> 55 #include <vector> 56 #include <string> 57 58 /// \class CX3DImporter_NodeElement 59 /// Base class for elements of nodes. 60 class CX3DImporter_NodeElement 61 { 62 /***********************************************/ 63 /******************** Types ********************/ 64 /***********************************************/ 65 66 public: 67 68 /// \enum EType 69 /// Define what data type contain node element. 70 enum EType 71 { 72 ENET_Group, ///< Element has type "Group". 73 ENET_MetaBoolean, ///< Element has type "Metadata boolean". 74 ENET_MetaDouble, ///< Element has type "Metadata double". 75 ENET_MetaFloat, ///< Element has type "Metadata float". 76 ENET_MetaInteger, ///< Element has type "Metadata integer". 77 ENET_MetaSet, ///< Element has type "Metadata set". 78 ENET_MetaString, ///< Element has type "Metadata string". 79 ENET_Arc2D, ///< Element has type "Arc2D". 80 ENET_ArcClose2D, ///< Element has type "ArcClose2D". 81 ENET_Circle2D, ///< Element has type "Circle2D". 82 ENET_Disk2D, ///< Element has type "Disk2D". 83 ENET_Polyline2D, ///< Element has type "Polyline2D". 84 ENET_Polypoint2D, ///< Element has type "Polypoint2D". 85 ENET_Rectangle2D, ///< Element has type "Rectangle2D". 86 ENET_TriangleSet2D, ///< Element has type "TriangleSet2D". 87 ENET_Box, ///< Element has type "Box". 88 ENET_Cone, ///< Element has type "Cone". 89 ENET_Cylinder, ///< Element has type "Cylinder". 90 ENET_Sphere, ///< Element has type "Sphere". 91 ENET_ElevationGrid, ///< Element has type "ElevationGrid". 92 ENET_Extrusion, ///< Element has type "Extrusion". 93 ENET_Coordinate, ///< Element has type "Coordinate". 94 ENET_Normal, ///< Element has type "Normal". 95 ENET_TextureCoordinate, ///< Element has type "TextureCoordinate". 96 ENET_IndexedFaceSet, ///< Element has type "IndexedFaceSet". 97 ENET_IndexedLineSet, ///< Element has type "IndexedLineSet". 98 ENET_IndexedTriangleSet, ///< Element has type "IndexedTriangleSet". 99 ENET_IndexedTriangleFanSet, ///< Element has type "IndexedTriangleFanSet". 100 ENET_IndexedTriangleStripSet,///< Element has type "IndexedTriangleStripSet". 101 ENET_LineSet, ///< Element has type "LineSet". 102 ENET_PointSet, ///< Element has type "PointSet". 103 ENET_TriangleSet, ///< Element has type "TriangleSet". 104 ENET_TriangleFanSet, ///< Element has type "TriangleFanSet". 105 ENET_TriangleStripSet, ///< Element has type "TriangleStripSet". 106 ENET_Color, ///< Element has type "Color". 107 ENET_ColorRGBA, ///< Element has type "ColorRGBA". 108 ENET_Shape, ///< Element has type "Shape". 109 ENET_Appearance, ///< Element has type "Appearance". 110 ENET_Material, ///< Element has type "Material". 111 ENET_ImageTexture, ///< Element has type "ImageTexture". 112 ENET_TextureTransform, ///< Element has type "TextureTransform". 113 ENET_DirectionalLight, ///< Element has type "DirectionalLight". 114 ENET_PointLight, ///< Element has type "PointLight". 115 ENET_SpotLight, ///< Element has type "SpotLight". 116 117 ENET_Invalid ///< Element has invalid type and possible contain invalid data. 118 }; 119 120 /***********************************************/ 121 /****************** Constants ******************/ 122 /***********************************************/ 123 124 public: 125 126 const EType Type; 127 128 /***********************************************/ 129 /****************** Variables ******************/ 130 /***********************************************/ 131 132 public: 133 134 std::string ID;///< ID of the element. Can be empty. In X3D synonym for "ID" attribute. 135 CX3DImporter_NodeElement* Parent;///< Parent element. If nullptr then this node is root. 136 std::list<CX3DImporter_NodeElement*> Child;///< Child elements. 137 138 /***********************************************/ 139 /****************** Functions ******************/ 140 /***********************************************/ 141 142 /// @brief The destructor, virtual. ~CX3DImporter_NodeElement()143 virtual ~CX3DImporter_NodeElement() { 144 // empty 145 } 146 147 private: 148 /// Disabled copy constructor. 149 CX3DImporter_NodeElement(const CX3DImporter_NodeElement& pNodeElement); 150 151 /// Disabled assign operator. 152 CX3DImporter_NodeElement& operator=(const CX3DImporter_NodeElement& pNodeElement); 153 154 /// Disabled default constructor. 155 CX3DImporter_NodeElement(); 156 157 protected: 158 /// In constructor inheritor must set element type. 159 /// \param [in] pType - element type. 160 /// \param [in] pParent - parent element. CX3DImporter_NodeElement(const EType pType,CX3DImporter_NodeElement * pParent)161 CX3DImporter_NodeElement(const EType pType, CX3DImporter_NodeElement* pParent) 162 : Type(pType), Parent(pParent) 163 {} 164 };// class IX3DImporter_NodeElement 165 166 /// \class CX3DImporter_NodeElement_Group 167 /// Class that define grouping node. Define transformation matrix for children. 168 /// Also can select which child will be kept and others are removed. 169 class CX3DImporter_NodeElement_Group : public CX3DImporter_NodeElement 170 { 171 /***********************************************/ 172 /****************** Variables ******************/ 173 /***********************************************/ 174 175 public: 176 177 aiMatrix4x4 Transformation;///< Transformation matrix. 178 179 /// \var bool Static 180 /// As you know node elements can use already defined node elements when attribute "USE" is defined. 181 /// Standard search when looking for an element in the whole scene graph, existing at this moment. 182 /// If a node is marked as static, the children(or lower) can not search for elements in the nodes upper then static. 183 bool Static; 184 185 bool UseChoice;///< Flag: if true then use number from \ref Choice to choose what the child will be kept. 186 int32_t Choice;///< Number of the child which will be kept. 187 188 /***********************************************/ 189 /****************** Functions ******************/ 190 /***********************************************/ 191 192 private: 193 194 /// \fn CX3DImporter_NodeElement_Group(const CX3DImporter_NodeElement_Group& pNode) 195 /// Disabled copy constructor. 196 CX3DImporter_NodeElement_Group(const CX3DImporter_NodeElement_Group& pNode); 197 198 /// \fn CX3DImporter_NodeElement_Group& operator=(const CX3DImporter_NodeElement_Group& pNode) 199 /// Disabled assign operator. 200 CX3DImporter_NodeElement_Group& operator=(const CX3DImporter_NodeElement_Group& pNode); 201 202 /// \fn CX3DImporter_NodeElement_Group() 203 /// Disabled default constructor. 204 CX3DImporter_NodeElement_Group(); 205 206 public: 207 208 /// \fn CX3DImporter_NodeElement_Group(CX3DImporter_NodeElement_Group* pParent, const bool pStatic = false) 209 /// Constructor. 210 /// \param [in] pParent - pointer to parent node. 211 /// \param [in] pStatic - static node flag. CX3DImporter_NodeElement_Group(CX3DImporter_NodeElement * pParent,const bool pStatic=false)212 CX3DImporter_NodeElement_Group(CX3DImporter_NodeElement* pParent, const bool pStatic = false) 213 : CX3DImporter_NodeElement(ENET_Group, pParent), Static(pStatic), UseChoice(false) 214 {} 215 216 };// class CX3DImporter_NodeElement_Group 217 218 /// \class CX3DImporter_NodeElement_Meta 219 /// This struct describe metavalue. 220 class CX3DImporter_NodeElement_Meta : public CX3DImporter_NodeElement 221 { 222 /***********************************************/ 223 /****************** Variables ******************/ 224 /***********************************************/ 225 226 public: 227 228 std::string Name;///< Name of metadata object. 229 /// \var std::string Reference 230 /// If provided, it identifies the metadata standard or other specification that defines the name field. If the reference field is not provided or is 231 /// empty, the meaning of the name field is considered implicit to the characters in the string. 232 std::string Reference; 233 234 /***********************************************/ 235 /****************** Functions ******************/ 236 /***********************************************/ 237 238 private: 239 240 /// \fn CX3DImporter_NodeElement_Meta(const CX3DImporter_NodeElement_Meta& pNode) 241 /// Disabled copy constructor. 242 CX3DImporter_NodeElement_Meta(const CX3DImporter_NodeElement_Meta& pNode); 243 244 /// \fn CX3DImporter_NodeElement_Meta& operator=(const CX3DImporter_NodeElement_Meta& pNode) 245 /// Disabled assign operator. 246 CX3DImporter_NodeElement_Meta& operator=(const CX3DImporter_NodeElement_Meta& pNode); 247 248 /// \fn CX3DImporter_NodeElement_Meta() 249 /// Disabled default constructor. 250 CX3DImporter_NodeElement_Meta(); 251 252 public: 253 254 /// \fn CX3DImporter_NodeElement_Meta(const EType pType, CX3DImporter_NodeElement* pParent) 255 /// In constructor inheritor must set element type. 256 /// \param [in] pType - element type. 257 /// \param [in] pParent - pointer to parent node. CX3DImporter_NodeElement_Meta(const EType pType,CX3DImporter_NodeElement * pParent)258 CX3DImporter_NodeElement_Meta(const EType pType, CX3DImporter_NodeElement* pParent) 259 : CX3DImporter_NodeElement(pType, pParent) 260 {} 261 262 };// class CX3DImporter_NodeElement_Meta 263 264 /// \struct CX3DImporter_NodeElement_MetaBoolean 265 /// This struct describe metavalue of type boolean. 266 struct CX3DImporter_NodeElement_MetaBoolean : public CX3DImporter_NodeElement_Meta 267 { 268 std::vector<bool> Value;///< Stored value. 269 270 /// \fn CX3DImporter_NodeElement_MetaBoolean(CX3DImporter_NodeElement* pParent) 271 /// Constructor 272 /// \param [in] pParent - pointer to parent node. CX3DImporter_NodeElement_MetaBooleanCX3DImporter_NodeElement_MetaBoolean273 CX3DImporter_NodeElement_MetaBoolean(CX3DImporter_NodeElement* pParent) 274 : CX3DImporter_NodeElement_Meta(ENET_MetaBoolean, pParent) 275 {} 276 277 };// struct CX3DImporter_NodeElement_MetaBoolean 278 279 /// \struct CX3DImporter_NodeElement_MetaDouble 280 /// This struct describe metavalue of type double. 281 struct CX3DImporter_NodeElement_MetaDouble : public CX3DImporter_NodeElement_Meta 282 { 283 std::vector<double> Value;///< Stored value. 284 285 /// \fn CX3DImporter_NodeElement_MetaDouble(CX3DImporter_NodeElement* pParent) 286 /// Constructor 287 /// \param [in] pParent - pointer to parent node. CX3DImporter_NodeElement_MetaDoubleCX3DImporter_NodeElement_MetaDouble288 CX3DImporter_NodeElement_MetaDouble(CX3DImporter_NodeElement* pParent) 289 : CX3DImporter_NodeElement_Meta(ENET_MetaDouble, pParent) 290 {} 291 292 };// struct CX3DImporter_NodeElement_MetaDouble 293 294 /// \struct CX3DImporter_NodeElement_MetaFloat 295 /// This struct describe metavalue of type float. 296 struct CX3DImporter_NodeElement_MetaFloat : public CX3DImporter_NodeElement_Meta 297 { 298 std::vector<float> Value;///< Stored value. 299 300 /// \fn CX3DImporter_NodeElement_MetaFloat(CX3DImporter_NodeElement* pParent) 301 /// Constructor 302 /// \param [in] pParent - pointer to parent node. CX3DImporter_NodeElement_MetaFloatCX3DImporter_NodeElement_MetaFloat303 CX3DImporter_NodeElement_MetaFloat(CX3DImporter_NodeElement* pParent) 304 : CX3DImporter_NodeElement_Meta(ENET_MetaFloat, pParent) 305 {} 306 307 };// struct CX3DImporter_NodeElement_MetaFloat 308 309 /// \struct CX3DImporter_NodeElement_MetaInteger 310 /// This struct describe metavalue of type integer. 311 struct CX3DImporter_NodeElement_MetaInteger : public CX3DImporter_NodeElement_Meta 312 { 313 std::vector<int32_t> Value;///< Stored value. 314 315 /// \fn CX3DImporter_NodeElement_MetaInteger(CX3DImporter_NodeElement* pParent) 316 /// Constructor 317 /// \param [in] pParent - pointer to parent node. CX3DImporter_NodeElement_MetaIntegerCX3DImporter_NodeElement_MetaInteger318 CX3DImporter_NodeElement_MetaInteger(CX3DImporter_NodeElement* pParent) 319 : CX3DImporter_NodeElement_Meta(ENET_MetaInteger, pParent) 320 {} 321 322 };// struct CX3DImporter_NodeElement_MetaInteger 323 324 /// \struct CX3DImporter_NodeElement_MetaSet 325 /// This struct describe container for metaobjects. 326 struct CX3DImporter_NodeElement_MetaSet : public CX3DImporter_NodeElement_Meta 327 { 328 std::list<CX3DImporter_NodeElement_Meta> Value;///< Stored value. 329 330 /// \fn CX3DImporter_NodeElement_MetaSet(CX3DImporter_NodeElement* pParent) 331 /// Constructor 332 /// \param [in] pParent - pointer to parent node. CX3DImporter_NodeElement_MetaSetCX3DImporter_NodeElement_MetaSet333 CX3DImporter_NodeElement_MetaSet(CX3DImporter_NodeElement* pParent) 334 : CX3DImporter_NodeElement_Meta(ENET_MetaSet, pParent) 335 {} 336 337 };// struct CX3DImporter_NodeElement_MetaSet 338 339 /// \struct CX3DImporter_NodeElement_MetaString 340 /// This struct describe metavalue of type string. 341 struct CX3DImporter_NodeElement_MetaString : public CX3DImporter_NodeElement_Meta 342 { 343 std::list<std::string> Value;///< Stored value. 344 345 /// \fn CX3DImporter_NodeElement_MetaString(CX3DImporter_NodeElement* pParent) 346 /// Constructor 347 /// \param [in] pParent - pointer to parent node. CX3DImporter_NodeElement_MetaStringCX3DImporter_NodeElement_MetaString348 CX3DImporter_NodeElement_MetaString(CX3DImporter_NodeElement* pParent) 349 : CX3DImporter_NodeElement_Meta(ENET_MetaString, pParent) 350 {} 351 352 };// struct CX3DImporter_NodeElement_MetaString 353 354 /// \struct CX3DImporter_NodeElement_Color 355 /// This struct hold <Color> value. 356 struct CX3DImporter_NodeElement_Color : public CX3DImporter_NodeElement 357 { 358 std::list<aiColor3D> Value;///< Stored value. 359 360 /// \fn CX3DImporter_NodeElement_Color(CX3DImporter_NodeElement* pParent) 361 /// Constructor 362 /// \param [in] pParent - pointer to parent node. CX3DImporter_NodeElement_ColorCX3DImporter_NodeElement_Color363 CX3DImporter_NodeElement_Color(CX3DImporter_NodeElement* pParent) 364 : CX3DImporter_NodeElement(ENET_Color, pParent) 365 {} 366 367 };// struct CX3DImporter_NodeElement_Color 368 369 /// \struct CX3DImporter_NodeElement_ColorRGBA 370 /// This struct hold <ColorRGBA> value. 371 struct CX3DImporter_NodeElement_ColorRGBA : public CX3DImporter_NodeElement 372 { 373 std::list<aiColor4D> Value;///< Stored value. 374 375 /// \fn CX3DImporter_NodeElement_ColorRGBA(CX3DImporter_NodeElement* pParent) 376 /// Constructor 377 /// \param [in] pParent - pointer to parent node. CX3DImporter_NodeElement_ColorRGBACX3DImporter_NodeElement_ColorRGBA378 CX3DImporter_NodeElement_ColorRGBA(CX3DImporter_NodeElement* pParent) 379 : CX3DImporter_NodeElement(ENET_ColorRGBA, pParent) 380 {} 381 382 };// struct CX3DImporter_NodeElement_ColorRGBA 383 384 /// \struct CX3DImporter_NodeElement_Coordinate 385 /// This struct hold <Coordinate> value. 386 struct CX3DImporter_NodeElement_Coordinate : public CX3DImporter_NodeElement 387 { 388 std::list<aiVector3D> Value;///< Stored value. 389 390 /// \fn CX3DImporter_NodeElement_Coordinate(CX3DImporter_NodeElement* pParent) 391 /// Constructor 392 /// \param [in] pParent - pointer to parent node. CX3DImporter_NodeElement_CoordinateCX3DImporter_NodeElement_Coordinate393 CX3DImporter_NodeElement_Coordinate(CX3DImporter_NodeElement* pParent) 394 : CX3DImporter_NodeElement(ENET_Coordinate, pParent) 395 {} 396 397 };// struct CX3DImporter_NodeElement_Coordinate 398 399 /// \struct CX3DImporter_NodeElement_Normal 400 /// This struct hold <Normal> value. 401 struct CX3DImporter_NodeElement_Normal : public CX3DImporter_NodeElement 402 { 403 std::list<aiVector3D> Value;///< Stored value. 404 405 /// \fn CX3DImporter_NodeElement_Normal(CX3DImporter_NodeElement* pParent) 406 /// Constructor 407 /// \param [in] pParent - pointer to parent node. CX3DImporter_NodeElement_NormalCX3DImporter_NodeElement_Normal408 CX3DImporter_NodeElement_Normal(CX3DImporter_NodeElement* pParent) 409 : CX3DImporter_NodeElement(ENET_Normal, pParent) 410 {} 411 412 };// struct CX3DImporter_NodeElement_Normal 413 414 /// \struct CX3DImporter_NodeElement_TextureCoordinate 415 /// This struct hold <TextureCoordinate> value. 416 struct CX3DImporter_NodeElement_TextureCoordinate : public CX3DImporter_NodeElement 417 { 418 std::list<aiVector2D> Value;///< Stored value. 419 420 /// \fn CX3DImporter_NodeElement_TextureCoordinate(CX3DImporter_NodeElement* pParent) 421 /// Constructor 422 /// \param [in] pParent - pointer to parent node. CX3DImporter_NodeElement_TextureCoordinateCX3DImporter_NodeElement_TextureCoordinate423 CX3DImporter_NodeElement_TextureCoordinate(CX3DImporter_NodeElement* pParent) 424 : CX3DImporter_NodeElement(ENET_TextureCoordinate, pParent) 425 {} 426 427 };// struct CX3DImporter_NodeElement_TextureCoordinate 428 429 /// \class CX3DImporter_NodeElement_Geometry2D 430 /// Two-dimensional figure. 431 class CX3DImporter_NodeElement_Geometry2D : public CX3DImporter_NodeElement 432 { 433 /***********************************************/ 434 /****************** Variables ******************/ 435 /***********************************************/ 436 437 public: 438 439 std::list<aiVector3D> Vertices;///< Vertices list. 440 size_t NumIndices;///< Number of indices in one face. 441 bool Solid;///< Flag: if true then render must use back-face culling, else render must draw both sides of object. 442 443 /***********************************************/ 444 /****************** Functions ******************/ 445 /***********************************************/ 446 447 private: 448 449 /// \fn CX3DImporter_NodeElement_Geometry2D(const CX3DImporter_NodeElement_Geometry2D& pNode) 450 /// Disabled copy constructor. 451 CX3DImporter_NodeElement_Geometry2D(const CX3DImporter_NodeElement_Geometry2D& pNode); 452 453 /// \fn CX3DImporter_NodeElement_Geometry2D& operator=(const CX3DImporter_NodeElement_Geometry2D& pNode) 454 /// Disabled assign operator. 455 CX3DImporter_NodeElement_Geometry2D& operator=(const CX3DImporter_NodeElement_Geometry2D& pNode); 456 457 public: 458 459 /// \fn CX3DImporter_NodeElement_Geometry2D(const EType pType, CX3DImporter_NodeElement* pParent) 460 /// Constructor. 461 /// \param [in] pParent - pointer to parent node. 462 /// \param [in] pType - type of geometry object. CX3DImporter_NodeElement_Geometry2D(const EType pType,CX3DImporter_NodeElement * pParent)463 CX3DImporter_NodeElement_Geometry2D(const EType pType, CX3DImporter_NodeElement* pParent) 464 : CX3DImporter_NodeElement(pType, pParent), Solid(true) 465 {} 466 467 };// class CX3DImporter_NodeElement_Geometry2D 468 469 /// \class CX3DImporter_NodeElement_Geometry3D 470 /// Three-dimensional body. 471 class CX3DImporter_NodeElement_Geometry3D : public CX3DImporter_NodeElement { 472 public: 473 std::list<aiVector3D> Vertices; ///< Vertices list. 474 size_t NumIndices;///< Number of indices in one face. 475 bool Solid; ///< Flag: if true then render must use back-face culling, else render must draw both sides of object. 476 477 /// Constructor. 478 /// \param [in] pParent - pointer to parent node. 479 /// \param [in] pType - type of geometry object. CX3DImporter_NodeElement_Geometry3D(const EType pType,CX3DImporter_NodeElement * pParent)480 CX3DImporter_NodeElement_Geometry3D(const EType pType, CX3DImporter_NodeElement* pParent) 481 : CX3DImporter_NodeElement(pType, pParent) 482 , Vertices() 483 , NumIndices( 0 ) 484 , Solid(true) { 485 // empty 486 } 487 488 private: 489 /// Disabled copy constructor. 490 CX3DImporter_NodeElement_Geometry3D(const CX3DImporter_NodeElement_Geometry3D& pNode); 491 492 /// Disabled assign operator. 493 CX3DImporter_NodeElement_Geometry3D& operator=(const CX3DImporter_NodeElement_Geometry3D& pNode); 494 };// class CX3DImporter_NodeElement_Geometry3D 495 496 /// \class CX3DImporter_NodeElement_ElevationGrid 497 /// Uniform rectangular grid of varying height. 498 class CX3DImporter_NodeElement_ElevationGrid : public CX3DImporter_NodeElement_Geometry3D 499 { 500 /***********************************************/ 501 /****************** Variables ******************/ 502 /***********************************************/ 503 504 public: 505 506 bool NormalPerVertex;///< If true then normals are defined for every vertex, else for every face(line). 507 bool ColorPerVertex;///< If true then colors are defined for every vertex, else for every face(line). 508 /// \var CreaseAngle 509 /// If the angle between the geometric normals of two adjacent faces is less than the crease angle, normals shall be calculated so that the faces are 510 /// shaded smoothly across the edge; otherwise, normals shall be calculated so that a lighting discontinuity across the edge is produced. 511 float CreaseAngle; 512 std::vector<int32_t> CoordIdx;///< Coordinates list by faces. In X3D format: "-1" - delimiter for faces. 513 514 /***********************************************/ 515 /****************** Functions ******************/ 516 /***********************************************/ 517 518 private: 519 520 /// \fn CX3DImporter_NodeElement_ElevationGrid(const CX3DImporter_NodeElement_ElevationGrid& pNode) 521 /// Disabled copy constructor. 522 CX3DImporter_NodeElement_ElevationGrid(const CX3DImporter_NodeElement_ElevationGrid& pNode); 523 524 /// \fn CX3DImporter_NodeElement_ElevationGrid& operator=(const CX3DImporter_NodeElement_ElevationGrid& pNode) 525 /// Disabled assign operator. 526 CX3DImporter_NodeElement_ElevationGrid& operator=(const CX3DImporter_NodeElement_ElevationGrid& pNode); 527 528 public: 529 530 /// \fn CX3DImporter_NodeElement_ElevationGrid(const EType pType, CX3DImporter_NodeElement* pParent) 531 /// Constructor. 532 /// \param [in] pParent - pointer to parent node. 533 /// \param [in] pType - type of geometry object. CX3DImporter_NodeElement_ElevationGrid(const EType pType,CX3DImporter_NodeElement * pParent)534 CX3DImporter_NodeElement_ElevationGrid(const EType pType, CX3DImporter_NodeElement* pParent) 535 : CX3DImporter_NodeElement_Geometry3D(pType, pParent) 536 {} 537 538 };// class CX3DImporter_NodeElement_IndexedSet 539 540 /// \class CX3DImporter_NodeElement_IndexedSet 541 /// Shape with indexed vertices. 542 class CX3DImporter_NodeElement_IndexedSet : public CX3DImporter_NodeElement_Geometry3D 543 { 544 /***********************************************/ 545 /****************** Variables ******************/ 546 /***********************************************/ 547 548 public: 549 550 /// \var CCW 551 /// The ccw field defines the ordering of the vertex coordinates of the geometry with respect to user-given or automatically generated normal vectors 552 /// used in the lighting model equations. If ccw is TRUE, the normals shall follow the right hand rule; the orientation of each normal with respect to 553 /// the vertices (taken in order) shall be such that the vertices appear to be oriented in a counterclockwise order when the vertices are viewed (in the 554 /// local coordinate system of the Shape) from the opposite direction as the normal. If ccw is FALSE, the normals shall be oriented in the opposite 555 /// direction. If normals are not generated but are supplied using a Normal node, and the orientation of the normals does not match the setting of the 556 /// ccw field, results are undefined. 557 bool CCW; 558 std::vector<int32_t> ColorIndex;///< Field to specify the polygonal faces by indexing into the <Color> or <ColorRGBA>. 559 bool ColorPerVertex;///< If true then colors are defined for every vertex, else for every face(line). 560 /// \var Convex 561 /// The convex field indicates whether all polygons in the shape are convex (TRUE). A polygon is convex if it is planar, does not intersect itself, 562 /// and all of the interior angles at its vertices are less than 180 degrees. Non planar and self intersecting polygons may produce undefined results 563 /// even if the convex field is FALSE. 564 bool Convex; 565 std::vector<int32_t> CoordIndex;///< Field to specify the polygonal faces by indexing into the <Coordinate>. 566 /// \var CreaseAngle 567 /// If the angle between the geometric normals of two adjacent faces is less than the crease angle, normals shall be calculated so that the faces are 568 /// shaded smoothly across the edge; otherwise, normals shall be calculated so that a lighting discontinuity across the edge is produced. 569 float CreaseAngle; 570 std::vector<int32_t> NormalIndex;///< Field to specify the polygonal faces by indexing into the <Normal>. 571 bool NormalPerVertex;///< If true then normals are defined for every vertex, else for every face(line). 572 std::vector<int32_t> TexCoordIndex;///< Field to specify the polygonal faces by indexing into the <TextureCoordinate>. 573 574 /***********************************************/ 575 /****************** Functions ******************/ 576 /***********************************************/ 577 578 private: 579 580 /// \fn CX3DImporter_NodeElement_IndexedSet(const CX3DImporter_NodeElement_IndexedSet& pNode) 581 /// Disabled copy constructor. 582 CX3DImporter_NodeElement_IndexedSet(const CX3DImporter_NodeElement_IndexedSet& pNode); 583 584 /// \fn CX3DImporter_NodeElement_IndexedSet& operator=(const CX3DImporter_NodeElement_IndexedSet& pNode) 585 /// Disabled assign operator. 586 CX3DImporter_NodeElement_IndexedSet& operator=(const CX3DImporter_NodeElement_IndexedSet& pNode); 587 588 public: 589 590 /// \fn CX3DImporter_NodeElement_IndexedSet(const EType pType, CX3DImporter_NodeElement* pParent) 591 /// Constructor. 592 /// \param [in] pParent - pointer to parent node. 593 /// \param [in] pType - type of geometry object. CX3DImporter_NodeElement_IndexedSet(const EType pType,CX3DImporter_NodeElement * pParent)594 CX3DImporter_NodeElement_IndexedSet(const EType pType, CX3DImporter_NodeElement* pParent) 595 : CX3DImporter_NodeElement_Geometry3D(pType, pParent) 596 {} 597 598 };// class CX3DImporter_NodeElement_IndexedSet 599 600 /// \class CX3DImporter_NodeElement_Set 601 /// Shape with set of vertices. 602 class CX3DImporter_NodeElement_Set : public CX3DImporter_NodeElement_Geometry3D 603 { 604 /***********************************************/ 605 /****************** Variables ******************/ 606 /***********************************************/ 607 608 public: 609 610 /// \var CCW 611 /// The ccw field defines the ordering of the vertex coordinates of the geometry with respect to user-given or automatically generated normal vectors 612 /// used in the lighting model equations. If ccw is TRUE, the normals shall follow the right hand rule; the orientation of each normal with respect to 613 /// the vertices (taken in order) shall be such that the vertices appear to be oriented in a counterclockwise order when the vertices are viewed (in the 614 /// local coordinate system of the Shape) from the opposite direction as the normal. If ccw is FALSE, the normals shall be oriented in the opposite 615 /// direction. If normals are not generated but are supplied using a Normal node, and the orientation of the normals does not match the setting of the 616 /// ccw field, results are undefined. 617 bool CCW; 618 bool ColorPerVertex;///< If true then colors are defined for every vertex, else for every face(line). 619 bool NormalPerVertex;///< If true then normals are defined for every vertex, else for every face(line). 620 std::vector<int32_t> CoordIndex;///< Field to specify the polygonal faces by indexing into the <Coordinate>. 621 std::vector<int32_t> NormalIndex;///< Field to specify the polygonal faces by indexing into the <Normal>. 622 std::vector<int32_t> TexCoordIndex;///< Field to specify the polygonal faces by indexing into the <TextureCoordinate>. 623 std::vector<int32_t> VertexCount;///< Field describes how many vertices are to be used in each polyline(polygon) from the <Coordinate> field. 624 625 /***********************************************/ 626 /****************** Functions ******************/ 627 /***********************************************/ 628 629 private: 630 631 /// \fn CX3DImporter_NodeElement_Set(const CX3DImporter_NodeElement_Set& pNode) 632 /// Disabled copy constructor. 633 CX3DImporter_NodeElement_Set(const CX3DImporter_NodeElement_Set& pNode); 634 635 /// \fn CX3DImporter_NodeElement_Set& operator=(const CX3DImporter_NodeElement_Set& pNode) 636 /// Disabled assign operator. 637 CX3DImporter_NodeElement_Set& operator=(const CX3DImporter_NodeElement_Set& pNode); 638 639 public: 640 641 /// \fn CX3DImporter_NodeElement_Set(const EType pType, CX3DImporter_NodeElement* pParent) 642 /// Constructor. 643 /// \param [in] pParent - pointer to parent node. 644 /// \param [in] pType - type of geometry object. CX3DImporter_NodeElement_Set(const EType pType,CX3DImporter_NodeElement * pParent)645 CX3DImporter_NodeElement_Set(const EType pType, CX3DImporter_NodeElement* pParent) 646 : CX3DImporter_NodeElement_Geometry3D(pType, pParent) 647 {} 648 649 };// class CX3DImporter_NodeElement_Set 650 651 /// \struct CX3DImporter_NodeElement_Shape 652 /// This struct hold <Shape> value. 653 struct CX3DImporter_NodeElement_Shape : public CX3DImporter_NodeElement 654 { 655 /// \fn CX3DImporter_NodeElement_Shape(CX3DImporter_NodeElement_Shape* pParent) 656 /// Constructor 657 /// \param [in] pParent - pointer to parent node. CX3DImporter_NodeElement_ShapeCX3DImporter_NodeElement_Shape658 CX3DImporter_NodeElement_Shape(CX3DImporter_NodeElement* pParent) 659 : CX3DImporter_NodeElement(ENET_Shape, pParent) 660 {} 661 662 };// struct CX3DImporter_NodeElement_Shape 663 664 /// \struct CX3DImporter_NodeElement_Appearance 665 /// This struct hold <Appearance> value. 666 struct CX3DImporter_NodeElement_Appearance : public CX3DImporter_NodeElement 667 { 668 /// \fn CX3DImporter_NodeElement_Appearance(CX3DImporter_NodeElement_Appearance* pParent) 669 /// Constructor 670 /// \param [in] pParent - pointer to parent node. CX3DImporter_NodeElement_AppearanceCX3DImporter_NodeElement_Appearance671 CX3DImporter_NodeElement_Appearance(CX3DImporter_NodeElement* pParent) 672 : CX3DImporter_NodeElement(ENET_Appearance, pParent) 673 {} 674 675 };// struct CX3DImporter_NodeElement_Appearance 676 677 /// \class CX3DImporter_NodeElement_Material 678 /// Material. 679 class CX3DImporter_NodeElement_Material : public CX3DImporter_NodeElement { 680 public: 681 float AmbientIntensity;///< Specifies how much ambient light from light sources this surface shall reflect. 682 aiColor3D DiffuseColor; ///< Reflects all X3D light sources depending on the angle of the surface with respect to the light source. 683 aiColor3D EmissiveColor; ///< Models "glowing" objects. This can be useful for displaying pre-lit models. 684 float Shininess; ///< Lower shininess values produce soft glows, while higher values result in sharper, smaller highlights. 685 aiColor3D SpecularColor; ///< The specularColor and shininess fields determine the specular highlights. 686 float Transparency; ///< Specifies how "clear" an object is, with 1.0 being completely transparent, and 0.0 completely opaque. 687 688 /// Constructor. 689 /// \param [in] pParent - pointer to parent node. 690 /// \param [in] pType - type of geometry object. CX3DImporter_NodeElement_Material(CX3DImporter_NodeElement * pParent)691 CX3DImporter_NodeElement_Material(CX3DImporter_NodeElement* pParent) 692 : CX3DImporter_NodeElement(ENET_Material, pParent) 693 , AmbientIntensity( 0.0f ) 694 , DiffuseColor() 695 , EmissiveColor() 696 , Shininess( 0.0f ) 697 , SpecularColor() 698 , Transparency( 1.0f ) { 699 // empty 700 } 701 702 private: 703 /// Disabled copy constructor. 704 CX3DImporter_NodeElement_Material(const CX3DImporter_NodeElement_Material& pNode); 705 706 /// Disabled assign operator. 707 CX3DImporter_NodeElement_Material& operator=(const CX3DImporter_NodeElement_Material& pNode); 708 };// class CX3DImporter_NodeElement_Material 709 710 /// \struct CX3DImporter_NodeElement_ImageTexture 711 /// This struct hold <ImageTexture> value. 712 struct CX3DImporter_NodeElement_ImageTexture : public CX3DImporter_NodeElement 713 { 714 /// \var RepeatS 715 /// RepeatS and RepeatT, that specify how the texture wraps in the S and T directions. If repeatS is TRUE (the default), the texture map is repeated 716 /// outside the [0.0, 1.0] texture coordinate range in the S direction so that it fills the shape. If repeatS is FALSE, the texture coordinates are 717 /// clamped in the S direction to lie within the [0.0, 1.0] range. The repeatT field is analogous to the repeatS field. 718 bool RepeatS; 719 bool RepeatT;///< See \ref RepeatS. 720 std::string URL;///< URL of the texture. 721 /// \fn CX3DImporter_NodeElement_ImageTexture(CX3DImporter_NodeElement_ImageTexture* pParent) 722 /// Constructor 723 /// \param [in] pParent - pointer to parent node. CX3DImporter_NodeElement_ImageTextureCX3DImporter_NodeElement_ImageTexture724 CX3DImporter_NodeElement_ImageTexture(CX3DImporter_NodeElement* pParent) 725 : CX3DImporter_NodeElement(ENET_ImageTexture, pParent) 726 {} 727 728 };// struct CX3DImporter_NodeElement_ImageTexture 729 730 /// \struct CX3DImporter_NodeElement_TextureTransform 731 /// This struct hold <TextureTransform> value. 732 struct CX3DImporter_NodeElement_TextureTransform : public CX3DImporter_NodeElement 733 { 734 aiVector2D Center;///< Specifies a translation offset in texture coordinate space about which the rotation and scale fields are applied. 735 float Rotation;///< Specifies a rotation in angle base units of the texture coordinates about the center point after the scale has been applied. 736 aiVector2D Scale;///< Specifies a scaling factor in S and T of the texture coordinates about the center point. 737 aiVector2D Translation;///< Specifies a translation of the texture coordinates. 738 739 /// \fn CX3DImporter_NodeElement_TextureTransform(CX3DImporter_NodeElement_TextureTransform* pParent) 740 /// Constructor 741 /// \param [in] pParent - pointer to parent node. CX3DImporter_NodeElement_TextureTransformCX3DImporter_NodeElement_TextureTransform742 CX3DImporter_NodeElement_TextureTransform(CX3DImporter_NodeElement* pParent) 743 : CX3DImporter_NodeElement(ENET_TextureTransform, pParent) 744 {} 745 746 };// struct CX3DImporter_NodeElement_TextureTransform 747 748 /// \struct CX3DImporter_NodeElement_Light 749 /// This struct hold <TextureTransform> value. 750 struct CX3DImporter_NodeElement_Light : public CX3DImporter_NodeElement 751 { 752 float AmbientIntensity;///< Specifies the intensity of the ambient emission from the light. 753 aiColor3D Color;///< specifies the spectral colour properties of both the direct and ambient light emission as an RGB value. 754 aiVector3D Direction;///< Specifies the direction vector of the illumination emanating from the light source in the local coordinate system. 755 /// \var Global 756 /// Field that determines whether the light is global or scoped. Global lights illuminate all objects that fall within their volume of lighting influence. 757 /// Scoped lights only illuminate objects that are in the same transformation hierarchy as the light. 758 bool Global; 759 float Intensity;///< Specifies the brightness of the direct emission from the light. 760 /// \var Attenuation 761 /// PointLight node's illumination falls off with distance as specified by three attenuation coefficients. The attenuation factor 762 /// is: "1 / max(attenuation[0] + attenuation[1] * r + attenuation[2] * r2, 1)", where r is the distance from the light to the surface being illuminated. 763 aiVector3D Attenuation; 764 aiVector3D Location;///< Specifies a translation offset of the centre point of the light source from the light's local coordinate system origin. 765 float Radius;///< Specifies the radial extent of the solid angle and the maximum distance from location that may be illuminated by the light source. 766 float BeamWidth;///< Specifies an inner solid angle in which the light source emits light at uniform full intensity. 767 float CutOffAngle;///< The light source's emission intensity drops off from the inner solid angle (beamWidth) to the outer solid angle (cutOffAngle). 768 769 /// \fn CX3DImporter_NodeElement_Light(EType pLightType, CX3DImporter_NodeElement* pParent) 770 /// Constructor 771 /// \param [in] pParent - pointer to parent node. 772 /// \param [in] pLightType - type of the light source. CX3DImporter_NodeElement_LightCX3DImporter_NodeElement_Light773 CX3DImporter_NodeElement_Light(EType pLightType, CX3DImporter_NodeElement* pParent) 774 : CX3DImporter_NodeElement(pLightType, pParent) 775 {} 776 777 };// struct CX3DImporter_NodeElement_Light 778 779 #endif // INCLUDED_AI_X3D_IMPORTER_NODE_H 780