SleakEngine 1.0.0
C++23 multi-backend game engine
Loading...
Searching...
No Matches
Sleak::MeshComponent Class Reference

#include <MeshComponent.hpp>

Inheritance diagram for Sleak::MeshComponent:

Public Member Functions

 MeshComponent (GameObject *, MeshData data)
 Uploads data's vertex/index arrays to new GPU buffers.
 MeshComponent (GameObject *object)
void AddConstantBuffer (RefPtr< RenderEngine::BufferBase > &buffer)
void AddConstantBuffer (RenderEngine::TransformBuffer &bufferData)
 Creates a new constant buffer from bufferData and appends it to the draw's buffer list.
virtual bool Initialize () override
 Validates that vertex and index buffers were created successfully.
void SetCullBoundsLocal (const Math::AABB &bounds)
void SetCullBoundsWorld (const Math::AABB &bounds)
void SetIndexBuffer (RefPtr< RenderEngine::BufferBase > &buffer)
void SetVertexBuffer (RefPtr< RenderEngine::BufferBase > &buffer)
virtual void Update (float deltaTime) override
 Culls against cull bounds if set, then submits an indexed draw call.
Public Member Functions inherited from Sleak::Component
 Component (GameObject *object)
virtual ~Component ()=default
virtual void FixedUpdate (float fixedDeltaTime)
GameObjectGetOwner ()
virtual void LateUpdate (float deltaTime)
virtual void OnDestroy ()
 Called when the component is detached or the owner is destroyed.
virtual void OnDisable ()
virtual void OnEnable ()
Public Member Functions inherited from Sleak::Object
 Object (const std::string &name="Object")
virtual ~Object ()=default
const std::string & GetName () const
uint64_t GetUniqueID () const
void SetName (const std::string &value)

Additional Inherited Members

Protected Attributes inherited from Sleak::Component
bool bIsInitialized
GameObjectowner

Detailed Description

Holds the GPU vertex/index/constant buffers for a renderable mesh and submits a draw call each Update, subject to frustum culling.

Definition at line 26 of file MeshComponent.hpp.

Constructor & Destructor Documentation

◆ MeshComponent() [1/2]

Sleak::MeshComponent::MeshComponent ( GameObject * object)
inline

Definition at line 28 of file MeshComponent.hpp.

◆ MeshComponent() [2/2]

Sleak::MeshComponent::MeshComponent ( GameObject * object,
MeshData data )

Uploads data's vertex/index arrays to new GPU buffers.

Definition at line 27 of file MeshComponent.cpp.

Member Function Documentation

◆ AddConstantBuffer() [1/2]

void Sleak::MeshComponent::AddConstantBuffer ( RefPtr< RenderEngine::BufferBase > & buffer)

Definition at line 97 of file MeshComponent.cpp.

◆ AddConstantBuffer() [2/2]

void Sleak::MeshComponent::AddConstantBuffer ( RenderEngine::TransformBuffer & bufferData)

Creates a new constant buffer from bufferData and appends it to the draw's buffer list.

Definition at line 89 of file MeshComponent.cpp.

◆ Initialize()

bool Sleak::MeshComponent::Initialize ( )
overridevirtual

Validates that vertex and index buffers were created successfully.

Implements Sleak::Component.

Definition at line 42 of file MeshComponent.cpp.

◆ SetCullBoundsLocal()

void Sleak::MeshComponent::SetCullBoundsLocal ( const Math::AABB & bounds)

Definition at line 108 of file MeshComponent.cpp.

◆ SetCullBoundsWorld()

void Sleak::MeshComponent::SetCullBoundsWorld ( const Math::AABB & bounds)

Definition at line 102 of file MeshComponent.cpp.

◆ SetIndexBuffer()

void Sleak::MeshComponent::SetIndexBuffer ( RefPtr< RenderEngine::BufferBase > & buffer)

Definition at line 85 of file MeshComponent.cpp.

◆ SetVertexBuffer()

void Sleak::MeshComponent::SetVertexBuffer ( RefPtr< RenderEngine::BufferBase > & buffer)

Definition at line 81 of file MeshComponent.cpp.

◆ Update()

void Sleak::MeshComponent::Update ( float deltaTime)
overridevirtual

Culls against cull bounds if set, then submits an indexed draw call.

Implements Sleak::Component.

Definition at line 54 of file MeshComponent.cpp.