Tramway SDK
render.h
Go to the documentation of this file.
1// Tramway Drifting and Dungeon Exploration Simulator SDK Runtime
2
3#ifndef TRAM_SDK_COMPONENTS_RENDERCOMPONENT_H
4#define TRAM_SDK_COMPONENTS_RENDERCOMPONENT_H
5
6#include <render/model.h>
7
8namespace tram {
9
10class AnimationComponent;
11
13public:
16 inline Render::Model* GetModel() { return model.get(); }
17
18 inline name_t GetLightmap() { return (lightmap.get() == nullptr) ? 0 : lightmap->GetName();};
19
20 void SetModel(name_t name);
21 void SetLightmap(name_t name);
22 void SetArmature(AnimationComponent* armature);
23
24 void Start();
25
26 vec3 GetLocation() const { return location; }
27 quat GetRotation() const { return rotation; }
28 vec3 GetScale() const { return scale; }
29
30 void SetLocation(vec3 nlocation);
31 void SetRotation(quat nrotation);
32 void SetScale(vec3 scale);
33 void SetColor(vec3 color);
34 void SetLayer(uint32_t layer);
35 void SetTextureOffset(name_t material, vec4 offset);
36
37 void SetDirectionaLight(bool enabled);
38 void SetRenderDebug(bool enabled);
39
40 void EventHandler(Event &event) { return; }
41protected:
43 void RefreshAABB();
44
47
48 std::vector<Render::drawlistentry_t> draw_list_entries;
49
50 Render::Pose* pose = nullptr;
51
52 vec3 location = {0.0f, 0.0f, 0.0f};
53 quat rotation = {1.0f, 0.0f, 0.0f, 0.0f};
54 vec3 scale = {1.0f, 1.0f, 1.0f};
55 vec3 color = {1.0f, 1.0f, 1.0f};
56 uint32_t layer = 0;
57
58 void* aabb_tree_leaf = 0;
59
60 uint32_t render_flags;
61};
62
63}
64
65#endif // TRAM_SDK_COMPONENTS_RENDERCOMPONENT_H
Plays back Animations.
Definition: animation.h:13
Component base class.
Definition: entitycomponent.h:16
Definition: model.h:27
Renders a Model.
Definition: render.h:12
void EventHandler(Event &event)
Definition: render.h:40
vec3 color
Definition: render.h:55
void SetLightmap(name_t name)
Sets the lightmap for the model.
Definition: render.cpp:52
ResourceProxy< Render::Model > model
Definition: render.h:45
vec3 location
Definition: render.h:52
uint32_t render_flags
Definition: render.h:60
void RefreshAABB()
Definition: render.cpp:247
std::vector< Render::drawlistentry_t > draw_list_entries
Definition: render.h:48
void SetRenderDebug(bool enabled)
Sets render debugging.
Definition: render.cpp:123
name_t GetLightmap()
Definition: render.h:18
void SetDirectionaLight(bool enabled)
Sets the world parameters for model rendering.
Definition: render.cpp:104
Render::Model * GetModel()
Definition: render.h:16
ResourceProxy< Render::Material > lightmap
Definition: render.h:46
void SetLocation(vec3 nlocation)
Sets the location of the model.
Definition: render.cpp:140
vec3 GetScale() const
Definition: render.h:28
~RenderComponent()
Definition: render.cpp:89
void Start()
Definition: render.cpp:238
uint32_t layer
Definition: render.h:56
RenderComponent()
Definition: render.cpp:85
void InsertDrawListEntries()
Definition: render.cpp:255
void SetModel(name_t name)
Set the model that the component will render.
Definition: render.cpp:32
quat rotation
Definition: render.h:53
void SetArmature(AnimationComponent *armature)
Links an AnimationComponent.
Definition: render.cpp:69
quat GetRotation() const
Definition: render.h:27
vec3 GetLocation() const
Definition: render.h:26
void SetRotation(quat nrotation)
Sets the rotation of the model.
Definition: render.cpp:158
void SetTextureOffset(name_t material, vec4 offset)
Definition: render.cpp:199
void SetScale(vec3 scale)
Sets the scale of the model.
Definition: render.cpp:173
void SetLayer(uint32_t layer)
Definition: render.cpp:187
void * aabb_tree_leaf
Definition: render.h:58
vec3 scale
Definition: render.h:54
void SetColor(vec3 color)
Sets the scale of the model.
Definition: render.cpp:220
Render::Pose * pose
Definition: render.h:50
Definition: resource.h:46
Serialization, i.e.
glm::vec4 vec4
Definition: math.h:15
glm::vec3 vec3
Definition: math.h:11
glm::quat quat
Definition: math.h:12
Event data.
Definition: event.h:24
Definition: animation.h:35
Interned string type.
Definition: uid.h:10