Voltray Engine Docs
Loading...
Searching...
No Matches
SceneObject Class Reference

Base class for objects in the 3D scene. More...

#include <SceneObject.h>

Collaboration diagram for SceneObject:

Public Member Functions

 SceneObject (const std::string &name="SceneObject")
 Constructor with name.
 
 SceneObject (std::shared_ptr< Mesh > mesh, const std::string &name="SceneObject")
 Constructor with mesh.
 
virtual ~SceneObject ()=default
 Virtual destructor.
 
TransformGetTransform ()
 
const TransformGetTransform () const
 
void SetRelativePivot (const Vec3 &relativePivot)
 Sets the relative pivot point where (0,0,0) represents the mesh center.
 
Vec3 GetRelativePivot () const
 Gets the relative pivot point where (0,0,0) represents the mesh center.
 
void SetMesh (std::shared_ptr< Mesh > mesh)
 
std::shared_ptr< MeshGetMesh () const
 
const std::string & GetName () const
 
void SetName (const std::string &name)
 
bool IsVisible () const
 
void SetVisible (bool visible)
 
bool IsSelected () const
 
void SetSelected (bool selected)
 
const Vec3GetMaterialColor () const
 
void SetMaterialColor (const Vec3 &color)
 
Mat4 GetModelMatrix () const
 Gets the model matrix for rendering.
 
void GetWorldBounds (Vec3 &minBounds, Vec3 &maxBounds) const
 Gets the axis-aligned bounding box in world space.
 
virtual void Update (float deltaTime)
 Virtual update method - can be overridden for custom behavior.
 
virtual void OnRender ()
 Virtual method called before rendering - can be overridden.
 

Protected Attributes

std::string m_Name
 
Transform m_Transform
 
std::shared_ptr< Meshm_Mesh
 
bool m_Visible = true
 
bool m_Selected = false
 
Vec3 m_MaterialColor {1.0f, 1.0f, 1.0f}
 
Vec3 m_RelativePivot {0.0f, 0.0f, 0.0f}
 

Detailed Description

Base class for objects in the 3D scene.

SceneObject represents any object that can be placed in the 3D scene. It contains a transform for positioning, rotation, and scaling, as well as a mesh for rendering. This serves as the base class for all scene objects.

Constructor & Destructor Documentation

◆ SceneObject() [1/2]

SceneObject::SceneObject ( const std::string &  name = "SceneObject")
explicit

Constructor with name.

Parameters
nameThe name of the scene object.

◆ SceneObject() [2/2]

SceneObject::SceneObject ( std::shared_ptr< Mesh mesh,
const std::string &  name = "SceneObject" 
)

Constructor with mesh.

Parameters
meshShared pointer to the mesh.
nameThe name of the scene object.

◆ ~SceneObject()

virtual SceneObject::~SceneObject ( )
virtualdefault

Virtual destructor.

Member Function Documentation

◆ GetMaterialColor()

const Vec3 & SceneObject::GetMaterialColor ( ) const
inline

◆ GetMesh()

std::shared_ptr< Mesh > SceneObject::GetMesh ( ) const
inline

◆ GetModelMatrix()

Mat4 SceneObject::GetModelMatrix ( ) const
inline

Gets the model matrix for rendering.

Returns
The transformation matrix.

◆ GetName()

const std::string & SceneObject::GetName ( ) const
inline

◆ GetRelativePivot()

Vec3 SceneObject::GetRelativePivot ( ) const

Gets the relative pivot point where (0,0,0) represents the mesh center.

Returns
The relative pivot offset from mesh center.

◆ GetTransform() [1/2]

Transform & SceneObject::GetTransform ( )
inline

◆ GetTransform() [2/2]

const Transform & SceneObject::GetTransform ( ) const
inline

◆ GetWorldBounds()

void SceneObject::GetWorldBounds ( Vec3 minBounds,
Vec3 maxBounds 
) const

Gets the axis-aligned bounding box in world space.

Parameters
minBoundsOutput minimum bounds of the bounding box.
maxBoundsOutput maximum bounds of the bounding box.

◆ IsSelected()

bool SceneObject::IsSelected ( ) const
inline

◆ IsVisible()

bool SceneObject::IsVisible ( ) const
inline

◆ OnRender()

virtual void SceneObject::OnRender ( )
inlinevirtual

Virtual method called before rendering - can be overridden.

◆ SetMaterialColor()

void SceneObject::SetMaterialColor ( const Vec3 color)
inline

◆ SetMesh()

void SceneObject::SetMesh ( std::shared_ptr< Mesh mesh)
inline

◆ SetName()

void SceneObject::SetName ( const std::string &  name)
inline

◆ SetRelativePivot()

void SceneObject::SetRelativePivot ( const Vec3 relativePivot)

Sets the relative pivot point where (0,0,0) represents the mesh center.

Parameters
relativePivotThe pivot offset from mesh center.

◆ SetSelected()

void SceneObject::SetSelected ( bool  selected)
inline

◆ SetVisible()

void SceneObject::SetVisible ( bool  visible)
inline

◆ Update()

virtual void SceneObject::Update ( float  deltaTime)
inlinevirtual

Virtual update method - can be overridden for custom behavior.

Parameters
deltaTimeTime since last update in seconds.

Member Data Documentation

◆ m_MaterialColor

Vec3 SceneObject::m_MaterialColor {1.0f, 1.0f, 1.0f}
protected

◆ m_Mesh

std::shared_ptr<Mesh> SceneObject::m_Mesh
protected

◆ m_Name

std::string SceneObject::m_Name
protected

◆ m_RelativePivot

Vec3 SceneObject::m_RelativePivot {0.0f, 0.0f, 0.0f}
protected

◆ m_Selected

bool SceneObject::m_Selected = false
protected

◆ m_Transform

Transform SceneObject::m_Transform
protected

◆ m_Visible

bool SceneObject::m_Visible = true
protected

The documentation for this class was generated from the following files: