RAMSES Documentation  27.0.130
Information for RAMSES users and developers
Public Member Functions | List of all members
ramses::IRendererResourceCache Class Referenceabstract

An interface used to implement a caching mechanism for resources used on the RamsesRenderer. Important: Please note that the resource ids in this context do not match client resource ids. More...

#include <IRendererResourceCache.h>

Inheritance diagram for ramses::IRendererResourceCache:
[legend]

Public Member Functions

virtual ~IRendererResourceCache ()=default
 Destructor of IRendererResourceCache. More...
 
virtual bool hasResource (rendererResourceId_t resourceId, uint32_t &size) const =0
 Called by RamsesRenderer to ask for a resource with the given id. More...
 
virtual bool getResourceData (rendererResourceId_t resourceId, uint8_t *buffer, uint32_t bufferSize) const =0
 Called by RamsesRenderer to get the resource data associated with a given resource id. This method will be called immediately after hasResource(...), if the resource exists in the cache. More...
 
virtual bool shouldResourceBeCached (rendererResourceId_t resourceId, uint32_t resourceDataSize, resourceCacheFlag_t cacheFlag, sceneId_t sceneId) const =0
 Called by RamsesRenderer when a resource was not in the cache and is now available from other source. The cache is asked if it wants to store a given resource or not. This avoids the overhead of preparing the resource data in case it is not to be cached. More...
 
virtual void storeResource (rendererResourceId_t resourceId, const uint8_t *resourceData, uint32_t resourceDataSize, resourceCacheFlag_t cacheFlag, sceneId_t sceneId)=0
 Called by RamsesRenderer with the final resource for storing. This is called immediately after shouldResourceBeCached(...), if it was requested to be cached. More...
 

Detailed Description

An interface used to implement a caching mechanism for resources used on the RamsesRenderer. Important: Please note that the resource ids in this context do not match client resource ids.

Constructor & Destructor Documentation

◆ ~IRendererResourceCache()

virtual ramses::IRendererResourceCache::~IRendererResourceCache ( )
virtualdefault

Destructor of IRendererResourceCache.

Member Function Documentation

◆ getResourceData()

virtual bool ramses::IRendererResourceCache::getResourceData ( rendererResourceId_t  resourceId,
uint8_t *  buffer,
uint32_t  bufferSize 
) const
pure virtual

Called by RamsesRenderer to get the resource data associated with a given resource id. This method will be called immediately after hasResource(...), if the resource exists in the cache.

Parameters
resourceIdId for the resource.
bufferA pre-allocated buffer which the resource data will be copied into.
bufferSizeThe size of the pre-allocated buffer in bytes. It should be at least the size of the requested resource (returned by hasResource(...)).
Returns
true if the resource was copied successfully into the buffer.

Implemented in ramses::DefaultRendererResourceCache.

◆ hasResource()

virtual bool ramses::IRendererResourceCache::hasResource ( rendererResourceId_t  resourceId,
uint32_t &  size 
) const
pure virtual

Called by RamsesRenderer to ask for a resource with the given id.

Parameters
resourceIdId for the resource.
[out]sizeThe size of the found resource in bytes. This value is only relevant if the resource exists in the cache.
Returns
true if a resource with the given resource id exists in the cache.

Implemented in ramses::DefaultRendererResourceCache.

◆ shouldResourceBeCached()

virtual bool ramses::IRendererResourceCache::shouldResourceBeCached ( rendererResourceId_t  resourceId,
uint32_t  resourceDataSize,
resourceCacheFlag_t  cacheFlag,
sceneId_t  sceneId 
) const
pure virtual

Called by RamsesRenderer when a resource was not in the cache and is now available from other source. The cache is asked if it wants to store a given resource or not. This avoids the overhead of preparing the resource data in case it is not to be cached.

Parameters
resourceIdId for the resource.
resourceDataSizeThe size of the resource in bytes.
cacheFlagThe cache flag associated with the resource (set on client side).
sceneIdThe id of the first scene which requested the resource. In case of multiple scenes using the same resource, only the first scene id is guaranteed to be reported.
Returns
true if the cache wants to store the resource.

Implemented in ramses::DefaultRendererResourceCache.

◆ storeResource()

virtual void ramses::IRendererResourceCache::storeResource ( rendererResourceId_t  resourceId,
const uint8_t *  resourceData,
uint32_t  resourceDataSize,
resourceCacheFlag_t  cacheFlag,
sceneId_t  sceneId 
)
pure virtual

Called by RamsesRenderer with the final resource for storing. This is called immediately after shouldResourceBeCached(...), if it was requested to be cached.

Parameters
resourceIdId for the resource.
resourceDataThe resource data which will be copied into the cache.
resourceDataSizeThe size of the resource in bytes.
cacheFlagThe cache flag associated with the resource (set on client side).
sceneIdThe id of the first scene which requested the resource. In case of multiple scenes using the same resource, only the first scene id is guaranteed to be reported.

Implemented in ramses::DefaultRendererResourceCache.


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