#include <SceneObject.h>
Definition at line 22 of file SceneObject.h.
◆ PosMap
◆ SceneObject()
◆ ~SceneObject()
| SceneObject::~SceneObject |
( |
| ) |
|
◆ getCreationOptions()
◆ getHovered()
| bool SceneObject::getHovered |
( |
| ) |
const |
|
overridevirtual |
Gets the current hover state of this object.
- Returns
- true if the object is currently being hovered over, false otherwise.
Implements IPickable.
Definition at line 244 of file SceneObject.cpp.
◆ getInstanceData()
Gets the complete per-instance data for GPU upload.
Constructs an InstanceData structure containing the model matrix, object ID, and any additional per-instance attributes. This data is uploaded to the GPU's instance buffer for instanced rendering.
The default implementation provides model matrix and object ID. Override to add custom attributes (e.g., per-instance color).
- Returns
- InstanceData structure for this object.
- Note
- The InstanceData layout must match the vertex attribute setup in Mesh::setupInstanceAttributes().
- See also
- Rendering::InstanceData
-
Mesh::drawInstanced()
Implements IInstancedDrawable.
Definition at line 252 of file SceneObject.cpp.
◆ getMesh()
| Mesh * SceneObject::getMesh |
( |
| ) |
const |
|
inlineoverridevirtual |
◆ getMeshName()
| const std::string & SceneObject::getMeshName |
( |
| ) |
const |
|
inline |
◆ getModelMatrix()
| glm::mat4 SceneObject::getModelMatrix |
( |
| ) |
const |
|
overridevirtual |
Gets the model transformation matrix for this instance.
The model matrix transforms vertices from model space to render space. World-space drawables should subtract SceneObject::getRenderOrigin() before uploading instance data. Simulation, picking, and serialization must keep using world-space transforms.
- Returns
- The 4x4 model transformation matrix.
- Note
- This is called once per frame during batch preparation.
Implements IInstancedDrawable.
Definition at line 78 of file SceneObject.cpp.
◆ getName()
| const std::string & SceneObject::getName |
( |
| ) |
const |
|
inline |
◆ getObjectID()
| uint32_t SceneObject::getObjectID |
( |
| ) |
const |
|
overridevirtual |
◆ getPhysicsBody()
◆ getPosition()
| glm::vec3 SceneObject::getPosition |
( |
| ) |
const |
◆ getRenderOrigin()
| static glm::vec3 SceneObject::getRenderOrigin |
( |
| ) |
|
|
inlinestatic |
◆ getRotation()
| glm::vec3 SceneObject::getRotation |
( |
| ) |
const |
◆ getRotationQuat()
| glm::quat SceneObject::getRotationQuat |
( |
| ) |
const |
◆ getScale()
| glm::vec3 SceneObject::getScale |
( |
| ) |
const |
◆ getShader()
| Shader * SceneObject::getShader |
( |
| ) |
const |
|
overridevirtual |
◆ handleClick()
| void SceneObject::handleClick |
( |
const Math::Ray & |
ray, |
|
|
float |
distance |
|
) |
| |
|
overridevirtual |
Handles a mouse click on this object.
Called by the scene manager when the user clicks on this object. Implementations can respond by:
- Changing selection state
- Spawning interaction gizmos
- Triggering object-specific behaviors
- Emitting signals for UI updates
- Parameters
-
| ray | The picking ray that intersected this object. |
| distance | The distance along the ray to the intersection point. |
- Note
- This is only called if rayIntersection() returned a valid distance.
- See also
- SceneManager::handleMouseButton()
-
SceneObject::handleClick()
-
Gizmo::handleClick()
Implements IPickable.
Definition at line 179 of file SceneObject.cpp.
◆ intersectsRay()
| std::optional< float > SceneObject::intersectsRay |
( |
const Math::Ray & |
ray | ) |
const |
|
overridevirtual |
Tests if a ray intersects this object's geometry.
Implementations should test the ray against the object's bounding volume or exact geometry and return the distance to the intersection point if hit.
- Parameters
-
| ray | The picking ray in world space coordinates. |
- Returns
- std::optional<float> containing the distance along the ray to the intersection point if hit, or std::nullopt if no intersection.
- Note
- For performance, implementations should first test against an AABB before performing exact mesh intersection tests.
Example implementation:
float aabbDist;
if (!intersectsAABB(ray, aabbDist)) {
return std::nullopt;
}
float meshDist;
if (intersectsMesh(ray, meshDist)) {
return meshDist;
}
return std::nullopt;
}
std::optional< float > intersectsRay(const Math::Ray &ray) const override
Tests if a ray intersects this object's geometry.
- See also
- SceneObject::intersectsRay()
-
Gizmo::intersectsRay()
-
MathUtils::intersectsRay()
Implements IPickable.
Definition at line 166 of file SceneObject.cpp.
◆ setHovered()
| void SceneObject::setHovered |
( |
bool |
hovered | ) |
|
|
overridevirtual |
Sets the hover state of this object.
Called by the scene manager when the mouse cursor enters or leaves this object. Implementations should update their internal state and may trigger visual feedback (e.g., highlighting).
The actual visual feedback is typically handled through the rendering system via uniform buffers (isHovered[objectID]).
- Parameters
-
| hovered | true if the mouse is hovering over this object, false otherwise. |
- See also
- SceneManager::updateHoverState()
-
Scene::draw()
Implements IPickable.
Definition at line 240 of file SceneObject.cpp.
◆ setName()
| void SceneObject::setName |
( |
std::string |
name | ) |
|
|
inline |
◆ setPhysicsPosMap()
| static void SceneObject::setPhysicsPosMap |
( |
const PosMap & |
m | ) |
|
|
inlinestatic |
◆ setPosition()
| void SceneObject::setPosition |
( |
const glm::vec3 & |
pos | ) |
|
◆ setRenderOrigin()
| static void SceneObject::setRenderOrigin |
( |
const glm::vec3 & |
origin | ) |
|
|
inlinestatic |
◆ setRotation()
| void SceneObject::setRotation |
( |
const glm::vec3 & |
rot | ) |
|
◆ setRotationQuat()
| void SceneObject::setRotationQuat |
( |
const glm::quat & |
q | ) |
|
◆ setScale()
| void SceneObject::setScale |
( |
const glm::vec3 & |
scl | ) |
|
◆ worldToRenderMatrix()
| static glm::mat4 SceneObject::worldToRenderMatrix |
( |
| ) |
|
|
inlinestatic |
The documentation for this class was generated from the following files: