55#define SCENE_H
66
77#include " Savitar/SceneNode.h"
8+ #include " TextureData.h"
89
910#include < map> // For std::map
1011#include < string> // For std::string
@@ -29,7 +30,7 @@ class Scene
2930 */
3031 [[nodiscard]] std::vector<SceneNode*> getSceneNodes ();
3132
32- [[nodiscard]] std::vector<SceneNode*> getAllSceneNodes ();
33+ [[nodiscard]] std::vector<SceneNode*> getAllSceneNodes () const ;
3334
3435 /* *
3536 * Add a scene node to the scene.
@@ -42,6 +43,11 @@ class Scene
4243 */
4344 void fillByXMLNode (pugi::xml_node xml_node);
4445
46+ /* *
47+ * Serialise the scene to model_node
48+ */
49+ void toXmlNode (pugi::xml_node& model_node);
50+
4551 /* *
4652 * Store a metadata entry as metadata.
4753 * @param key The key of the metadata.
@@ -68,6 +74,12 @@ class Scene
6874 */
6975 [[nodiscard]] const std::map<std::string, MetadataEntry>& getMetadata () const ;
7076
77+ /* *
78+ * Find the next available resource ID amongst actually stored texture, UV coordinates and scene nodes. This should be called before
79+ * adding any of these resources, so that IDs are unique in the end.
80+ */
81+ [[nodiscard]] int getNextAvailableResourceId () const ;
82+
7183 /* *
7284 * Get the unit (milimeter, inch, etc) of the scene.
7385 * This is in milimeter by default.
@@ -76,10 +88,25 @@ class Scene
7688
7789 void setUnit (std::string unit);
7890
91+ [[nodiscard]] std::string getTexturePathFromGroupId (const int uv_group_id) const ;
92+
93+ [[nodiscard]] const TextureData::UVCoordinatesGroup* getUVCoordinatesGroup (const int uv_group_id) const ;
94+
95+ void addTexturePath (const std::string& texture_path, const int texture_id);
96+
97+ /* *
98+ * Stores a UV coordinates group from raw data
99+ * @param data The raw data to be stored
100+ * @param texture_id The ID of the associated texture
101+ * @param group_id The ID of the newly created coordinates group
102+ */
103+ void setUVCoordinatesGroupFromBytes (const bytearray& data, const int texture_id, const int group_id);
104+
79105private:
80106 std::vector<SceneNode*> scene_nodes_;
81107 std::map<std::string, MetadataEntry> metadata_;
82108 std::string unit_{ " millimeter" };
109+ TextureData texture_data_;
83110
84111 /* *
85112 * Used to recursively create SceneNode objects based on xml nodes.
0 commit comments