X3DImporter_Node.hpp 35 KB

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