VisuTwin Canvas
C++ 3D Engine — Metal Backend
Loading...
Searching...
No Matches
visutwin::canvas::RenderComponent Class Reference

#include <framework/components/render/renderComponent.h>

Inheritance diagram for visutwin::canvas::RenderComponent:
[legend]

Public Member Functions

int batchGroupId () const
bool castShadows () const
void cloneFrom (const Component *source) override
void initializeComponentData () override
const std::vector< int > & layers () const
Materialmaterial () const
std::vector< MeshInstance * > & meshInstances ()
const std::vector< MeshInstance * > & meshInstances () const
bool receiveShadows () const
 RenderComponent (IComponentSystem *system, Entity *entity)
void setBatchGroupId (int id)
void setCastShadows (bool value)
void setLayers (const std::vector< int > &layers)
void setMaterial (Material *material)
void setReceiveShadows (bool value)
void setType (const std::string &type)
const std::string & type () const
 ~RenderComponent () override
Public Member Functions inherited from visutwin::canvas::Component
 Component (IComponentSystem *system, Entity *entity)
virtual bool enabled () const
Entityentity () const
virtual void onDisable ()
virtual void onEnable ()
virtual void onPostStateChange ()
virtual void setEnabled (bool value)
IComponentSystemsystem () const
virtual ~Component ()=default
Public Member Functions inherited from visutwin::canvas::EventHandler
template<typename... Args>
EventHandlerfire (const std::string &name, Args &&... args)
bool hasEvent (const std::string &name) const
void initEventHandler ()
template<typename Callback>
requires (!std::is_same_v<std::decay_t<Callback>, HandleEventCallback>)
EventHandleroff (const std::string &name, Callback &&callback, void *scope=nullptr)
EventHandleroff (const std::string &name="", const HandleEventCallback &callback=HandleEventCallback(), void *scope=nullptr)
EventHandleroffByHandle (EventHandle *handle)
template<typename Callback>
requires (!std::is_same_v<std::decay_t<Callback>, HandleEventCallback>)
EventHandleon (const std::string &name, Callback &&callback, void *scope=nullptr)
EventHandleon (const std::string &name, HandleEventCallback callback, void *scope=nullptr)
template<typename Callback>
requires (!std::is_same_v<std::decay_t<Callback>, HandleEventCallback>)
EventHandleonce (const std::string &name, Callback &&callback, void *scope=nullptr)
EventHandleonce (const std::string &name, HandleEventCallback callback, void *scope=nullptr)
virtual ~EventHandler ()=default

Static Public Member Functions

static const std::vector< RenderComponent * > & instances ()

Additional Inherited Members

Protected Member Functions inherited from visutwin::canvas::Component
virtual void onSetEnabled (bool oldValue, bool newValue)
Protected Member Functions inherited from visutwin::canvas::EventHandler
EventHandleaddCallback (const std::string &name, HandleEventCallback callback, void *scope=nullptr, bool once=false)
Protected Attributes inherited from visutwin::canvas::Component
bool _enabled = true
Entity_entity

Detailed Description

The RenderComponent enables an Entity to render 3D meshes. The type property can be set to one of several predefined shapes (such as box, sphere, cone and so on). Alternatively, the component can be configured to manage an arbitrary array of MeshInstances. These can either be created programmatically or loaded from an Asset.

Definition at line 30 of file renderComponent.h.

Constructor & Destructor Documentation

◆ RenderComponent()

visutwin::canvas::RenderComponent::RenderComponent ( IComponentSystem * system,
Entity * entity )

◆ ~RenderComponent()

visutwin::canvas::RenderComponent::~RenderComponent ( )
override

Definition at line 482 of file renderComponent.cpp.

Member Function Documentation

◆ batchGroupId()

int visutwin::canvas::RenderComponent::batchGroupId ( ) const
inline

Definition at line 66 of file renderComponent.h.

◆ castShadows()

bool visutwin::canvas::RenderComponent::castShadows ( ) const
inline

Definition at line 55 of file renderComponent.h.

◆ cloneFrom()

void visutwin::canvas::RenderComponent::cloneFrom ( const Component * source)
overridevirtual

Clones mesh instances (sharing mesh/material), layers, type, shadow flags.

Reimplemented from visutwin::canvas::Component.

Definition at line 536 of file renderComponent.cpp.

References visutwin::canvas::Component::_entity, visutwin::canvas::Component::Component(), RenderComponent(), and visutwin::canvas::Component::setEnabled().

◆ initializeComponentData()

void visutwin::canvas::RenderComponent::initializeComponentData ( )
inlineoverridevirtual

Implements visutwin::canvas::Component.

Definition at line 36 of file renderComponent.h.

◆ instances()

◆ layers()

const std::vector< int > & visutwin::canvas::RenderComponent::layers ( ) const
inline

Definition at line 41 of file renderComponent.h.

Referenced by setLayers().

◆ material()

Material * visutwin::canvas::RenderComponent::material ( ) const
inline

◆ meshInstances() [1/2]

std::vector< MeshInstance * > & visutwin::canvas::RenderComponent::meshInstances ( )
inline

Definition at line 38 of file renderComponent.h.

◆ meshInstances() [2/2]

const std::vector< MeshInstance * > & visutwin::canvas::RenderComponent::meshInstances ( ) const
inline

Definition at line 39 of file renderComponent.h.

◆ receiveShadows()

bool visutwin::canvas::RenderComponent::receiveShadows ( ) const
inline

Definition at line 52 of file renderComponent.h.

◆ setBatchGroupId()

void visutwin::canvas::RenderComponent::setBatchGroupId ( int id)
inline

Definition at line 67 of file renderComponent.h.

◆ setCastShadows()

void visutwin::canvas::RenderComponent::setCastShadows ( bool value)

Definition at line 525 of file renderComponent.cpp.

◆ setLayers()

void visutwin::canvas::RenderComponent::setLayers ( const std::vector< int > & layers)
inline

Definition at line 42 of file renderComponent.h.

References layers().

◆ setMaterial()

void visutwin::canvas::RenderComponent::setMaterial ( Material * material)

Definition at line 502 of file renderComponent.cpp.

References material().

◆ setReceiveShadows()

void visutwin::canvas::RenderComponent::setReceiveShadows ( bool value)

Definition at line 514 of file renderComponent.cpp.

◆ setType()

void visutwin::canvas::RenderComponent::setType ( const std::string & type)

Definition at line 493 of file renderComponent.cpp.

References type().

◆ type()

const std::string & visutwin::canvas::RenderComponent::type ( ) const
inline

Definition at line 44 of file renderComponent.h.

Referenced by setType().


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