Blamite Game Engine - API  00406.12.10.23.1457.blamite
The API for the Blamite Game Engine.
world_objects.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 #include <vector>
5 
6 #include <Strings/components/classes/events/events.h>
7 #include <Strings/components/classes/vector/vector.h>
9 
10 #ifdef BLAM_EXPORTS
11 #define BLAM_EXT_API __declspec(dllexport)
12 #else
13 #define BLAM_EXT_API __declspec(dllimport)
14 #endif
15 
16 namespace Ogre
17 {
18  class ManualObject;
19  class SceneNode;
20  class HlmsDatablock;
21 }
22 
23 class BlamWorldState;
24 class BlamTagData;
25 class TickEvent;
26 
28 {
29  Tag,
30  Primitive,
32 };
33 
35 {
36  Cuboid,
37  Cylinder,
38  Sphere,
39  Capsule,
40  Plane
41 };
42 
50 {
51 public:
52  std::string name = "unnamed";
53  std::string description = "";
54  int editor_folder_id = 0;
55  uint64_t id = 0;
56 
57  BlamWorldState* world = nullptr;
58  BlamVector3 position = { 0, 0, 0 };
59  BlamVector3 rotation = { 0, 0, 0 };
60  BlamVector3 scale = { 1, 1, 1 };
61 
63 
71  virtual ~BlamWorldObject() {};
72 
76  virtual void Render();
77 };
78 
86 {
87 public:
88  BlamTagData* tag_data = nullptr;
89 
96  BlamWorldObject_Tag(BlamTagData* _tag_data, BlamWorldState* _world);
97 
98  void Render();
99 };
100 
111 {
112 private:
113  float cached_radius_0 = 1.0f;
114  float cached_radius_1 = 1.0f;
115  int cached_resolution = 5;
116 
117  BlamVector3 cached_position = { 0, 0, 0 };
118  BlamVector3 cached_rotation = { 0, 0, 0 };
119  BlamVector3 cached_scale = { 1, 1, 1 };
120  BlamColor cached_color = BlamColor(255, 255, 255);
121  bool cached_solid = true;
122 
123  void CreateManualObject();
124 
125 public:
127  Ogre::ManualObject* manual_object = nullptr;
128  Ogre::SceneNode* node = nullptr;
129  Ogre::HlmsDatablock* datablock = nullptr;
130 
131  float radius_0 = 1.0f;
132  float radius_1 = 1.0f;
133  int resolution = 5;
134  BlamColor color = BlamColor(255, 255, 255);
135  bool solid = true;
136 
144 
146 
147  void Render();
148 };
149 
156 class BLAM_EXT_API BlamWorldState : public BlamEventListener
157 {
158 private:
159  std::vector<BlamWorldObject*> objects = std::vector<BlamWorldObject*>();
160 
161 public:
165  BlamWorldState();
166 
170  ~BlamWorldState();
171 
172  void AddObject(BlamWorldObject* object);
173 
174  void RemoveObject(uint64_t object_id);
175 
176  int GetObjectCount();
177 
178  bool HasObject(uint64_t object_id);
179 
180  BlamWorldObject* GetObjectAtIndex(int index);
181 
182  BlamWorldObject* GetObjectById(uint64_t object_id);
183 
194  bool Drop(BlamTagData* tag_data, BlamVector3 position);
195 
196  void OnTickEvent(TickEvent* event);
197 
198  void RenderObjects();
199 };
BLAM_EXT_API
#define BLAM_EXT_API
Definition: world_objects.h:13
BlamTagFieldType::Unspecified
@ Unspecified
Indicates that the field's type is not specified. Fields with this type should be considered invalid.
Blam::API::v1::HS::Drop
void Drop(std::string tag_name)
Definition: hs.cpp:44
BlamWorldObjectType
BlamWorldObjectType
Definition: world_objects.h:27
tags.h
Blam3DPrimitiveType::Plane
@ Plane
color
BlamColor color
Typedef for a color field, used in tag definitions.
Definition: tags.h:416
BlamWorldObjectType::Unspecified
@ Unspecified
BlamWorldObject_Tag
Class representing a tag-based world object.
Definition: world_objects.h:85
Blam3DPrimitiveType::Cuboid
@ Cuboid
BlamWorldObject::Render
virtual void Render()
Renders the object to the screen.
Definition: BlamWorldObject.cpp:9
BlamWorldObject::~BlamWorldObject
virtual ~BlamWorldObject()
Definition: world_objects.h:71
BlamWorldObject_Primitive
Class representing a primitive-based world object.
Definition: world_objects.h:110
BlamWorldObject
Class representing a world object.
Definition: world_objects.h:49
Blam3DPrimitiveType::Cylinder
@ Cylinder
Blam3DPrimitiveType::Capsule
@ Capsule
Blam3DPrimitiveType::Sphere
@ Sphere
BlamWorldObjectType::Primitive
@ Primitive
Ogre
Definition: world_objects.h:16
BlamTagData
Class used to contain and access tag data.
Definition: tags.h:125
Blam3DPrimitiveType
Blam3DPrimitiveType
Definition: world_objects.h:34
BlamWorldState
Class representing a world state.
Definition: world_objects.h:156
BlamWorldObjectType::Tag
@ Tag