Tramway SDK
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
tram::RenderComponent Class Reference

#include <render.h>

Inheritance diagram for tram::RenderComponent:
tram::EntityComponent

Public Member Functions

 RenderComponent ()
 
 ~RenderComponent ()
 
Render::ModelGetModel ()
 
name_t GetLightmap ()
 
void SetModel (name_t name)
 Set the model that the component will render. More...
 
void SetLightmap (name_t name)
 Sets the lightmap for the model. More...
 
void SetArmature (AnimationComponent *armature)
 Links an AnimationComponent. More...
 
void Start ()
 
vec3 GetLocation () const
 
quat GetRotation () const
 
void SetLocation (vec3 nlocation)
 Sets the location of the model. More...
 
void SetRotation (quat nrotation)
 Sets the rotation of the model. More...
 
void SetScale (vec3 scale)
 Sets the scale of the model. More...
 
void SetColor (vec3 color)
 Sets the scale of the model. More...
 
void SetLayer (uint32_t layer)
 
void SetTextureOffset (name_t material, vec4 offset)
 
void SetDirectionaLight (bool enabled)
 Sets the world parameters for model rendering. More...
 
void EventHandler (Event &event)
 
- Public Member Functions inherited from tram::EntityComponent
 EntityComponent ()
 
virtual ~EntityComponent ()
 
virtual void Init ()
 
bool IsReady ()
 
bool IsInit ()
 
EntityGetParent ()
 
void SetParent (Entity *parent)
 

Protected Member Functions

void InsertDrawListEntries ()
 
void RefreshAABB ()
 
- Protected Member Functions inherited from tram::EntityComponent
void ResourceReady ()
 

Protected Attributes

ResourceProxy< Render::Modelmodel
 
ResourceProxy< Render::Materiallightmap
 
std::vector< Render::drawlistentry_tdraw_list_entries
 
Render::Posepose = nullptr
 
vec3 location = {0.0f, 0.0f, 0.0f}
 
quat rotation = {1.0f, 0.0f, 0.0f, 0.0f}
 
vec3 scale = {1.0f, 1.0f, 1.0f}
 
vec3 color = {1.0f, 1.0f, 1.0f}
 
uint32_t layer = 0
 
void * aabb_tree_leaf = 0
 
uint32_t render_flags
 
- Protected Attributes inherited from tram::EntityComponent
size_t resources_waiting = 0
 
bool is_ready = false
 
bool is_init = false
 
Entityparent = nullptr
 

Constructor & Destructor Documentation

◆ RenderComponent()

tram::RenderComponent::RenderComponent ( )

◆ ~RenderComponent()

tram::RenderComponent::~RenderComponent ( )

Member Function Documentation

◆ EventHandler()

void tram::RenderComponent::EventHandler ( Event event)
inlinevirtual

Implements tram::EntityComponent.

◆ GetLightmap()

name_t tram::RenderComponent::GetLightmap ( )
inline

◆ GetLocation()

vec3 tram::RenderComponent::GetLocation ( ) const
inline

◆ GetModel()

Render::Model * tram::RenderComponent::GetModel ( )
inline

◆ GetRotation()

quat tram::RenderComponent::GetRotation ( ) const
inline

◆ InsertDrawListEntries()

void tram::RenderComponent::InsertDrawListEntries ( )
protected

◆ RefreshAABB()

void tram::RenderComponent::RefreshAABB ( )
protected

◆ SetArmature()

void tram::RenderComponent::SetArmature ( AnimationComponent armature)

Links an AnimationComponent.

This needs to be set, so that the model can be rendered with the animations played by the AnimationComponent. Alternatively, this can be set to a nullptr, if no animations are to be played. This affects only dynamic models, static models don't play animations.

◆ SetColor()

void tram::RenderComponent::SetColor ( vec3  color)

Sets the scale of the model.

◆ SetDirectionaLight()

void tram::RenderComponent::SetDirectionaLight ( bool  enabled)

Sets the world parameters for model rendering.

◆ SetLayer()

void tram::RenderComponent::SetLayer ( uint32_t  layer)

◆ SetLightmap()

void tram::RenderComponent::SetLightmap ( name_t  name)

Sets the lightmap for the model.

Lightmaps are rendered only for static models, so setting a lightmap for a dynamic model will do nothing.

◆ SetLocation()

void tram::RenderComponent::SetLocation ( vec3  nlocation)

Sets the location of the model.

◆ SetModel()

void tram::RenderComponent::SetModel ( name_t  name)

Set the model that the component will render.

If the model is not already loaded, then it will be added to loader queue and the component will start when it the loading is complete.

◆ SetRotation()

void tram::RenderComponent::SetRotation ( quat  nrotation)

Sets the rotation of the model.

◆ SetScale()

void tram::RenderComponent::SetScale ( vec3  scale)

Sets the scale of the model.

◆ SetTextureOffset()

void tram::RenderComponent::SetTextureOffset ( name_t  material,
vec4  offset 
)

◆ Start()

void tram::RenderComponent::Start ( )
virtual

Implements tram::EntityComponent.

Member Data Documentation

◆ aabb_tree_leaf

void* tram::RenderComponent::aabb_tree_leaf = 0
protected

◆ color

vec3 tram::RenderComponent::color = {1.0f, 1.0f, 1.0f}
protected

◆ draw_list_entries

std::vector<Render::drawlistentry_t> tram::RenderComponent::draw_list_entries
protected

◆ layer

uint32_t tram::RenderComponent::layer = 0
protected

◆ lightmap

ResourceProxy<Render::Material> tram::RenderComponent::lightmap
protected

◆ location

vec3 tram::RenderComponent::location = {0.0f, 0.0f, 0.0f}
protected

◆ model

ResourceProxy<Render::Model> tram::RenderComponent::model
protected

◆ pose

Render::Pose* tram::RenderComponent::pose = nullptr
protected

◆ render_flags

uint32_t tram::RenderComponent::render_flags
protected

◆ rotation

quat tram::RenderComponent::rotation = {1.0f, 0.0f, 0.0f, 0.0f}
protected

◆ scale

vec3 tram::RenderComponent::scale = {1.0f, 1.0f, 1.0f}
protected

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