StevEngine
StevEngine is a customizable C++ game engine.
Loading...
Searching...
No Matches
StevEngine::Visuals::ModelRenderer Class Reference

Component for rendering 3D models. More...

#include <visuals/ModelRenderer.hpp>

Inheritance diagram for StevEngine::Visuals::ModelRenderer:
StevEngine::Component

Public Member Functions

 ModelRenderer (const Utilities::Model &model, const Material &material=Material(), Utilities::Vector3 position=Utilities::Vector3(), Utilities::Quaternion rotation=Utilities::Quaternion(), Utilities::Vector3 scale=Utilities::Vector3(1))
 Create model renderer.
 
 ModelRenderer (Utilities::Stream &stream)
 Create model renderer from text serialized data.
 
std::string GetType () const
 Get component type.
 
Utilities::Stream Export (Utilities::StreamType type) const
 Serialize component to a stream.
 
size_t MeshCount () const
 Get number of meshes in model.
 
Renderer::ObjectGetObject (uint index)
 Get renderable object for mesh.
 
Visuals::MaterialGetMaterials (uint index)
 Get material for mesh.
 
void AddShader (Renderer::ShaderProgram program)
 Add shader program.
 
void RemoveShader (Renderer::ShaderType type)
 Remove shader of specified type.
 
void Draw (const Utilities::Matrix4 &transform)
 Draw model with transform.
 
 ~ModelRenderer ()
 Clean up component resources.
 
- Public Member Functions inherited from StevEngine::Component
 Component ()
 Create new component.
 
virtual ~Component ()
 Clean up component resources.
 
GameObjectGetParent () const
 Get parent GameObject.
 
SceneGetScene () const
 Get containing Scene.
 
virtual void Start ()
 Initialize component after creation.
 

Public Attributes

Utilities::Vector3 position = Utilities::Vector3()
 Local position offset.
 
Utilities::Quaternion rotation = Utilities::Quaternion()
 Local rotation offset.
 
Utilities::Vector3 scale = Utilities::Vector3(1)
 Local scale modifier.
 

Additional Inherited Members

- Protected Attributes inherited from StevEngine::Component
std::vector< std::pair< Utilities::ID, std::string > > handlers
 Event handler registrations.
 

Detailed Description

Component for rendering 3D models.

Handles rendering of 3D mesh data with materials and shaders. Supports multiple meshes per model with individual materials.

Constructor & Destructor Documentation

◆ ModelRenderer() [1/2]

StevEngine::Visuals::ModelRenderer::ModelRenderer ( const Utilities::Model & model,
const Material & material = Material(),
Utilities::Vector3 position = Utilities::Vector3(),
Utilities::Quaternion rotation = Utilities::Quaternion(),
Utilities::Vector3 scale = Utilities::Vector3(1) )

Create model renderer.

Parameters
model3D model to render
materialDefault material if model has none
positionLocal position offset
rotationLocal rotation offset
scaleLocal scale modifier

◆ ModelRenderer() [2/2]

StevEngine::Visuals::ModelRenderer::ModelRenderer ( Utilities::Stream & stream)

Create model renderer from text serialized data.

Parameters
streamStream containing serialized component data

Member Function Documentation

◆ AddShader()

void StevEngine::Visuals::ModelRenderer::AddShader ( Renderer::ShaderProgram program)

Add shader program.

Parameters
programShader to add

◆ Draw()

void StevEngine::Visuals::ModelRenderer::Draw ( const Utilities::Matrix4 & transform)
virtual

Draw model with transform.

Parameters
transformWorld transform matrix

Reimplemented from StevEngine::Component.

◆ Export()

Utilities::Stream StevEngine::Visuals::ModelRenderer::Export ( Utilities::StreamType type) const
virtual

Serialize component to a stream.

Parameters
typeType of stream to export to
Returns
Serialized stream

Implements StevEngine::Component.

◆ GetMaterials()

Visuals::Material & StevEngine::Visuals::ModelRenderer::GetMaterials ( uint index)
inline

Get material for mesh.

Parameters
indexMesh index
Returns
Reference to material

◆ GetObject()

Renderer::Object & StevEngine::Visuals::ModelRenderer::GetObject ( uint index)
inline

Get renderable object for mesh.

Parameters
indexMesh index
Returns
Reference to render object

◆ GetType()

std::string StevEngine::Visuals::ModelRenderer::GetType ( ) const
inlinevirtual

Get component type.

Returns
Type identifier string

Implements StevEngine::Component.

◆ MeshCount()

size_t StevEngine::Visuals::ModelRenderer::MeshCount ( ) const
inline

Get number of meshes in model.

Returns
Mesh count

◆ RemoveShader()

void StevEngine::Visuals::ModelRenderer::RemoveShader ( Renderer::ShaderType type)

Remove shader of specified type.

Parameters
typeType of shader to remove

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