Graph
The Graph class represents a node hierarchy within a 3D scene that organizes scene elements into a structured graph.
Each Graph maintains bounding volume hierarchies for lights, objects, and instances to enable efficient spatial queries and rendering.
A Scene can have multiple Graph instances to support efficient streaming and management of large worlds.
It supports loading parameters from an external *.graph
file.
Graph is a container for Node instances.
#include <scene/TellusimGraph.h>
Constructors
explicit Graph(const char *name = nullptr)
explicit Graph(Scene &scene, const char *name = nullptr)
Methods
static Graph create(Type type, const char *name = nullptr)
Clear graph.
void clear()
Graph type.
Type getType() const
static const char *getTypeName(Type type)
const char *getTypeName() const
bool isBase() const
bool isVarying() const
bool isScript() const
Graph unique identifier.
uint32_t getID() const
Graph index.
uint32_t getIndex() const
Graph address.
uint32_t getAddress() const
Graph name.
void setName(const char *name)
void setName(const String &name)
String getName() const
Graph file name.
void setGraphName(const char *name)
void setGraphName(const String &name)
String getGraphName() const
Graph scene.
void setScene(Scene &scene, bool check = true)
const Scene getScene() const
Scene getScene()
Enabled flag.
void setEnabled(bool enabled)
bool isEnabled() const
Instance flag.
void setInstance(bool instance)
bool isInstance() const
Light mask.
void setLightMask(uint32_t mask)
uint32_t getLightMask() const
Camera mask.
void setCameraMask(uint32_t mask)
uint32_t getCameraMask() const
Object mask.
void setObjectMask(uint32_t mask)
uint32_t getObjectMask() const
Shadow mask.
void setShadowMask(uint32_t mask)
uint32_t getShadowMask() const
Tracer mask.
void setTracerMask(uint32_t mask)
uint32_t getTracerMask() const
Tracing mask.
void setTracingMask(uint32_t mask)
uint32_t getTracingMask() const
Collider mask.
void setColliderMask(uint32_t mask)
uint32_t getColliderMask() const
Hidden flag.
void setHidden(bool flag)
bool isHidden() const
Expanded flag.
void setExpanded(bool flag)
bool isExpanded() const
Internal flag.
void setInternal(bool flag)
bool isInternal() const
Virtual flag.
void setVirtual(bool flag)
bool isVirtual() const
Changed flag.
void setChanged(bool flag)
bool isChanged() const
Pointer info.
void setPtrInfo(void *ptr)
void *getPtrInfo() const
Meta info.
void setMetaInfo(const String &info)
String getMetaInfo() const
Visibility range.
void setMinVisibility(float32_t min_distance)
void setMaxVisibility(float32_t max_distance)
void setVisibilityRange(float32_t min_distance, float32_t max_distance)
float32_t getMinVisibility() const
float32_t getMaxVisibility() const
Graph nodes.
void shrinkNodes()
void reserveNodes(uint32_t num_nodes)
uint32_t addNode(Node &node, bool check = true)
bool removeNode(Node &node, bool clean = false, bool update = false)
void releaseNodes(bool clean = false, bool update = false)
bool swapNodes(Node &node_0, Node &node_1, bool update = false)
uint32_t findNode(const Node &node) const
uint32_t findNode(const char *name) const
uint32_t findNode(uint32_t type) const
uint32_t getNumNodes() const
uint32_t getNodeCount() const
uint32_t getNodeCapacity() const
const Array<Node> getNodes() const
Array<Node> getNodes()
const Node getNode(uint32_t index) const
const Node getNode(const char *name) const
Node getNode(uint32_t index)
Node getNode(const char *name)
void updateNodes(Array<Node> nodes)
void updateNode(Node &node)
void updateNodes(bool update = false)
uint32_t getNodeAddress() const
Light nodes.
void shrinkLightIndices()
void reserveLightIndices(uint32_t num_lights)
uint32_t getNumLightIndices() const
const Array<uint32_t> getLightIndices() const
uint32_t getLightIndex(uint32_t index) const
bool removeLight(const Light &light, bool update = false)
bool updateLight(const Light &light, bool update = false)
uint32_t getLightAddress() const
uint32_t getLightTree() const
Camera nodes.
void shrinkCameraIndices()
void reserveCameraIndices(uint32_t num_cameras)
uint32_t getNumCameraIndices() const
const Array<uint32_t> getCameraIndices() const
uint32_t getCameraIndex(uint32_t index) const
bool removeCamera(const Camera &camera, bool update = false)
bool updateCamera(const Camera &camera, bool update = false)
uint32_t getCameraAddress() const
Object nodes.
void shrinkObjectIndices()
void reserveObjectIndices(uint32_t num_objects)
uint32_t getNumObjectIndices() const
const Array<uint32_t> getObjectIndices() const
uint32_t getObjectIndex(uint32_t index) const
bool removeObject(const Object &object, bool update = false)
bool updateObject(const Object &object, bool update = false)
bool removeMaterial(const Material &material, bool update = false)
bool updateMaterial(const Material &material, bool update = false)
uint32_t getObjectAddress() const
uint32_t getObjectTree() const
Instance nodes.
void shrinkInstanceIndices()
void reserveInstanceIndices(uint32_t num_instances)
uint32_t getNumInstanceIndices() const
const Array<uint32_t> getInstanceIndices() const
uint32_t getInstanceIndex(uint32_t index) const
bool removeInstance(const Graph &instance, bool update = false)
bool updateInstance(const Graph &instance, bool update = false)
uint32_t getInstanceAddress() const
uint32_t getInstanceTree() const
Varying nodes.
void shrinkVaryingIndices()
void reserveVaryingIndices(uint32_t num_varyings)
uint32_t getNumVaryingIndices() const
const Array<uint32_t> getVaryingIndices() const
uint32_t getVaryingIndex(uint32_t index) const
uint32_t getVaryingAddress() const
Script nodes.
void shrinkScriptIndices()
void reserveScriptIndices(uint32_t num_scripts)
uint32_t getNumScriptIndices() const
const Array<uint32_t> getScriptIndices() const
uint32_t getScriptIndex(uint32_t index) const
uint32_t getScriptAddress() const
Joint nodes.
void shrinkJointIndices()
void reserveJointIndices(uint32_t num_joints)
uint32_t getNumJointIndices() const
const Array<uint32_t> getJointIndices() const
uint32_t getJointIndex(uint32_t index) const
bool removeJoint(const Node &joint, bool update = false)
bool updateJoint(const Node &joint, bool update = false)
uint32_t getJointAddress() const
Graph bound box.
void setBoundBox(BoundBoxf box)
const BoundBoxf getBoundBox() const
Graph transform.
void setTransform(Matrix4x3d transform, bool force = false, bool atomic = false)
const Matrix4x3d getTransform() const
Create transforms.
void createTransforms(bool update = false, bool clear = false)
Type | Name | Description |
---|---|---|
bool | update | Update Graph and Nodes. |
bool | clear | Clear Node update mask after transformation. |
Update transforms.
void updateTransforms(bool update = false)
Type | Name | Description |
---|---|---|
bool | update | Update Graph and Nodes. |
Fetch transforms.
bool fetchTransforms(bool children = false)
Update spatial trees.
void updateLightTree(bool update = false)
void updateObjectTree(bool update = false)
void updateInstanceTree(bool update = false)
void updateSpatial(bool update = false)
Fetch bound box.
bool fetchBoundBox(const BoundBoxCallback &func)
Load graph.
bool load(const Xml &xml)
bool load(const Json &json)
bool load(Stream &stream)
Save graph.
bool save(Xml &xml) const
bool save(Json &json) const
bool save(Stream &stream) const
Clone graph.
Graph clone(Scene &scene) const
Updated flag.
bool isUpdated() const
Update scene.
void updateScene()
Types
using BoundBoxCallback = Function<void(Graph graph)>
Enums
Type
Graph types.
Name | Value |
---|---|
TypeUnknown | 0 |
TypeBase | 1 |
TypeVarying | 2 |
TypeScript | 3 |
NumTypes | 4 |