![]() |
RAMSES Documentation
27.0.130
Information for RAMSES users and developers
|
The ResourceDataPool holds resource data which can be instantiated for a given scene. Resource data can either be added by calling the add functions or by attaching a resource data file to the pool. The same resource data can be instantiated by multiple scenes at the same time. More...
#include <ResourceDataPool.h>
Public Member Functions | |
resourceId_t | addArrayResourceData (EDataType type, uint32_t numElements, const void *arrayData, resourceCacheFlag_t cacheFlag=ResourceCacheFlag_DoNotCache, const char *name=nullptr) |
Add ArrayResource data to the pool. The pool is taking ownership of the given range of data of a certain type and keeps it to instantiate resource from it later via createResourceForScene. See ramses::ArrayResource for more details. Readding the same resource data again will return the previous resource id, but not recreate the resource data. Readding a same resource requires removing it again with removeResourceData. More... | |
resourceId_t | addTexture2DData (ETextureFormat format, uint32_t width, uint32_t height, uint32_t mipMapCount, const MipLevelData mipLevelData[], bool generateMipChain=false, const TextureSwizzle &swizzle={}, resourceCacheFlag_t cacheFlag=ResourceCacheFlag_DoNotCache, const char *name=nullptr) |
Add Texture2D data to the pool. It is taking ownership of the given range of texture data in the specified pixel format and keeps it to instantiate resource from it later via createResourceForScene. See ramses::Texture2D for more details. More... | |
resourceId_t | addTexture3DData (ETextureFormat format, uint32_t width, uint32_t height, uint32_t depth, uint32_t mipMapCount, const MipLevelData mipLevelData[], bool generateMipChain=false, resourceCacheFlag_t cacheFlag=ResourceCacheFlag_DoNotCache, const char *name=nullptr) |
Add Texture3D data to the pool. It is taking ownership of the given range of texture data in the specified pixel format and keeps it to instantiate resource from it later via createResourceForScene. See ramses::Texture3D for more details. Readding the same resource data again will return the previous resource id, but not recreate the resource data. Readding a same resource requires removing it again with removeResourceData. More... | |
resourceId_t | addTextureCubeData (ETextureFormat format, uint32_t size, uint32_t mipMapCount, const CubeMipLevelData mipLevelData[], bool generateMipChain=false, const TextureSwizzle &swizzle={}, resourceCacheFlag_t cacheFlag=ResourceCacheFlag_DoNotCache, const char *name=nullptr) |
Add Cube Texture data to the pool. It is taking ownership of the given range of texture data in the specified pixel format and keeps it to instantiate resource from it later via createResourceForScene. All texel values are initially initialized to 0. See ramses::TextureCube for more details. Readding the same resource data again will return the previous resource id, but not recreate the resource data. Readding a same resource requires removing it again with removeResourceData. More... | |
resourceId_t | addEffectData (const EffectDescription &effectDesc, resourceCacheFlag_t cacheFlag=ResourceCacheFlag_DoNotCache, const char *name=nullptr) |
Add Effect data to the pool by parsing a GLSL shader described by an EffectDescription instance. The data can be used to instantiate a resource via createResourceForScene. Refer to RamsesClient::getLastEffectErrorMessages in case of parsing error. See ramses::Effect for more details. Readding the same resource data again will return the previous resource id, but not recreate the resource data. Readding a same resource requires removing it again with removeResourceData. More... | |
std::string | getLastEffectErrorMessages () const |
Get the GLSL error messages that were produced at the creation of the last Effect data. More... | |
bool | removeResourceData (resourceId_t const &id) |
Removes data which was added to the pool. The provided resource id might not be used anymore to instantiate a resource via createResourceForScene, depending on how many times corresponding addResourceData was called before. Already instantiated resources will not be affected by removeResourceData. More... | |
bool | addResourceDataFile (std::string const &filename) |
Adds a file to the resource data pool, so the contained data can be instantiated via createResourceForScene. More... | |
bool | forceLoadResourcesFromResourceDataFile (std::string const &filename) |
Loads all resources in a file currently in use by any scene from that file to memory. More... | |
bool | removeResourceDataFile (std::string const &filename) |
Removes a resource file from the pool. The contained data can then not be used anymore to instantiate a resource via createResourceForScene. More... | |
Resource * | createResourceForScene (Scene &scene, resourceId_t const &id) |
Creates a resource for a scene out of pool data. The resource can then be used in scene as if created with the scenes create resource functions. More... | |
Public Attributes | |
ResourceDataPoolImpl & | impl |
Friends | |
class | RamsesClientImpl |
RamsesClientImpl is the factory for creating the ResourceDataPool instance. More... | |
The ResourceDataPool holds resource data which can be instantiated for a given scene. Resource data can either be added by calling the add functions or by attaching a resource data file to the pool. The same resource data can be instantiated by multiple scenes at the same time.
resourceId_t ramses::ResourceDataPool::addArrayResourceData | ( | EDataType | type, |
uint32_t | numElements, | ||
const void * | arrayData, | ||
resourceCacheFlag_t | cacheFlag = ResourceCacheFlag_DoNotCache , |
||
const char * | name = nullptr |
||
) |
Add ArrayResource data to the pool. The pool is taking ownership of the given range of data of a certain type and keeps it to instantiate resource from it later via createResourceForScene. See ramses::ArrayResource for more details. Readding the same resource data again will return the previous resource id, but not recreate the resource data. Readding a same resource requires removing it again with removeResourceData.
[in] | type | The data type of the array elements. |
[in] | numElements | The number of elements of the given data type to use for the resource. |
[in] | arrayData | Pointer to the data to be used to create the array from. |
[in] | cacheFlag | The optional flag sent to the renderer. The value describes how the cache implementation should handle the resource. |
[in] | name | The optional name of the ArrayResource. |
resourceId_t ramses::ResourceDataPool::addEffectData | ( | const EffectDescription & | effectDesc, |
resourceCacheFlag_t | cacheFlag = ResourceCacheFlag_DoNotCache , |
||
const char * | name = nullptr |
||
) |
Add Effect data to the pool by parsing a GLSL shader described by an EffectDescription instance. The data can be used to instantiate a resource via createResourceForScene. Refer to RamsesClient::getLastEffectErrorMessages in case of parsing error. See ramses::Effect for more details. Readding the same resource data again will return the previous resource id, but not recreate the resource data. Readding a same resource requires removing it again with removeResourceData.
[in] | effectDesc | Effect description. |
[in] | cacheFlag | The optional flag sent to the renderer. The value describes how the cache implementation should handle the resource. |
[in] | name | The name of the created Effect. |
bool ramses::ResourceDataPool::addResourceDataFile | ( | std::string const & | filename | ) |
Adds a file to the resource data pool, so the contained data can be instantiated via createResourceForScene.
[in] | filename | The file name of the resource file to be added to pool. |
resourceId_t ramses::ResourceDataPool::addTexture2DData | ( | ETextureFormat | format, |
uint32_t | width, | ||
uint32_t | height, | ||
uint32_t | mipMapCount, | ||
const MipLevelData | mipLevelData[], | ||
bool | generateMipChain = false , |
||
const TextureSwizzle & | swizzle = {} , |
||
resourceCacheFlag_t | cacheFlag = ResourceCacheFlag_DoNotCache , |
||
const char * | name = nullptr |
||
) |
Add Texture2D data to the pool. It is taking ownership of the given range of texture data in the specified pixel format and keeps it to instantiate resource from it later via createResourceForScene. See ramses::Texture2D for more details.
Readding the same resource data again will return the previous resource id, but not recreate the resource data. Readding a same resource requires removing it again with removeResourceData.
[in] | format | Pixel format of the Texture2D data. |
[in] | width | Width of the texture (mipmap level 0). |
[in] | height | Height of the texture (mipmap level 0). |
[in] | mipMapCount | Number of mipmap levels contained in mipLevelData array. |
[in] | mipLevelData | Array of MipLevelData structs defining mipmap levels to use. Amount and sizes of supplied mipmap levels have to conform to GL specification. Order is lowest level (biggest resolution) to highest level (smallest resolution). |
[in] | swizzle | Describes how RGBA channels of the texture are swizzled, where each member of the struct represents one destination channel that the source channel should get sampled from. |
[in] | generateMipChain | Auto generate mipmap levels. Cannot be used if custom data for lower mipmap levels provided. |
[in] | cacheFlag | The optional flag sent to the renderer. The value describes how the cache implementation should handle the resource. |
[in] | name | The name of the Texture2D. |
resourceId_t ramses::ResourceDataPool::addTexture3DData | ( | ETextureFormat | format, |
uint32_t | width, | ||
uint32_t | height, | ||
uint32_t | depth, | ||
uint32_t | mipMapCount, | ||
const MipLevelData | mipLevelData[], | ||
bool | generateMipChain = false , |
||
resourceCacheFlag_t | cacheFlag = ResourceCacheFlag_DoNotCache , |
||
const char * | name = nullptr |
||
) |
Add Texture3D data to the pool. It is taking ownership of the given range of texture data in the specified pixel format and keeps it to instantiate resource from it later via createResourceForScene. See ramses::Texture3D for more details. Readding the same resource data again will return the previous resource id, but not recreate the resource data. Readding a same resource requires removing it again with removeResourceData.
[in] | format | Pixel format of the Texture3D data. |
[in] | width | Width of the texture (mipmap level 0). |
[in] | height | Height of the texture (mipmap level 0). |
[in] | depth | Depth of the texture. |
[in] | mipMapCount | Number of mipmap levels contained in mipLevelData array. |
[in] | mipLevelData | Array of MipLevelData structs defining mipmap levels to use. Amount and sizes of supplied mipmap levels have to conform to GL specification. Order is lowest level (biggest resolution) to highest level (smallest resolution). |
[in] | generateMipChain | Auto generate mipmap levels. Cannot be used if custom data for lower mipmap levels provided. |
[in] | cacheFlag | The optional flag sent to the renderer. The value describes how the cache implementation should handle the resource. |
[in] | name | The name of the Texture3D. |
resourceId_t ramses::ResourceDataPool::addTextureCubeData | ( | ETextureFormat | format, |
uint32_t | size, | ||
uint32_t | mipMapCount, | ||
const CubeMipLevelData | mipLevelData[], | ||
bool | generateMipChain = false , |
||
const TextureSwizzle & | swizzle = {} , |
||
resourceCacheFlag_t | cacheFlag = ResourceCacheFlag_DoNotCache , |
||
const char * | name = nullptr |
||
) |
Add Cube Texture data to the pool. It is taking ownership of the given range of texture data in the specified pixel format and keeps it to instantiate resource from it later via createResourceForScene. All texel values are initially initialized to 0. See ramses::TextureCube for more details. Readding the same resource data again will return the previous resource id, but not recreate the resource data. Readding a same resource requires removing it again with removeResourceData.
[in] | format | Pixel format of the Cube Texture data. |
[in] | size | edge length of one quadratic cube face, belonging to the texture. |
[in] | mipMapCount | Number of mipmaps contained in mipLevelData array. |
[in] | mipLevelData | Array of MipLevelData structs defining mipmap levels to use. Amount and sizes of supplied mipmap levels have to conform to GL specification. Order ist lowest level (biggest resolution) to highest level (smallest resolution). |
[in] | generateMipChain | Auto generate mipmap levels. Cannot be used if custom data for lower mipmap levels provided. |
[in] | swizzle | Describes how RGBA channels of the texture are swizzled, |
[in] | cacheFlag | The optional flag sent to the renderer. The value describes how the cache implementation should handle the resource. |
[in] | name | The name of the Cube Texture. |
Resource* ramses::ResourceDataPool::createResourceForScene | ( | Scene & | scene, |
resourceId_t const & | id | ||
) |
Creates a resource for a scene out of pool data. The resource can then be used in scene as if created with the scenes create resource functions.
[in] | scene | The scene to instantiate the resource in. |
[in] | id | The resource id of the previously added resource. |
bool ramses::ResourceDataPool::forceLoadResourcesFromResourceDataFile | ( | std::string const & | filename | ) |
Loads all resources in a file currently in use by any scene from that file to memory.
When resources are created via createResourceForScene, not the full resource data is loaded immediately, but lazily at a later time when the data is actually needed. This function will fully load all resources which are currently instantiated in any scene and make sure resources are complete and independent of the resource file.
This operation can be used to trigger the potentially heavy resource loading at a user chosen, most convenient point in time to ensure fast resource handling once the resource is actually used for rendering.
This operation is recommended to be called before removeResourceDataFile to avoid removing a resource file whose resource data hasn't been fully loaded yet for all its resources in any scene.
[in] | filename | The file name of the resource file resource are supposed to force loaded from. |
std::string ramses::ResourceDataPool::getLastEffectErrorMessages | ( | ) | const |
Get the GLSL error messages that were produced at the creation of the last Effect data.
bool ramses::ResourceDataPool::removeResourceData | ( | resourceId_t const & | id | ) |
Removes data which was added to the pool. The provided resource id might not be used anymore to instantiate a resource via createResourceForScene, depending on how many times corresponding addResourceData was called before. Already instantiated resources will not be affected by removeResourceData.
[in] | id | The resource id of the previously added resource data. |
bool ramses::ResourceDataPool::removeResourceDataFile | ( | std::string const & | filename | ) |
Removes a resource file from the pool. The contained data can then not be used anymore to instantiate a resource via createResourceForScene.
Calling this function might make resource data contained in the file unavailable for loading which leads to a scene not being rendered or rendered in a wrong way. It is recommended to call forceLoadResourcesFromResourceDataFile before to make sure all resource data is in memory and don't do any other resource operation before calling removeResourceDataFile.
[in] | filename | The file name of the resource file to be removed from pool. |
|
friend |
RamsesClientImpl is the factory for creating the ResourceDataPool instance.
ResourceDataPoolImpl& ramses::ResourceDataPool::impl |
Stores internal data for implementation specifics of ResourceDataPool.