Cogs.Core
EntityDefinitions.cpp
1#include "EntityDefinitions.h"
2#include "EntityDefinition.h"
3
4#include "EntityStore.h"
5
6#include "Serialization/EntityReader.h"
7
9{
10 readEntityDefinition(R"(
11{ "name": "Default",
12 "components": [
13 "TransformComponent",
14 "SceneComponent",
15 "MeshComponent",
16 "MeshRenderComponent",
17 "MaterialComponent" ]
18})"
19, entityStore);
20
21 readEntityDefinition(R"(
22{ "name": "SphereMesh",
23 "components": [
24 "TransformComponent",
25 "SceneComponent",
26 "MeshGeneratorComponent",
27 "LodComponent",
28 "MeshComponent",
29 "MeshRenderComponent" ],
30 "defaults": [
31 { "MeshGeneratorComponent": { "shape": "SphereGeoTexSph" }},
32 { "LodComponent": { "policy": "None" }} ]
33})"
34, entityStore);
35
36 readEntityDefinition(R"(
37{ "name": "MarkerPointSet",
38 "components": [
39 "TransformComponent",
40 "SceneComponent",
41 "MarkerPointSetComponent",
42 "MeshComponent",
43 "InstancedMeshRenderComponent"
44 ]
45})", entityStore);
46
47 readEntityDefinition(R"(
48{ "name": "OceanRectangle",
49 "components": [
50 "AdaptivePlanarGridComponent",
51 "BasicOceanComponent",
52 "TransformComponent",
53 "SceneComponent",
54 "LodComponent",
55 ],
56 "defaults": [
57 { "LodComponent": { "policy": "GeometricTolerance", "geometricTolerance": 20.0 }},
58 { "SceneComponent" : { "pickable": false } },
59 ],
60})"
61, entityStore);
62
63 readEntityDefinition(R"(
64{ "name": "BasicTerrain",
65 "components": [
66 "AdaptivePlanarGridComponent",
67 "BasicTerrainComponent",
68 "TransformComponent",
69 "SceneComponent",
70 "MeshComponent",
71 "MeshRenderComponent",
72 "LodComponent",
73 ],
74 "defaults": [
75 { "LodComponent": { "policy": "GeometricTolerance", "geometricTolerance": 20.0 }},
76 { "SceneComponent" : { "pickable": false } },
77 ],
78})"
79, entityStore);
80
81 readEntityDefinition(R"(
82{
83 "name": "Follower",
84 "components": [
85 "FollowComponent",
86 "TransformComponent",
87 "SceneComponent",
88 "MeshComponent",
89 "MeshRenderComponent",
90 "MaterialComponent" ],
91})"
92, entityStore);
93
94 readEntityDefinition(R"(
95{
96 "name": "MeshPartWithMaterial",
97 "components": [
98 "TransformComponent",
99 "SceneComponent",
100 "MeshComponent",
101 "MeshRenderComponent",
102 "MaterialComponent" ],
103})"
104, entityStore);
105
106 readEntityDefinition(R"(
107{
108 "name": "Wellbore",
109 "components": [
110 "TransformComponent",
111 "SceneComponent",
112 "MeshComponent",
113 "MeshRenderComponent",
114 "ExtrusionComponent",
115 "MaterialComponent" ],
116})"
117, entityStore);
118
119 readEntityDefinition(R"(
120{
121 "name": "Extrusion",
122 "components": [
123 "TransformComponent",
124 "SceneComponent",
125 "MeshComponent",
126 "MeshRenderComponent",
127 "ExtrusionComponent",
128 "MaterialComponent" ],
129})"
130, entityStore);
131
132 readEntityDefinition(R"(
133{
134 "name": "ExtrudeShape",
135 "components": [
136 "TransformComponent",
137 "SceneComponent",
138 "MeshComponent",
139 "MeshRenderComponent",
140 "ExtrusionComponent",
141 "MaterialComponent" ],
142})"
143, entityStore);
144
145 readEntityDefinition(R"(
146{
147 "name": "Trajectory",
148 "components": [
149 "LodComponent",
150 "TransformComponent",
151 "SceneComponent",
152 "TrajectoryComponent" ],
153})"
154, entityStore);
155
156 readEntityDefinition(R"(
157{
158 "name": "TrajectoryLayout",
159 "components": [
160 "TransformComponent",
161 "SceneComponent",
162 "TrajectoryLayoutComponent" ],
163})"
164, entityStore);
165
166 readEntityDefinition(R"(
167{
168 "name": "ReflectionCamera",
169 "components": [
170 "TransformComponent",
171 "SceneComponent",
172 "CameraComponent",
173 "ReflectionComponent" ],
174})"
175, entityStore);
176
177 readEntityDefinition(R"(
178{
179 "name": "CogsMaterial",
180 "description": "Entity with only MaterialComponent. Can be used to supply master material, e.g. MaterialComponent.material",
181 "components": [
182 "MaterialComponent" ],
183})"
184, entityStore);
185
186 readEntityDefinition(R"(
187{
188 "name": "TextureGeneratorMaterial",
189 "components": [
190 "TextureGeneratorComponent",
191 "MaterialComponent" ],
192})"
193, entityStore);
194
195 readEntityDefinition(R"(
196{
197 "name": "PointSet",
198 "components": [
199 "TransformComponent",
200 "SceneComponent",
201 "ShapeComponent",
202 "MaterialComponent",
203 "MeshComponent",
204 "MeshRenderComponent" ],
205 "defaults": [
206 { "ShapeComponent": { "primitiveType": "PointList" } },
207 ],
208})"
209, entityStore);
210
211 readEntityDefinition(R"(
212{
213 "name": "DrillBit",
214 "components": [
215 "TransformComponent",
216 "SceneComponent",
217 "ModelComponent",
218 "TrajectoryAlignedComponent",
219 "MaterialComponent" ],
220})"
221, entityStore);
222
223 readEntityDefinition(R"(
224{
225 "name": "DataSet",
226 "components": [
227 "DataSetComponent" ],
228})"
229, entityStore);
230
231 readEntityDefinition(R"(
232{
233 "name": "LookupColorMap",
234 "description": "Colormap Entity. Store colormap as texture in MaterialComponent. Sample usage: HeightMapComponent.colorMap, ZipComponent.colorMap",
235 "components": [
236 "MaterialComponent" ],
237})"
238, entityStore);
239
240 readEntityDefinition(R"(
241{
242 "name": "SingleColorMap",
243 "components": [
244 "MaterialComponent" ],
245})"
246, entityStore);
247
248 readEntityDefinition(R"(
249{
250 "name": "VariableExtrusionShape",
251 "components": [
252 "TransformComponent",
253 "SceneComponent",
254 "MeshComponent",
255 "MeshRenderComponent",
256 "VariableExtrusionComponent",
257 "MaterialComponent" ],
258})"
259, entityStore);
260
261}
262
263void Cogs::Core::createEntityDefinition(const std::string & name, std::vector<std::string> components, EntityStore * entityStore)
264{
265 EntityDefinition definition;
266 definition.name = name;
267 definition.components = components;
268
269 entityStore->addEntityDefinition(definition);
270}
Stores top level entities for the engine.
Definition: EntityStore.h:50
void addEntityDefinition(const EntityDefinition &definition)
Add the given entity definition to the store.
Definition: EntityStore.cpp:59
void COGSCORE_DLL_API createDefaultEntityDefinitions(class EntityStore *entityStore)
Create the default entity definitions supported by Cogs.
void COGSCORE_DLL_API createEntityDefinition(const std::string &name, std::vector< std::string > components, class EntityStore *entityStore)
Create a simple entity definition with the given name and list of components.
Defines how to construct entities of a certain type by a list of components to instantiate and defaul...
std::vector< std::string > components
Names of the component types to instantiate when creating an entity from this definition.