![]() |
Polygon Crucher SDK - Documentation
Documentation
|
The class allows to get access to the scene graph, node hierarchy, material. More...
The class allows to get access to the scene graph, node hierarchy, material.
C3DScene contains a C3DSceneNode tree and materials reference. It allows to read and write different files and to perform some different operations on the scene such node concatenation, scene merging...
#include <3DScene.h>
Classes | |
struct | GeoLocation |
struct | SortSceneData |
Public Types | |
typedef struct C3DScene::SortSceneData | SortSceneData |
typedef struct C3DScene::GeoLocation | GeoLocation |
![]() | |
enum | FindKey { KEYFRAME_PREV = 0x01 , KEYFRAME_NEXT = 0x02 , KEYFRAME_SAME = 0x04 } |
Public Member Functions | |
virtual | ~C3DScene () |
Use Delete instead, unless the C3DScene is created on the stack (take care that it is referenced once only in this case) | |
CTree * | GetTree () |
CTree base class has protected access, so use this with precaution. | |
CGuidMgr & | GetGuidMgr () |
Scene information | |
Various information about the scene | |
C3DSceneNode * | GetRoot () const |
Return the root node in the scene. | |
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. | |
CFileNameSpec | GetFilename () const |
CXString | GetFilepath () const |
void | SetFilename (const CFileNameSpec &filename) |
void | SetParserData (bool isReading, unsigned int parserClass, void *data) |
void * | GetParserData (unsigned int &parserClass, bool detachData) |
Scene node tree traversal | |
Different methods to traverse the node's tree Traversing the different nodes of the scene | |
bool | IsChildNode (C3DSceneNode *parent, C3DSceneNode *node) const |
C3DNodePos | GetFirstNode (unsigned int kindof=OBJECT_ALL_KINDOF, unsigned int traverseFlags=NODEPOS_DEFAULT, const C3DSceneNode *startNode=NULL, const C3DSceneNode *stopNode=NULL) const |
C3DNodePos | GetFirstNode (const C3DSceneNode *startNode, unsigned int traverseFlags=NODEPOS_DEFAULT, const C3DSceneNode *stopNode=NULL) const |
C3DSceneNode * | GetNextNode (C3DNodePos &pos) const |
Return only the node (don't care about the object which can be obtained using C3DSceneNode::GetBaseObject()) | |
C3DSceneNode * | GetNextNode (C3DBaseObject *&object, C3DNodePos &pos) const |
Return the node and it's object. | |
C3DSceneNode * | GetNextNode (C3DGeomObject *&object, C3DNodePos &pos) const |
GetFirstNode must define OBJECT_GEOM when using this version. | |
C3DSceneNode * | GetChildNode (const C3DSceneNode *node=NULL) const |
C3DSceneNode * | GetRightNode (const C3DSceneNode *node) const |
C3DSceneNode * | GetParent (const C3DSceneNode *node) const |
Node retrievial | |
Different methods to retrieve nodes | |
bool | IsSceneRoot (const C3DSceneNode *node) const |
bool | IsNodeInScene (C3DSceneNode *pParentNode=NULL) const |
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. | |
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. | |
C3DSceneNode * | GetNodeByID (SceneNodeID id, bool is32BitsID=false) const |
If is32BitsID, the method lookl for 32 bits ID get with GetNodeID32() method. | |
int | GetNodeDepth (C3DSceneNode *pNode=NULL) const |
Return the node depth.A direct child of the root as the depth 0. | |
int | GetDirectChildCount (C3DSceneNode *pParentNode=NULL, unsigned int kindof=OBJECT_ALL_KINDOF) const |
Return the number of child below the given node (direct childs) | |
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) | |
C3DSceneNode * | GetCommonParent (const C3DNodeArray &nodes) const |
Return the upper common parent in the hierarchy to the provided nodes. | |
unsigned int | GetNodeIDMap (C3DSceneNodeIDMap &nodes, bool create32BitsIDMap) const |
Add / remove / copy nodes from scene | |
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 | |
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. | |
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. | |
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. | |
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) | |
void | DetachAndAddNode (C3DSceneNode *parentNode, C3DSceneNode *node, bool lastNode=false) |
Same has AddNode, but remove the node from a previous scene if needed. | |
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. | |
bool | ChangeNodeParent (C3DSceneNode *newParent, C3DSceneNode *node, bool updateMatrix=true) |
Attach node with its child to newParent. Matrix are update accordingly. | |
void | RemoveAll () |
void | RemoveAllNodes () |
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. | |
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. | |
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. | |
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. | |
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. | |
bool | MergeMatrixKeyframes (C3DSceneNode *fromNode, C3DSceneNode *toNode) |
Multiply toNode's Matrix Keyframes by fromNode's ones. | |
int | ConvertToType (C3DSceneNode *parentNode, C3DObjectCreator *objectCreator) |
perform object type conversion. Return number of object that has been modified. | |
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. | |
void | Inherit (const C3DScene *pFromScene, unsigned int flags=SCENE_COPY_DEFAULT) |
void | InheritNode (C3DScene *pDestScene, C3DSceneNode *pSrcNode, unsigned int flags) const |
C3DSceneNode * | CopySingleNode (C3DScene *pDstScene, C3DSceneNode *pDestParentNode, C3DSceneNode *pSrcNode, int flags=SCENE_COPY_DEFAULT, C3DObjectCreator *objectCreator=NULL) const |
Copy only the node. | |
C3DSceneNode * | CopyNode (C3DScene *pDstScene, C3DSceneNode *pDestParentNode, C3DSceneNode *pSrcNode, int flags=SCENE_COPY_DEFAULT, C3DObjectCreator *objectCreator=NULL) const |
Copy the node and its childs. | |
void | CopyChilds (C3DScene *pDstScene, C3DSceneNode *pDestParentNode, C3DSceneNode *pParentNode=NULL, int flags=SCENE_COPY_DEFAULT, C3DObjectCreator *objectCreator=NULL) const |
Copy only node's childs. | |
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) | |
bool | AddScene (const C3DScene *scene, int sceneCopyflags=SCENE_COPY_DEFAULT, C3DObjectCreator *objectCreator=NULL) |
Copy scene to the current scene using sceneCopyflags. | |
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. | |
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) | |
virtual void | Serialize (CXArchive &ar) |
Object instanciation | |
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 | |
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. | |
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. | |
unsigned int | GetInstancesMap (C3DInstanceMap &instances) const |
Init an instance map when multiple call to GetInstancesByID is required. Return the number of instance sets. | |
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. | |
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. | |
unsigned int | GetInstancesCount (C3DSceneNode *pParentNode, BaseObjectID id) const |
return the number of instance found in pParentNode branch. | |
Scene default setting | |
void | SetSmoothAngle (float radianAngle, bool saveToPrefs=false) |
void | SetSmoothMode (NormalSmoothMode mode, bool saveToPrefs=false) |
float | GetSmoothAngle () const |
Return smooth angle in radian. | |
NormalSmoothMode | GetSmoothMode () const |
void | SetPatchLevel (unsigned int level) |
Information about the scene | |
C3DBBox | GetBoundingBox (const C3DNodeArray &nodes) const |
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. | |
int | GetFaceNbr (C3DSceneNode *pParentNode=NULL, unsigned int kindof=OBJECT_ALL_KINDOF, unsigned int nodeFlag=SCENE_NODE_NONE, bool mustBeSet=true) const |
int | GetPointNbr (C3DSceneNode *pParentNode=NULL, unsigned int kindof=OBJECT_ALL_KINDOF, unsigned int nodeFlag=SCENE_NODE_NONE, bool mustBeSet=true) const |
Selection | |
void | SelectAll () |
void | SelectNone () |
void | Unselect (C3DSceneNode *node) |
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. | |
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. | |
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) | |
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) | |
Animation | |
CTimeRange | GetTimeRange (longuint classid=KEYFRAME_NULLID) const |
const C3DKeyframe * | GetConstKey (int time, unsigned int pos, longuint classid, int *findKeyTime) const |
int | GetCurrentTime () const |
bool | SetCurrentTime (int newtime) |
void | DeleteAllKeys () |
Modifying scene content | |
These methods allows to modify a node, a particular branch of the scene, or the whole scene. | |
int | ConvertToGlobalCoordinates (C3DSceneNode *pParentNode=NULL, bool includeNodeItself=false) |
Convert a node and its child to global coordinates. Return the number of node changed. | |
void | Scale (const C3DVector &scale) |
void | PivotTransform (C3DSceneNode *node, const C4x4Matrix &toTransform, bool worldTransform, bool preserveChildPosition=true, bool preserveInstancePosition=true) |
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. | |
bool | OrientScene (UP_AXIS_MODE mode, bool import) |
return true if something changed | |
bool | SwapCoordinates (int swapmode) |
return true if something changed | |
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. | |
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) |
void | Clean () |
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. | |
unsigned int | CleanGroups (C3DSceneNode *pParent=NULL, bool onlyEmptyGroup=true, bool includeNodeItself=false) |
Return the number of group removed. | |
void | RemoveGroups () |
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. | |
C3DSceneNode * | Concatenate (C3DSceneNode *pParentNode=NULL, unsigned int concatenateFlags=CONCATENATE_REMOVE_TO_ROOT|CONCATENATE_SORT_BY_MATERIAL, C3DConcatenateFilter *filter=NULL, C3DNodeArray *processedMeshes=NULL) |
int | ConcatenateByMaterials (C3DSceneNode *parentNode=NULL, unsigned int concatenateFlags=CONCATENATE_REMOVE_TO_ROOT, C3DConcatenateFilter *filter=NULL, C3DNodeArray *createdNodes=NULL) |
bool | GenerateUVW () |
unsigned int | CreateBackfaceNodes (C3DSceneNode *pParentNode=NULL, unsigned int createBackFaceFlags=BACKFACE_DEFAULT, C3DFilter *pFilter=NULL) |
Textures path | |
Different methods related to textures | |
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...) | |
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. | |
int | GetTexturePaths (CXStringArray &paths, bool removeAll=true) const |
Get scene texture path, and return the paths size (including any previous one, if removeAll = false) | |
bool | CopyTextures (const CXString &sceneFilename, const CXString &refDstPath, CSceneExportOptions *options) |
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) | |
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. | |
Materials | |
C3DMaterial * | CreateNewMaterial (MATERIAL_CLASS materialClass) |
Create material with automatic ID assignment. | |
C3DMaterial * | CreateNewMaterial (MaterialID &matID, MATERIAL_CLASS materialClass) |
Create material providing an ID (which might be modified if it already exists) | |
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. | |
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. | |
const CMaterials & | GetMaterials () const |
HashPos | GetFirstMaterial () const |
if matclass = MATERIAL_CLASS_UNDEFINED, return all type of materials, otherwise return materials of the given class | |
C3DMaterial * | GetNextMaterial (HashPos &pos) const |
if defined matclass should be the same than the one use in GetFirstMaterial | |
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). | |
int | GetMaterialNumber (MATERIAL_CLASS matclass=MATERIAL_CLASS_UNDEFINED) const |
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. | |
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. | |
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. | |
int | GetNodesByMaterial (C3DSceneNode *pParentNode, MaterialID matid, C3DNodeArray &array, bool resetArray, C3DFilter *filter=NULL) const |
int | GetNodesByType (C3DSceneNode *pParentNode, unsigned int objectKindof, C3DNodeArray &nodes, bool singleInstance, bool resetArray) const |
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). | |
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. | |
void | CopyMaterials (const C3DScene &scene, unsigned int flags=MATERIAL_COPY_KEEP_ID|MATERIAL_COPY_REMOVE_ALL, const CMaterialHashMap *matids=NULL) |
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. | |
unsigned int | GetMaterialsByText (const CXString &filter, bool matchCase, C3DMaterialIDArray &matids, bool resetHash) |
Advanced search: find all materials which name match the given text. | |
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. | |
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. | |
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. | |
C3DMaterial * | FindMaterial (const C3DMaterial &material, bool sameName) const |
MaterialID | FindMaterialID (const C3DMaterial &material, bool sameName) const |
MaterialID | GetMaterialID (const CXString &name) |
Same has GetMaterialByID except it returns a MaterialID. | |
![]() | |
int | GetKeyTime (int time, unsigned int pos, longuint classid=KEYFRAME_NULLID) |
![]() | |
virtual bool | Delete () |
int | GetRefCount () const |
int | AddRef () const |
Static Public Member Functions | |
static C3DScene * | Create () |
Allocates and creates an empty scene. Use C3DScene::Delete to delete the scene. Same as xNew(C3DScene). | |
Scene units | |
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. | |
double | ConvertToUnit (double x) const |
Get a value in the current length / scale unit. (x * scale factor) / GetUnitFactor()) | |
double | ConvertFromUnit (double x) const |
Get a value from the current length / scale unit. (x * GetUnitFactor()) / scale_factor) | |
CXString | GetUnitText (bool abreviation) const |
Return a text that describe the unit of the scene (ie. "centimers" or "cm" if abbreviation is true) | |
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. | |
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) | |
void | SetUnit (UNIT_MODE unit) |
Set the scene unit. | |
double | GetScaleFactor () const |
Return scene scale. Multiply the coordinates by this scale to get an information expressed in centimers. | |
void | SetScaleFactor (double scale) |
Define the scale factor, which is the coordinate multiplied by this factor to get values in centimers. | |
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. | |
Prepare scene before Import / Export | |
void | CheckoutImport (CSceneImportOptions &options) |
This method is called after scene is imported using C3DIo::Read. It prepares the scene following the import requirements. | |
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. | |
static bool | InitExport (CSceneExportOptions &options, C3DScene *scene) |
static void | ReleaseExport (CSceneExportOptions &options) |
C3DSceneNode * C3DScene::Concatenate | ( | C3DSceneNode * | pParentNode = NULL , |
unsigned int | concatenateFlags = CONCATENATE_REMOVE_TO_ROOT|CONCATENATE_SORT_BY_MATERIAL , |
||
C3DConcatenateFilter * | filter = NULL , |
||
C3DNodeArray * | processedMeshes = NULL |
||
) |
Return a single node from the pParentNode childs (which can be selected by a C3DFilter).
This node is automatically substituted to the nodes and added to scene root (if !CONCATENATE_KEEP_PARENT) is set to true.
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. |
unsigned int C3DScene::CreateBackfaceNodes | ( | C3DSceneNode * | pParentNode = NULL , |
unsigned int | createBackFaceFlags = BACKFACE_DEFAULT , |
||
C3DFilter * | pFilter = NULL |
||
) |
When an object has different front and backface materials, this create a new node that contains the back face content.
createBackFaceFlags | 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. 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. In that case, a face is not duplicated if its front when its front material is transparent. |
bool C3DScene::GenerateUVW | ( | ) |
Generate UV for the whole scene for material which have the planar/spherical/cubic projection type.
Materials are modified and projection type is turned to UVW
|
virtual |
Implements C3DAnimatable.
unsigned int C3DScene::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
|
virtual |
Implements C3DAnimatable.