Rendering Engine 0.2.0
Modular Graphics Rendering Engine | v0.2.0
Loading...
Searching...
No Matches
rendering_engine::StaticMesh Class Reference

3D drawable component for rendering static (non-animated) meshes. More...

#include <static_mesh.hpp>

Inherits rendering_engine::Drawable3D.

Public Member Functions

 StaticMesh (RenderResourceContext renderContext)
 Constructs a StaticMesh component associated with a given render context.
void Initialize () override
 Initializes render resource pointers (material, mesh, etc.). Must be called after setting material and mesh names.
void Update (float deltaTime) override
 Updates logic (animation, movement, etc.) for this drawable.
void Draw (const Camera &camera) override
 Submits this mesh to the renderer for drawing.
 StaticMesh (const StaticMesh &rhs)=delete
 <
StaticMeshoperator= (const StaticMesh &rhs)=delete
void SetMaterialName (const std::string &materialName)
 Sets the material to use (by name).
void SetMeshName (const std::string &meshName)
 <
Public Member Functions inherited from rendering_engine::Drawable3D
 Drawable3D (RenderResourceContext renderContext)
 Constructs the Drawable3D with a render context.
void SetPosition (const glm::vec3 &position)
 Sets the mesh position in world space.
void SetRotation (const glm::vec3 &rotation)
 Sets the mesh rotation in degrees.
void SetScale (const glm::vec3 &scale)
 Sets the mesh scale along each axis.
const glm::vec3 & GetPosition () const
 Gets the mesh position.
const glm::vec3 & GetRotation () const
 Gets the mesh rotation (pitch, yaw, roll in degrees).
const glm::vec3 & GetScale () const
 Gets the mesh scale.
SceneComponentGetTransform ()
 Access to the underlying SceneComponent (transform).
const SceneComponentGetTransform () const
 Drawable3D (const Drawable3D &rhs)=delete
Drawable3Doperator= (const Drawable3D &rhs)=delete
Public Member Functions inherited from rendering_engine::DrawableComponent
 DrawableComponent (RenderResourceContext renderContext)
 Constructs the DrawableComponent with a resource context.
virtual ~DrawableComponent ()=default
 Virtual destructor.
virtual void Shutdown ()
 DrawableComponent (const DrawableComponent &)=delete
DrawableComponentoperator= (const DrawableComponent &)=delete

Additional Inherited Members

Protected Member Functions inherited from rendering_engine::DrawableComponent
void SetMaterialName (const std::string &materialName)
 Sets the material to use (by name).
void SetMeshName (const std::string &meshName)
 Sets the mesh to use (by name).
Protected Attributes inherited from rendering_engine::Drawable3D
SceneComponent mSceneComponent
Protected Attributes inherited from rendering_engine::DrawableComponent
RenderResourceContext mRenderContext
std::unique_ptr< IRenderResourcesmRenderResources
std::string mMaterialName
std::string mMeshName
MaterialmMaterial
PackedMaterialData mMaterialParameters
MeshDataGpumMeshData

Detailed Description

3D drawable component for rendering static (non-animated) meshes.

Note
Not copyable or assignable.
See also
Drawable3D, DrawableComponent, SceneComponent, Camera

Definition at line 20 of file static_mesh.hpp.

Constructor & Destructor Documentation

◆ StaticMesh() [1/2]

rendering_engine::StaticMesh::StaticMesh ( RenderResourceContext renderContext)

Constructs a StaticMesh component associated with a given render context.

Parameters
renderContextRendering resource context for material and mesh initialization.

Definition at line 10 of file static_mesh.cpp.

11 :
12 Drawable3D(renderContext)
13{
14}
Drawable3D(RenderResourceContext renderContext)
Constructs the Drawable3D with a render context.

◆ StaticMesh() [2/2]

rendering_engine::StaticMesh::StaticMesh ( const StaticMesh & rhs)
delete

<

Sets the mesh to use (by name).

Parameters
meshNameName of the mesh.

Member Function Documentation

◆ Draw()

void rendering_engine::StaticMesh::Draw ( const Camera & camera)
overridevirtual

Submits this mesh to the renderer for drawing.

Implements rendering_engine::Drawable3D.

Definition at line 26 of file static_mesh.cpp.

27{
28 Transformations3D transformations;
29 transformations.model = mSceneComponent.GetWorldMatrix();
30 transformations.view = camera.ViewMatrix();
31 transformations.proj = camera.ProjectionMatrix();
32
33 mRenderResources->SubmitResources(transformations, mMaterialParameters);
34}
std::unique_ptr< IRenderResources > mRenderResources

◆ Initialize()

void rendering_engine::StaticMesh::Initialize ( )
overridevirtual

Initializes render resource pointers (material, mesh, etc.). Must be called after setting material and mesh names.

Reimplemented from rendering_engine::Drawable3D.

Definition at line 16 of file static_mesh.cpp.

17{
19}
void Initialize() override
Initializes render resource pointers (material, mesh, etc.). Must be called after setting material an...

◆ operator=()

StaticMesh & rendering_engine::StaticMesh::operator= ( const StaticMesh & rhs)
delete

◆ SetMaterialName()

void rendering_engine::DrawableComponent::SetMaterialName ( const std::string & materialName)

Sets the material to use (by name).

Parameters
materialNameName of the material.

Definition at line 72 of file drawable_component.cpp.

40{
41 mMaterialName = materialName;
42}

◆ SetMeshName()

void rendering_engine::DrawableComponent::SetMeshName ( const std::string & meshName)

<

Sets the material to use (by name).

Parameters
materialNameName of the material.

Definition at line 78 of file drawable_component.cpp.

44{
45 mMeshName = meshName;
46}

◆ Update()

void rendering_engine::StaticMesh::Update ( float deltaTime)
overridevirtual

Updates logic (animation, movement, etc.) for this drawable.

Parameters
deltaTimeTime step (seconds).

Reimplemented from rendering_engine::Drawable3D.

Definition at line 21 of file static_mesh.cpp.

22{
23 Drawable3D::Update(deltaTime);
24}
void Update(float deltaTime) override
Updates logic (animation, movement, etc.) for this drawable.

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