RAMSES Documentation  27.0.130
Information for RAMSES users and developers
ResourceDataPool.h
Go to the documentation of this file.
1 // -------------------------------------------------------------------------
2 // Copyright (C) 2020 BMW AG
3 // -------------------------------------------------------------------------
4 // This Source Code Form is subject to the terms of the Mozilla Public
5 // License, v. 2.0. If a copy of the MPL was not distributed with this
6 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
7 // -------------------------------------------------------------------------
8 
9 #ifndef RAMSES_RESOURCEDATAPOOL_H
10 #define RAMSES_RESOURCEDATAPOOL_H
11 
16 
18 
19 #include <string>
20 
21 namespace ramses
22 {
23  class EffectDescription;
24  class Resource;
25  class Scene;
26  class ResourceDataPoolImpl;
27 
37  {
38  public:
53  EDataType type,
54  uint32_t numElements,
55  const void* arrayData,
57  const char* name = nullptr);
58 
82  ETextureFormat format,
83  uint32_t width,
84  uint32_t height,
85  uint32_t mipMapCount,
86  const MipLevelData mipLevelData[],
87  bool generateMipChain = false,
88  const TextureSwizzle& swizzle = {},
90  const char* name = nullptr);
91 
113  ETextureFormat format,
114  uint32_t width,
115  uint32_t height,
116  uint32_t depth,
117  uint32_t mipMapCount,
118  const MipLevelData mipLevelData[],
119  bool generateMipChain = false,
121  const char* name = nullptr);
122 
123 
145  ETextureFormat format,
146  uint32_t size,
147  uint32_t mipMapCount,
148  const CubeMipLevelData mipLevelData[],
149  bool generateMipChain = false,
150  const TextureSwizzle& swizzle = {},
152  const char* name = nullptr);
153 
167  const EffectDescription& effectDesc,
169  const char* name = nullptr);
170 
176  std::string getLastEffectErrorMessages() const;
177 
187 
195  bool addResourceDataFile(std::string const& filename);
196 
214  bool forceLoadResourcesFromResourceDataFile(std::string const& filename);
215 
228  bool removeResourceDataFile(std::string const& filename);
229 
239 
243  ResourceDataPoolImpl& impl;
244 
245  private:
246 
250  friend class RamsesClientImpl;
251 
257  explicit ResourceDataPool(ResourceDataPoolImpl& pimpl);
258 
262  ~ResourceDataPool();
263  };
264 }
265 
266 #endif
#define RAMSES_API
Definition: APIExport.h:35
An effect description holds all necessary information for an effect to be created.
Definition: EffectDescription.h:21
The ResourceDataPool holds resource data which can be instantiated for a given scene....
Definition: ResourceDataPool.h:37
bool removeResourceData(resourceId_t const &id)
Removes data which was added to the pool. The provided resource id might not be used anymore to insta...
bool addResourceDataFile(std::string const &filename)
Adds a file to the resource data pool, so the contained data can be instantiated via createResourceFo...
std::string getLastEffectErrorMessages() const
Get the GLSL error messages that were produced at the creation of the last Effect data.
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 spec...
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...
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....
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 s...
bool removeResourceDataFile(std::string const &filename)
Removes a resource file from the pool. The contained data can then not be used anymore to instantiate...
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 spec...
bool forceLoadResourcesFromResourceDataFile(std::string const &filename)
Loads all resources in a file currently in use by any scene from that file to memory.
ResourceDataPoolImpl & impl
Definition: ResourceDataPool.h:243
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 cert...
The Resource is the base class of all resources, such as arrays and textures.
Definition: Resource.h:20
The Scene holds a scene graph. It is the essential class for distributing content to the ramses syste...
Definition: Scene.h:83
Helper class to create strongly typed values out of various types.
Definition: StronglyTypedValue.h:23
The RAMSES namespace contains all client side objects and functions used to implement RAMSES applicat...
Definition: AnimatedProperty.h:15
ETextureFormat
Texture data format.
Definition: TextureEnums.h:40
EDataType
Specifies the data type used for creating data buffers.
Definition: EDataType.h:20
constexpr const resourceCacheFlag_t ResourceCacheFlag_DoNotCache
Requests the render to not cache a resource. This is the default value.
Definition: RamsesFrameworkTypes.h:212
Struct containing information about one mip-map level of a cube texture. All faces of the cube textur...
Definition: MipLevelData.h:60
Struct containing information about one mip-map level of a texture.
Definition: MipLevelData.h:24
Information of how color channels of a texture are reordered or set to fixed value (one,...
Definition: TextureSwizzle.h:23
Resource identifier used to refer to a resource.
Definition: RamsesFrameworkTypes.h:84