Cogs.Core
WellLogExtension.cpp
1#include "Context.h"
2#include "ExtensionRegistry.h"
3#include "Serialization/EntityReader.h"
4
5#include "Components/ZipComponent.h"
6#include "Systems/ZipSystem.h"
7
8namespace Cogs
9{
10 namespace Core
11 {
13 {
14 WellLogExtension() { ExtensionRegistry::add(this, COGS_CORE_VERSION_STRING); }
15
16 bool initializeStatic() override;
17 bool initialize(Context *context) override;
18 const char *getExtensionKey() const override { return "WellLog"; }
19 } wellLogExtension;
20
22 {
23 ZipComponent::registerType();
24 return true;
25 }
26
28 {
29 readEntityDefinition(R"(
30 {
31 "name": "WellLog",
32 "components": [
33 "TransformComponent",
34 "SceneComponent",
35 "MeshComponent",
36 "SubMeshRenderComponent",
37 "ZipComponent",
38 "ExtrusionComponent",
39 "MaterialComponent"
40 ],
41 "defaults": [
42 { "ExtrusionComponent": { "active": false } }
43 ]
44 }
45 )", context->store);
46
47 readEntityDefinition(R"(
48 {
49 "name": "HighlightSection",
50 "components": [
51 "TransformComponent",
52 "SceneComponent",
53 "MeshComponent",
54 "SubMeshRenderComponent",
55 "ZipComponent",
56 "ExtrusionComponent",
57 "MaterialComponent"
58 ]
59 }
60 )", context->store);
61
62 ExtensionRegistry::registerExtensionSystem<ZipSystem>(context, SystemPriority::PostView, 128);
63 return true;
64 }
65 }
66}
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Definition: Context.h:83
class EntityStore * store
Entity store.
Definition: Context.h:231
static void add(Extension *extension, StringView version)
Adds the given extension to the registry, ensuring the initialization methods are called at appropria...
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
Defines an extension to Cogs.Core and provides methods to override in order to initialize extension c...
@ PostView
Run after view data has been updated. Anything after this is appropriate for geometry depending on e....
Definition: Engine.h:66
const char * getExtensionKey() const override
Get the extensions unique key, used to check for extension presence and retrieve extension specific d...
bool initialize(Context *context) override
Initialize extension for the given context.
bool initializeStatic() override
Initialize extension statically.