Cogs.Core
Public Member Functions | Private Types | Private Attributes | List of all members
Cogs::Core::AssetSystem Class Reference
Inheritance diagram for Cogs::Core::AssetSystem:
Cogs::Core::ComponentSystemWithDataPools< AssetComponent, AssetData > Cogs::Core::ComponentSystem< ComponentType > Cogs::Core::ComponentSystemBase

Public Member Functions

 AssetSystem (Memory::Allocator *allocator, SizeType capacity)
 
void initialize (Context *context) override
 Initialize the system.
 
void update (Context *context) override
 Provided for custom update logic in derived systems.
 
void postUpdate (Context *context) override
 
ComponentHandle createComponent () override
 Create a new component instance.
 
void destroyComponent (ComponentHandle component) override
 Destroy the component held by the given handle.
 
const struct AssetInstanceStatsgetStats (AssetComponent *assetComponent) const
 
const Geometry::BoundingBox * getLocalBounds (AssetComponent *assetComponent) const
 
Geometry::BoundingBox getWorldBounds (AssetComponent *assetComponent, bool ignoreVisibility) const
 
std::span< const AssetModelRequest *const > getPendingRequests () const
 
std::span< const AssetModelRequest *const > getInFlightRequests () const
 
- Public Member Functions inherited from Cogs::Core::ComponentSystemWithDataPools< AssetComponent, AssetData >
 ComponentSystemWithDataPools (Memory::Allocator *allocator, SizeType size=1024, MemBlockType componentMemType=MemBlockType::Component, MemBlockType dataMemType=MemBlockType::ComponentData)
 
ComponentHandle createComponent () override
 
void destroyComponent (ComponentHandle component) override
 
T & getData (const AssetComponent *component)
 Get the data stored for the given component from the data pool storing objects of the specified template type.
 
const T & getData (const AssetComponent *component) const
 Get the const data stored for the given component from the data pool storing objects of the specified template type.
 
- Public Member Functions inherited from Cogs::Core::ComponentSystem< ComponentType >
 ComponentSystem (Memory::Allocator *allocator, SizeType size=16384, MemBlockType componentMemType=MemBlockType::Component)
 
void instrumentedPreUpdate () override
 Provided for tagged engine instrumentation.
 
void instrumentedUpdate () override
 Provided for tagged engine instrumentation.
 
void instrumentedPostUpdate () override
 Provided for tagged engine instrumentation.
 
ComponentHandle createComponent () override
 Create a new component instance.
 
void destroyComponent (ComponentHandle component) override
 Destroy the component held by the given handle.
 
SizeType getComponentIndex (const Component *component) const
 Get the index of the given component in the component pool.
 
size_t size ()
 Returns the number of active components.
 
void clearCarryFlags ()
 Clear carry flags of all active components.
 
void resetFlags ()
 Reset the flags of all active components.
 
void prepareUpdate (Context *) override
 
void postUpdate (Context *) override
 
ComponentHandle getHandle (const ComponentType *component)
 Get a handle to the given Component instance.
 
virtual void addEntitiesWithComponent (std::vector< EntityId > &entities, Reflection::TypeId componentTypeId) override
 Return all entities with a given.
 
- Public Member Functions inherited from Cogs::Core::ComponentSystemBase
virtual ~ComponentSystemBase ()
 Provided for destruction via pointer to base.
 
 ComponentSystemBase (Reflection::TypeId componentType)
 Constructs a ComponentSystemBase to manage components of the given componentType.
 
virtual void initialize (Context *context)
 Initialize the system.
 
void preUpdate ()
 Run the pre-update method of the system.
 
void update ()
 Updates the system state to that of the current frame.
 
void postUpdate ()
 Perform post update logic in the system.
 
virtual void preUpdate (Context *)
 Provided for custom pre update logic in derived systems.
 
virtual void prepareUpdate (Context *)
 Provided for custom update preparation logic in derived systems.
 
virtual void update (Context *)
 Provided for custom update logic in derived systems.
 
virtual void postUpdate (Context *)
 Provided for custom post update logic in derived systems.
 
virtual void instrumentedPreUpdate ()
 Provided for tagged engine instrumentation.
 
virtual void instrumentedUpdate ()
 Provided for tagged engine instrumentation.
 
virtual void instrumentedPostUpdate ()
 Provided for tagged engine instrumentation.
 
virtual void addEntitiesWithComponent (std::vector< EntityId > &, Reflection::TypeId)
 Return all entities with a given.
 
virtual void cleanup (Context *)
 Provided for custom cleanup logic in derived systems.
 
virtual ComponentHandle createComponent ()
 Create a new component instance.
 
virtual void destroyComponent (ComponentHandle)
 Destroy the component held by the given handle.
 
Reflection::TypeId getComponentType () const
 Get the reflected type of the components managed by this system.
 

Private Types

using base = Cogs::Core::ComponentSystemWithDataPools< AssetComponent, AssetData >
 

Private Attributes

std::unique_ptr< AssetBoundsbounds
 
std::unique_ptr< struct AssetSystemDatasystemData
 

Additional Inherited Members

- Public Types inherited from Cogs::Core::ComponentSystem< ComponentType >
typedef ComponentType component_type
 
- Static Public Member Functions inherited from Cogs::Core::ComponentSystem< ComponentType >
static Reflection::TypeId getTypeId ()
 Get the type id of the component type used by the system.
 
- Public Attributes inherited from Cogs::Core::ComponentSystem< ComponentType >
ComponentPool< ComponentType > pool
 Pool of components managed by the system.
 
- Public Attributes inherited from Cogs::Core::ComponentSystemBase
Reflection::TypeId componentType
 The type of components managed by this instance.
 
Contextcontext = nullptr
 Pointer to the Context instance the system lives in.
 

Detailed Description

Definition at line 78 of file AssetSystem.h.

Member Typedef Documentation

◆ base

Definition at line 80 of file AssetSystem.h.

Constructor & Destructor Documentation

◆ AssetSystem()

Cogs::Core::AssetSystem::AssetSystem ( Memory::Allocator allocator,
SizeType  capacity 
)

Definition at line 1897 of file AssetSystem.cpp.

Member Function Documentation

◆ createComponent()

ComponentHandle Cogs::Core::AssetSystem::createComponent ( )
overridevirtual

Create a new component instance.

Reimplemented from Cogs::Core::ComponentSystem< ComponentType >.

Definition at line 2224 of file AssetSystem.cpp.

◆ destroyComponent()

void Cogs::Core::AssetSystem::destroyComponent ( ComponentHandle  component)
overridevirtual

Destroy the component held by the given handle.

Reimplemented from Cogs::Core::ComponentSystem< ComponentType >.

Definition at line 2238 of file AssetSystem.cpp.

◆ getInFlightRequests()

std::span< const Cogs::Core::AssetModelRequest *const > Cogs::Core::AssetSystem::getInFlightRequests ( ) const

Definition at line 2275 of file AssetSystem.cpp.

◆ getLocalBounds()

const Cogs::Geometry::BoundingBox * Cogs::Core::AssetSystem::getLocalBounds ( AssetComponent assetComponent) const

Definition at line 2257 of file AssetSystem.cpp.

◆ getPendingRequests()

std::span< const Cogs::Core::AssetModelRequest *const > Cogs::Core::AssetSystem::getPendingRequests ( ) const

Definition at line 2270 of file AssetSystem.cpp.

◆ getStats()

const Cogs::Core::AssetInstanceStats * Cogs::Core::AssetSystem::getStats ( AssetComponent assetComponent) const

Definition at line 2248 of file AssetSystem.cpp.

◆ getWorldBounds()

Cogs::Geometry::BoundingBox Cogs::Core::AssetSystem::getWorldBounds ( AssetComponent assetComponent,
bool  ignoreVisibility 
) const

Definition at line 2280 of file AssetSystem.cpp.

◆ initialize()

void Cogs::Core::AssetSystem::initialize ( Context context)
overridevirtual

Initialize the system.

Initialization is performed after all systems are created and a renderer initialized, but before the first time anything is rendered.

Parameters
contextPointer to the context the system lives in.

Reimplemented from Cogs::Core::ComponentSystemBase.

Definition at line 1901 of file AssetSystem.cpp.

References Cogs::Core::Context::variables.

◆ postUpdate()

void Cogs::Core::AssetSystem::postUpdate ( Context )
overridevirtual

Overridden to propagate carry flags. Any subclass overriding this method should also call base class.

Reimplemented from Cogs::Core::ComponentSystem< ComponentType >.

Definition at line 2219 of file AssetSystem.cpp.

◆ update()

void Cogs::Core::AssetSystem::update ( Context )
overridevirtual

Member Data Documentation

◆ bounds

std::unique_ptr<AssetBounds> Cogs::Core::AssetSystem::bounds
private

Definition at line 99 of file AssetSystem.h.

◆ systemData

std::unique_ptr<struct AssetSystemData> Cogs::Core::AssetSystem::systemData
private

Definition at line 100 of file AssetSystem.h.


The documentation for this class was generated from the following files: