X3DImporter_Node.hpp 34 KB

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