2#include "ExtensionRegistry.h"
3#include "ResourceManifest.h"
4#include "Resources/ResourceStore.h"
5#include "Serialization/EntityReader.h"
7#include "Renderer/Tasks/RenderTaskFactory.h"
9#include "../../TexAtlas/Source/TexAtlasSystem.h"
11#include "TwinVisualsComponent.h"
12#include "TwinVisualsSystem.h"
13#include "TwinCadModelComponent.h"
14#include "TwinCadModelSystem.h"
15#include "TwinVisualsTexAtlasRenderTask.h"
19 static RenderTask* createTwinVisualsTexAtlasRenderTask(RenderTaskContext* renderTaskContext,
const RenderTaskDefinition& renderTaskDefinition,
const PipelineOptions& pipelineOptions)
21 TexAtlasSystem* texAtlasSystem = ExtensionRegistry::getExtensionSystem<TexAtlasSystem>(renderTaskContext->context);
22 TwinVisualsSystem* twinVisualsSystem = ExtensionRegistry::getExtensionSystem<TwinVisualsSystem>(renderTaskContext->context);
23 if (texAtlasSystem && twinVisualsSystem) {
24 return new TwinVisualsTexAtlasRenderTask(renderTaskContext, texAtlasSystem, twinVisualsSystem, renderTaskDefinition, pipelineOptions);
29 static void destroyTwinVisualsTexAtlasRenderTask(RenderTask** task, RenderTaskContext*)
31 if (TwinVisualsTexAtlasRenderTask* myTask =
dynamic_cast<TwinVisualsTexAtlasRenderTask*
>(*task); myTask) {
48 } twinVisualsExtension;
55 TwinVisualsComponent::registerType();
56 TwinCadModelComponent::registerType();
62 const std::string resourceArchive =
"Cogs.Core.Extensions.TwinVisuals.zip";
64 bool resourceArchiveAdded =
false;
65 std::vector<std::string> manifest = getResourceManifest(context);
66 for (
auto& item : manifest) {
67 if (item.find(resourceArchive) != std::string::npos) {
69 resourceArchiveAdded =
true;
73 if (!resourceArchiveAdded) {
77 context->
resourceStore->addSearchPath(
"../Extensions/TwinVisuals/Data/");
81 readEntityDefinition(R
"(
82{ "name": "TwinVisuals",
84 "TwinVisualsComponent"
88 readEntityDefinition(R"(
89{ "name": "TwinCadModel",
95 "TwinCadModelComponent"
101 addTaskType("TwinVisualsTexAtlasRender", createTwinVisualsTexAtlasRenderTask, destroyTwinVisualsTexAtlasRenderTask);
A Context instance contains all the services, systems and runtime components needed to use Cogs.
class EntityStore * store
Entity store.
std::unique_ptr< class ResourceStore > resourceStore
ResourceStore service instance.
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...
@ PreRendering
Run before rendering is performed.
bool initializeStatic() override
Initialize extension statically.
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.
void cleanup(Context *context) override
Cleanup context bound extension content.