/// \file AMFImporter_Node.hpp /// \brief Elements of scene graph. /// \date 2016 /// \author smal.root@gmail.com #ifndef INCLUDED_AI_AMF_IMPORTER_NODE_H #define INCLUDED_AI_AMF_IMPORTER_NODE_H // Header files, stdlib. #include #include #include // Header files, Assimp. #include "assimp/types.h" #include "assimp/scene.h" /// \class CAMFImporter_NodeElement /// Base class for elements of nodes. class CAMFImporter_NodeElement { /***********************************************/ /******************** Types ********************/ /***********************************************/ public: /// \enum EType /// Define what data type contain node element. enum EType { ENET_Color, ///< Color element: . ENET_Constellation,///< Grouping element: . ENET_Coordinates, ///< Coordinates element: . ENET_Edge, ///< Edge element: . ENET_Instance, ///< Grouping element: . ENET_Material, ///< Material element: . ENET_Metadata, ///< Metadata element: . ENET_Mesh, ///< Metadata element: . ENET_Object, ///< Element which hold object: . ENET_Root, ///< Root element: . ENET_Triangle, ///< Triangle element: . ENET_TexMap, ///< Texture coordinates element: or . ENET_Texture, ///< Texture element: . ENET_Vertex, ///< Vertex element: . ENET_Vertices, ///< Vertex element: . ENET_Volume, ///< Volume element: . ENET_Invalid ///< Element has invalid type and possible contain invalid data. }; /***********************************************/ /****************** Constants ******************/ /***********************************************/ public: const EType Type;///< Type of element. /***********************************************/ /****************** Variables ******************/ /***********************************************/ public: std::string ID;///< ID of element. CAMFImporter_NodeElement* Parent;///< Parrent element. If nullptr then this node is root. std::list Child;///< Child elements. /***********************************************/ /****************** Functions ******************/ /***********************************************/ private: /// \fn CAMFImporter_NodeElement(const CAMFImporter_NodeElement& pNodeElement) /// Disabled copy constructor. CAMFImporter_NodeElement(const CAMFImporter_NodeElement& pNodeElement); /// \fn CAMFImporter_NodeElement& operator=(const CAMFImporter_NodeElement& pNodeElement) /// Disabled assign operator. CAMFImporter_NodeElement& operator=(const CAMFImporter_NodeElement& pNodeElement); /// \fn CAMFImporter_NodeElement() /// Disabled default constructor. CAMFImporter_NodeElement(); protected: /// \fn CAMFImporter_NodeElement(const EType pType, CAMFImporter_NodeElement* pParent) /// In constructor inheritor must set element type. /// \param [in] pType - element type. /// \param [in] pParent - parent element. CAMFImporter_NodeElement(const EType pType, CAMFImporter_NodeElement* pParent) : Type(pType), Parent(pParent) {} };// class IAMFImporter_NodeElement /// \struct CAMFImporter_NodeElement_Constellation /// A collection of objects or constellations with specific relative locations. struct CAMFImporter_NodeElement_Constellation : public CAMFImporter_NodeElement { /// \fn CAMFImporter_NodeElement_Constellation(CAMFImporter_NodeElement* pParent) /// Constructor. /// \param [in] pParent - pointer to parent node. CAMFImporter_NodeElement_Constellation(CAMFImporter_NodeElement* pParent) : CAMFImporter_NodeElement(ENET_Constellation, pParent) {} };// struct CAMFImporter_NodeElement_Constellation /// \struct CAMFImporter_NodeElement_Instance /// Part of constellation. struct CAMFImporter_NodeElement_Instance : public CAMFImporter_NodeElement { /****************** Variables ******************/ std::string ObjectID;///< ID of object for instanciation. /// \var Delta - The distance of translation in the x, y, or z direction, respectively, in the referenced object's coordinate system, to /// create an instance of the object in the current constellation. aiVector3D Delta; /// \var Rotation - The rotation, in degrees, to rotate the referenced object about its x, y, and z axes, respectively, to create an /// instance of the object in the current constellation. Rotations shall be executed in order of x first, then y, then z. aiVector3D Rotation; /****************** Functions ******************/ /// \fn CAMFImporter_NodeElement_Instance(CAMFImporter_NodeElement* pParent) /// Constructor. /// \param [in] pParent - pointer to parent node. CAMFImporter_NodeElement_Instance(CAMFImporter_NodeElement* pParent) : CAMFImporter_NodeElement(ENET_Instance, pParent) {} };// struct CAMFImporter_NodeElement_Instance /// \struct CAMFImporter_NodeElement_Metadata /// Structure that define metadata node. struct CAMFImporter_NodeElement_Metadata : public CAMFImporter_NodeElement { /****************** Variables ******************/ std::string Type;///< Type of "Value". std::string Value;///< Value. /****************** Functions ******************/ /// \fn CAMFImporter_NodeElement_Metadata(CAMFImporter_NodeElement* pParent) /// Constructor. /// \param [in] pParent - pointer to parent node. CAMFImporter_NodeElement_Metadata(CAMFImporter_NodeElement* pParent) : CAMFImporter_NodeElement(ENET_Metadata, pParent) {} };// struct CAMFImporter_NodeElement_Metadata /// \struct CAMFImporter_NodeElement_Root /// Structure that define root node. struct CAMFImporter_NodeElement_Root : public CAMFImporter_NodeElement { /****************** Variables ******************/ std::string Unit;///< The units to be used. May be "inch", "millimeter", "meter", "feet", or "micron". std::string Version;///< Version of format. /****************** Functions ******************/ /// \fn CAMFImporter_NodeElement_Root(CAMFImporter_NodeElement* pParent) /// Constructor. /// \param [in] pParent - pointer to parent node. CAMFImporter_NodeElement_Root(CAMFImporter_NodeElement* pParent) : CAMFImporter_NodeElement(ENET_Root, pParent) {} };// struct CAMFImporter_NodeElement_Root /// \struct CAMFImporter_NodeElement_Color /// Structure that define object node. struct CAMFImporter_NodeElement_Color : public CAMFImporter_NodeElement { /****************** Variables ******************/ bool Composed;///< Type of color stored: if true then look for formula in \ref Color_Composed[4], else - in \ref Color. std::string Color_Composed[4];///< By components formulas of composed color. [0..3] => RGBA. aiColor4D Color;///< Constant color. std::string Profile;///< The ICC color space used to interpret the three color channels , and .. /****************** Functions ******************/ /// \fn CAMFImporter_NodeElement_Color(CAMFImporter_NodeElement* pParent) /// Constructor. /// \param [in] pParent - pointer to parent node. CAMFImporter_NodeElement_Color(CAMFImporter_NodeElement* pParent) : CAMFImporter_NodeElement(ENET_Color, pParent) {} };// struct CAMFImporter_NodeElement_Color /// \struct CAMFImporter_NodeElement_Material /// Structure that define material node. struct CAMFImporter_NodeElement_Material : public CAMFImporter_NodeElement { /// \fn CAMFImporter_NodeElement_Material(CAMFImporter_NodeElement* pParent) /// Constructor. /// \param [in] pParent - pointer to parent node. CAMFImporter_NodeElement_Material(CAMFImporter_NodeElement* pParent) : CAMFImporter_NodeElement(ENET_Material, pParent) {} };// struct CAMFImporter_NodeElement_Material /// \struct CAMFImporter_NodeElement_Object /// Structure that define object node. struct CAMFImporter_NodeElement_Object : public CAMFImporter_NodeElement { /// \fn CAMFImporter_NodeElement_Object(CAMFImporter_NodeElement* pParent) /// Constructor. /// \param [in] pParent - pointer to parent node. CAMFImporter_NodeElement_Object(CAMFImporter_NodeElement* pParent) : CAMFImporter_NodeElement(ENET_Object, pParent) {} };// struct CAMFImporter_NodeElement_Object /// \struct CAMFImporter_NodeElement_Mesh /// Structure that define mesh node. struct CAMFImporter_NodeElement_Mesh : public CAMFImporter_NodeElement { /// \fn CAMFImporter_NodeElement_Mesh(CAMFImporter_NodeElement* pParent) /// Constructor. /// \param [in] pParent - pointer to parent node. CAMFImporter_NodeElement_Mesh(CAMFImporter_NodeElement* pParent) : CAMFImporter_NodeElement(ENET_Mesh, pParent) {} };// struct CAMFImporter_NodeElement_Mesh /// \struct CAMFImporter_NodeElement_Vertex /// Structure that define vertex node. struct CAMFImporter_NodeElement_Vertex : public CAMFImporter_NodeElement { /// \fn CAMFImporter_NodeElement_Vertex(CAMFImporter_NodeElement* pParent) /// Constructor. /// \param [in] pParent - pointer to parent node. CAMFImporter_NodeElement_Vertex(CAMFImporter_NodeElement* pParent) : CAMFImporter_NodeElement(ENET_Vertex, pParent) {} };// struct CAMFImporter_NodeElement_Vertex /// \struct CAMFImporter_NodeElement_Edge /// Structure that define edge node. struct CAMFImporter_NodeElement_Edge : public CAMFImporter_NodeElement { /// \fn CAMFImporter_NodeElement_Edge(CAMFImporter_NodeElement* pParent) /// Constructor. /// \param [in] pParent - pointer to parent node. CAMFImporter_NodeElement_Edge(CAMFImporter_NodeElement* pParent) : CAMFImporter_NodeElement(ENET_Edge, pParent) {} };// struct CAMFImporter_NodeElement_Vertex /// \struct CAMFImporter_NodeElement_Vertices /// Structure that define vertices node. struct CAMFImporter_NodeElement_Vertices : public CAMFImporter_NodeElement { /// \fn CAMFImporter_NodeElement_Vertices(CAMFImporter_NodeElement* pParent) /// Constructor. /// \param [in] pParent - pointer to parent node. CAMFImporter_NodeElement_Vertices(CAMFImporter_NodeElement* pParent) : CAMFImporter_NodeElement(ENET_Vertices, pParent) {} };// struct CAMFImporter_NodeElement_Vertices /// \struct CAMFImporter_NodeElement_Volume /// Structure that define volume node. struct CAMFImporter_NodeElement_Volume : public CAMFImporter_NodeElement { /****************** Variables ******************/ std::string MaterialID;///< Which material to use. std::string Type;///< What this volume describes can be “region” or “support”. If none specified, “object” is assumed. /****************** Functions ******************/ /// \fn CAMFImporter_NodeElement_Volume(CAMFImporter_NodeElement* pParent) /// Constructor. /// \param [in] pParent - pointer to parent node. CAMFImporter_NodeElement_Volume(CAMFImporter_NodeElement* pParent) : CAMFImporter_NodeElement(ENET_Volume, pParent) {} };// struct CAMFImporter_NodeElement_Volume /// \struct CAMFImporter_NodeElement_Coordinates /// Structure that define coordinates node. struct CAMFImporter_NodeElement_Coordinates : public CAMFImporter_NodeElement { /****************** Variables ******************/ aiVector3D Coordinate;///< Coordinate. /****************** Functions ******************/ /// \fn CAMFImporter_NodeElement_Coordinates(CAMFImporter_NodeElement* pParent) /// Constructor. /// \param [in] pParent - pointer to parent node. CAMFImporter_NodeElement_Coordinates(CAMFImporter_NodeElement* pParent) : CAMFImporter_NodeElement(ENET_Coordinates, pParent) {} };// struct CAMFImporter_NodeElement_Coordinates /// \struct CAMFImporter_NodeElement_TexMap /// Structure that define texture coordinates node. struct CAMFImporter_NodeElement_TexMap : public CAMFImporter_NodeElement { /****************** Variables ******************/ aiVector3D TextureCoordinate[3];///< Texture coordinates. std::string TextureID_R;///< Texture ID for red color component. std::string TextureID_G;///< Texture ID for green color component. std::string TextureID_B;///< Texture ID for blue color component. std::string TextureID_A;///< Texture ID for alpha color component. /****************** Functions ******************/ /// \fn CAMFImporter_NodeElement_TexMap(CAMFImporter_NodeElement* pParent) /// Constructor. /// \param [in] pParent - pointer to parent node. CAMFImporter_NodeElement_TexMap(CAMFImporter_NodeElement* pParent) : CAMFImporter_NodeElement(ENET_TexMap, pParent) {} };// struct CAMFImporter_NodeElement_TexMap /// \struct CAMFImporter_NodeElement_Triangle /// Structure that define triangle node. struct CAMFImporter_NodeElement_Triangle : public CAMFImporter_NodeElement { /****************** Variables ******************/ size_t V[3];///< Triangle vertices. /****************** Functions ******************/ /// \fn CAMFImporter_NodeElement_Triangle(CAMFImporter_NodeElement* pParent) /// Constructor. /// \param [in] pParent - pointer to parent node. CAMFImporter_NodeElement_Triangle(CAMFImporter_NodeElement* pParent) : CAMFImporter_NodeElement(ENET_Triangle, pParent) {} };// struct CAMFImporter_NodeElement_Triangle /// \struct CAMFImporter_NodeElement_Texture /// Structure that define texture node. struct CAMFImporter_NodeElement_Texture : public CAMFImporter_NodeElement { /****************** Variables ******************/ size_t Width, Height, Depth;///< Size of the texture. std::vector Data;///< Data of the texture. bool Tiled; /****************** Functions ******************/ /// \fn CAMFImporter_NodeElement_Texture(CAMFImporter_NodeElement* pParent) /// Constructor. /// \param [in] pParent - pointer to parent node. CAMFImporter_NodeElement_Texture(CAMFImporter_NodeElement* pParent) : CAMFImporter_NodeElement(ENET_Texture, pParent) {} };// struct CAMFImporter_NodeElement_Texture #endif // INCLUDED_AI_AMF_IMPORTER_NODE_H