Public Member Functions | Public Attributes | List of all members
RenderableMeshComponent Class Reference

#include <renderablemeshcomponent.h>

Public Member Functions

virtual void getDependentComponents (std::vector< rtti::TypeInfo > &components) const override
IMeshgetMeshResource ()
- Public Member Functions inherited from Component
virtual const rtti::TypeInfo getInstanceType () const =0
- Public Member Functions inherited from Resource
 Resource ()
- Public Member Functions inherited from Object
 Object ()
virtual ~Object ()
virtual bool init (utility::ErrorState &errorState)
virtual void onDestroy ()
 Object (Object &)=delete
Objectoperator= (const Object &)=delete
 Object (Object &&)=delete
Objectoperator= (Object &&)=delete

Public Attributes

ResourcePtr< IMeshmMesh
 Property: 'Mesh' Resource to render. More...
MaterialInstanceResource mMaterialInstanceResource
 Property: 'MaterialInstance' instance of the material, used to override uniforms for this instance. More...
math::Rect mClipRect
 Property: 'ClipRect' Optional clipping rectangle, in pixel coordinates. More...
float mLineWidth = 1.0f
 Property: 'LineWidth' Width of the line when rendered, values higher than 1.0 only work when the GPU supports it. More...
- Public Attributes inherited from RenderableComponent
bool mVisible = true
 Property: 'Visible' if this object is rendered to target by the render service. More...
- Public Attributes inherited from Object
std::string mID
 Property: 'mID' unique name of the object. Used as an identifier by the system. More...

Additional Inherited Members

- Static Public Member Functions inherited from Object
static bool isIDProperty (rtti::Instance &object, const rtti::Property &property)


Resource part of the renderable mesh component. Renders a mesh to screen or any other render target. The link to the mesh and clipping rectangle (property) are optional. You can set the mesh at runtime if necessary. The material is required.

A mesh becomes 'renderable' when it is used in combination with a material. Such a mesh-material combination forms a 'nap::RenderableMesh'. Vertex attributes in both the shader and mesh should match. Otherwise, the RenderableMesh is invalid. The nap::RenderableMesh is created based on the given mesh and the material properties.

It is, however, possible to switch the mesh and / or material from the RenderableMeshComponent to some other mesh and / or material. To do so, other components should create their own nap::RenderableMesh by calling nap::RenderService::createRenderableMesh, and pass the returned object to setMesh(). The object calling nap::RenderService::createRenderableMesh should own the custom mesh and / or material and should validate the result on init().

The model view and projection matrices are automatically set when the vertex shader exposes a struct with the 'uniform::mvpStruct' name. If exposed by the shader it is required that the model, view and projection matrix names match those as declared in 'renderglobals.h'.

A Transform component is required to position the mesh.

Inheritance diagram for RenderableMeshComponent:
Collaboration diagram for RenderableMeshComponent:

Member Function Documentation

◆ getDependentComponents()

virtual void getDependentComponents ( std::vector< rtti::TypeInfo > &  components) const

RenderableMesh requires a transform to position itself in the world.

componentsthe components this component depends upon.

Reimplemented from Component.

◆ getMeshResource()

IMesh& getMeshResource ( )
the mesh resource to render.

Member Data Documentation

◆ mClipRect

math::Rect mClipRect

Property: 'ClipRect' Optional clipping rectangle, in pixel coordinates.

◆ mLineWidth

float mLineWidth = 1.0f

Property: 'LineWidth' Width of the line when rendered, values higher than 1.0 only work when the GPU supports it.

◆ mMaterialInstanceResource

MaterialInstanceResource mMaterialInstanceResource

Property: 'MaterialInstance' instance of the material, used to override uniforms for this instance.

◆ mMesh

Property: 'Mesh' Resource to render.