ObjectGeometry
The ObjectGeometry class represents a rendered or simulated geometry within an Object. It supports a hierarchical structure for LOD selection, including up to two parent geometries for efficient culling and combination of branches based on visibility. Non-hierarchical and root geometries use visibility and transition distances, while hierarchical ones also consider a visibility error parameter for refinement. In addition to visibility distance and error, ObjectGeometry provides mask parameters for controlling visibility, shadow casting, and other rendering behaviors. ObjectGeometry supports multiple Material references.
#include <scene/TellusimObject.h>
Constructors
explicit ObjectGeometry(const char *name = nullptr)
explicit ObjectGeometry(Object &object, const char *name = nullptr)
Methods
static ObjectGeometry create(Type type, const char *name = nullptr)
Clear geometry.
void clear()
Geometry type.
Type getType() const
static const char *getTypeName(Type type)
const char *getTypeName() const
bool isBase() const
bool isMesh() const
bool isBrep() const
Geometry unique identifier.
uint32_t getID() const
Geometry index.
uint32_t getIndex() const
Geometry address.
uint32_t getAddress() const
Geometry name.
void setName(const char *name)
void setName(const String &name)
String getName() const
Geometry object.
void setObject(Object &object, bool check = true)
const Object getObject() const
Object getObject()
Enabled flag.
void setEnabled(bool enabled)
bool isEnabled() 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
Geometry parent.
void clearParent0()
void clearParent1()
uint32_t setParent0(ObjectGeometry &parent, bool check = true)
uint32_t setParent1(ObjectGeometry &parent, bool check = true)
const ObjectGeometry getParent0() const
const ObjectGeometry getParent1() const
ObjectGeometry getParent0()
ObjectGeometry getParent1()
bool isRoot() const
Geometry children.
void reserveChildren(uint32_t num_children)
uint32_t addChild0(ObjectGeometry &child, bool check = true)
uint32_t addChild1(ObjectGeometry &child, bool check = true)
bool removeChild(ObjectGeometry &child)
bool releaseChildren()
bool clearChildren()
void swapChildren(uint32_t index_0, uint32_t index_1)
uint32_t findChild(const ObjectGeometry &child) const
bool isChild(const ObjectGeometry &child) const
uint32_t getNumChildren() const
const Array<ObjectGeometry> getChildren() const
Array<ObjectGeometry> getChildren()
const ObjectGeometry getChild(uint32_t index) const
ObjectGeometry getChild(uint32_t index)
uint32_t getChildrenOffset() const
Geometry sibling.
void setSiblingIndex(uint32_t index)
uint32_t getSiblingIndex() const
Geometry hierarchy.
uint32_t getHierarchy(Array<ObjectGeometry> &nodes, bool clear = true)
Visibility error.
void setVisibilityError(float32_t error)
float32_t getVisibilityError() const
Visibility range.
void setMinVisibility(float32_t min_distance)
void setMaxVisibility(float32_t max_distance)
void setShadowVisibility(float32_t shadow_distance)
void setTracingVisibility(float32_t shadow_distance)
void setVisibilityRange(float32_t min_distance, float32_t max_distance)
void setVisibilityRange(float32_t min_distance, float32_t max_distance, float32_t shadow_distance)
void setVisibilityRange(float32_t min_distance, float32_t max_distance, float32_t shadow_distance, float32_t tracing_distance)
float32_t getMinVisibility() const
float32_t getMaxVisibility() const
float32_t getShadowVisibility() const
float32_t getTracingVisibility() const
Visibility range.
void setMinTransition(float32_t min_distance)
void setMaxTransition(float32_t max_distance)
void setShadowTransition(float32_t shadow_distance)
void setTracingTransition(float32_t shadow_distance)
void setTransitionRange(float32_t min_distance, float32_t max_distance)
void setTransitionRange(float32_t min_distance, float32_t max_distance, float32_t shadow_distance)
void setTransitionRange(float32_t min_distance, float32_t max_distance, float32_t shadow_distance, float32_t tracing_distance)
float32_t getMinTransition() const
float32_t getMaxTransition() const
float32_t getShadowTransition() const
float32_t getTracingTransition() const
Geometry materials.
void clearMaterials()
void shrinkMaterials()
void reserveMaterials(uint32_t num_materials)
void setNumMaterials(uint32_t num_materials)
void setMaterial(uint32_t index, Material &material)
uint32_t addMaterial(Material &material)
bool removeMaterial(const Material &material)
bool updateMaterial(const Material &material, bool update = false)
uint32_t findMaterial(const Material &material) const
uint32_t getNumMaterials() const
const Array<Material> getMaterials() const
Array<Material> getMaterials()
const Material getMaterial(uint32_t index) const
Material getMaterial(uint32_t index)
uint32_t getMaterialAddress() const
uint32_t getMaterialOffset() const
Node object materials.
void setMaterial(NodeObject &node, uint32_t index, Material &material)
Material getMaterial(NodeObject &node, uint32_t index) const
Geometry bound box.
void setBoundBox(BoundBoxf box, bool force = false, bool atomic = false)
const BoundBoxf getBoundBox() const
Geometry transform.
void setTransform(Matrix4x3f transform, bool force = false, bool atomic = false)
const Matrix4x3f getTransform() const
Create geometry tracings.
void updateTracings(bool update = false)
void removeTracings(bool update = false)
Create geometry spatial tree.
void updateSpatial(bool update = false)
void removeSpatial(bool update = false)
Create geometry spatial bounds.
void updateBounds(bool update = false)
Load geometry.
bool load(const Xml &xml)
bool load(const Json &json)
bool load(Stream &stream)
Save geometry.
bool save(Xml &xml) const
bool save(Json &json) const
bool save(Stream &stream) const
Clone geometry.
ObjectGeometry clone(Object &object) const
Updated flag.
bool isUpdated() const
Update scene.
void updateScene()
Enums
Type
Geometry types.
Name | Value |
---|---|
TypeUnknown | 0 |
TypeBase | 1 |
TypeMesh | 2 |
TypeBrep | 3 |
NumTypes | 4 |