Class for scene loading from XML file.
More...
#include <XmlSceneLoader.h>
|
| XmlSceneLoader () |
| Default constructor for XML scene loader.
|
|
std::shared_ptr< Scene > | createSceneFromXml (tinyxml2::XMLElement *sceneNode, std::string path, SerialSceneWrapper::SceneType *sceneType=nullptr) |
| Create scene from given XML element (node) More...
|
|
shared_ptr< ScenePart > | loadFilters (tinyxml2::XMLElement *scenePartNode, bool &holistic) |
| Load filters defining the scene part. More...
|
|
bool | loadScenePartId (tinyxml2::XMLElement *scenePartNode, int partIndex, shared_ptr< ScenePart > scenePart) |
| Load the scene part identifier. More...
|
|
bool | validateScenePart (shared_ptr< ScenePart > scenePart, tinyxml2::XMLElement *scenePartNode) |
| Validate the given loaded scene part. More...
|
|
void | digestScenePart (shared_ptr< ScenePart > &scenePart, std::shared_ptr< StaticScene > &scene, bool holistic, bool splitPart, bool dynObject, int &partIndex) |
| Apply final processings to the built scene part so it is fully integrated in the scene and totally configured. More...
|
|
shared_ptr< KDTreeFactory > | makeKDTreeFactory () |
| Build the KDTree factory from loader's kdtFactoryType and kdtSAHLossNodes attributes. More...
|
|
shared_ptr< KDGroveFactory > | makeKDGroveFactory () |
| Build the KDGrove factory from loader's KDTree factory specification. More...
|
|
shared_ptr< DynSequentiableMovingObject > | loadDynMotions (tinyxml2::XMLElement *scenePartNode, shared_ptr< ScenePart > scenePart) |
| Build a dynamic sequentiable moving object which is composed of dynamic motions. More...
|
|
shared_ptr< StaticScene > | makeSceneDynamic (shared_ptr< StaticScene > scene) |
| Build a dynamic scene based on given static scene. More...
|
|
void | handleDynamicSceneAttributes (tinyxml2::XMLElement *sceneNode, shared_ptr< DynScene > scene) |
| Handle the loading of dynamic scene attributes. More...
|
|
Class for scene loading from XML file.
Whenever possible, it is preferred to load XML defined components by XmlAssetsLoader or XmlSurveyLoader classes which are the main classes for this purpose.
- See also
- XmlAssetsLoader
◆ createSceneFromXml()
Create scene from given XML element (node)
- Parameters
-
sceneNode | XML element (node) containing scene data |
path | Path to scene file |
sceneType[out] | When it is not null, it will be used to store the type of created scene |
- Returns
- Shared pointer to created scene
- See also
- Scene
◆ digestScenePart()
void XmlSceneLoader::digestScenePart |
( |
shared_ptr< ScenePart > & |
scenePart, |
|
|
std::shared_ptr< StaticScene > & |
scene, |
|
|
bool |
holistic, |
|
|
bool |
splitPart, |
|
|
bool |
dynObject, |
|
|
int & |
partIndex |
|
) |
| |
Apply final processings to the built scene part so it is fully integrated in the scene and totally configured.
- Parameters
-
| scenePart | The scene part object to be digested |
| scene | The scene where the scene part belongs |
| holistic | Flag used to specify if all vertices defining each primitive must be considered as a whole (true) or not (false) |
| splitPart | Flag to specify if scene part must be splitted into subparts (true) or not (false) |
| dynObject | Flag to specify if the scene part corresponds to a dynamic object (true) or to a static one (false) |
[out] | partIndex | If the subpart is splitted, then partIndex will be opportunely updated |
- See also
- ScenePart::splitSubparts
◆ handleDynamicSceneAttributes()
void XmlSceneLoader::handleDynamicSceneAttributes |
( |
tinyxml2::XMLElement * |
sceneNode, |
|
|
shared_ptr< DynScene > |
scene |
|
) |
| |
Handle the loading of dynamic scene attributes.
- Parameters
-
sceneNode | The XML node defining the dynamic scene |
scene | Dynamic scene which attributes must be configured |
◆ loadDynMotions()
Build a dynamic sequentiable moving object which is composed of dynamic motions.
It is mandatory that dmotion elements contained in the part element also contain an id attribute specifying the unique identifier for the sequence in its context. The loop attribute is also mandatory, where \(0\) means infinity loop and \(n > 0\) specifies how many times the sequence will be repeated until proceeding to next sequence. Next sequence can be specified through the next attribute, which may contain the identifier of the next sequence. If no next attribute is given, then it is assumed that there is no next sequence.
- Parameters
-
scenePartNode | XML part node defining the scene part |
scenePart | The scene part object where the dynamic sequentiable moving object belongs to |
- Returns
- Built dynamic sequentiable moving object composed of dynamic motions specified in the XML
- See also
- DynSequencer
-
DynSequence
-
rigidmotion::RigidMotion
-
DynMotion
-
XmlUtils::createDynMotionsVector
◆ loadFilters()
shared_ptr< ScenePart > XmlSceneLoader::loadFilters |
( |
tinyxml2::XMLElement * |
scenePartNode, |
|
|
bool & |
holistic |
|
) |
| |
Load filters defining the scene part.
NOTICE a scene part requires at least one primitives loading filter to be instantiated, otherwise it will be nullptr
- Parameters
-
| scenePartNode | XML part node defining the scene part |
[out] | holistic | Used to specify if all vertices defining each primitive must be considered as a whole (true) or not |
- Returns
- Built scene part if any, nullptr otherwise
◆ loadScenePartId()
bool XmlSceneLoader::loadScenePartId |
( |
tinyxml2::XMLElement * |
scenePartNode, |
|
|
int |
partIndex, |
|
|
shared_ptr< ScenePart > |
scenePart |
|
) |
| |
Load the scene part identifier.
- Parameters
-
scenePartNode | XML part node where the identifier might be explicitly specified |
partIndex | Index of scene part according to current loop iteration. It will be used if no specific identifier is provided through XML |
scenePart | The scene part object to which identifier must be assigned |
- Returns
- True if scene part must be splitted, false otherwise. A scene part can only be splitted when a part identifier is explicitly provided
◆ makeKDGroveFactory()
◆ makeKDTreeFactory()
shared_ptr< KDTreeFactory > XmlSceneLoader::makeKDTreeFactory |
( |
| ) |
|
◆ makeSceneDynamic()
Build a dynamic scene based on given static scene.
NOTICE for this method to work properly given scene MUST be of StaticScene type or unexpected behaviors might occur. Use with caution.
- Parameters
-
scene | Static scene to be used to build a dynamic scene |
- Returns
- Built dynamic scene based on given static scene
- See also
- StaticScene
-
DynScene
◆ validateScenePart()
bool XmlSceneLoader::validateScenePart |
( |
shared_ptr< ScenePart > |
scenePart, |
|
|
tinyxml2::XMLElement * |
scenePartNode |
|
) |
| |
Validate the given loaded scene part.
- Parameters
-
scenePartNode | XML part node corresponding to the scene part being validated |
scenePart | The scene part to be validated |
- Returns
- True if the given ScenePart is valid, false otherwise
◆ kdtFactoryType
int XmlSceneLoader::kdtFactoryType = 1 |
Type of KDTree factory to be used to build scene.
- See also
- KDTreeFactory
◆ kdtGeomJobs
size_t XmlSceneLoader::kdtGeomJobs = 1 |
◆ kdtNumJobs
size_t XmlSceneLoader::kdtNumJobs = 1 |
◆ sceneSpec
The documentation for this class was generated from the following files: