Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

MeshRenderer

Add this in your code:

#include <engine/graphics/3d_graphics/mesh_renderer.h>

Description

Component that renders a mesh with materials.

Public methods


GetMeshData

Get mesh data.

const std::shared_ptr<MeshData>& GetMeshData() const

SetMeshData

Set mesh data.

Parameters:

  • meshData: Mesh data to use
void SetMeshData(const std::shared_ptr <MeshData>& meshData)

GetMaterials

Get materials list.

std::vector<std::shared_ptr<Material>> GetMaterials() const

GetMaterial

Get a material at a specific index.

Parameters:

  • index: Index of the material
std::shared_ptr<Material> GetMaterial(int index) const

SetMeshData

Set a material at a specific index.

Parameters:

  • material: Material to use
  • index: Index of the material
void SetMaterial(const std::shared_ptr <Material>& material, int index)

GetBoundingSphere

Get the bounding sphere of the mesh.

const Sphere& GetBoundingSphere() const

GetUseAdvancedLighting

Get if the mesh can use advanced lighting (point lights, spot lights), improve performance if disabled.

bool GetUseAdvancedLighting() const

SetUseAdvancedLighting

Set if the mesh can use advanced lighting (point lights, spot lights), improve performance if disabled.

Parameters:

  • value: Enable advanced lighting?
void SetUseAdvancedLighting(bool value)