Cogs.Core
GltfLoaderExtension.cpp
1
2#include "GltfLoader.h"
3
4#include "Context.h"
5#include "EntityDefinition.h"
6#include "EntityStore.h"
7#include "ExtensionRegistry.h"
8
9#include "Services/Variables.h"
10#include "Resources/ResourceStore.h"
11#include "Resources/ModelManager.h"
12
13namespace Cogs::Core {
14
16
18 ExtensionRegistry::add(this, COGS_CORE_VERSION_STRING);
19 }
20
21 bool initialize(Context* context) override {
22 context->modelManager->registerLoader(new GltfLoader::GltfLoader());
23 if (Variable* var = context->variables->get(GltfLoader::optimizeVariableName); var->isEmpty()) {
24 context->variables->set(GltfLoader::optimizeVariableName, 1);
25 }
26 return true;
27 }
28
29 const char* getExtensionKey() const override {
30 return "GltfLoader";
31 }
32
33 } gltfLoader;
34};
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Definition: Context.h:83
std::unique_ptr< class Variables > variables
Variables service instance.
Definition: Context.h:180
static void add(Extension *extension, StringView version)
Adds the given extension to the registry, ensuring the initialization methods are called at appropria...
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....
Defines an extension to Cogs.Core and provides methods to override in order to initialize extension c...
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.
Runtime control variable.
Definition: Variables.h:27