Tramway SDK
render.h
Go to the documentation of this file.
1// TRAMWAY DRIFT AND DUNGEON EXPLORATION SIMULATOR 2022
2// All rights reserved.
3
4#ifndef TRAM_SDK_COMPONENTS_RENDERCOMPONENT_H
5#define TRAM_SDK_COMPONENTS_RENDERCOMPONENT_H
6
7#include <render/model.h>
8
9namespace tram {
10
11class AnimationComponent;
12
14public:
17 inline Render::Model* GetModel() { return model.get(); }
18
19 inline name_t GetLightmap() { return (lightmap.get() == nullptr) ? 0 : lightmap->GetName();};
20
21 void SetModel(name_t name);
22 void SetLightmap(name_t name);
23 void SetArmature(AnimationComponent* armature);
24
25 void Start();
26
27 vec3 GetLocation() const { return location; }
28 quat GetRotation() const { return rotation; }
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
39 void EventHandler(Event &event) { return; }
40protected:
42 void RefreshAABB();
43
46
47 std::vector<Render::drawlistentry_t> draw_list_entries;
48
49 Render::Pose* pose = nullptr;
50
51 vec3 location = {0.0f, 0.0f, 0.0f};
52 quat rotation = {1.0f, 0.0f, 0.0f, 0.0f};
53 vec3 scale = {1.0f, 1.0f, 1.0f};
54 vec3 color = {1.0f, 1.0f, 1.0f};
55 uint32_t layer = 0;
56
57 void* aabb_tree_leaf = 0;
58
59 uint32_t render_flags;
60};
61
62}
63
64#endif // TRAM_SDK_COMPONENTS_RENDERCOMPONENT_H
Definition: animation.h:13
Definition: entitycomponent.h:18
Definition: model.h:28
Definition: render.h:13
void EventHandler(Event &event)
Definition: render.h:39
vec3 color
Definition: render.h:54
void SetLightmap(name_t name)
Sets the lightmap for the model.
Definition: render.cpp:41
ResourceProxy< Render::Model > model
Definition: render.h:44
vec3 location
Definition: render.h:51
uint32_t render_flags
Definition: render.h:59
void RefreshAABB()
Definition: render.cpp:217
std::vector< Render::drawlistentry_t > draw_list_entries
Definition: render.h:47
name_t GetLightmap()
Definition: render.h:19
void SetDirectionaLight(bool enabled)
Sets the world parameters for model rendering.
Definition: render.cpp:93
Render::Model * GetModel()
Definition: render.h:17
ResourceProxy< Render::Material > lightmap
Definition: render.h:45
void SetLocation(vec3 nlocation)
Sets the location of the model.
Definition: render.cpp:110
~RenderComponent()
Definition: render.cpp:78
void Start()
Definition: render.cpp:208
uint32_t layer
Definition: render.h:55
RenderComponent()
Definition: render.cpp:74
void InsertDrawListEntries()
Definition: render.cpp:225
void SetModel(name_t name)
Set the model that the component will render.
Definition: render.cpp:21
quat rotation
Definition: render.h:52
void SetArmature(AnimationComponent *armature)
Links an AnimationComponent.
Definition: render.cpp:58
quat GetRotation() const
Definition: render.h:28
vec3 GetLocation() const
Definition: render.h:27
void SetRotation(quat nrotation)
Sets the rotation of the model.
Definition: render.cpp:128
void SetTextureOffset(name_t material, vec4 offset)
Definition: render.cpp:169
void SetScale(vec3 scale)
Sets the scale of the model.
Definition: render.cpp:143
void SetLayer(uint32_t layer)
Definition: render.cpp:157
void * aabb_tree_leaf
Definition: render.h:57
vec3 scale
Definition: render.h:53
void SetColor(vec3 color)
Sets the scale of the model.
Definition: render.cpp:190
Render::Pose * pose
Definition: render.h:49
Definition: resource.h:47
Definition: api.h:9
glm::vec4 vec4
Definition: math.h:16
glm::vec3 vec3
Definition: math.h:12
glm::quat quat
Definition: math.h:13
Definition: event.h:24
Definition: animation.h:36
Definition: uid.h:11