|
Cogs.Core
|
Material instance manager handles creation, processing and lifetime for MaterialInstance resources. More...
#include <MaterialManager.h>
Public Member Functions | |
| MaterialInstanceManager (Context *context) | |
| Constructs a MaterialInstanceManager in the given context. | |
| ~MaterialInstanceManager () | |
| Destructs the MaterialInstanceManager. | |
| void | initialize () override |
| Initialize the MaterialInstanceManager. | |
| void | initializeDefaultMaterialInstance () |
| MaterialInstanceHandle | createMaterialInstance (const MaterialHandle &material) |
| Create a new MaterialInstance from the Material given held by material. | |
| MaterialInstanceHandle | getMaterialInstance (const StringView &name) |
| ActivationResult | handleActivation (MaterialInstanceHandle handle, MaterialInstance *resource) override |
| Overridden to handle activation of MaterialInstances, updating the resource in the renderer. | |
| void | handleDeletion (MaterialInstance *resource) override |
| Overridden to handle material instance deletion, removing the resource from the renderer. | |
| int | getUpdateQuota () const override |
Public Member Functions inherited from Cogs::Core::ResourceManager< MaterialInstance, ResourceLoadInfoBase > | |
| ResourceManager (Context *context, Collections::ElementOffset capacity=1024) | |
| Constructs a resource manager with the given context. | |
| ~ResourceManager () override | |
| Destructs a resource manager, provided for destruction via base pointer. | |
| void | clear () override |
| Clear the resource manager, cleaning up resources held by member handles. | |
| void | clearSwapping () override |
| Clear the swap queue, ensuring indirect resource references are released. | |
| ResourceHandle | create () |
| Create a new resource. | |
| ResourceHandle | release (ResourceId resourceId) |
| ResourceHandle | loadResource (ResourceLoadInfoBase *loadInfo) |
| ResourceProxy | createLocked () |
| Creates a new resource, but returns a ResourceProxy for thread safe editing instead of a handle to the actual resource. | |
| ResourceProxy | lock (const ResourceHandle &handle) |
| Takes the handle given and returns a resource proxy to edit the contents of the held resource safely on other threads than the main thread. | |
| void | unlockProxy (const ResourceHandle &handle, const ResourceHandle &proxy) |
| Unlock the given resource proxy. | |
| ResourceHandle | generateHandle (ResourceBase *resource) |
| Generate a handle to the given resource. | |
| virtual void | handleLoad (ResourceLoadInfoBase *) |
| Handler for resource loading. | |
| virtual void | handleFailedLoad (const ResourceLoadInfoBase *) |
| Handler for failed resource loads using the given loadInfo. | |
| virtual ActivationResult | handleActivation (ResourceHandle, MaterialInstance *) |
| Handler for activation of resources. | |
| virtual void | handleDeletion (MaterialInstance *) |
| Handler for deletion of resources. | |
| MaterialInstance * | get (const ResourceHandleBase &handle) |
| Resolve the given handle to a resource. | |
| void | processSwapping () override |
| Process queued swap operations, exchanging resource contents of the destination resources by those indicated in the operation data. | |
| ResourceHandle | getHandle (const ResourceId id) const |
| Get a resource handle to the resource with the given id. | |
| void | registerLoader (IResourceLoader< MaterialInstance, ResourceLoadInfoBase > *loader) |
| Register a resource loader capable of handling resources of the template type. | |
| void | destroyLoadInfoInternal (ResourceLoadInfoBase *loadInfo) override |
| ResourceLoadInfoBase * | createLoadInfo () |
Public Member Functions inherited from Cogs::Core::ResourceManagerBase | |
| ResourceManagerBase (Context *context) | |
| void | initialize () override |
| void | clear () override |
| void | reportLeaks (std::string_view typeName) |
| std::string | getReport () |
| Return a string with current resource usage. | |
| bool | checkPreloaded (ResourceLoadInfoBase *loadInfo) |
| ResourceHandleBase | releaseInternal (ResourceId resourceId) |
| Releases a resourceId -> ResourceHandle mapping. | |
| ResourceHandleBase | loadResourceInternal (ResourceLoadInfoBase *loadInfo) |
| Load a resource using the given loadInfo. | |
| void | processLoading () final |
| Process loading resources. | |
| void | setProcessed (ResourceLoadInfoBase *loadInfo, bool swapping=false) |
| Signal the resource being loaded as done loading and ready for activation etc. | |
| void | activateResources () final |
| virtual void | processDeletion () override |
| Process resources pending deallocation. | |
| void | fillDeletionQueue (std::vector< ResourceBase * > &deletion) |
| void | destroyLocked (ResourceBase *resource) |
| void | safeDestroy (ResourceBase *resource) |
| ResourceId | getNextResourceId () override |
| Get the next unique resource id. | |
| void | resourceChanged (ResourceBase *resource) override |
| void | resourceDeleted (ResourceBase *resource) override |
| void | setResourceId (ResourceBase *resource, ResourceId id) override |
| Assign the given id to a previously created resource. | |
| void | queueResource (ResourceLoadInfoBase *loadInfo) |
| Re-queue the given loadInfo to defer loading to the next time the processLoading() phase is performed. | |
| virtual void | handleLoadInternal (ResourceLoadInfoBase *loadInfo)=0 |
| virtual ActivationResult | handleActivationInternal (ResourceHandleBase r, ResourceBase *resource)=0 |
| virtual void | handleDeletionInternal (ResourceBase *resource)=0 |
| virtual void | handleFailedLoadInternal (ResourceLoadInfoBase *loadInfo)=0 |
| virtual void | destroyLoadInfoInternal (ResourceLoadInfoBase *loadInfo)=0 |
| virtual bool | shouldAutoReload () const |
| virtual bool | shouldMergeBySource () const |
| virtual void | handleReload (ResourceHandleBase) |
| std::vector< ResourceBase * > | getAllocatedResources () const |
| ResourceHandleBase | getOrCreate (ResourceId id) |
| ResourceHandleBase | getByName (std::string_view name) const |
| ResourceHandleBase | getBySource (std::string_view source) const |
| ResourceHandleBase | createResource () |
| virtual ResourceBase * | createInternal ()=0 |
| virtual void | destroyInternal (ResourceBase *resource)=0 |
| virtual void | destroyInternalLocked (ResourceBase *resource)=0 |
| ResourceHandleBase | generateHandle (ResourceBase *resource) |
| void | clearUpdated () |
| virtual int | getUpdateQuota () const |
| size_t | updatedResourceCount () |
| size_t | orphanedResourceCount () |
| size_t | allocatedResourceCount () |
| virtual void | initialize ()=0 |
| virtual void | clear ()=0 |
| virtual void | clearSwapping ()=0 |
| virtual void | processLoading ()=0 |
| virtual void | processSwapping ()=0 |
| virtual void | activateResources ()=0 |
| virtual void | processDeletion ()=0 |
| virtual void | resourceChanged (ResourceBase *resource)=0 |
| virtual void | resourceDeleted (ResourceBase *resource)=0 |
| virtual ResourceId | getNextResourceId ()=0 |
| virtual void | setResourceId (ResourceBase *resource, ResourceId id)=0 |
Material instance manager handles creation, processing and lifetime for MaterialInstance resources.
Definition at line 112 of file MaterialManager.h.
|
inline |
Constructs a MaterialInstanceManager in the given context.
Definition at line 116 of file MaterialManager.h.
| Cogs::Core::MaterialInstanceManager::~MaterialInstanceManager | ( | ) |
Destructs the MaterialInstanceManager.
Definition at line 1038 of file MaterialManager.cpp.
| Cogs::Core::MaterialInstanceHandle Cogs::Core::MaterialInstanceManager::createMaterialInstance | ( | const MaterialHandle & | material | ) |
Create a new MaterialInstance from the Material given held by material.
The created MaterialInstance will have all properties and values set to the defaults indicated in the parent Material.
| material | Handle to a valid material. |
Definition at line 1055 of file MaterialManager.cpp.
References Cogs::Core::ResourceHandle_t< ResourceType >::resolve().
| Cogs::Core::MaterialInstanceHandle Cogs::Core::MaterialInstanceManager::getMaterialInstance | ( | const StringView & | name | ) |
Definition at line 1070 of file MaterialManager.cpp.
|
overridevirtual |
Reimplemented from Cogs::Core::ResourceManagerBase.
Definition at line 1085 of file MaterialManager.cpp.
|
overridevirtual |
Overridden to handle activation of MaterialInstances, updating the resource in the renderer.
Reimplemented from Cogs::Core::ResourceManager< MaterialInstance, ResourceLoadInfoBase >.
Definition at line 1075 of file MaterialManager.cpp.
|
overridevirtual |
Overridden to handle material instance deletion, removing the resource from the renderer.
Reimplemented from Cogs::Core::ResourceManager< MaterialInstance, ResourceLoadInfoBase >.
Definition at line 1080 of file MaterialManager.cpp.
|
overridevirtual |
Initialize the MaterialInstanceManager.
Implements Cogs::Core::IResourceManager.
Definition at line 1043 of file MaterialManager.cpp.
| void Cogs::Core::MaterialInstanceManager::initializeDefaultMaterialInstance | ( | ) |
Definition at line 1050 of file MaterialManager.cpp.