Cogs.Core
|
A Context instance contains all the services, systems and runtime components needed to use Cogs. More...
#include <Context.h>
Classes | |
struct | Callbacks |
Context callbacks. More... | |
struct | Debug |
Debugging context. More... | |
Public Member Functions | |
Context (const char **variables, int count) | |
Constructs a new context instance, initializing all services, an engine instance, and extension systems. | |
~Context () override | |
Destructs a context instance. | |
bool | createDevice () |
void | initialize () |
Initialize all services and component systems. | |
void | clear () |
Does clearing of context. | |
void | initializeDynamicComponents () |
Initialize and register dynamic component types. | |
void | registerDynamicComponentType (const StringView &typeName) |
Register a dynamic component type with the given typeName. | |
void | registerExtensionSystem (const uint16_t id, class ComponentSystemBase *system) |
Register an extension component system using the given id. | |
class ComponentSystemBase * | getExtensionSystem (const uint16_t id) |
Retrieve the system with the given id. | |
void | update () |
void | preRender () |
ViewContext * | createView (WindowData *windowData) |
void | deleteView (ViewContext *view) |
void | setDefaultView (ViewContext *view) |
ViewContext * | getDefaultView () const |
std::span< ViewContext * > | getViews () |
Static Public Member Functions | |
static void | initializeStatic () |
Perform static initialization of the Context. | |
static void | cleanupStatic () |
Perform static cleanup of the Context. | |
Public Attributes | |
std::unique_ptr< struct MemoryContext > | memory |
Memory and allocation info. | |
std::unique_ptr< class Services > | services |
Services. | |
std::unique_ptr< class Features > | features |
Features service instance. | |
std::unique_ptr< class Variables > | variables |
Variables service instance. | |
std::unique_ptr< class ResourceUsageLogger > | resourceUsageLogger |
Resource usage logger service instance. | |
std::unique_ptr< class TaskManager > | taskManager |
TaskManager service instance. | |
std::unique_ptr< class Random > | random |
Random Number service instance. | |
std::unique_ptr< class ScriptingManager > | scriptingManager |
ScriptingManager service instance. | |
std::unique_ptr< class CullingManager > | cullingManager |
CullingManager instance. | |
std::unique_ptr< class Time > | time |
Time service instance. | |
std::unique_ptr< class QualityService > | qualityService |
Quality service instance. | |
std::unique_ptr< class DeferredNameResolution > | deferredResolution |
Deferred name resolution service instance. | |
std::unique_ptr< FileSystemWatcher > | watcher |
File system watcher. | |
std::unique_ptr< class ResourceStore > | resourceStore |
ResourceStore service instance. | |
std::unique_ptr< class RayPicking > | rayPicking |
RayPicking service instance. | |
std::unique_ptr< class Bounds > | bounds |
Bounds service instance. | |
std::unique_ptr< class ExtensionSystems > | extensionSystems |
Mapping of active extension systems. | |
std::unique_ptr< class Engine > | engine |
Engine instance. | |
std::unique_ptr< class Scene > | scene |
Scene structure. | |
class IRenderer * | renderer |
Renderer. | |
class EntityStore * | store |
Entity store. | |
struct Cogs::Core::Context::Debug | debug |
struct Cogs::Core::Context::Callbacks | callbacks |
![]() | |
class TransformSystem * | transformSystem = nullptr |
class SceneSystem * | sceneSystem = nullptr |
class MeshSystem * | meshSystem = nullptr |
class RenderSystem * | renderSystem = nullptr |
class SubMeshRenderSystem * | subMeshRenderSystem = nullptr |
class InstancedMeshRenderSystem * | instancedMeshRenderSystem = nullptr |
Private Attributes | |
ViewContext * | defaultView = nullptr |
std::vector< ViewContext * > | views |
A Context instance contains all the services, systems and runtime components needed to use Cogs.
In addition to the engine and core systems, the context contains services, extensions, and additional component systems not part of the core.
The context acts as a kind of service locator for modules in Cogs.Core, allowing them to access services and systems. All references contained herein should be forward declared, ensuring that consumers of dependencies must locally include what's needed to access them.
Cogs::Core::Context::Context | ( | const char ** | variables, |
int | count | ||
) |
Constructs a new context instance, initializing all services, an engine instance, and extension systems.
The order of initialization is as follows:
Definition at line 106 of file Context.cpp.
References Context(), memory, resourceStore, store, and variables.
Referenced by Context().
Cogs::Core::Context::Context | ( | ) |
Definition at line 103 of file Context.cpp.
|
override |
Destructs a context instance.
All services and components are destructed in the order of initialization.
Definition at line 149 of file Context.cpp.
References Cogs::Factory::releaseDevice().
|
static |
Perform static cleanup of the Context.
Calling cleanupStatic() twice has no effect but may produce warnings.
Definition at line 214 of file Context.cpp.
void Cogs::Core::Context::clear | ( | ) |
Does clearing of context.
Called by Bridge clearContext
Definition at line 355 of file Context.cpp.
Referenced by Cogs::Core::Engine::~Engine().
bool Cogs::Core::Context::createDevice | ( | ) |
Definition at line 229 of file Context.cpp.
Cogs::Core::ViewContext * Cogs::Core::Context::createView | ( | WindowData * | windowData | ) |
Definition at line 449 of file Context.cpp.
void Cogs::Core::Context::deleteView | ( | ViewContext * | view | ) |
Definition at line 456 of file Context.cpp.
|
inline |
Cogs::Core::ComponentSystemBase * Cogs::Core::Context::getExtensionSystem | ( | const uint16_t | id | ) |
Retrieve the system with the given id.
id | Type id of the system to retrieve. |
Definition at line 415 of file Context.cpp.
Referenced by Cogs::Core::ExtensionRegistry::getExtensionSystem().
|
inline |
void Cogs::Core::Context::initialize | ( | ) |
Initialize all services and component systems.
Component systems without engine dependencies, such as the DepthAxisSystem are initialized by the context.
Definition at line 304 of file Context.cpp.
References Cogs::Core::SystemPriority::Geometry, Cogs::Core::ExtensionRegistry::initialize(), Cogs::Core::NoDefault, Cogs::Core::SystemPriority::PostTransform, Cogs::Core::SystemPriority::PostView, Cogs::Core::SystemPriority::PreLightView, Cogs::Core::SystemPriority::PreRendering, and Cogs::Core::SystemPriority::PreTransform.
void Cogs::Core::Context::initializeDynamicComponents | ( | ) |
Initialize and register dynamic component types.
All component types derived from DynamicComponent should be registered here.
Definition at line 362 of file Context.cpp.
|
static |
Perform static initialization of the Context.
All type information will be initialized by calling this method. Calling initializeStatic() twice has no effect but may produce warnings.
Definition at line 189 of file Context.cpp.
References Cogs::Core::ExtensionRegistry::initializeStatic().
void Cogs::Core::Context::preRender | ( | ) |
Definition at line 433 of file Context.cpp.
void Cogs::Core::Context::registerDynamicComponentType | ( | const StringView & | typeName | ) |
Register a dynamic component type with the given typeName.
typeName | A string containing the designated name of a type. The type must be derived from DynamicComponent. |
Definition at line 380 of file Context.cpp.
References Cogs::Reflection::TypeDatabase::getType().
Referenced by Cogs::Core::AudioExtension::initialize(), Cogs::Core::AxisCube::AxisCubeExtension::initialize(), Cogs::Core::DrillingExtension::initialize(), Cogs::Core::EchoSounder::EchoSounderExtension::initialize(), Cogs::Core::HeightMap::HeightMapExtension::initialize(), Cogs::Core::MultiphaseFlowExtension::initialize(), Cogs::Core::ProceduralSkyExtension::initialize(), Cogs::RationalReducerExtension::RationalReducerExtension::initialize(), and Cogs::Core::Volumetric::VolumetricExtension::initialize().
void Cogs::Core::Context::registerExtensionSystem | ( | const uint16_t | id, |
class ComponentSystemBase * | system | ||
) |
Register an extension component system using the given id.
id | Id used to retrieve the extension system. |
system | Pointer to the system to register. Ownership of the system is assumed to reside elsewhere. |
Definition at line 404 of file Context.cpp.
References Cogs::Core::ComponentSystemBase::initialize().
Referenced by Cogs::Core::ExtensionRegistry::registerExtensionSystem().
|
inline |
void Cogs::Core::Context::update | ( | ) |
Definition at line 420 of file Context.cpp.
std::unique_ptr<class Bounds> Cogs::Core::Context::bounds |
Bounds service instance.
Definition at line 216 of file Context.h.
Referenced by Cogs::Core::Image360System::createComponent(), Cogs::Core::OGC3DTilesSystem::createComponent(), Cogs::Core::PotreeSystem::createComponent(), Cogs::Core::VectorField::VectorFieldSystem::createComponent(), Cogs::Core::Image360System::destroyComponent(), Cogs::Core::OGC3DTilesSystem::destroyComponent(), Cogs::Core::PotreeSystem::destroyComponent(), Cogs::Core::VectorField::VectorFieldSystem::destroyComponent(), Cogs::Core::Volumetric::OctSystem::initialize(), Cogs::Core::OceanSystem::update(), Cogs::Core::TerrainSystem::update(), and Cogs::Core::CameraSystem::updateClippingPlanes().
std::unique_ptr<class CullingManager> Cogs::Core::Context::cullingManager |
CullingManager instance.
Definition at line 195 of file Context.h.
Referenced by Cogs::Core::CameraSystem::postUpdate(), and Cogs::Core::LightSystem::preRender().
|
private |
std::unique_ptr<class DeferredNameResolution> Cogs::Core::Context::deferredResolution |
Deferred name resolution service instance.
Definition at line 204 of file Context.h.
Referenced by Cogs::Core::applyFieldValues(), and Cogs::Core::InstancedModelSystem::update().
std::unique_ptr<class Engine> Cogs::Core::Context::engine |
Engine instance.
Definition at line 222 of file Context.h.
Referenced by Cogs::Core::applyFieldValues(), Cogs::Core::PotreeSystem::endFetch(), Cogs::Core::AudioExtension::initialize(), Cogs::Core::BlueNoiseExtension::initialize(), Cogs::Core::EditorExtension::initialize(), Cogs::Core::GuiExtension::initialize(), Cogs::Core::LightSystem::preRender(), Cogs::Core::ResourceManager< ResourceType, LoadInfoType >::processSwapping(), Cogs::Core::OGC3DTilesSystem::pruneTileCache(), Cogs::Core::ExtensionRegistry::registerExtensionSystem(), Cogs::setChanged(), Cogs::Core::PotreeSystem::startFetch(), Cogs::Core::TransformSystem::update(), Cogs::Core::AnimationSystem::update(), Cogs::Core::VariableExtrusionSystem::update(), Cogs::Core::EchoSounder::PingIsoSystem::update(), Cogs::Core::EchoSounder::SwathBottomSystem::update(), Cogs::Core::EchoSounder::SwathIsoSystem::update(), Cogs::Core::Image360System::update(), Cogs::Core::OGC3DTilesSystem::update(), Cogs::Core::BasicOceanSystem::update(), Cogs::Core::ScreenSizeSystem::update(), Cogs::Core::InstancedMeshRenderSystem::update(), Cogs::Core::RenderSystem::update(), Cogs::Core::SubMeshRenderSystem::update(), and Cogs::Core::CameraSystem::updateClippingPlanes().
std::unique_ptr<class ExtensionSystems> Cogs::Core::Context::extensionSystems |
std::unique_ptr<class Features> Cogs::Core::Context::features |
std::unique_ptr<struct MemoryContext> Cogs::Core::Context::memory |
Memory and allocation info.
Definition at line 171 of file Context.h.
Referenced by Cogs::Core::DynamicComponentSystem::cleanup(), Context(), Cogs::Core::Services::registerService(), Cogs::Core::Engine::registerSystem(), Cogs::Core::StaticModelSystem::update(), and Cogs::Core::Engine::~Engine().
std::unique_ptr<class QualityService> Cogs::Core::Context::qualityService |
Quality service instance.
Definition at line 201 of file Context.h.
Referenced by Cogs::Core::OGC3DTilesSystem::pruneTileCache(), Cogs::Core::Engine::update(), and Cogs::Core::AssetSystem::update().
std::unique_ptr<class Random> Cogs::Core::Context::random |
std::unique_ptr<class RayPicking> Cogs::Core::Context::rayPicking |
RayPicking service instance.
Definition at line 213 of file Context.h.
Referenced by Cogs::Core::Image360System::createComponent(), Cogs::Core::PotreeSystem::createComponent(), Cogs::Core::VectorField::VectorFieldSystem::createComponent(), Cogs::Core::Image360System::destroyComponent(), Cogs::Core::PotreeSystem::destroyComponent(), Cogs::Core::VectorField::VectorFieldSystem::destroyComponent(), and Cogs::Core::OceanSystem::update().
class IRenderer* Cogs::Core::Context::renderer |
Definition at line 228 of file Context.h.
Referenced by Cogs::Core::EditorExtension::cleanup(), Cogs::Core::PotreeSystem::cleanup(), Cogs::Core::SeaCurrentsSystem::cleanup(), Cogs::Core::TerrainSystem::cleanup(), Cogs::Core::VideoCaptureSystem::cleanup(), Cogs::Core::Image360System::createComponent(), Cogs::Core::Image360System::destroyComponent(), Cogs::Core::EditorExtension::initialize(), Cogs::Core::GuiExtension::initialize(), Cogs::Core::PotreeSystem::initialize(), Cogs::Core::SeaCurrentsSystem::initialize(), Cogs::Core::TerrainSystem::initialize(), Cogs::Core::VectorField::VectorFieldSystem::initialize(), Cogs::Core::VideoCaptureSystem::initialize(), Cogs::Core::Volumetric::OctSystem::initialize(), Cogs::Core::ShapeSystem::initialize(), Cogs::Core::CameraSystem::postRender(), Cogs::Core::LightSystem::preRender(), Cogs::Core::Engine::update(), Cogs::Core::GuiSystem::update(), Cogs::Core::Image360System::update(), and Cogs::Core::CameraSystem::updateProjection().
std::unique_ptr<class ResourceStore> Cogs::Core::Context::resourceStore |
ResourceStore service instance.
Definition at line 210 of file Context.h.
Referenced by Context(), Cogs::Core::BlueNoiseExtension::initialize(), Cogs::Core::CurtainView::CurtainViewExtension::initialize(), Cogs::Core::EchoSounder::EchoSounderExtension::initialize(), Cogs::Core::EditorExtension::initialize(), Cogs::Core::Image360Extension::initialize(), Cogs::Core::MultiphaseFlowExtension::initialize(), Cogs::Core::OGC3DTilesExtension::initialize(), Cogs::Core::PotreeExtension::initialize(), Cogs::Core::ProceduralSkyExtension::initialize(), Cogs::RationalReducerExtension::RationalReducerExtension::initialize(), Cogs::Core::SeaCurrentsExtension::initialize(), Cogs::Core::TerrainExtension::initialize(), Cogs::Core::TerrainSystem::initialize(), Cogs::Core::TerrainProvider::TerrainProviderExtension::initialize(), Cogs::Core::VectorField::VectorFieldExtension::initialize(), Cogs::Core::Volumetric::VolumetricExtension::initialize(), and Cogs::Core::GuiSystem::update().
std::unique_ptr<class ResourceUsageLogger> Cogs::Core::Context::resourceUsageLogger |
Resource usage logger service instance.
Definition at line 183 of file Context.h.
Referenced by Cogs::Core::Engine::update(), and Cogs::Core::Engine::~Engine().
std::unique_ptr<class Scene> Cogs::Core::Context::scene |
Scene structure.
Definition at line 225 of file Context.h.
Referenced by Cogs::Core::AssetSystem::update().
std::unique_ptr<class ScriptingManager> Cogs::Core::Context::scriptingManager |
ScriptingManager service instance.
Definition at line 192 of file Context.h.
Referenced by Cogs::Core::ScriptSystem::update().
std::unique_ptr<class Services> Cogs::Core::Context::services |
Definition at line 174 of file Context.h.
Referenced by Cogs::RationalReducerExtension::RationalReducerExtension::cleanup(), Cogs::Core::AudioExtension::initialize(), Cogs::Core::PotreeSystem::initialize(), Cogs::RationalReducerExtension::RationalReducerExtension::initialize(), Cogs::Core::TerrainProvider::TerrainProviderExtension::initialize(), Cogs::Core::RigidBodySystem::postUpdate(), Cogs::Core::RigidBodySystem::preUpdate(), Cogs::Core::TextureGeneratorSystem::update(), Cogs::Core::MeshGeneratorSystem::update(), Cogs::Core::FixedConstraintSystem::update(), Cogs::Core::HingeConstraintSystem::update(), Cogs::Core::SpringConstraintSystem::update(), Cogs::Core::GenericConstraintSystem::update(), Cogs::Core::GhostSystem::update(), Cogs::Core::RigidBodySystem::update(), and Cogs::Core::TriggerSystem::update().
class EntityStore* Cogs::Core::Context::store |
Entity store.
Definition at line 231 of file Context.h.
Referenced by Cogs::Core::OGC3DTilesSystem::addModelToScene(), Cogs::Core::CreateEntityCommand::apply(), Cogs::Core::ExportCommand::apply(), Cogs::Core::ExportGltfCommand::apply(), Cogs::Core::SetFieldCommand< T >::apply(), Cogs::Core::PackMeshCommand::apply(), Cogs::Core::applyFieldValues(), Context(), Cogs::Core::OGC3DTilesSystem::destroyComponent(), Cogs::Core::EditorState::eraseInvalidSelected(), Cogs::Core::EditorState::getSelected(), Cogs::Core::Editor::hideUnselected(), Cogs::Core::AxisCube::AxisCubeExtension::initialize(), Cogs::Core::CasingExtension::initialize(), Cogs::Core::CurtainView::CurtainViewExtension::initialize(), Cogs::Core::DrillingExtension::initialize(), Cogs::Core::EchoSounder::EchoSounderExtension::initialize(), Cogs::Core::HeightMap::HeightMapExtension::initialize(), Cogs::Core::Image360Extension::initialize(), Cogs::Core::MultiphaseFlowExtension::initialize(), Cogs::Core::OGC3DTilesExtension::initialize(), Cogs::Core::PotreeExtension::initialize(), Cogs::Core::ProceduralSkyExtension::initialize(), Cogs::Core::SeaCurrentsExtension::initialize(), Cogs::Core::TerrainExtension::initialize(), Cogs::Core::VectorField::VectorFieldExtension::initialize(), Cogs::VideoExtension::VideoExtension::initialize(), Cogs::Core::Volumetric::VolumetricExtension::initialize(), Cogs::Core::WellLogExtension::initialize(), Cogs::Core::Editor::invertVisibility(), Cogs::Core::Editor::isUserRootEntity(), Cogs::Core::EchoSounder::UniformGridSystem::preUpdate(), Cogs::Core::OGC3DTilesSystem::pruneTileCache(), Cogs::Core::Engine::registerSystem(), Cogs::Core::Editor::selectFurthestAway(), Cogs::Core::Scene::setup(), Cogs::Core::Editor::showAll(), Cogs::Core::Editor::showHide(), Cogs::Core::VariableExtrusionSystem::update(), Cogs::Core::GhostSystem::update(), Cogs::Core::RigidBodySystem::update(), Cogs::Core::TriggerSystem::update(), Cogs::Core::EchoSounder::SwathBottomSystem::update(), Cogs::Core::EchoSounder::SwathIsoSystem::update(), Cogs::Core::OGC3DTilesSystem::update(), Cogs::Core::OceanSystem::update(), Cogs::Core::BasicOceanSystem::update(), Cogs::Core::AssetSystem::update(), Cogs::Core::InstancedModelSystem::update(), Cogs::Core::AdaptivePlanarGridSystem::update(), Cogs::Core::EditorState::updateSelectedInfo(), and Cogs::Core::writeEntity().
std::unique_ptr<class TaskManager> Cogs::Core::Context::taskManager |
TaskManager service instance.
Definition at line 186 of file Context.h.
Referenced by Cogs::Core::BasicOceanSystem::cleanup(), Cogs::Core::ScreenSizeSystem::cleanup(), Cogs::Core::InstancedMeshRenderSystem::cleanup(), Cogs::Core::RenderSystem::cleanup(), Cogs::Core::SubMeshRenderSystem::cleanup(), Cogs::Core::EchoSounder::UniformGridSystem::createComponent(), Cogs::Core::CaptureSystem::destroyComponent(), Cogs::Core::EchoSounder::UniformGridSystem::initialize(), Cogs::Core::BasicOceanSystem::initialize(), Cogs::Core::ScreenSizeSystem::initialize(), Cogs::Core::InstancedMeshRenderSystem::initialize(), Cogs::Core::RenderSystem::initialize(), Cogs::Core::SubMeshRenderSystem::initialize(), Cogs::Core::MeshManager::MeshManager(), Cogs::Core::ModelManager::ModelManager(), Cogs::Core::MeshRenderPicker::pickImpl(), Cogs::Core::BasicOceanSystem::postUpdate(), Cogs::Core::EchoSounder::UniformGridSystem::preUpdate(), Cogs::Core::TransformSystem::update(), Cogs::Core::AnimationSystem::update(), Cogs::Core::VariableExtrusionSystem::update(), Cogs::Core::EchoSounder::OctProviderSystem::update(), Cogs::Core::EchoSounder::PingIsoSystem::update(), Cogs::Core::Volumetric::DensityFieldSystem::update(), Cogs::Core::Volumetric::OctDummyProviderSystem::update(), Cogs::Core::BasicOceanSystem::update(), Cogs::Core::CaptureSystem::update(), Cogs::Core::InstancedMeshRenderSystem::update(), Cogs::Core::RenderSystem::update(), Cogs::Core::SubMeshRenderSystem::update(), and Cogs::Core::Engine::~Engine().
std::unique_ptr<class Time> Cogs::Core::Context::time |
Time service instance.
Definition at line 198 of file Context.h.
Referenced by Cogs::Core::OGC3DTilesSystem::loadMissingModels(), Cogs::Core::LightSystem::preRender(), Cogs::Core::OGC3DTilesSystem::pruneTileCache(), Cogs::Core::AnimationSystem::update(), Cogs::Core::RigidBodySystem::update(), Cogs::Core::AudioSystem::update(), Cogs::Core::Image360System::update(), Cogs::Core::OGC3DTilesSystem::update(), Cogs::Core::BasicOceanSystem::update(), and Cogs::Core::CaptureSystem::update().
std::unique_ptr<class Variables> Cogs::Core::Context::variables |
Variables service instance.
Definition at line 180 of file Context.h.
Referenced by Cogs::Core::Renderer::cleanup(), Context(), Cogs::Core::Renderer::getClearDepth(), Cogs::Core::Renderer::getNearDepth(), Cogs::Core::Renderer::getProjectionMatrix(), Cogs::Core::EchoSounder::EchoSounderExtension::initialize(), Cogs::Core::GltfLoaderExtension::initialize(), Cogs::Core::OGC3DTilesSystem::initialize(), Cogs::Core::PotreeSystem::initialize(), Cogs::Core::Volumetric::VolumetricExtension::initialize(), Cogs::Core::BasicOceanSystem::initialize(), Cogs::Core::AssetSystem::initialize(), Cogs::Core::LightSystem::initialize(), Cogs::Core::OGC3DTilesSystem::loadMissingModels(), Cogs::Core::ModelManager::ModelManager(), Cogs::Core::Image360::RayPickExtension::pickCamera(), Cogs::Core::LightSystem::preRender(), Cogs::Core::Renderer::render(), Cogs::Core::Scene::setup(), Cogs::Core::TaskManager::TaskManager(), Cogs::Core::Engine::update(), Cogs::Core::LodSystem::update(), Cogs::Core::EchoSounder::SwathBottomSystem::update(), Cogs::Core::EchoSounder::SwathIsoSystem::update(), Cogs::Core::Image360System::update(), Cogs::Core::OGC3DTilesSystem::update(), Cogs::Core::PotreeSystem::update(), Cogs::Core::OceanSystem::update(), Cogs::Core::ZipSystem::update(), Cogs::Core::BasicOceanSystem::update(), Cogs::Core::AssetSystem::update(), Cogs::Core::ShapeSystem::update(), Cogs::Core::CameraSystem::updateClippingPlanes(), Cogs::Core::Renderer::updatePermutation(), and Cogs::Core::Engine::~Engine().
|
private |
std::unique_ptr<FileSystemWatcher> Cogs::Core::Context::watcher |