Polygon Crucher SDK - Documentation
Documentation
Loading...
Searching...
No Matches
3DScene.h
Go to the documentation of this file.
1//! @file 3DScene.h
2//! @brief C3DScene class definition
3//////////////////////////////////////////////////////////////////////
4
5#if !defined(AFX_3DScene_H__CA6BC29F_FAC2_11D1_A0DE_000000000000__INCLUDED_)
6#define AFX_3DScene_H__CA6BC29F_FAC2_11D1_A0DE_000000000000__INCLUDED_
7
8#ifdef _MSC_VER
9#pragma once
10#endif // _MSC_VER
11
12#include "3DSceneNode.h"
13#include "3DBaseObject.h"
14#include "3DFaceList.h"
15#include "3DMaterial.h"
16#include "3DAnimatable.h"
17#include "Tree.h"
18
19BEGIN_MOOTOOLS_NAMESPACE
20
23class C3DInstanceID;
25
26//! @enum SCENE_DATA
27//! These information might be retrieve through the C3DScene::GetCustomData() class.\n
28//! If these information is missing, the default value should be taken into account.
29typedef enum SCENE_DATA XEnumType(unsigned int)
30{
31 SCENE_DATA_FILENAME = MAKE_CUSTOM_ID('S', 'N', 'F', 'L'), //!< CXString: the scene file path
32 SCENE_DATA_FILECLASS = MAKE_CUSTOM_ID('S', 'N', 'F', 'C'), //!< Unsigned int: the scene file class (Ie. FBX_3D_FILE, WAVEFRONT_3D_FILE...)
33 SCENE_DATA_TEMPORARY_TEXTURES = MAKE_CUSTOM_ID('T', 'M', 'M', 'P'), //!< Bool (false): texture files are temporaries and can be deleted when scene deleted (ie, embedded textures in FBX or sketchup). Texture are not temporary if this information is missing.
34 SCENE_DATA_PATCH_LEVEL = MAKE_CUSTOM_ID('P', 'A', 'L', 'V'), //!< unsigned int (C3DPreferences::Get3DPreferences()::GetPatchLevel())
35 SCENE_DATA_SMOOTH_ANGLE = MAKE_CUSTOM_ID('S', 'M', 'A', 'N'), //!< float ((C3DPreferences::Get3DPreferences()::GetSmoothAngle()). Smooth angle in radian
36 SCENE_DATA_SMOOTH_MODE = MAKE_CUSTOM_ID('S', 'M', 'M', 'O'), //!< unsigned int ((C3DPreferences::Get3DPreferences()::GetSmoothMode())
37 SCENE_DATA_TEXTURE_PATHS = MAKE_CUSTOM_ID('T', 'X', 'P', 'H'), //!< string array: additional texture paths. Can be retrieve using C3DScene::GetTexturePaths
38 SCENE_DATA_GEOLOCATION = MAKE_CUSTOM_ID('G', 'E', 'O', 'L'), //!< Binary (C3DScene::GeoLocation): longitude and latitude position of the scene
39 SCENE_DATA_TARGET_MR_BBOX = MAKE_CUSTOM_ID('T', 'G', 'B', 'X'), //!< Binary - 6 floats - Target bounding box for multiresolution file
41
42//! @class C3DObjectCreator
43//! @brief This class can be provided in C3DScene::Copy operations and allows to modify the created kind of class during the copy operation.
44//! @details If you intend to overidde some specific class, such C3DPointList, you can create a copy of the scene that will use this new class.
45//! C3DPolygonCruncherObjectCreator typically does this, using C3DExtPointList for object instead of the standard C3DPointList.
46class DLL_3DFUNCTION C3DObjectCreator
47{
48 friend C3DScene;
49
50public:
51 //! @brief Destination scene to which the element is copied.
52 //! @details The element GUID will remain the same if the destination scene differs from the original scene, or if no scene (= NULL) is defined.
53 //! If no scene is defined, the element is not attached to any scene until it is attached to the scene (using C3DScene::AddNode for example)
55 virtual ~C3DObjectCreator();
56
57 virtual C3DBaseObject *ConvertToType(const C3DSceneNode *refnode, const C3DBaseObject *refobject); //!< Convert refobject to another type. return the object itself if no conversion performed
58 virtual C3DBaseObject *GetNewObjectFrom(const C3DBaseObject *refobject, bool& emptyCopy); //!< Return an object from the provided refobject. Returned object might be empty (empty points/faces/channels). In this case, object copy fills the returned empty object
59
60 virtual bool CanProcess(const C3DSceneNode *node, const C3DBaseObject *object); //!< Return true if the node and its object should be copied / converted
61
62 //! @name overriden possibilities
63 //! The following methods are called to create the copy of the object
64 //! It gives a chance to the copy method to copy the object to a different type
65 //! @{
66 virtual C3DFaceList *GetNewFaceList();
67 virtual C3DPointList *GetNewPointList();
68 virtual C3DObject *GetNewPolygonalObject();
69 virtual C3DCurve *GetNewCurveObject();
70 virtual C3DPatch *GetNewPatchObject();
71 virtual C3DGroup *GetNewGroupObject();
72 virtual C3DDummy *GetNewDummy();
73 virtual C3DCamera *GetNewCamera();
74 virtual C3DLight *GetNewLight();
75
76 //! @}
77
78 C3DScene *GetScene() const; //!< Set the scene to which the copied object will belong to. The element GUID is updated
79 void SetScene(C3DScene *scene); //!< Set the scene to which the copied object will belong to. The element GUID is updated
80 CCustomData& GetCustomData(); //!< Can be used to store some information
81
82protected:
83 C3DScene *scene;
84 CCustomData data;
85 CHashMap<BaseObjectID, BaseObjectID, BaseObjectID> ids; // Used internally to map object id
86};
87
88//! @enum NodePosFlags
89//! Scene Node traversal flags
90//! These flags can be used with C3DScene::GetFirstNode/C3DScene::GetNextNode to control the way the scene tree is
91typedef enum NodePosFlags XEnumType(unsigned int)
92{
93 NODEPOS_DEFAULT = 0, //!< Do default traversal, which means it starts traversal from the first child of the provided node. If provided node is NULL, then all the scene will be traverse
94 NODEPOS_INSTANCE_ONCE = 0x01, //!< When traversing the tree, settings this flag returns only once time each object instance. This is useful to perform an operation only once on objects when processing them.
95 NODEPOS_INCLUDE_NODE = 0x02, //!< Include the node itself in the traversal. Node childs and right brothers will also be traversed.
96 NODEPOS_BRANCH_ONLY = 0x04, //!< Traverse provided node childs. If NODEPOS_INCLUDE_NODE specified, traverse also right branch (brothers and childs).
97 NODEPOS_ALLOW_EMPTY_NODES = 0x08, //!< During serialization some node might be provided with geometry. This allows to get access to such node, which are used only under special circumstances.
99
100//! @enum NodeFilterFlags
101//! These flags are used within C3DFilter to limit processing to the nodes concerned.
102typedef enum NodeFilterFlags XEnumType(unsigned int)
103{
104 NODEFILTER_DEFAULT = 0, //!< Do default traversal, filter nothing
105 NODEFILTER_VALID = 0x01, //!< Return only valid nodes
106 NODEFILTER_SHOW = 0x02, //!< Return only displayed nodes
107 NODEFILTER_SELECTED = 0x04, //!< Return only selected nodes
109
110//! @class C3DFilter
111//! @brief C3DFilter allows to filter the nodes / faces / points being processed.
112//! @details Some C3DScene methods offers to provide C3DFilter
113//! This is a convienient method to process or not some of the elements when they are traversed.\n
114//! Depending on the method, some or all the callback (ProcessNode, ProcessFace, ProcessPoint) might be called.\n
115//! The return value of these methods will make the element processed or not by the calling function.
116//!
117class DLL_3DFUNCTION C3DFilter
118{
119protected:
120 unsigned int flags, kindof;
121 void *callbackData;
122
123public:
124 C3DFilter(unsigned int flags = NODEFILTER_DEFAULT, unsigned int kindOfObject = OBJECT_ALL_KINDOF); //!< By default all the nodes are transmitted to ProcessNode.
125
126 void SetCallbackData(void* data); //!< specific that can be used in the callback operation
127 void* GetCallbackData() { return callbackData; } //!< specific that can be used in the callback operation
128
129 virtual bool ProcessNode(const C3DSceneNode *node) const; //!< Return true if the node should be processed, false otherwise.
130 virtual bool ProcessFace(const C3DBaseObject *object, const C3DFace *face) const; //!< Return true if the face should be processed, false otherwise.
131 virtual bool ProcessPoint(const C3DBaseObject *object, const C3DPoint *point) const; //!< Return true if the point should be processed, false otherwise.
132
133 static bool ProcessNode(unsigned int filterFlags, const C3DSceneNode *node, unsigned int kindOfObject = OBJECT_ALL_KINDOF); //!< Flags is one or more NodeFilterFlags. Call this static method allows a simple filter on the nodes.
134};
135
136//! @class C3DFlagFilter
137//! This C3DFilter derived class adds a way to define some flags the node must / mustn't have
138class DLL_3DFUNCTION C3DFlagFilter : public C3DFilter
139{
140protected:
141 unsigned int neededFlags;
142 unsigned int excludingFlags;
143 void* callbackData;
144
145public:
146 C3DFlagFilter(unsigned int kindOfObject = OBJECT_ALL_KINDOF); //!< By default all the nodes are transmitted to ProcessNode.
147
148 void NeededFlags(unsigned int flags); //!< Defines flags required for the node to be processed
149 void ExcludindFlags(unsigned int flags); //!< Defines flags that the node must not have
150
151 virtual bool ProcessNode(const C3DSceneNode* node) const; //!< Return true if the node should be processed, false if not
152};
153
154//! @class C3DConcatenateFilter
155//! This C3DFilter derived class is used as a callback in the concatenation process. It allows to have a fine control on what should be concatenated
156class DLL_3DFUNCTION C3DConcatenateFilter : public C3DFilter
157{
158protected:
159 C3DScene *scene; // The scene from which concatenation is performed
160 FBMaterialID fbmatid; // MATERIAL_UNDEFINED by default, unless if only faces with this material is to be extracted
161
162 bool mustHave;
163 enum XEnumType(unsigned char)
164 {
165 NO_FILTER = 0,
166 SINGLESIDE_FILTER,
167 DOUBLESIDE_FILTER,
168 } materialFilteringMode;
169
170public:
171 C3DConcatenateFilter(unsigned int flags = NODEFILTER_DEFAULT, unsigned int kindOfObject = OBJECT_ALL_KINDOF);
172
173 void SetScene(C3DScene *refscene) { this->scene = refscene; }
174 void SetMaterial(MaterialID matid, bool musHave); //!< Used to perform material filtering (used by ConcatenateByMaterial)
175 bool PerformMaterialFiltering() const; //!< Return true if material filtering is performed
176 void SetFBMaterial(FBMaterialID matid, bool musHave); //!< Used to perform material filtering (used by ConcatenateByMaterial)
177 FBMaterialID GetFBMaterialID() const; //!< Get the material that was set. If SetMaterial call, the return material as only frontID defined
178 virtual bool ProcessNode(const C3DSceneNode *node) const; //!< Must be called by overriden methods to handle material filtering if needed.
179 virtual bool ProcessFace(const C3DBaseObject *object, const C3DFace *face) const; //!< Must be called by overriden methods to handle material filtering if needed.
180
181 virtual C3DSceneNode *OnConcatenateBegin(); //!< A new concatenated node need to be created with its object. We will try to add something to it, if filter allows it. This give the chance to set a node name, or some custom data if needed.
182 virtual void OnConcatenateEnd(C3DSceneNode *dstnode, bool validNode) {}; //!< The dstnode send previously in OnConcatenateBegin is finished to be processed. If validNode == true, this means that dstnode contains an Object (available with C3DSceneNode::GetObject). Otherwise the node will be destroyed.
183 virtual void OnConcatenate(C3DSceneNode *dstnode, const C3DSceneNode *srcnode) {}; //!< This is called when something from srcnode object goes into dstnode object. This give a chance to merge the customdata for example
184 virtual void OnConcatenate(C3DGeomObject *dstobject, const C3DBaseObject *srcobject) {}; //!< This is calledwhen something from srcobject goes into dstobject. dstobject is a geom object, but srcobject is an object that belong to a node which has been approved by filter (ie, a group)
185 virtual void OnConcatenate(C3DFaceList *dstfaces, unsigned int dstindex, const C3DFaceList *srcfacelist, unsigned int srcindex) {}; //!< This is called when the #srcindex from srcfacelist, is added to #dstindex of dstfaces. This can be used for advanced DataChunk processing.
186};
187
188//! @class C3DNodePos
189//! This is a C3DScene iterator for node traversal. Cf. @ref TRAVERSING for more information and C3DScene::GetFirstNode() / C3DScene::GetNextNode()
190class DLL_3DFUNCTION C3DNodePos
191{
192 friend C3DScene;
193
194public:
195 C3DNodePos();
196 C3DNodePos(const C3DNodePos& pos);
197 virtual ~C3DNodePos();
198
199 operator bool() { return (node != NULL); }
200 C3DNodePos& operator=(const C3DNodePos& pos);
201
202 void SetFilter(const C3DFilter* filter); //!< Place a filter to exclude node from being processed. To be set after C3DScene::GetFirstNode();
203
204 // Special processing when NODEPOS_INSTANCE_ONCE is set. This allow to insert an ID if some object are replaced by new during the processing
205 // Cf ConvertToType for example
206 bool CheckObjectID(BaseObjectID id) const; //!< return true if specified object id has been seen (works in conjunction with AddObjectID)
207 void AddObjectID(BaseObjectID id); //!< Add an ObjectID in the processed list. No other nodes with this object ID will be returned by GetNext any more. This can be used to exclude some nodes that would have been inserted during a traversal to be part of the traversal.
208
209protected:
210 typedef enum _NodePosInternalFlags
211 {
212 NODEPOS_INTERNAL_NONE = 0x00,
213 NODEPOS_INTERNAL_STOP_TRAVERSAL = 0x01,
214 NODEPOS_INTERNAL_ALLOW_EMPTY_GEOM = 0x02,
215 NODEPOS_INTERNAL_IGNORE_INSTANCE_ONCE = 0x04,
216 } NodePosInternalFlags;
217
218 const C3DScene *scene;
219 const C3DFilter *filter;
220 unsigned int kindof; // kind of object required
221 unsigned int internalflags;
222 C3DSceneNode *node; // The current node
223 C3DSceneNode *stopNode; // Node to stop to
224 C3DInstanceID *instances; // Instance already taken into account
225};
226
227//! @struct SceneSerializeData
228//! This information can be retrieve through CXArchive::GetData during serialization, while all scene data is traversed
229typedef struct SceneSerializeData
230{
231 unsigned int sceneVersion, materialsVersion;
232 C3DScene *scene;
233 CCustomData data;
235
236//! @enum SceneSelectionFlags
237//! these flags control the selection for C3DScene::Select method
238//! If these information is missing, the default value should be taken into account.
239typedef enum SceneSelectionFlags XEnumType(unsigned int)
240{
241 SELECTION_DEFAULT = 0,
242 SELECTION_KEEP_SELECTION = 0x01, //!< Add the new selection to the existing one
243 SELECTION_SELECT_INSTANCES = 0x02, //!< Select also the instances of the provided node
244 SELECTION_SELECT_CHILDS = 0x04, //!< Select the child of the provided node
246
247//! @enum ConcatenateFlags
248//! Used by C3DScene::Concatenate and C3DScene::ConcatenateByMaterials to control what is process and where the created nodes are inserted in the scene
249typedef enum ConcatenateFlags XEnumType(unsigned int)
250{
251 CONCATENATE_DEFAULT = 0, //!< The scene is not modified, and a node is returned which can be added as you need in the scene graph
252 CONCATENATE_INCLUDE_PARENT = 0x01, //!< parentNode is included in concatenation (could be useful if parent is a geom object)
253
254 // Insert the concatenated node in the scene graph by replacing the parentNode or parentNode childs
255 CONCATENATE_REMOVE_TO_ROOT = 0x10, //!< Parent and childs are deleted (or not depending on the optionnal C3DFilter::ProcessNode returned value) and concatenated node is added to the scene root
256 CONCATENATE_REMOVE_AND_ADD_TO_PARENT = 0x20, //!< Parent childs are deleted (or not depending on the optionnal C3DFilter::ProcessNode returned value) and replace by concatenated node which become child of parent.
257 CONCATENATE_REPLACE_PARENT = 0x40, //!< Parent and its childs is replaced by concatenated node (whatever C3DFilter::ProcessNode returned value)
258
259 CONCATENATE_PROCESSING_FLAGS = 0xFFFF000,
260 CONCATENATE_SORT_BY_MATERIAL = 0x1000, //!< The result node has its faces sorted by material
262
263//! @enum CreateBackFaceFlags
264//! Flags for CreateBackfaceNodes method
265typedef enum CreateBackFaceFlags XEnumType(unsigned int)
266{
267 BACKFACE_DEFAULT = 0, //!< Create back face for all geom and the whole geom
268 BACKFACE_FBGEOM = 0x01, //!< Create back face only if geom have back face materials. In this case the whole geom is backfaced.
269 BACKFACE_FBFACE_ONLY = 0x02, //!< Create back face only for face that have back face materials. In this case only the fb faces are backfaced
271
272//! @enum ReplaceMatIDFlags
273//! Flags to control how C3DScene::ReplaceNodeMaterialID handles material replacement
274typedef enum ReplaceMatIDFlags XEnumType(unsigned int)
275{
276 REPLACEMATID_DEFAULT = 0,
277 REPLACEMATID_COPY_MATERIAL = 0x1, //!< the target material (newmatid) is replaced by the src material (if newmatid exits, it is deleted). If not set, newmatid material is supposed to exists in the material list
278 REPLACEMATID_DELETE_SRC_MATERIAL = 0x2, //!< Delete the src material (matid). To be used only if pParentNode = NULL, otherwise some other might reference oldmatid
279 REPLACEMATID_INCLUDE_PARENT = 0x100, //!< pParentNode is included in the change
281
282class DLL_3DFUNCTION C3DInstanceMap : protected CAssociationMap<BaseObjectID, C3DSceneNode *, unsigned int>
283{
284 friend C3DScene;
287
288 mutable C3DSceneNode *refnode;
289
290public:
291 using CAssociationMap::Free;
292 C3DSceneNode **GetInstancesByID(C3DSceneNode *node, int& size) const; //!< Return instances of the node. If the node has no instance, it return the a pointer to the node itself with size = 1
293};
294
295//! @class C3DScene
296//! @brief The class allows to get access to the scene graph, node hierarchy, material.
297//! @details C3DScene contains a C3DSceneNode tree and materials reference.
298//! It allows to read and write different files and to perform some different operations on the scene such node concatenation, scene merging...
299//!
300//! @par
301//! Most of the C3DScene method specify a parent node. If you want to process the whole scene you can either this parent node can be NULL or GetRoot()
302//! @note
303//! The scene can have multiple reference and CInstanciatedObject::Delete should be used to correctly release it.
304//!
305class DLL_3DFUNCTION C3DScene : private CTree, public C3DAnimatable, public CInstanciatedObject
306{
307public:
308 typedef struct SortSceneData
309 {
310 C3DScene* scene;
311 unsigned int kindOfObject;
312 unsigned int nodeFlags;
313 bool nodeFlagSet;
314 void* userData;
316
317 typedef struct GeoLocation
318 {
319 double longitude, latitude, altitude; //!< altitude in m
320 double northCorrection; //!< Rotation around Z axis to align Y axis to the north, in radian
321 } GeoLocation;
322
323public:
324 C3DScene();
325 virtual ~C3DScene(); //!< Use Delete instead, unless the C3DScene is created on the stack (take care that it is referenced once only in this case)
326
327 static C3DScene *Create(); //!< Allocates and creates an empty scene. Use C3DScene::Delete to delete the scene. Same as xNew(C3DScene).
328#ifdef MOOTOOLS_PRIVATE_BUILD
329 int AddRef() const;
330 virtual bool Delete();
331#endif
332
333 //! @name Scene information
334 //! Various information about the scene
335 //!
336 //! @{
337 C3DSceneNode *GetRoot() const; //!< Return the root node in the scene.
338 CCustomData& GetCustomData(); //!< Get access to custom data which allows to set or retrieve specific information. cf. #SCENE_DATA to find or retrieve some particular information. You may also store you own information creating your own IDs.
339
340 CFileNameSpec GetFilename() const;
341 CXString GetFilepath() const;
342 void SetFilename(const CFileNameSpec& filename);
343 void SetParserData(bool isReading, unsigned int parserClass, void *data);
344 void *GetParserData(unsigned int& parserClass, bool detachData);
345
346 //! @}
347
348 //! @name Scene units
349 //! Set and retrieve units and scale factor. The SDK Internal unit is arbitrarly defined as centimeters, which means that by default an unit vector length is considered to be 1 cm.
350 //! @{
351 double ConvertToUnit(double x) const; //!< Get a value in the current length / scale unit. (x * scale factor) / GetUnitFactor())
352 double ConvertFromUnit(double x) const; //!< Get a value from the current length / scale unit. (x * GetUnitFactor()) / scale_factor)
353 CXString GetUnitText(bool abreviation) const; //!< Return a text that describe the unit of the scene (ie. "centimers" or "cm" if abbreviation is true)
354 bool IsUnitDefined() const; //!< Return false if unit has not been defined when reading file. This means that we are not able to convert the coordinates to a real size value.
355 UNIT_MODE GetUnit() const; //!< By default UNIT_UNDEFINED is set unless the format specify it. C3DVector(1, 0, 0) has a length of 1 cm, unless GetScaleFactor is used to define another scale (ie. SetScaleFactor(100), means that C3DVector(1, 0, 0) has a length of 1 meter)
356 void SetUnit(UNIT_MODE unit); //!< Set the scene unit
357 double GetScaleFactor() const; //!< Return scene scale. Multiply the coordinates by this scale to get an information expressed in centimers
358 void SetScaleFactor(double scale); //!< Define the scale factor, which is the coordinate multiplied by this factor to get values in centimers.
359 static double GetUnitFactor(UNIT_MODE unit); //!< Return the value needed to convert centimer to the given unit. Ie. if unit = UNIT_M, the method will return 100.
360
361 //! @}
362
363 //! @name Scene node tree traversal
364 //! Different methods to traverse the node's tree
365 //! @ref TRAVERSAL
366 //! @{
367 bool IsChildNode(C3DSceneNode *parent, C3DSceneNode *node) const;
368 C3DNodePos GetFirstNode(unsigned int kindof = OBJECT_ALL_KINDOF, unsigned int traverseFlags = NODEPOS_DEFAULT, const C3DSceneNode *startNode = NULL, const C3DSceneNode *stopNode = NULL) const;
369 C3DNodePos GetFirstNode(const C3DSceneNode *startNode, unsigned int traverseFlags = NODEPOS_DEFAULT, const C3DSceneNode *stopNode = NULL) const;
370 C3DSceneNode * GetNextNode(C3DNodePos & pos) const; //!< Return only the node (don't care about the object which can be obtained using C3DSceneNode::GetBaseObject())
371 C3DSceneNode *GetNextNode(C3DBaseObject *&object, C3DNodePos& pos) const; //!< Return the node and it's object
372 C3DSceneNode *GetNextNode(C3DGeomObject *&object, C3DNodePos& pos) const; //!< GetFirstNode must define OBJECT_GEOM when using this version
373 C3DSceneNode *GetChildNode(const C3DSceneNode *node = NULL) const;
374 C3DSceneNode *GetRightNode(const C3DSceneNode *node) const;
375 C3DSceneNode *GetParent(const C3DSceneNode *node) const;
376
377 //! @}
378
379 //! @name Node retrievial
380 //! Different methods to retrieve nodes
381 //! @{
382 bool IsSceneRoot(const C3DSceneNode *node) const;
383 bool IsNodeInScene(C3DSceneNode *pParentNode = NULL) const;
384
385 unsigned int GetNodesByText(C3DSceneNode* pParent, const CXString& filter, bool matchCase, C3DNodeArray& nodes, bool resetArray = true); //!< Advanced search: find all nodes which name match the given regular expression
386 C3DSceneNode* GetNodeByName(C3DSceneNode* pParent, const CXString& name) const; //!< Beware node names are not supposed to be single. The first node encountered with the given name is returned by this method
387 C3DSceneNode* GetNodeByID(SceneNodeID id, bool is32BitsID = false) const; //!< If is32BitsID, the method lookl for 32 bits ID get with GetNodeID32() method
388
389 int GetNodeDepth(C3DSceneNode* pNode = NULL) const; //!< Return the node depth.A direct child of the root as the depth 0.
390 int GetDirectChildCount(C3DSceneNode *pParentNode = NULL, unsigned int kindof = OBJECT_ALL_KINDOF) const; //!< Return the number of child below the given node (direct childs)
391 int GetChildCount(C3DSceneNode *pParentNode = NULL, unsigned int kindof = OBJECT_ALL_KINDOF, unsigned int nodeFlag = SCENE_NODE_NONE, bool mustBeSet = true) const; //!< Return the number of child below the given node (all branch) of the given type and with the given flags (or not)
392 C3DSceneNode* GetCommonParent(const C3DNodeArray& nodes) const; //!< Return the upper common parent in the hierarchy to the provided nodes
393
394 unsigned int GetNodeIDMap(C3DSceneNodeIDMap& nodes, bool create32BitsIDMap) const; //!< Get a map that allows to get a C3DSceneNode from a SceneNodeID. If create32BitsIDMap, the method creates for 32 bits ID map
395 //! @}
396
397 //! @name Add / remove / copy nodes from scene
398 //! The following methods attach / detach the node and its object to / from the scene and eventually update the elements GUID to avoid GUID conflict in the scene
399 //! @{
400 unsigned int SetNodeObject(C3DSceneNode* node, C3DBaseObject* newobject, bool allObjectInstance, bool deletePreviousObject = true); //!< Replace node object with newobject and detach it from the scene. Replaces all object instance is needed. if newobject GUID and node object GUID is the same, the method avoid a new GUID being generated
401 unsigned int SetNodeObject(BaseObjectID objectID, C3DBaseObject* newobject, bool deletePreviousObject = true); //!< Replace all objectID instances with the new object. If object is not deleted, it is detached from the scene and does not belong to it anymore
402
403 C3DBaseObject* GetObjectByID(BaseObjectID id) const; //!< Look for object id through the whole scene. The first node with this ID is returned. As multiple nodes might reference id, this is better to use C3DScene::GetInstancesByID
404
405 void AddNode(C3DSceneNode *parentNode, C3DSceneNode *node, bool lastNode = false); //!< Add a node to the scene which parent is parentNode. node is attached to the scene, and its child if it has some. if lastNode = true, the node is the last of its branch (slower)
406 void DetachAndAddNode(C3DSceneNode* parentNode, C3DSceneNode* node, bool lastNode = false); //!< Same has AddNode, but remove the node from a previous scene if needed.
407 bool ReplaceNode(C3DSceneNode * newNode, C3DSceneNode * oldNode, bool deleteOldNode); //!< Replace oldNode by newNode. newNode is attached to oldNode childs, and become a child of oldNode parent.
408 bool ChangeNodeParent(C3DSceneNode *newParent, C3DSceneNode * node, bool updateMatrix = true ); //!< Attach node with its child to newParent. Matrix are update accordingly
409 void RemoveAll();
410 void RemoveAllNodes();
411 C3DSceneNode *RemoveNode(C3DSceneNode *node, bool deleteIt = true); //!< Remove or delete a node from the scene graph. Childs are also removed, if any. Return the previous valid node in the scene. Return NULL if node can't be delete.
412 bool RemoveNode(C3DSceneNode *node, C3DNodePos& pos, bool deleteIt = true); //!< Remove or delete the node (and its childs) from the scene graph. This version is to use when traversing the graph because if modify the node pos to the previous node. Return true if ok.
413 unsigned int RemoveNodeByObjectID(C3DSceneNode *pParentNode, BaseObjectID objectID, bool deleteObject = true); //!< Remove all node that reference objectID. if deleteObject = false, the last object reference is kept
414 unsigned int RemoveNodes(C3DNodeArray& nodes, bool deleteThem = true, bool cleanTree = true); //!< Remove or delete the nodes (and their childs) from the scene graph. if cleanTree = true, the empty groups of the tree are removed
415 bool DeleteNodes(C3DSceneNode *node = NULL, const C3DFilter* filter = NULL, bool includeNode = false); //!< Delete the node descendance that match the C3DFilter criteria. if includeNode = true, the node itself is considered to be deleted
416 bool MergeMatrixKeyframes(C3DSceneNode *fromNode, C3DSceneNode *toNode); //!< Multiply toNode's Matrix Keyframes by fromNode's ones.
417
418 int ConvertToType(C3DSceneNode *parentNode, C3DObjectCreator *objectCreator); //!< perform object type conversion. Return number of object that has been modified.
419 int DeleteInstanciation(C3DSceneNode *pParentNode = NULL); //!< Remove instanciation for the pParentNode and its childrend and replace it by a real copy. Return the number of instanciated object that were modified.
420 void Inherit(const C3DScene *pFromScene, unsigned int flags = SCENE_COPY_DEFAULT);
421 void InheritNode(C3DScene *pDestScene, C3DSceneNode *pSrcNode, unsigned int flags) const;
422 C3DSceneNode *CopySingleNode(C3DScene *pDstScene, C3DSceneNode *pDestParentNode, C3DSceneNode *pSrcNode, int flags = SCENE_COPY_DEFAULT, C3DObjectCreator *objectCreator = NULL) const; //!< Copy only the node
423 C3DSceneNode *CopyNode(C3DScene *pDstScene, C3DSceneNode *pDestParentNode, C3DSceneNode *pSrcNode, int flags = SCENE_COPY_DEFAULT, C3DObjectCreator *objectCreator = NULL) const; //!< Copy the node and its childs
424 void CopyChilds(C3DScene *pDstScene, C3DSceneNode *pDestParentNode, C3DSceneNode *pParentNode = NULL, int flags = SCENE_COPY_DEFAULT, C3DObjectCreator *objectCreator = NULL) const; //!< Copy only node's childs
425 C3DScene *Copy(C3DSceneNode *pSrcNode = NULL, int sceneCopyflags = SCENE_COPY_DEFAULT, C3DObjectCreator *objectCreator = NULL) const; //!< Return a copy of the scene, or NULL if the scene does not contains any node (unless SCENE_COPY_EMPTY_HIERARCHY is set)
426 bool AddScene(const C3DScene *scene, int sceneCopyflags = SCENE_COPY_DEFAULT, C3DObjectCreator *objectCreator = NULL); //!< Copy scene to the current scene using sceneCopyflags
427 bool Merge(C3DScene *sceneToMerge, C3DSceneNode *parentNode = NULL); //!< Merge sceneToMerge to parentNode or the root of the current scene. All sceneToMerge nodes are moved to the current scene (without copy), and sceneToMerge is deleted
428 void Sort(C3DSceneNode* pParentNode = NULL, bool sortDirectChildOnly = false, unsigned int kindof = OBJECT_ALL_KINDOF, unsigned int nodeFlag = SCENE_NODE_NONE, bool mustBeSet = true, XQSORT_PROTO compareMethod = NULL, void* userData = NULL); //!< Sort scene using compareMethod. If compareMethod = NULL a sort by name is done, otherwise the compare method can be assimiled to void SortkMethod(const C3DSceneNode **node1, const C3DSceneNode **node2, SortSceneData *data)
429 virtual void Serialize(CXArchive& ar);
430
431 //! @}
432
433 //! @name Object instanciation
434 //! Object are referenced by their BaseObjectID. It is possible to create several instance on a given BaseObjectID. Each instances are attached to a specific C3DSceneNode
435 //! @{
436 C3DSceneNode *CreateInstance(const C3DSceneNode *node); //!< Instanciate the the object node and object subnode. Returned node, contains a node (with possibily sub nodes) that reference an instanciated object
437 C3DBaseObject *CreateObjectInstance(const C3DBaseObject *refObject) const; //!< Create an instance of the given object. The returned instanciated node must be attached to a node then inserted into the scene
438
439 unsigned int GetInstancesMap(C3DInstanceMap& instances) const; //!< Init an instance map when multiple call to GetInstancesByID is required. Return the number of instance sets.
440 unsigned int GetInstancesByID(C3DSceneNode *pParentNode, C3DSceneNode *refnode, C3DNodeArray& nodes, bool resetArray) const; //!< Retrieve nodes that contains instance of object contained by refnode. Internally, the method looks if the object is instanciated and call the below method. This method does not traverse the scene if the node contains an object which is not instanciated.
441 unsigned int GetInstancesByID(C3DSceneNode *pParentNode, BaseObjectID id, C3DNodeArray& nodes, bool resetArray) const; //!< Get nodes which object are instance of id. It adds the node itself if node is not instanciated. This method is slower than GetInstancesByID version above, because it traverse the scene each time it is called, wether or not the object is instanciated.
442 unsigned int GetInstancesCount(C3DSceneNode* pParentNode, BaseObjectID id) const; //!< return the number of instance found in pParentNode branch.
443
444 //! @}
445
446 //! @name Scene default setting
447 //! @{
448 void SetSmoothAngle(float radianAngle, bool saveToPrefs = false);
449 void SetSmoothMode(NormalSmoothMode mode, bool saveToPrefs = false);
450 float GetSmoothAngle() const; //!< Return smooth angle in radian
451 NormalSmoothMode GetSmoothMode() const;
452 void SetPatchLevel(unsigned int level);
453
454 //! @}
455
456 //! @name Information about the scene
457 //! @{
458 C3DBBox GetBoundingBox(const C3DNodeArray& nodes) const;
459 int GetBoundingBox(C3DBBox& bbox, C3DSceneNode* pParentNode = NULL, unsigned int kindof = OBJECT_ALL_KINDOF, unsigned int nodeFlag = SCENE_NODE_NONE, bool mustBeSet = true) const; //!< Return the number of node found that satisfies the condition
460 int GetFaceNbr(C3DSceneNode* pParentNode = NULL, unsigned int kindof = OBJECT_ALL_KINDOF, unsigned int nodeFlag = SCENE_NODE_NONE, bool mustBeSet = true) const;
461 int GetPointNbr(C3DSceneNode* pParentNode = NULL, unsigned int kindof = OBJECT_ALL_KINDOF, unsigned int nodeFlag = SCENE_NODE_NONE, bool mustBeSet = true) const;
462
463 //! @}
464
465 //! @name Selection
466 //! @{
467 void SelectAll();
468 void SelectNone();
469 void Unselect(C3DSceneNode *node);
470 int Select(C3DSceneNode *node, unsigned int sceneSelectionFlags); //!< SelectionFlags is a combination of SceneSelectionFlags. Return the number of newly selected objects
471 bool IsNodeSelected(unsigned int kindof = OBJECT_ALL_KINDOF) const; //!< Return true if one node is selected
472 unsigned int GetNodesByFilter(C3DSceneNode* pParentNode, C3DNodeArray& nodes, const C3DFilter *filter = NULL) const; //!< Get nodes filtered by filter (or not) for the whole scene (pParentNode == NULL) or for the pParentNode childs (including itself). If filter is NULL there is no filtering and the whole scene nodes might be retrieved.
473 unsigned int GetSelectedNodes(C3DSceneNode * pParentNode, C3DNodeArray& nodes, unsigned int kindof = OBJECT_ALL_KINDOF) const; //!< Get selected nodes for the whole scene (pParentNode == NULL) or for the pParentNode childs (including itself)
474 unsigned int GetSelectedNodeNumber(C3DSceneNode* pParentNode = NULL, unsigned int kindof = OBJECT_ALL_KINDOF) const; //!< Get selected node count for the whole scene (pParentNode == NULL) or for the pParentNode childs (including itself)
475
476 //! @}
477
478 //! @name Animation
479 //! @{
480 CTimeRange GetTimeRange(longuint classid = KEYFRAME_NULLID) const;
481 const C3DKeyframe *GetConstKey(int time, unsigned int pos, longuint classid, int *findKeyTime) const;
482 int GetCurrentTime() const;
483 bool SetCurrentTime(int newtime);
484 void DeleteAllKeys();
485
486 //! @}
487
488 //! @name Prepare scene before Import / Export
489 //! @{
490 void CheckoutImport(CSceneImportOptions& options); //!< This method is called after scene is imported using C3DIo::Read. It prepares the scene following the import requirements.
491 C3DScene *InitExport(CSceneExportOptions& options); //!< this method is called before the scene is save using C3DIo::Save. It returns a scene copy (unless SCENE_EXPORT_COPY is used) following the export requirements.
492 static bool InitExport(CSceneExportOptions& options, C3DScene *scene);
493 static void ReleaseExport(CSceneExportOptions& options);
494
495 //! @}
496
497 //! @name Modifying scene content
498 //! These methods allows to modify a node, a particular branch of the scene, or the whole scene.
499 //! @{
500 int ConvertToGlobalCoordinates(C3DSceneNode *pParentNode = NULL, bool includeNodeItself = false); //!< Convert a node and its child to global coordinates. Return the number of node changed.
501 void Scale(const C3DVector& scale);
502
503 void PivotTransform(C3DSceneNode* node, const C4x4Matrix& toTransform, bool worldTransform, bool preserveChildPosition = true, bool preserveInstancePosition = true);
504
505 void CompensateTransform(C3DSceneNode* node, const C4x4Matrix& transform); //!< Transform the points with the given matrix but apply the equivalent transform to the node, so the scene stays globally unchanged. This allows to recenter points around origin for example or avoid too small edge length.
506
507 bool OrientScene(UP_AXIS_MODE mode, bool import); //!< return true if something changed
508 bool SwapCoordinates(int swapmode); //!< return true if something changed
509 bool GenerateNormals(C3DSceneNode *node = NULL, unsigned int mode = GENNORMAL_PER_VERTEX, NormalSmoothMode smooth = NORMAL_GLOBAL_MODE); //!< Generate normal in multithread process. Mode is one or a combination of GENNORMAL_MODE (if GENNORMAL_SPEC_CHANNEL is used). Return true if at least one normal has been computed, false if nothing need to be computed
510 bool DisconnectBorderFaces(unsigned int channelType = ALL_CHANNELS_TYPE, unsigned int tagPointsFlags = POINT_BELONG_TO_BORDER|POINT_IS_CONFUSED, unsigned int tagFaceFlags = FACE_IS_BORDER|FACE_HAS_CONFUSED_POINTS);
511 void Clean();
512 bool MakeGroupForChilds(C3DSceneNode *pParentNode = NULL); //!< If an object has a child, make this child being attached to a C3DGroup instead. This guarantee that all object are leaves only.
513 unsigned int CleanGroups(C3DSceneNode *pParent = NULL, bool onlyEmptyGroup = true, bool includeNodeItself = false); //!< Return the number of group removed
514 void RemoveGroups();
515 void CreatePersistentGuids(); //!< Give each node a persitent GUID based on mix of name, node properties and hierarchy position. This ID is made to be able to find back a specific node even if file has been modified
516
517 //! Return a single node from the pParentNode childs (which can be selected by a C3DFilter).\n
518 //! This node is automatically substituted to the nodes and added to scene root (if !CONCATENATE_KEEP_PARENT) is set to true.
519 //! @param C3DFilter::ProcessNode can exclude some node in the processing. In such case, the branch might still contain some elements, and empty group might remain. If required, you may call CleanGroups to remove such elements.
520 //! @return The returned node can be an existing node, if the parent when the parent has a single child and the caller ask to replace the node (and if there is no filter define and no special processing are request)
523
524 //! Generate UV for the whole scene for material which have the planar/spherical/cubic projection type.\n
525 //! Materials are modified and projection type is turned to UVW
527
528 //! When an object has different front and backface materials, this create a new node that contains the back face content.
529 //! @param createBackFaceFlags
530 //! #BACKFACE_FBGEOM, if an object have double-sided material faces, then the whole object is duplicated. If such object has 100 faces, but only 10 are double sided, then a new node with 100 faces is created. If an object has no back face material, it is no duplicated.
531 //! #BACKFACE_FBFACE_ONLY, only double sided material faces are duplicated. If an object has 100 faces, but only 10 are double sided, then a new node with 10 faces is created.
532 //! In that case, a face is not duplicated if its front when its front material is transparent.
534
535 //! @}
536
537 //! @name Textures path
538 //! Different methods related to textures
539 //! @{
540 bool AddTexturePath(const CXString& path); //!< Add a specific texture path for the scene. The path is not added to preferences. Return true if the path is new, false if already added. Useful for format that embed textures (sketchup, kmz, fbx...)
541 bool GetTexturePath(int index, CXString& path) const; //!< Get ith scene texture path, starting with index 0. Returns false if there is no path for the index, meaning that no more paths exists.
542 int GetTexturePaths(CXStringArray& paths, bool removeAll = true) const; //!< Get scene texture path, and return the paths size (including any previous one, if removeAll = false)
543 bool CopyTextures(const CXString& sceneFilename, const CXString& refDstPath, CSceneExportOptions *options);
544 void AdjustPaths(const CXString& targetPath, bool relativePathAllowed); //!< This adjusts paths of files in relation with the scene in order to make them relative to the scene path. This can also resolves some issues with file which are incorrectly located (ie. texture maps, that are presume to be in a given folder but are finally in the scene folder)
545 int GetLinkedFiles(CXStringArray& files, bool pathRelativeToScenePath = true, bool textureOnly = false) const; //!< This returns a list of file that are in relation with the scene (texture files...). When pathRelativeToScenePath, the returned path are relative to the scene path when they are contained in the scene folder.
546
547 //! @}
548
549 //! @name Materials
550 //! @{
551 C3DMaterial *CreateNewMaterial(MATERIAL_CLASS materialClass); //!< Create material with automatic ID assignment
552 C3DMaterial* CreateNewMaterial(MaterialID& matID, MATERIAL_CLASS materialClass); //!< Create material providing an ID (which might be modified if it already exists)
553 MaterialID AddNewMaterial(C3DMaterial *material); //!< Add a material that has been created from scratch and which is not attached to any material list. The materialID is kept unless a material already exists with the same id. In that case, the new and different materialID assigned to the material is returned.
554 bool RemoveMaterial(MaterialID matid, bool deleteIt = true); //!< Remove the material from the scene. This does not modify object material association, and face that used that materials remains unchanged
555 const CMaterials& GetMaterials() const;
556 HashPos GetFirstMaterial() const; //!< if matclass = MATERIAL_CLASS_UNDEFINED, return all type of materials, otherwise return materials of the given class
557 C3DMaterial *GetNextMaterial(HashPos& pos) const; //!< if defined matclass should be the same than the one use in GetFirstMaterial
558 unsigned int GetMaterials(C3DMaterialArray& mats, bool resetArray = true, MATERIAL_CLASS matclass = MATERIAL_CLASS_UNDEFINED) const; //!< Fill the material array and return the number of scene's material of the given class (or all class if MATERIAL_CLASS_UNDEFINED specified).
559 int GetMaterialNumber(MATERIAL_CLASS matclass = MATERIAL_CLASS_UNDEFINED) const;
560
561 int GetFBMaterials(C3DSceneNode * pParentNode, CFBMaterialHashMap & fbmatids, bool resetHash) const; //!< Collect front and back face material pairs referenced by pParentNode and childs. CFBMaterialHashMap is a map that associate a fbmaterial to the number of object that reference the material.
562 int GetMaterials(C3DSceneNode *pParentNode, CMaterialHashMap& materials, bool resetHash) const; //!< Collect the materials referenced by pParentNode and childs. CMaterialHashMap is a map that associate a material to the number of object that reference the material.
563 int GetChilds(C3DSceneNode* pParentNode, C3DNodeArray& array, bool singleInstance = false, bool includeParentNode = false) const; //!< Get childs of a node and potentially the node itself. If singleInstance = true, only one instance of a given object is added to the array
564 int GetNodesByMaterial(C3DSceneNode *pParentNode, MaterialID matid, C3DNodeArray& array, bool resetArray, C3DFilter* filter = NULL) const;
565 int GetNodesByType(C3DSceneNode *pParentNode, unsigned int objectKindof, C3DNodeArray& nodes, bool singleInstance, bool resetArray) const;
566 int GetNodesByFlags(C3DSceneNode* pParentNode, unsigned int nodeflags, bool nodeflagset, unsigned int objectflags, bool objectflagset, C3DNodeArray& nodes, bool singleInstance, bool resetArray, unsigned int objectKindof = OBJECT_ALL_KINDOF) const; //!< Return the nodes that matches the required flags. When singleInstance = true, this return the first node found of a given instance. If a flag is required (is NODE_IS_SELECTED), this return the first instance of the node with the selected flag (the flag might be missing for other node instance).
567 void SortNodesByDepth(C3DNodeArray& array, bool highToSmallDepth = true) const; //!< Sort a node array by its depth in the hierarchy from highest to smallest depth or the inverse if highToSmallDepth = false
568 void CopyMaterials(const C3DScene& scene, unsigned int flags = MATERIAL_COPY_KEEP_ID|MATERIAL_COPY_REMOVE_ALL, const CMaterialHashMap *matids = NULL);
569 bool ReplaceNodeMaterialID(C3DSceneNode* pParentNode, MaterialID srcmatid, MaterialID newmatid, unsigned int replaceNodeMaterialIDFlags = REPLACEMATID_DEFAULT); //!< Replace all occurences of srcmatid in the pParentNode childs with newmatid. replaceNodeMaterialIDFlags is one or more ReplaceMatIDFlags flags
570
571 unsigned int GetMaterialsByText(const CXString& filter, bool matchCase, C3DMaterialIDArray& matids, bool resetHash); //!< Advanced search: find all materials which name match the given text
572
573 C3DMaterial* GetMaterialByName(const CXString& name) const; //!< Beware material names are not supposed to be single. The first material encountered with a given name is returned by this method
574 C3DMaterial* GetMaterialByID(MaterialID id, bool createIfMissing = false, MATERIAL_CLASS materialClass = MATERIAL_CLASS_STANDARD); //!< Find a material given its id. Return NULL if does not exists, or create it if createIfMissing = true
575 C3DMaterial* GetMaterialByID2(MaterialID id, MATERIAL_CLASS materialClass) const; //!< Find a material given its id. if materialClass is specified, the material is returned only if it has the given class. NULL otherwise.
576 C3DMaterial *FindMaterial(const C3DMaterial& material, bool sameName) const;
577 MaterialID FindMaterialID(const C3DMaterial& material, bool sameName) const;
578 MaterialID GetMaterialID(const CXString& name); //!< Same has GetMaterialByID except it returns a MaterialID.
579
580 //! @}
581
582 CTree *GetTree() { return this; } //!< CTree base class has protected access, so use this with precaution
583 CGuidMgr& GetGuidMgr() { return guidMgr; }
584
585protected:
586 CParserSceneInfo *parserInfo;
587 CGuidMgr guidMgr;
588 CCustomData sceneData;
589 CMaterials materials;
590 int currentTime;
591
592 bool CopyTextureFile(const CXString& srcfile, const CXString& dstPath, CXString& newFilePath, CSceneExportOptions *options);
593 void CheckoutNode(CSceneImportOptions& options);
594 void ReleaseParserInfo();
595 void UpdateParenting(C3DScene *scene, C3DSceneNode *node); // Parenting changed for node, which now belong to scene. If scene is NULL, node, does not belong to anything.
596};
597
598END_MOOTOOLS_NAMESPACE
599
600#endif // !defined(AFX_3DScene_H__CA6BC29F_FAC2_11D1_A0DE_000000000000__INCLUDED_)
C3DKeyframable class for handling keyframes.
C3DBaseObject class which is the common base class for all object types.
@ OBJECT_ALL_KINDOF
This also include private type for copy and other specific operations.
Definition 3DBaseObject.h:48
C3DFaceList class definition which is a list of C3DFace.
@ GENNORMAL_PER_VERTEX
Generate per vertex normal (CPointNormalChannel smooth normals)
Definition 3DGeomObject.h:36
The files handles materials definition.
MATERIAL_CLASS
Definition 3DMaterial.h:53
@ MATERIAL_CLASS_STANDARD
The material is a C3DStandardMaterial.
Definition 3DMaterial.h:55
SceneSelectionFlags
Definition 3DScene.h:240
@ SELECTION_SELECT_INSTANCES
Select also the instances of the provided node.
Definition 3DScene.h:243
@ SELECTION_SELECT_CHILDS
Select the child of the provided node.
Definition 3DScene.h:244
@ SELECTION_KEEP_SELECTION
Add the new selection to the existing one.
Definition 3DScene.h:242
ReplaceMatIDFlags
Definition 3DScene.h:275
@ REPLACEMATID_DELETE_SRC_MATERIAL
Delete the src material (matid). To be used only if pParentNode = NULL, otherwise some other might re...
Definition 3DScene.h:278
@ REPLACEMATID_COPY_MATERIAL
the target material (newmatid) is replaced by the src material (if newmatid exits,...
Definition 3DScene.h:277
@ REPLACEMATID_INCLUDE_PARENT
pParentNode is included in the change
Definition 3DScene.h:279
NodeFilterFlags
Definition 3DScene.h:103
@ NODEFILTER_SELECTED
Return only selected nodes.
Definition 3DScene.h:107
@ NODEFILTER_DEFAULT
Do default traversal, filter nothing.
Definition 3DScene.h:104
@ NODEFILTER_VALID
Return only valid nodes.
Definition 3DScene.h:105
@ NODEFILTER_SHOW
Return only displayed nodes.
Definition 3DScene.h:106
CreateBackFaceFlags
Definition 3DScene.h:266
@ BACKFACE_FBGEOM
Create back face only if geom have back face materials. In this case the whole geom is backfaced.
Definition 3DScene.h:268
@ BACKFACE_DEFAULT
Create back face for all geom and the whole geom.
Definition 3DScene.h:267
@ BACKFACE_FBFACE_ONLY
Create back face only for face that have back face materials. In this case only the fb faces are back...
Definition 3DScene.h:269
NodePosFlags
Definition 3DScene.h:92
@ NODEPOS_INSTANCE_ONCE
When traversing the tree, settings this flag returns only once time each object instance....
Definition 3DScene.h:94
@ NODEPOS_DEFAULT
Do default traversal, which means it starts traversal from the first child of the provided node....
Definition 3DScene.h:93
@ NODEPOS_INCLUDE_NODE
Include the node itself in the traversal. Node childs and right brothers will also be traversed.
Definition 3DScene.h:95
@ NODEPOS_BRANCH_ONLY
Traverse provided node childs. If NODEPOS_INCLUDE_NODE specified, traverse also right branch (brother...
Definition 3DScene.h:96
@ NODEPOS_ALLOW_EMPTY_NODES
During serialization some node might be provided with geometry. This allows to get access to such nod...
Definition 3DScene.h:97
ConcatenateFlags
Definition 3DScene.h:250
@ CONCATENATE_DEFAULT
The scene is not modified, and a node is returned which can be added as you need in the scene graph.
Definition 3DScene.h:251
@ CONCATENATE_SORT_BY_MATERIAL
The result node has its faces sorted by material.
Definition 3DScene.h:260
@ CONCATENATE_REMOVE_TO_ROOT
Parent and childs are deleted (or not depending on the optionnal C3DFilter::ProcessNode returned valu...
Definition 3DScene.h:255
@ CONCATENATE_REMOVE_AND_ADD_TO_PARENT
Parent childs are deleted (or not depending on the optionnal C3DFilter::ProcessNode returned value) a...
Definition 3DScene.h:256
@ CONCATENATE_INCLUDE_PARENT
parentNode is included in concatenation (could be useful if parent is a geom object)
Definition 3DScene.h:252
@ CONCATENATE_REPLACE_PARENT
Parent and its childs is replaced by concatenated node (whatever C3DFilter::ProcessNode returned valu...
Definition 3DScene.h:257
SCENE_DATA
Definition 3DScene.h:30
@ SCENE_DATA_SMOOTH_ANGLE
float ((C3DPreferences::Get3DPreferences()::GetSmoothAngle()). Smooth angle in radian
Definition 3DScene.h:35
@ SCENE_DATA_TEXTURE_PATHS
string array: additional texture paths. Can be retrieve using C3DScene::GetTexturePaths
Definition 3DScene.h:37
@ SCENE_DATA_FILENAME
CXString: the scene file path.
Definition 3DScene.h:31
@ SCENE_DATA_TEMPORARY_TEXTURES
Bool (false): texture files are temporaries and can be deleted when scene deleted (ie,...
Definition 3DScene.h:33
@ SCENE_DATA_PATCH_LEVEL
unsigned int (C3DPreferences::Get3DPreferences()::GetPatchLevel())
Definition 3DScene.h:34
@ SCENE_DATA_FILECLASS
Unsigned int: the scene file class (Ie. FBX_3D_FILE, WAVEFRONT_3D_FILE...)
Definition 3DScene.h:32
@ SCENE_DATA_GEOLOCATION
Binary (C3DScene::GeoLocation): longitude and latitude position of the scene.
Definition 3DScene.h:38
@ SCENE_DATA_TARGET_MR_BBOX
Binary - 6 floats - Target bounding box for multiresolution file.
Definition 3DScene.h:39
@ SCENE_DATA_SMOOTH_MODE
unsigned int ((C3DPreferences::Get3DPreferences()::GetSmoothMode())
Definition 3DScene.h:36
C3DSceneNode class definition.
UP_AXIS_MODE
Definition 3DType.h:360
NormalSmoothMode
Definition 3DType.h:401
@ NORMAL_GLOBAL_MODE
The object used the preferences smoothing mode.
Definition 3DType.h:402
@ POINT_IS_CONFUSED
The point is confused with one or several other points.
Definition Point.h:29
@ POINT_BELONG_TO_BORDER
The point belongs to an edge which a border edge (belonging to a single face)
Definition Point.h:26
C3DAnimatable is the base class for any object which inherits an animation.
Definition 3DAnimatable.h:25
This is the base class for any kind of object.
Definition 3DBaseObject.h:106
C3DCamera handles camera object.
Definition 3DCamera.h:61
Definition 3DScene.h:157
FBMaterialID GetFBMaterialID() const
Get the material that was set. If SetMaterial call, the return material as only frontID defined.
virtual void OnConcatenate(C3DSceneNode *dstnode, const C3DSceneNode *srcnode)
The dstnode send previously in OnConcatenateBegin is finished to be processed. If validNode == true,...
Definition 3DScene.h:183
virtual bool ProcessFace(const C3DBaseObject *object, const C3DFace *face) const
Must be called by overriden methods to handle material filtering if needed.
virtual C3DSceneNode * OnConcatenateBegin()
A new concatenated node need to be created with its object. We will try to add something to it,...
virtual void OnConcatenate(C3DFaceList *dstfaces, unsigned int dstindex, const C3DFaceList *srcfacelist, unsigned int srcindex)
This is calledwhen something from srcobject goes into dstobject. dstobject is a geom object,...
Definition 3DScene.h:185
virtual bool ProcessNode(const C3DSceneNode *node) const
Must be called by overriden methods to handle material filtering if needed.
virtual void OnConcatenate(C3DGeomObject *dstobject, const C3DBaseObject *srcobject)
This is called when something from srcnode object goes into dstnode object. This give a chance to mer...
Definition 3DScene.h:184
void SetFBMaterial(FBMaterialID matid, bool musHave)
Used to perform material filtering (used by ConcatenateByMaterial)
bool PerformMaterialFiltering() const
Return true if material filtering is performed.
void SetMaterial(MaterialID matid, bool musHave)
Used to perform material filtering (used by ConcatenateByMaterial)
A 3D curve is a list of C3DPoint. It has specific flags and material.
Definition 3DCurve.h:20
A dummy is a void object that does not contains geometry.
Definition 3DDummy.h:21
A 3D face is a list of indexes of C3DPointList object point list.
Definition 3DFace.h:43
C3DFaceList class which implement a list of C3DFace. Each face contains indexes to 3D points stored i...
Definition 3DFaceList.h:249
C3DFilter allows to filter the nodes / faces / points being processed.
Definition 3DScene.h:118
void SetCallbackData(void *data)
specific that can be used in the callback operation
virtual bool ProcessFace(const C3DBaseObject *object, const C3DFace *face) const
Return true if the face should be processed, false otherwise.
virtual bool ProcessPoint(const C3DBaseObject *object, const C3DPoint *point) const
Return true if the point should be processed, false otherwise.
static bool ProcessNode(unsigned int filterFlags, const C3DSceneNode *node, unsigned int kindOfObject=OBJECT_ALL_KINDOF)
Flags is one or more NodeFilterFlags. Call this static method allows a simple filter on the nodes.
virtual bool ProcessNode(const C3DSceneNode *node) const
Return true if the node should be processed, false otherwise.
void * GetCallbackData()
specific that can be used in the callback operation
Definition 3DScene.h:127
C3DFilter(unsigned int flags=NODEFILTER_DEFAULT, unsigned int kindOfObject=OBJECT_ALL_KINDOF)
By default all the nodes are transmitted to ProcessNode.
Definition 3DScene.h:139
void ExcludindFlags(unsigned int flags)
Defines flags that the node must not have.
C3DFlagFilter(unsigned int kindOfObject=OBJECT_ALL_KINDOF)
By default all the nodes are transmitted to ProcessNode.
void NeededFlags(unsigned int flags)
Defines flags required for the node to be processed.
virtual bool ProcessNode(const C3DSceneNode *node) const
Return true if the node should be processed, false if not.
This is the base class for any object containing geometry (curve, polygonal object,...
Definition 3DGeomObject.h:49
C3DGroup class is an object without geometry. C3DGroup allows to organize the scene hierarchically.
Definition 3DGroup.h:22
Definition 3DScene.h:283
C3DSceneNode ** GetInstancesByID(C3DSceneNode *node, int &size) const
Return instances of the node. If the node has no instance, it return the a pointer to the node itself...
This is the base class for any keyframe that is part of C3DKeyframable class.
Definition 3DKeyframe.h:49
This class implements a light object in the scene (OBJECT_LIGHT)
Definition 3DLight.h:50
C3DMaterial is the base class for materials. There is currently two kinds of materials: C3DPbrMateria...
Definition 3DMaterial.h:69
Definition 3DScene.h:191
void SetFilter(const C3DFilter *filter)
Place a filter to exclude node from being processed. To be set after C3DScene::GetFirstNode();.
bool CheckObjectID(BaseObjectID id) const
return true if specified object id has been seen (works in conjunction with AddObjectID)
void AddObjectID(BaseObjectID id)
Add an ObjectID in the processed list. No other nodes with this object ID will be returned by GetNext...
This class can be provided in C3DScene::Copy operations and allows to modify the created kind of clas...
Definition 3DScene.h:47
C3DScene * GetScene() const
Set the scene to which the copied object will belong to. The element GUID is updated.
void SetScene(C3DScene *scene)
Set the scene to which the copied object will belong to. The element GUID is updated.
virtual C3DBaseObject * GetNewObjectFrom(const C3DBaseObject *refobject, bool &emptyCopy)
Return an object from the provided refobject. Returned object might be empty (empty points/faces/chan...
CCustomData & GetCustomData()
Can be used to store some information.
C3DObjectCreator(C3DScene *scene=NULL)
Destination scene to which the element is copied.
virtual C3DBaseObject * ConvertToType(const C3DSceneNode *refnode, const C3DBaseObject *refobject)
Convert refobject to another type. return the object itself if no conversion performed.
virtual bool CanProcess(const C3DSceneNode *node, const C3DBaseObject *object)
Return true if the node and its object should be copied / converted.
C3DObject handles polygonal mesh.
Definition 3DObject.h:24
C3DPatch handles handles patch object smoothed using a subdivision algorithm.
Definition 3DPatch.h:34
Definition 3DPointList.h:267
The class allows to get access to the scene graph, node hierarchy, material.
Definition 3DScene.h:306
bool MakeGroupForChilds(C3DSceneNode *pParentNode=NULL)
If an object has a child, make this child being attached to a C3DGroup instead. This guarantee that a...
bool AddTexturePath(const CXString &path)
Add a specific texture path for the scene. The path is not added to preferences. Return true if the p...
bool GenerateNormals(C3DSceneNode *node=NULL, unsigned int mode=GENNORMAL_PER_VERTEX, NormalSmoothMode smooth=NORMAL_GLOBAL_MODE)
Generate normal in multithread process. Mode is one or a combination of GENNORMAL_MODE (if GENNORMAL_...
unsigned int GetInstancesByID(C3DSceneNode *pParentNode, C3DSceneNode *refnode, C3DNodeArray &nodes, bool resetArray) const
Retrieve nodes that contains instance of object contained by refnode. Internally, the method looks if...
int ConvertToGlobalCoordinates(C3DSceneNode *pParentNode=NULL, bool includeNodeItself=false)
Convert a node and its child to global coordinates. Return the number of node changed.
void DetachAndAddNode(C3DSceneNode *parentNode, C3DSceneNode *node, bool lastNode=false)
Same has AddNode, but remove the node from a previous scene if needed.
int DeleteInstanciation(C3DSceneNode *pParentNode=NULL)
Remove instanciation for the pParentNode and its childrend and replace it by a real copy....
unsigned int GetInstancesCount(C3DSceneNode *pParentNode, BaseObjectID id) const
return the number of instance found in pParentNode branch.
bool MergeMatrixKeyframes(C3DSceneNode *fromNode, C3DSceneNode *toNode)
Multiply toNode's Matrix Keyframes by fromNode's ones.
MaterialID GetMaterialID(const CXString &name)
Same has GetMaterialByID except it returns a MaterialID.
C3DSceneNode * GetNextNode(C3DBaseObject *&object, C3DNodePos &pos) const
Return the node and it's object.
unsigned int GetInstancesByID(C3DSceneNode *pParentNode, BaseObjectID id, C3DNodeArray &nodes, bool resetArray) const
Get nodes which object are instance of id. It adds the node itself if node is not instanciated....
C3DBaseObject * GetObjectByID(BaseObjectID id) const
Look for object id through the whole scene. The first node with this ID is returned....
C3DBaseObject * CreateObjectInstance(const C3DBaseObject *refObject) const
Create an instance of the given object. The returned instanciated node must be attached to a node the...
C3DSceneNode * GetNodeByID(SceneNodeID id, bool is32BitsID=false) const
If is32BitsID, the method lookl for 32 bits ID get with GetNodeID32() method.
unsigned int GetSelectedNodeNumber(C3DSceneNode *pParentNode=NULL, unsigned int kindof=OBJECT_ALL_KINDOF) const
Get selected node count for the whole scene (pParentNode == NULL) or for the pParentNode childs (incl...
void SetUnit(UNIT_MODE unit)
Set the scene unit.
C3DScene * InitExport(CSceneExportOptions &options)
this method is called before the scene is save using C3DIo::Save. It returns a scene copy (unless SCE...
HashPos GetFirstMaterial() const
if matclass = MATERIAL_CLASS_UNDEFINED, return all type of materials, otherwise return materials of t...
static C3DScene * Create()
Allocates and creates an empty scene. Use C3DScene::Delete to delete the scene. Same as xNew(C3DScene...
CTree * GetTree()
CTree base class has protected access, so use this with precaution.
Definition 3DScene.h:582
double ConvertToUnit(double x) const
Get a value in the current length / scale unit. (x * scale factor) / GetUnitFactor())
C3DSceneNode * CreateInstance(const C3DSceneNode *node)
Instanciate the the object node and object subnode. Returned node, contains a node (with possibily su...
C3DMaterial * CreateNewMaterial(MATERIAL_CLASS materialClass)
Create material with automatic ID assignment.
C3DSceneNode * GetNextNode(C3DGeomObject *&object, C3DNodePos &pos) const
GetFirstNode must define OBJECT_GEOM when using this version.
int GetBoundingBox(C3DBBox &bbox, C3DSceneNode *pParentNode=NULL, unsigned int kindof=OBJECT_ALL_KINDOF, unsigned int nodeFlag=SCENE_NODE_NONE, bool mustBeSet=true) const
Return the number of node found that satisfies the condition.
bool ReplaceNode(C3DSceneNode *newNode, C3DSceneNode *oldNode, bool deleteOldNode)
Replace oldNode by newNode. newNode is attached to oldNode childs, and become a child of oldNode pare...
C3DMaterial * GetNextMaterial(HashPos &pos) const
if defined matclass should be the same than the one use in GetFirstMaterial
bool GenerateUVW()
int GetLinkedFiles(CXStringArray &files, bool pathRelativeToScenePath=true, bool textureOnly=false) const
This returns a list of file that are in relation with the scene (texture files...)....
C3DSceneNode * GetCommonParent(const C3DNodeArray &nodes) const
Return the upper common parent in the hierarchy to the provided nodes.
CCustomData & GetCustomData()
Get access to custom data which allows to set or retrieve specific information. cf....
C3DSceneNode * Concatenate(C3DSceneNode *pParentNode=NULL, unsigned int concatenateFlags=CONCATENATE_REMOVE_TO_ROOT|CONCATENATE_SORT_BY_MATERIAL, C3DConcatenateFilter *filter=NULL, C3DNodeArray *processedMeshes=NULL)
C3DSceneNode * GetRoot() const
Return the root node in the scene.
static double GetUnitFactor(UNIT_MODE unit)
Return the value needed to convert centimer to the given unit. Ie. if unit = UNIT_M,...
int GetMaterials(C3DSceneNode *pParentNode, CMaterialHashMap &materials, bool resetHash) const
Collect the materials referenced by pParentNode and childs. CMaterialHashMap is a map that associate ...
bool RemoveNode(C3DSceneNode *node, C3DNodePos &pos, bool deleteIt=true)
Remove or delete the node (and its childs) from the scene graph. This version is to use when traversi...
unsigned int GetMaterials(C3DMaterialArray &mats, bool resetArray=true, MATERIAL_CLASS matclass=MATERIAL_CLASS_UNDEFINED) const
Fill the material array and return the number of scene's material of the given class (or all class if...
CXString GetUnitText(bool abreviation) const
Return a text that describe the unit of the scene (ie. "centimers" or "cm" if abbreviation is true)
double GetScaleFactor() const
Return scene scale. Multiply the coordinates by this scale to get an information expressed in centime...
int GetNodesByFlags(C3DSceneNode *pParentNode, unsigned int nodeflags, bool nodeflagset, unsigned int objectflags, bool objectflagset, C3DNodeArray &nodes, bool singleInstance, bool resetArray, unsigned int objectKindof=OBJECT_ALL_KINDOF) const
Return the nodes that matches the required flags. When singleInstance = true, this return the first n...
void CopyChilds(C3DScene *pDstScene, C3DSceneNode *pDestParentNode, C3DSceneNode *pParentNode=NULL, int flags=SCENE_COPY_DEFAULT, C3DObjectCreator *objectCreator=NULL) const
Copy only node's childs.
void SortNodesByDepth(C3DNodeArray &array, bool highToSmallDepth=true) const
Sort a node array by its depth in the hierarchy from highest to smallest depth or the inverse if high...
double ConvertFromUnit(double x) const
Get a value from the current length / scale unit. (x * GetUnitFactor()) / scale_factor)
void AdjustPaths(const CXString &targetPath, bool relativePathAllowed)
This adjusts paths of files in relation with the scene in order to make them relative to the scene pa...
C3DSceneNode * GetNodeByName(C3DSceneNode *pParent, const CXString &name) const
Beware node names are not supposed to be single. The first node encountered with the given name is re...
void SetScaleFactor(double scale)
Define the scale factor, which is the coordinate multiplied by this factor to get values in centimers...
C3DSceneNode * CopySingleNode(C3DScene *pDstScene, C3DSceneNode *pDestParentNode, C3DSceneNode *pSrcNode, int flags=SCENE_COPY_DEFAULT, C3DObjectCreator *objectCreator=NULL) const
Copy only the node.
unsigned int SetNodeObject(C3DSceneNode *node, C3DBaseObject *newobject, bool allObjectInstance, bool deletePreviousObject=true)
Replace node object with newobject and detach it from the scene. Replaces all object instance is need...
MaterialID AddNewMaterial(C3DMaterial *material)
Add a material that has been created from scratch and which is not attached to any material list....
float GetSmoothAngle() const
Return smooth angle in radian.
int GetChilds(C3DSceneNode *pParentNode, C3DNodeArray &array, bool singleInstance=false, bool includeParentNode=false) const
Get childs of a node and potentially the node itself. If singleInstance = true, only one instance of ...
unsigned int GetNodeIDMap(C3DSceneNodeIDMap &nodes, bool create32BitsIDMap) const
void AddNode(C3DSceneNode *parentNode, C3DSceneNode *node, bool lastNode=false)
Add a node to the scene which parent is parentNode. node is attached to the scene,...
unsigned int GetSelectedNodes(C3DSceneNode *pParentNode, C3DNodeArray &nodes, unsigned int kindof=OBJECT_ALL_KINDOF) const
Get selected nodes for the whole scene (pParentNode == NULL) or for the pParentNode childs (including...
bool RemoveMaterial(MaterialID matid, bool deleteIt=true)
Remove the material from the scene. This does not modify object material association,...
int GetDirectChildCount(C3DSceneNode *pParentNode=NULL, unsigned int kindof=OBJECT_ALL_KINDOF) const
Return the number of child below the given node (direct childs)
C3DMaterial * GetMaterialByID(MaterialID id, bool createIfMissing=false, MATERIAL_CLASS materialClass=MATERIAL_CLASS_STANDARD)
Find a material given its id. Return NULL if does not exists, or create it if createIfMissing = true.
unsigned int RemoveNodes(C3DNodeArray &nodes, bool deleteThem=true, bool cleanTree=true)
Remove or delete the nodes (and their childs) from the scene graph. if cleanTree = true,...
int GetChildCount(C3DSceneNode *pParentNode=NULL, unsigned int kindof=OBJECT_ALL_KINDOF, unsigned int nodeFlag=SCENE_NODE_NONE, bool mustBeSet=true) const
Return the number of child below the given node (all branch) of the given type and with the given fla...
int ConvertToType(C3DSceneNode *parentNode, C3DObjectCreator *objectCreator)
perform object type conversion. Return number of object that has been modified.
unsigned int GetNodesByFilter(C3DSceneNode *pParentNode, C3DNodeArray &nodes, const C3DFilter *filter=NULL) const
Get nodes filtered by filter (or not) for the whole scene (pParentNode == NULL) or for the pParentNod...
bool ReplaceNodeMaterialID(C3DSceneNode *pParentNode, MaterialID srcmatid, MaterialID newmatid, unsigned int replaceNodeMaterialIDFlags=REPLACEMATID_DEFAULT)
Replace all occurences of srcmatid in the pParentNode childs with newmatid. replaceNodeMaterialIDFlag...
void CompensateTransform(C3DSceneNode *node, const C4x4Matrix &transform)
Transform the points with the given matrix but apply the equivalent transform to the node,...
void Sort(C3DSceneNode *pParentNode=NULL, bool sortDirectChildOnly=false, unsigned int kindof=OBJECT_ALL_KINDOF, unsigned int nodeFlag=SCENE_NODE_NONE, bool mustBeSet=true, XQSORT_PROTO compareMethod=NULL, void *userData=NULL)
Sort scene using compareMethod. If compareMethod = NULL a sort by name is done, otherwise the compare...
unsigned int RemoveNodeByObjectID(C3DSceneNode *pParentNode, BaseObjectID objectID, bool deleteObject=true)
Remove all node that reference objectID. if deleteObject = false, the last object reference is kept.
C3DSceneNode * RemoveNode(C3DSceneNode *node, bool deleteIt=true)
Remove or delete a node from the scene graph. Childs are also removed, if any. Return the previous va...
unsigned int GetInstancesMap(C3DInstanceMap &instances) const
Init an instance map when multiple call to GetInstancesByID is required. Return the number of instanc...
unsigned int CleanGroups(C3DSceneNode *pParent=NULL, bool onlyEmptyGroup=true, bool includeNodeItself=false)
Return the number of group removed.
unsigned int GetMaterialsByText(const CXString &filter, bool matchCase, C3DMaterialIDArray &matids, bool resetHash)
Advanced search: find all materials which name match the given text.
C3DMaterial * GetMaterialByID2(MaterialID id, MATERIAL_CLASS materialClass) const
Find a material given its id. if materialClass is specified, the material is returned only if it has ...
C3DMaterial * GetMaterialByName(const CXString &name) const
Beware material names are not supposed to be single. The first material encountered with a given name...
unsigned int CreateBackfaceNodes(C3DSceneNode *pParentNode=NULL, unsigned int createBackFaceFlags=BACKFACE_DEFAULT, C3DFilter *pFilter=NULL)
bool SwapCoordinates(int swapmode)
return true if something changed
C3DSceneNode * GetNextNode(C3DNodePos &pos) const
Return only the node (don't care about the object which can be obtained using C3DSceneNode::GetBaseOb...
bool ChangeNodeParent(C3DSceneNode *newParent, C3DSceneNode *node, bool updateMatrix=true)
Attach node with its child to newParent. Matrix are update accordingly.
bool AddScene(const C3DScene *scene, int sceneCopyflags=SCENE_COPY_DEFAULT, C3DObjectCreator *objectCreator=NULL)
Copy scene to the current scene using sceneCopyflags.
int GetFBMaterials(C3DSceneNode *pParentNode, CFBMaterialHashMap &fbmatids, bool resetHash) const
Collect front and back face material pairs referenced by pParentNode and childs. CFBMaterialHashMap i...
C3DSceneNode * CopyNode(C3DScene *pDstScene, C3DSceneNode *pDestParentNode, C3DSceneNode *pSrcNode, int flags=SCENE_COPY_DEFAULT, C3DObjectCreator *objectCreator=NULL) const
Copy the node and its childs.
bool Merge(C3DScene *sceneToMerge, C3DSceneNode *parentNode=NULL)
Merge sceneToMerge to parentNode or the root of the current scene. All sceneToMerge nodes are moved t...
unsigned int SetNodeObject(BaseObjectID objectID, C3DBaseObject *newobject, bool deletePreviousObject=true)
Replace all objectID instances with the new object. If object is not deleted, it is detached from the...
C3DMaterial * CreateNewMaterial(MaterialID &matID, MATERIAL_CLASS materialClass)
Create material providing an ID (which might be modified if it already exists)
int GetTexturePaths(CXStringArray &paths, bool removeAll=true) const
Get scene texture path, and return the paths size (including any previous one, if removeAll = false)
unsigned int GetNodesByText(C3DSceneNode *pParent, const CXString &filter, bool matchCase, C3DNodeArray &nodes, bool resetArray=true)
Advanced search: find all nodes which name match the given regular expression.
bool OrientScene(UP_AXIS_MODE mode, bool import)
return true if something changed
C3DScene * Copy(C3DSceneNode *pSrcNode=NULL, int sceneCopyflags=SCENE_COPY_DEFAULT, C3DObjectCreator *objectCreator=NULL) const
Return a copy of the scene, or NULL if the scene does not contains any node (unless SCENE_COPY_EMPTY_...
bool GetTexturePath(int index, CXString &path) const
Get ith scene texture path, starting with index 0. Returns false if there is no path for the index,...
void CheckoutImport(CSceneImportOptions &options)
This method is called after scene is imported using C3DIo::Read. It prepares the scene following the ...
bool DeleteNodes(C3DSceneNode *node=NULL, const C3DFilter *filter=NULL, bool includeNode=false)
Delete the node descendance that match the C3DFilter criteria. if includeNode = true,...
bool IsUnitDefined() const
Return false if unit has not been defined when reading file. This means that we are not able to conve...
int Select(C3DSceneNode *node, unsigned int sceneSelectionFlags)
SelectionFlags is a combination of SceneSelectionFlags. Return the number of newly selected objects.
bool IsNodeSelected(unsigned int kindof=OBJECT_ALL_KINDOF) const
Return true if one node is selected.
void CreatePersistentGuids()
Give each node a persitent GUID based on mix of name, node properties and hierarchy position....
int GetNodeDepth(C3DSceneNode *pNode=NULL) const
Return the node depth.A direct child of the root as the depth 0.
UNIT_MODE GetUnit() const
By default UNIT_UNDEFINED is set unless the format specify it. C3DVector(1, 0, 0) has a length of 1 c...
virtual ~C3DScene()
Use Delete instead, unless the C3DScene is created on the stack (take care that it is referenced once...
A node matches one element that is part of the C3DScene graph. It references a C3DBaseObject and has ...
Definition 3DSceneNode.h:64
The class defines an x, y, z 3D point which can use int, float or double.
Definition 3DPoint.h:27
This class handles an association between a key and its associated values.
Definition AssociationMap.h:240
void Convert(CAssociationCollector< MAPTYPE, ASSOCTYPE, SIZETYPE > &collector)
Init the association map from a CAssociationCollector.
Definition AssociationMap.h:544
unsigned int GetSize() const
return the number of key values in the association map
Definition AssociationMap.h:505
CCustomData is a handly class for storing any kind of data.
Definition CustomData.h:106
This class gets an object material hash. It returns front and back material pair. @Note if we have a ...
Definition 3DFaceList.h:108
A given extension may match several formats. In case of conflict CFileNameSpec is a way to indicate t...
Definition FileInfo.h:156
Definition GuidMgr.h:22
Definition InstanciatedObject.h:16
CMaterials stores scene materials. CMaterials::CreateNewMaterial allows to create a material and inse...
Definition 3DMaterial.h:387
This class is used to provide some specific options when exporting a 3D scene.
Definition Io3dmgr.h:157
This class is used to provide some specific options when loading scene file.
Definition Io3dmgr.h:133
Definition 3DKeyframe.h:22
Definition Tree.h:133
Definition XArchive.h:17
CXStringArray implement an array of CXString.
Definition XStringArray.h:25
This class handles two MaterialID that simplifies operation on faces which have front and back materi...
Definition 3DFaceList.h:28
Definition 3DScene.h:318
double altitude
altitude in m
Definition 3DScene.h:319
double northCorrection
Rotation around Z axis to align Y axis to the north, in radian.
Definition 3DScene.h:320
Definition 3DScene.h:309
Definition 3DScene.h:230