Cogs.Core
Extensions
GLTFLoader
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
13
namespace
Cogs::Core
{
14
15
struct
GltfLoaderExtension
:
public
Extension
{
16
17
GltfLoaderExtension
() {
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
};
Cogs::Core::Context
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Definition:
Context.h:83
Cogs::Core::Context::variables
std::unique_ptr< class Variables > variables
Variables service instance.
Definition:
Context.h:180
Cogs::Core::ExtensionRegistry::add
static void add(Extension *extension, StringView version)
Adds the given extension to the registry, ensuring the initialization methods are called at appropria...
Definition:
ExtensionRegistry.cpp:34
Cogs::Core::GltfLoader::GltfLoader
Definition:
GltfLoader.h:434
Cogs::Core
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....
Definition:
ComponentFunctions.h:10
Cogs::Core::Extension
Defines an extension to Cogs.Core and provides methods to override in order to initialize extension c...
Definition:
ExtensionRegistry.h:54
Cogs::Core::GltfLoaderExtension
Definition:
GltfLoaderExtension.cpp:15
Cogs::Core::GltfLoaderExtension::getExtensionKey
const char * getExtensionKey() const override
Get the extensions unique key, used to check for extension presence and retrieve extension specific d...
Definition:
GltfLoaderExtension.cpp:29
Cogs::Core::GltfLoaderExtension::initialize
bool initialize(Context *context) override
Initialize extension for the given context.
Definition:
GltfLoaderExtension.cpp:21
Cogs::Core::Variable
Runtime control variable.
Definition:
Variables.h:27
Generated by
1.9.6