IAssetManager
Functions
Detailed Description
-
class IAssetManager : public RED::IREDObject
Resource management interface.
One asset manager instance must be created from the ART::Factory using the CID_ARTAssetManager identifier. The asset manager is a singleton. The asset manager handles all resources needed by the world to run the simulation.
Public Functions
-
SET_CID(CID_class_ARTIAssetManager)
-
virtual RED_RC LoadAtlas(RED::Object *&oAtlas, RED::Vector<RED::Object*> &oCameras, unsigned int &oContext, const RED::String &iName, ART::ProgressCallback iProgress = NULL, void *iParam = NULL) = 0
Loads an atlas.
This method loads the specified atlas file identified by ‘iName’. The loaded atlas must then be set as a planetary atlas using ART::IPlanet::SetAtlas. The atlas is managed by the ART::IAssetManager.
- Parameters
oAtlas – The loaded atlas object. NULL if nothing was loaded.
oCameras – List of cameras associated to the atlas. These implement the ART::ICamera interface.
oContext – Data context of the loaded atlas. Needed for releasing the data.
iName – Atlas complete filename. Must be a .red file exported by the REDart editor.
iProgress – pointer to an optional progress callback.
iParam – optional parameter to the progress callback.
- Returns
RED_OK if the method has succeeded,
RED_FAIL if the .red file is not a valid atlas file,
Other file access, read RED_RC error codes from the REDsdk API.
-
virtual RED_RC DeleteAtlas(unsigned int iContext) = 0
Deletes an atlas loaded with ART::IAssetManager::LoadAtlas.
- Parameters
iContext – Data context provided at the loading time.
- Returns
RED_OK if the method has succeeded,
RED_FAIL if the .red file is not a valid atlas file,
Other file access, read RED_RC error codes from the REDsdk API.
-
virtual RED_RC CreateAtlas(RED::Object *&oAtlas, const RED::Color &iColor) = 0
Creates an empty flat atlas.
This helper method builds an Earth flat atlas with the specified soil color in iColor. All internal atlas parameters are those of the Earth. The created atlas must be then set as a planetary atlas using ART::IPlanet::SetAtlas. It must be released using ART::IAssetManager::DeleteAtlas.
- Parameters
oAtlas – The created atlas object.
iColor – The atlas creation color.
- Returns
RED_OK if the method has succeeded,
RED_ALLOC_FAILURE if a memory allocation error has occurred,
RED_FAIL otherwise.
-
virtual RED_RC DeleteAtlas(RED::Object *iAtlas) = 0
Deletes an atlas created with ART::IAssetManager::CreateAtlas.
- Parameters
iAtlas – The atlas address destroyed by the method.
- Returns
RED_OK if the method has succeeded,
RED_ALLOC_FAILURE if a memory error has occurred.
-
virtual RED_RC LoadEnvironment(RED::Object *&oEnvironment, RED::Matrix &oPosition, RED::Matrix &oPlanetAxisSystemForSun, const RED::String &iName) = 0
Loads an environment.
This method loads an environment map that can be used instead of an atlas. The loaded environment is a classic latitude longitude HDR map image. The method also returns the axis system on the planet that was used to create the map (so in Planet Coordinate System - PCS) as well as the planetary axis system (in World Coordinate System - WCS) that was used to create the map, so that the sun can be properly repositioned using ART::IPlanet::OverrideAxisSystem.
The loaded environment map is managed by the ART::IAssetManager.
- Parameters
oEnvironment – The loaded environment map. NULL if nothing was loaded.
oPosition – Environment axis system used for the generation of the environment in PCS.
oPlanetAxisSystemForSun – The planetary axis system used for the sun position at the generation of the environment in WCS.
iName – Environment complete filename. Must be a .red file exported by the asset editor.
- Returns
RED_OK if the method has succeeded,
Other RED_RC file reading related error codes,
RED_FAIL if the provided iName is not an editor generated environment map file.
-
virtual RED_RC LoadGeometrySourceFile(RED::Object *&oRoot, RED::Vector<unsigned int> &oContext, RED::Map<unsigned int, RED::String> &oId2Names, const RED::String &iFilePath, const RED::Matrix &iConvert, const RED::LayerSet &iMaterialLayerSet, bool iLoadTextures = true, ART::ProgressCallback iProgress = NULL, void *iUserData = NULL) const = 0
Load the original source data of a geometry from a .red file.
Use ART::IAssetManager::ClearGeometrySourceFile to discard all data created by this method.
The loaded scene is attached to a transform shape that holds the iConvert transformation matrix. The iConvert matrix ensures that the returned scene graph is using a right handed axis system and has a vertical direction set to +Z.
All images that are loaded by the call store their data into their local pixel storage. They’re not uploaded on the GPU after the method.
- Parameters
oRoot – Root shape of the loaded source data. Must be released after use.
oContext – List of data manager contexts storing the loaded data. Must be released after use.
oId2Names – List of ID to names conversions extracted from the loaded .red file.
iFilePath – Complete filepath to load.
iConvert – Axis system and scaling conversion matrix to be applied to the geometry.
iMaterialLayerSet – The layerset to use for the loading of the file and access to materials.
iLoadTextures – Set this flag to false to skip the loading of images contained by the source file. This flag is ignored for .RED files loading and applies only to .FBX files.
iProgress – progress callback.
iUserData – progress callback user data.
- Returns
RED_OK if the method has succeeded,
Any RED_RC from the file management API in case of an inacessible, unreadable file,
Other RED_RCs from the underlying REDsdk API.
-
virtual RED_RC LoadGeometrySourceFile(RED::Object *&oRoot, RED::Vector<unsigned int> &oContext, RED::Map<unsigned int, RED::String> &oId2Names, RED::IStream &iStream, const RED::Matrix &iConvert, const RED::LayerSet &iMaterialLayerSet, ART::ProgressCallback iProgress = NULL, void *iUserData = NULL) const = 0
Load the original source data of a geometry from a memory stream.
Use ART::IAssetManager::ClearGeometryOriginalFile to discard all data created by this method.
The loaded scene is attached to a transform shape that holds the iConvert transformation matrix. The iConvert matrix ensures that the returned scene graph is using a right handed axis system and has a vertical direction set to +Z.
All images that are loaded by the call store their data into their local pixel storage. They’re not uploaded on the GPU after the method.
- Parameters
oRoot – Root shape of the loaded source data. Must be released after use.
oContext – List of data manager contexts storing the loaded data. Must be released after use.
oId2Names – List of ID to names conversions extracted from the loaded .red file.
iStream – Memory stream to load.
iConvert – Axis system and scaling conversion matrix to be applied to the geometry.
iMaterialLayerSet – The layerset to use for the loading of the file and access to materials.
iProgress – progress callback.
iUserData – progress callback user data.
- Returns
RED_OK if the method has succeeded,
Any RED_RC from the file management API in case of an inacessible, unreadable file,
Other RED_RCs from the underlying REDsdk API.
-
virtual RED_RC ClearGeometrySourceFile(RED::Object *iRoot, const RED::Vector<unsigned int> &iContext) const = 0
Clears the original source data previously loaded.
Clears all data loaded using RED::IAssetManager::LoadGeometrySourceFile.
- Parameters
iRoot – Root shape to be released by the call.
iContext – List of loaded data contexts in REDsdk, that are released by the call.
- Returns
RED_OK if the method has succeeded,
Other RED_RCs from the REDdsk API.
-
virtual RED_RC ClearGeometrySourceFileImages(const RED::Vector<unsigned int> &iContext) const = 0
Clears all images loaded from an original source data previously loaded.
These images loaded may not be needed after the creation of a geometry and can be released using this method.
- Parameters
iContext – List of loaded data contexts in REDsdk. All images linked to these contexts are destroyed.
- Returns
RED_OK if the method has succeeded,
Other RED_RCs from the REDdsk API.
-
virtual RED_RC ClearGeometrySourceFileMaterials(const RED::Vector<unsigned int> &iContext) const = 0
Clears all materials loaded from an original source data previously loaded.
These materials loaded may not be needed after the creation of a geometry and can be released using this method.
- Parameters
iContext – List of loaded data contexts in REDsdk. All materials linked to these contexts are destroyed.
- Returns
RED_OK if the method has succeeded,
Other RED_RCs from the REDdsk API.
-
virtual RED_RC ConvertGeometrySourceAxis(RED::Object *&oRootZUp, RED::Object *iRoot, const RED::Matrix &iConvert) const = 0
Converts an existing source graph to set its axis system for a correct geometry setup.
Geometries in ART must use a right handed axis system and have a vertical direction set to +Z. This method just adds a transform shape set with the iConvert matrix on top of iRoot. The new root iRootZUp is returned instead and can be used for all geometry API methods.
- Parameters
oRootZUp – Top node created by the method that has iRoot as child and iConvert as transform.
iRoot – Source root to modify.
iConvert – The transformation matrix to set.
- Returns
RED_OK if the method has succeeded,
RED_BAD_PARAM if iRoot is invalid,
Other RED_RCs from the REDsdk API.
-
virtual RED_RC LoadGeometry(RED::Object *&oGeometry, const RED::String &iPath, ART::ProgressCallback iProgress = NULL, void *iUserData = NULL) = 0
Loads a .red file containing a ready-to-use geometry.
This method must be called from the main thread or from the REDsdk rendering thread. The loaded geometry is the property of the caller and must be deleted. The loaded geometry may contain all the features contained by a geometry: meshes, reflection probes, GI caches, lights,…
See \ref wf_importing_geometries.
- Parameters
oGeometry – The created and returned object implementing the ART::IGeometry interface.
iPath – The full path to the .red file.
iProgress – progress callback.
iUserData – progress callback user data.
- Returns
RED_OK if the operation has succeeded,
RED_BAD_PARAM if the method has received an invalid parameter,
RED_ALLOC_FAILURE if a memory allocation has failed,
RED_WORKFLOW_ERROR if the file was not created using
ART::IAssetManager::SaveGeometry,
RED_FAIL if the loaded .red file does not have the correct author or does not contain the correct geometry object,
Other RED_RC error codes from the REDsdk file management API.
-
virtual RED_RC SaveGeometry(const RED::Object *iGeometry, const RED::String &iPath) = 0
Saves a .red file containing a ready-to-use geometry.
This method must be called from the main thread or from the REDsdk rendering thread. The saved geometry contains all the features contained by a geometry: meshes, reflection probes, GI caches, lights,…
See \ref wf_importing_geometries.
- Parameters
iGeometry – The saved geometry implementing the ART::IGeometry interface.
iPath – The full path to the .red file.
- Returns
RED_OK if the operation has succeeded,
RED_BAD_PARAM if the method has received an invalid parameter,
RED_ALLOC_FAILURE if a memory allocation has failed,
Other RED_RC error codes from the REDsdk file management API.
-
virtual RED_RC CreateGeometry(RED::Object *&oGeometry, RED::Object *iSceneRoot, const RED::LayerSet &iMaterialLayerSet, const RED::Vector<RED::String> &iExcludedNames, RED::Map<unsigned int, RED::String> &ioIDToNames, bool iSkinnedMeshes, bool iCreateAtlas = true, ART::ProgressCallback iProgress = NULL, void *iUserData = NULL) = 0
Creates a geometry from a RED::ITransformShape root.
The loaded geometry is the property of the caller and must be deleted using ART::AssetManager::DeleteGeometry. The loaded geometry does not contain any shape whose name is in iExcludedNames. Names of the objects must be provided in the ioIDToNames map.
All the material images from the scene must have their properties set accordingly to the local pixel storage. If the local pixels are not null (RED::IImage2D::GetLocalPixels), then the local properties must be set (RED::IImage::SetLocalWrapModes for instance).
See \ref wf_building_a_geometry_part_1_loading_a_source_scene.
- Parameters
oGeometry – returned object implementing the ART::IGeometry interface.
iSceneRoot – root of the input graph as RED::ITransformShape.
iMaterialLayerSet – material layerset to get material parameters from.
iExcludedNames – Remove all objects whose names match any entry in iExcludedNames from the result.
ioIDToNames – Caller supplied map returned filled with objects ID associated to names.
iSkinnedMeshes – If true, the geometry is created with skinning meshes and ready to be animated. The trigger of this flag consumes some extra memory for the storage of skinned meshes.
iCreateAtlas – If true, the geometry atlas is created and loaded on the GPU. If false, the geometry is created and fully setup but its atlas is not created to avoid consuming memory. The geometry won’t display properly then and should be used in a transient way.
iProgress – progress callback.
iUserData – progress callback user data.
- Returns
RED_OK if the operation has succeeded,
RED_BAD_PARAM if the method has received an invalid parameter,
RED_ALLOC_FAILURE if a memory allocation has failed,
Other RED_RC values from the REDsdk material setup API.
-
virtual RED_RC DeleteGeometry(RED::Object *iGeometry) = 0
Deletes a geometry.
If the geometry belongs to a planet, this method removes it from the planet before the deletion. In this case, the geometry is not destroyed immediately but during the next call to ART::World::Update.
- Parameters
iGeometry – geometry to destroy.
- Returns
RED_OK if the operation has succeeded,
RED_BAD_PARAM if the method has received an invalid parameter,
Other RED_RC values from the REDsdk material setup API.
-
virtual RED_RC BuildGeometryREDGraph(RED::Object *&oRoot, RED::Map<RED::ShapePath, RED::Object*> &oMeshes, RED::Vector<RED::Object*> &oLights, RED::Map<int, RED::Object*> &oMaterials, RED::Vector<RED::Object*> &oImages, RED::Object *iGeometry, const RED::Map<unsigned int, RED::Object*> &iARTMaterialToREDMaterials) const = 0
Creates a native RED graph from a geometry.
The returned graph contains RED meshes (RED::IMeshShape) and lights (RED::ILightShape) created from the geometry and new REDsdk realistic materials corresponding to iGeometry materials. PBR metallic materials are converted into REDsdk realistic materials.
oMeshes maps the geometry parts (accessed via the initial shape path) to the associated new meshes.
oLights maps the geometry lights (given by their index) to the associated new lights.
oMaterials returns the list of materials (in values of the map) that were created for oRoot. oImages returns the list of images created during the process. These images are the results of the conversion of PBR metallic materials.Materials in oMaterials and images in oImages should be destroyed by the caller after use.
- Parameters
oRoot – returned root of the graph implementing the RED::ITransformShape interface.
oMeshes – returned list of meshes in the graph (RED::IMeshShape).
oLights – returned list of lights in the graph (RED::ILightShape).
oMaterials – returned list of materials in the graph (RED::IMaterial).
oImages – returned list of images created during the process.
iGeometry – The geometry to create the graph from.
iARTMaterialToREDMaterials – The conversion map replacing ART::Materials in iGeometry by pre-existing REDsdk materials. ART materials IDs ART::Material::GetID() are used as map key. If all materials in iGeometry are properly remapped, then oMaterials and oImages will be empty.
- Returns
RED_OK if the operation has succeeded,
RED_BAD_PARAM if the method has received an invalid parameter,
RED_ALLOC_FAILURE if a memory allocation has failed,
Other RED_RC values from the REDsdk material setup API.
-
virtual RED_RC GenerateGeometryGICache(RED::Vector<RED::Vector<RED::Object*>> &oGiCaches, RED::Vector<RED::Vector<RED::Object*>> &oGiCachesBakedLights, RED::Vector<RED::Object*> &oAoCaches, RED::Vector<unsigned char> &oGroundAO, double oGroundBC[3], RED::Object *iRoot, const RED::LayerSet &iMaterialLayerSet, const RED::Vector<RED::Vector3> &iFilterPosIndoor, const RED::Vector<RED::Vector3> &iFilterPosOutdoor, const RED::Vector<RED::Object*> &iSkyPortals, const RED::Vector<RED::Object*> &iGISplitters, const RED::Vector<unsigned int> &iBakedLightsFull, const RED::Vector<unsigned int> &iBakedLightsIndirect, const RED::Vector<unsigned int> &iBakedLightsShared, bool iHasGround, const RED::Color &iGroundColor, double iGroundAltitude, int iGICacheSamplesCount, int iLightsSamplingRate, int iGICacheHemiSamplingRate, int iGICacheInterpSamplesCount, int iGIEstimatorSamplingRate, int iGIEstimatorInterpSamplesCount, double iGICacheMergeBorderShrink, bool iDynamicSun, const RED::Vector3 &iSunDirection, ART::ProgressCallback iProgress = NULL, void *iUserData = NULL) const = 0
Generates GI and AO data for a geometry.
The generated data can be set to the geometry with ART::IGeometry::SetGICache and ART::IGeometry::SetGroundAOCache or can be saved with ART::IAssetManager::SaveGeometryGICache.
Images used by materials in the source scene graph are expected to have their contents properly filled on the CPU and/or GPU (e.g. RED::IImage2D::SetPixels has been called).
See \ref wf_building_a_geometry_part_2_setting_up_a_gi_cache.
Please make sure that the world does not get updated while running this method.
- Parameters
oGiCaches – Returned list of GI cache objects for the sun illumination directions.
oGiCachesBakedLights – Returned list of GI cache objects for the baked lights.
oAoCaches – Returned list of GI cache objects containing AO data.
oGroundAO – returned AO data for the ground under the geometry. Size is ART_GEOMETRY_AO_GROUND_FIELD_RESOLUTION * ART_GEOMETRY_AO_GROUND_FIELD_RESOLUTION.
oGroundBC – returned bounding circle data for the ground AO [center.x, center.y, radius].
iRoot – Root shape of the geometry source. May be temporarily modified by the call. Note that this shape can’t be the root shape of a RED::IViewpoint, otherwise the method will return RED_WORKFLOW_ERROR.
iMaterialLayerSet – The layerset to apply to scene materials to properly read the scene.
iFilterPosIndoor – List of indoor filtering positions.
iFilterPosOutdoor – List of outdoor filtering positions.
iSkyPortals – List of sky portals shapes to consider. All shapes in this list must be valid shapes.
iGISplitters – List of scene objects that can be used to block GI samples from viewing some filtering positions. For instance, the glass shape of a window can be declared as a GI splitter to prevent outdoor filtering positions to reach samples that are indoor and vice-versa. All shapes in this list must be valid shapes.
iBakedLightsFull – List of the light names that are fully baked.
iBakedLightsIndirect – List of the light names that are baked on indirect lighting.
iBakedLightsShared – List of the light names that - if baked - will store their baking in the shared light GI cache.
iHasGround – When true, add a ground when generating the indirect lighting on the geometry.
iGroundColor – ground color used when generating the indirect lighting on the geometry.
iGroundAltitude – altitude of the ground used when generating indirect lighting on the geometry in meters. Vertical is +Z.
iGICacheSamplesCount – see RED::OPTIONS_RAY_WORLD_CACHE_SAMPLES_COUNT.
iLightsSamplingRate – see RED::OPTIONS_RAY_LIGHTS_SAMPLING_RATE.
iGICacheHemiSamplingRate – see RED::OPTIONS_RAY_GI_CACHE_HEMI_SAMPLING_RATE.
iGICacheInterpSamplesCount – see RED::OPTIONS_RAY_GI_CACHE_INTERP_SAMPLES_COUNT.
iGIEstimatorSamplingRate – see RED::OPTIONS_RAY_GI_ESTIMATOR_SAMPLING_RATE.
iGIEstimatorInterpSamplesCount – see RED::OPTIONS_RAY_GI_ESTIMATOR_INTERP_SAMPLES_COUNT.
iGICacheMergeBorderShrink – border shrink used when merging indoor and outdoor GI caches. In [ 0.0, 1.0 ]. Samples closer to walls and to occluding objects have their size shrinked using this value.
iDynamicSun – true to generate GI caches for multiple sun positions. False for a single sun position.
iSunDirection – direction of the sun if iDynamicSun is false in the geometry coordinates system.
iProgress – progress callback.
iUserData – progress callback user data.
- Returns
RED_OK if the operation has succeeded,
RED_BAD_PARAM if the method has received an invalid parameter,
RED_ALLOC_FAILURE if a memory allocation has failed,
RED_WORKFLOW_ERROR if ‘iRoot’ is a viewpoint’s root shape,
Other RED_RC values from the REDsdk material setup API.
-
virtual RED_RC StopGenerateGeometryGICache() const = 0
Stops the generation of the GI and AO data for a geometry.
The ART::IAssetManager::GenerateGeometryGICache method may take time. It can be stopped from another thread by calling ART::StopGenerateGeometryGICache().
Calling this method immediately stops the GI cache calculation. ART::IAssetManager::GenerateGeometryGICache returns RED_INTERRUPT.
- Returns
RED_OK if the operation has succeeded,
Other RED_RC values from the REDsdk material setup API.
-
virtual RED_RC SaveGeometryGICache(const RED::Vector<RED::Vector<RED::Object*>> &iGiCaches, const RED::Vector<RED::Vector<RED::Object*>> &iGiCachesBakedLights, const RED::Vector<RED::Object*> &iAoCaches, const RED::Vector<unsigned char> &iGroundAO, double iGroundBC[3], const RED::Vector3 &iSunDirection, const RED::String &iPath) const = 0
Saves the .red file containing global illumination and ambient occlusion data of a geometry.
See \ref wf_building_a_geometry_part_2_setting_up_a_gi_cache.
- Parameters
iGiCaches – List of GI cache objects for the sun illumination directions.
iGiCachesBakedLights – List of GI cache objects for the baked lights.
iAoCaches – List of GI cache objects containing the AO data.
iGroundAO – AO data of the ground under the geometry. Expected size is ART_GEOMETRY_AO_GROUND_FIELD_RESOLUTION * ART_GEOMETRY_AO_GROUND_FIELD_RESOLUTION.
iGroundBC – Bounding circle data of the ground AO [center.x, center.y, radius].
iSunDirection – Sun direction in the case of a static GI cache.
iPath – Path where the .red file is saved.
- Returns
RED_OK if the operation has succeeded,
RED_BAD_PARAM if the method has received an invalid parameter,
RED_ALLOC_FAILURE if a memory allocation has failed,
Other RED_RC values from the REDsdk material setup API.
-
virtual RED_RC LoadGeometryGICache(RED::Vector<RED::Vector<RED::Object*>> &oGiCaches, RED::Vector<RED::Vector<RED::Object*>> &oGiCachesBakedLights, RED::Vector<RED::Object*> &oAoCaches, RED::Vector<unsigned char> &oGroundAO, double oGroundBC[3], RED::Vector3 &oSunDirection, const RED::String &iPath, ART::ProgressCallback iProgress = NULL, void *iUserData = NULL) const = 0
Loads a .red file containing global illumination and ambient occlusion data of a geometry.
The loaded data can be set to the geometry with ART::IGeometry::SetGICache and ART::IGeometry::SetGroundAOCache.
See \ref wf_building_a_geometry_part_2_setting_up_a_gi_cache.
Please make sure that the world does not get updated while running this method.
- Parameters
oGiCaches – Returned list of GI cache objects for the sun illumination directions.
oGiCachesBakedLights – Returned list of GI cache objects for the baked lights.
oAoCaches – Returned list of GI cache objects containing AO data.
oGroundAO – returned ground ambient occlusion. Copy of the loaded array, must be released by the caller. Size is ART_GEOMETRY_AO_GROUND_FIELD_RESOLUTION * ART_GEOMETRY_AO_GROUND_FIELD_RESOLUTION.
oGroundBC – returned bounding circle used to calibrate the ground ambient occlusion.
oSunDirection – returned sun direction used in the case of a static cache.
iPath – full path to the .red file.
iProgress – progress callback.
iUserData – progress callback user data.
- Returns
RED_OK if the operation has succeeded,
RED_BAD_PARAM if the method has received an invalid parameter,
RED_ALLOC_FAILURE if a memory allocation has failed,
-
virtual RED_RC ClearGeometryGICache(RED::Vector<RED::Vector<RED::Object*>> &iGiCaches, RED::Vector<RED::Vector<RED::Object*>> &iGiCachesBakedLights, RED::Vector<RED::Object*> &iAoCaches) const = 0
Clears loaded geometry GI caches.
This method can be used as an helper to release all GI caches retrieved using RED::IAssetManager::LoadGeometryGICache. RED::Vector objects get cleared by the method too.
- Parameters
iGiCaches – List of GI cache objects for the sun illumination directions.
iGiCachesBakedLights – List of GI cache objects for the baked lights.
iAoCaches – List of GI cache objects containing AO data.
- Returns
RED_OK if the operation has succeeded,
Other RED_RCs from the REDsdk API can be returned.
-
virtual RED_RC GenerateReflectionProbeMaps(RED::Object *&oEnvironmentMapAtlas, RED::Object *&oEnvironmentMapAtlasIndex, const RED::Object *iReflectionProbe, int iCubeSize, bool iDynamicSun, const RED::Vector3 &iSunDirection, ART::ProgressCallback iProgress = NULL, void *iUserData = NULL) const = 0
Generates reflection probe environment maps from a probe parameters.
The generated data can be set to a reflection probe with ART::IReflectionProbe::SetEnvironmentMap or saved with ART::IAssetManager::SaveReflectionProbesMaps.
See \ref wf_building_a_geometry_part_4_adding_reflection_probes.
Please make sure that the world does not get updated while running this method.
- Parameters
oEnvironmentMapAtlas – returned environment map atlas for multiple sun directions as RED::IImage2D.
oEnvironmentMapAtlasIndex – returned RED::IImage2D containing index data for the atlas.
iReflectionProbe – reflection for which the maps are generated.
iCubeSize – size of the cube map in pixels.
iDynamicSun – true to generate environment maps for multiple sun positions. False for a single sun position.
iSunDirection – direction of the sun if iDynamicSun is false.
iProgress – progress callback.
iUserData – progress callback user data.
- Returns
RED_OK if the operation has succeeded,
RED_BAD_PARAM if the method has received an invalid parameter,
RED_ALLOC_FAILURE if a memory allocation has failed,
Other RED_RC values from the REDsdk material setup API.
-
virtual RED_RC SaveReflectionProbesMaps(const RED::Vector<RED::Object*> &iEnvironmentMapAtlas, const RED::Vector<RED::Object*> &iEnvironmentMapAtlasIndex, const RED::String &iPath) const = 0
Saves a .red file containing multiple reflection probe environment maps.
See \ref wf_building_a_geometry_part_4_adding_reflection_probes.
- Parameters
iEnvironmentMapAtlas – list of environment map atlases to save as RED::IImage2D.
iEnvironmentMapAtlasIndex – list of atlas index map to save as RED::IImage2D.
iPath – path of the .red file to create.
- Returns
RED_OK if the operation has succeeded,
RED_BAD_PARAM if the method has received an invalid parameter,
RED_ALLOC_FAILURE if a memory allocation has failed,
Other RED_RC values from the REDsdk material setup API.
-
virtual RED_RC LoadReflectionProbesMaps(RED::Vector<RED::Object*> &oEnvironmentMapAtlas, RED::Vector<RED::Object*> &oEnvironmentMapAtlasIndex, unsigned int &oDataContext, const RED::String &iPath) const = 0
Loads a .red file containing multiple reflection probe environment maps.
The loaded data can be set to a reflection probe with ART::IReflectionProbe::SetEnvironmentMap.
It is the user responsability to release the data context with RED::IDataManager::ReleaseContext once the environment maps are not used anymore.
See \ref wf_building_a_geometry_part_4_adding_reflection_probes.
- Parameters
oEnvironmentMapAtlas – returned list of environment map atlases for multiple sun directions as RED::IImage2D.
oEnvironmentMapAtlasIndex – returned list of RED::IImage2D containing index data for the atlases.
oDataContext – returned data context id.
iPath – path of the .red file to load.
- Returns
RED_OK if the operation has succeeded,
RED_BAD_PARAM if the method has received an invalid parameter,
RED_ALLOC_FAILURE if a memory allocation has failed,
Other RED_RC values from the REDsdk material setup API.
-
virtual RED_RC DeleteReflectionProbesMaps(RED::Object *iEnvironmentMapAtlas, RED::Object *iEnvironmentMapAtlasIndex) const = 0
Deletes a reflection probe environment map atlas and its index from the resource manager.
This method must be called to delete the environment maps created using the resource manager. Using ART::AssetManager::GenerateReflectionProbeMaps for instance. Images loaded with the data manager must be deleted through the data manager context.
- Parameters
iEnvironmentMapAtlas – environment map atlas to delete.
iEnvironmentMapAtlasIndex – environment map atlas index to delete.
- Returns
RED_OK if the operation has succeeded,
RED_BAD_PARAM if the method has received an invalid parameter,
Other RED_RC values from the REDsdk material setup API.
-
virtual RED_RC DeleteReflectionProbesMaps(unsigned int iDataContext) const = 0
Deletes a reflection probe environment map atlas and its index from the data manager.
This method must be called to delete the environment maps created using the data manager. Using ART::AssetManager::LoadReflectionProbesMaps for instance.
- Parameters
iDataContext – data context containing the reflection probes to delete.
- Returns
RED_OK if the operation has succeeded,
RED_BAD_PARAM if the method has received an invalid parameter,
Other RED_RC values from the REDsdk material setup API.
-
virtual RED_RC GenerateGeometryVertexGI(RED::Vector<unsigned char> &oVertexAO, RED::Vector<unsigned char> &oVertexGI, RED::Vector<unsigned char> &oGroundAO, double oGroundBC[3], const RED::Object *iGeometry, bool iComputeGroundAO, double iGroundAltitude, const RED::Color &iGroundColor, int iQuality, ART::ProgressCallback iProgress = NULL, void *iUserData = NULL) const = 0
Generates vertex ambient occlusion for a geometry. Also generates ground AO if iHasGround is true.
oVertexAO size = geometry opaque vertex count + geometry transparent vertex count + geometry masked vertex count
geometry PBR opaque vertex count.
The generated data can be set to the geometry with ART::IGeometry::SetVertexAO and ART::IGeometry::SetGroundAO.
Please make sure that the world does not get updated while running this method.
The ground is always there for GI calculations, at iGroundAltitude and iGround Color. Set a negative value far away to discard the ground influence on GI if this is wished. If iComputeGroundAO is enabled, the field of oGroundAO is calculated, otherwise it’s let empty.
- Parameters
oVertexAO – Returned list of ambient occlusion values for each vertex of the geometry.
oVertexGI – Returned list of GI color values for each vertex of the geometry.
oGroundAO – Returned ground ambient occlusion. Copy of the loaded array, must be released by the caller. Size is ART_GEOMETRY_AO_GROUND_FIELD_RESOLUTION * ART_GEOMETRY_AO_GROUND_FIELD_RESOLUTION.
oGroundBC – returned bounding circle used to calibrate the ground ambient occlusion.
iGeometry – ART::Geometry to build the AO for.
iComputeGroundAO – When true, calculate the ground field ao in oGroundAO.
iGroundAltitude – Altitude of the ground. Vertical is +Z. Set the value to -DBL_MAX to remove any ground effect.
iGroundColor – Color of the ground to use for the GI calculations.
iQuality – The quality of the calculations in [ 0, 4 ]. 0 means 64 rays fired per vertex, so this can lead to some noise in the result. +1 multiplies the number of rays by 2, so that iQuality = 4 means 1024 samples fired. A good quality / performance tradeoff is a quality of 2 with 256 rays fired per vertex.
iProgress – progress callback.
iUserData – progress callback user data.
- Returns
RED_OK if the operation has succeeded,
RED_BAD_PARAM if the method has received an invalid parameter,
RED_ALLOC_FAILURE if a memory allocation has failed,
Other RED_RC values from the REDsdk material setup API.
-
virtual RED_RC StopGenerateGeometryVertexGI() const = 0
Stops the generation of the vertex AO data for a geometry.
The ART::IAssetManager::GenerateGeometryVertexGI method may take time. It can be stopped from another thread by calling ART::StopGenerateGeometryVertexGI().
Calling this method immediately stops the vertex AO calculation. ART::IAssetManager::GenerateGeometryVertexGI returns RED_INTERRUPT.
- Returns
RED_OK if the operation has succeeded,
Other RED_RC values from the REDsdk material setup API.
-
virtual RED_RC CreateGeometryInstance(RED::Object *&oInstance, RED::Object *iGeometry) const = 0
Creates an instance of the provided geometry.
Both the provided iGeometry and the returned oInstance geometry copy will share the same data.
- Parameters
oInstance – returned ART::IGeometry instance.
iGeometry – geometry to duplicate.
- Returns
RED_OK if the operation has succeeded,
RED_BAD_PARAM if the method has received an invalid parameter,
RED_ALLOC_FAILURE if a memory allocation has failed,
-
virtual RED_RC LoadIESFile(RED::Vector<double> &oAttributes, const RED::String &iFile) const = 0
Loads the IES file and gets its attributes.
- Parameters
oAttributes – returned index of the first direction.
iFile – file path of the file to load.
- Returns
RED_OK if the operation has succeeded,
RED_BAD_PARAM if the method has received an invalid parameter,
RED_ALLOC_FAILURE if a memory allocation has failed,
Other RED_RC values from the REDsdk material setup API.
-
virtual RED_RC GetMaterialLayerSets(RED::Vector<RED::LayerSet> &oLayerSets, const RED::Vector<unsigned int> &iContext) const = 0
Gets all the RED::LayerSet used by the materials in the RED::IDataManager context iContext.
- Parameters
oLayerSets – returned list of material RED::LayerSet.
iContext – Data manager context where to search the layer sets.
- Returns
RED_OK if the operation has succeeded,
RED_BAD_PARAM if the method has received an invalid parameter,
RED_ALLOC_FAILURE if a memory allocation has failed,
Other RED_RC values from the REDsdk material setup API.
-
virtual RED_RC GenerateGIFilteringPositions(RED::Vector<RED::Vector3> &ioFilterPos, const RED::Vector3 &iReference, bool iIndoor, const RED::Object *iSceneRoot, double iSpacing, double iGroundAltitude, ART::ProgressCallback iProgress = NULL, void *iUserData = NULL) = 0
Generates GI filtering positions for the specified source scene.
This method generates a list of filtering positions that can be used afterwards for the generation of a GI cache. These filtering positions are either computed for indoor rendering or for outdoor rendering.
The method will start from the specified iReference position and explore the iSceneRoot to generate relevant positions that can be viewed and reached out from iReference. For instance, if iReference is inside a closed box, all filtering positions will be generated inside that box, since it won’t be possible to reach any point outside of this box starting from iReference. Transparent surfaces can be crossed.
All calculations are performed in the coordinate system of geometries contained by iSceneRoot.
A model whose space is not properly split in indoor and outdoor regions should only generate one set of indoor filtering positions for the entire model. The partition between indoor and outdoor areas of the model can be achieved using any geometry, including portals, window glasses or any other element. Its important that these geometries do split the model in two parts, otherwise filtering positions can leak in another area and the resulting GI caches of these areas will incorrectly overlap when merged.
Filtering positions can be preserved and don’t need to be recalculated unless the model geometry has changed.
Filtering positions are spread evenly on a grid using the iSpacing distance between them. The number of filtering positions that can be spread out is limited internally to avoid overflowing the GI cache generation afterwards.
Please make sure that the world does not get updated while running this method.
- Parameters
ioFilterPos – The generated list of filtering positions which is appened at the end of ioFilterPos.
iReference – The reference position that must be in the considered domain.
iIndoor – If true, we compute indoor positions, if false, we compute outdoor positions.
iSceneRoot – The root of the scene to process.
iSpacing – Spacing between filtering positions in scene units.
iGroundAltitude – Altitude of the ground surrounding the geometry in meters. No filtering positions will be generated below the ground. Vertical axis is +Z.
iProgress – progress callback.
iUserData – progress callback user data.
- Returns
RED_OK if the method has succeeded,
RED_BAD_PARAM if the method has received an invalid parameter,
RED_ALLOC_FAILURE if a memory allocation has failed,
Other RED_RC values from the REDsdk API are possible.
-
virtual RED_RC GenerateLightStaticShadowMaps(RED::Vector<RED::Object*> &oShadowMaps, RED::Object *iLight, ART::ProgressCallback iProgress = NULL, void *iUserData = NULL) const = 0
Generates light shadow maps for a static use.
The generated data can be set to a light with ART::ILight::SetStaticShadowMap or saved with ART::IAssetManager::SaveLightStaticShadowMaps.
Please make sure that the world does not get updated while running this method.
- Parameters
oShadowMaps – returned list of shadow maps for each of the light instance.
iLight – light for which the maps are generated.
iProgress – progress callback.
iUserData – progress callback user data.
- Returns
RED_OK if the operation has succeeded,
RED_BAD_PARAM if the method has received an invalid parameter,
RED_ALLOC_FAILURE if a memory allocation has failed,
Other RED_RC values from the REDsdk material setup API.
-
virtual RED_RC SaveLightStaticShadowMaps(const RED::Vector<RED::Object*> iShadowMaps, const RED::Vector<int> &iLightIds, const RED::Vector<int> &iInstances, const RED::String &iPath) const = 0
Saves a .red file containing multiple light static shadow maps.
- Parameters
iShadowMaps – list of light static shadow map to save as RED::IImage2D.
iLightIds – list of light IDs.
iInstances – list of light instance number.
iPath – path of the .red file to create.
- Returns
RED_OK if the operation has succeeded,
RED_BAD_PARAM if the method has received an invalid parameter,
RED_ALLOC_FAILURE if a memory allocation has failed,
Other RED_RC values from the REDsdk material setup API.
-
virtual RED_RC LoadLightStaticShadowMaps(RED::Vector<RED::Object*> &oShadowMaps, RED::Vector<int> &oLightIds, RED::Vector<int> &oInstances, unsigned int &oDataContext, const RED::String &iPath) const = 0
Loads a .red file containing multiple light static shadow maps.
The loaded data can be set to a light with ART::ILight::SetStaticShadowMap.
- Parameters
oShadowMaps – returned list of shadow maps as RED::IImage2D.
oLightIds – returned list of light IDs.
oInstances – returned list of light instance number.
oDataContext – returned data context id.
iPath – path of the .red file to load.
- Returns
RED_OK if the operation has succeeded,
RED_BAD_PARAM if the method has received an invalid parameter,
RED_ALLOC_FAILURE if a memory allocation has failed,
Other RED_RC values from the REDsdk material setup API.
-
virtual RED_RC DeleteLightStaticShadowMaps(const RED::Vector<RED::Object*> &iShadowMaps) const = 0
Deletes one or more light static shadow maps from the resource manager.
This method must be called to delete the static shadow maps created using the resource manager. Using ART::AssetManager::GenerateLightStaticShadowMaps for instance. Images loaded with the data manager must be deleted through the data manager context.
- Parameters
iShadowMaps – list of shadow maps as RED::IImage2D.
- Returns
RED_OK if the operation has succeeded,
RED_BAD_PARAM if the method has received an invalid parameter,
Other RED_RC values from the REDsdk material setup API.
-
virtual RED_RC DeleteLightStaticShadowMaps(unsigned int iDataContext) const = 0
Deletes one or more light static shadow maps from the data manager.
This method must be called to delete the static shadow maps created using the data manager. Using ART::AssetManager::LoadLightStaticShadowMaps for instance.
- Parameters
iDataContext – data context containing the shadow maps to delete.
- Returns
RED_OK if the operation has succeeded,
RED_BAD_PARAM if the method has received an invalid parameter,
Other RED_RC values from the REDsdk material setup API.
-
virtual RED_RC UpdateGeometryPartTransform(RED::Object *ioGeometry, RED::Object *iSceneRoot, RED::Object *iUpdatedShape) const = 0
Updates a geometry part transform.
Modifies the ART::IGeometry to take into account a transform update in the source scene graph.
- Parameters
ioGeometry – ART::IGeometry to update.
iSceneRoot – source root of the scene containing the shape to update.
iUpdatedShape – RED::ITransformShape whose matrix has been updated.
- Returns
RED_OK if the operation has succeeded,
RED_BAD_PARAM if the method has received an invalid parameter,
RED_ALLOC_FAILURE if a memory allocation has failed,
Other RED_RC values from the REDsdk material setup API.
-
virtual RED_RC UpdateGeometryPartMaterial(bool &oNeedPlanetRefresh, RED::Object *ioGeometry, RED::Object *iSceneRoot, RED::Object *iUpdatedShape, const RED::LayerSet &iMaterialLayerSet, RED::Map<unsigned int, RED::String> &ioIDToNames) const = 0
Updates a geometry part material.
Modifies the ART::IGeometry to take into account a material update / change in the source scene graph.
If returned oNeedPlanetRefresh is true, a call to ART::IPlanet::RefreshGeometry must be done after this call.
- Parameters
oNeedPlanetRefresh – returned boolean indicating if the planet needs to refresh the geometry after the call.
ioGeometry – ART::IGeometry to update.
iSceneRoot – source root of the scene containing the shape to update.
iUpdatedShape – RED::IShape whose material has been changed.
iMaterialLayerSet – The layerset to use for the access to graph materials.
ioIDToNames – Caller supplied map containing the objects ID associated to names.
- Returns
RED_OK if the operation has succeeded,
RED_BAD_PARAM if the method has received an invalid parameter,
RED_ALLOC_FAILURE if a memory allocation has failed,
Other RED_RC values from the REDsdk material setup API.
-
virtual RED_RC SetGeometryPartVisible(RED::Object *ioGeometry, RED::Object *iSceneRoot, RED::Object *iUpdatedShape, bool iVisible, bool iShadowVisible) const = 0
Sets a geometry part visible or not.
Every shape in the graph under the updated node will be affected by the visibility set.
- Parameters
ioGeometry – ART::IGeometry to update.
iSceneRoot – source root of the scene containing the shape to update.
iUpdatedShape – RED::ITransformShape whose matrix has been updated.
iVisible – true to set the geometry part visible, false otherwise.
iShadowVisible – true to set the geometry part shadow visible, false otherwise.
- Returns
RED_OK if the operation has succeeded,
RED_BAD_PARAM if the method has received an invalid parameter,
RED_ALLOC_FAILURE if a memory allocation has failed,
Other RED_RC values from the REDsdk material setup API.
-
virtual RED_RC AddGeometryPart(bool &oNeedPlanetRefresh, RED::Object *ioGeometry, RED::Object *iSceneRoot, RED::Object *iAddedShape, const RED::LayerSet &iMaterialLayerSet, RED::Map<unsigned int, RED::String> &ioIDToNames) const = 0
Adds a new geometry part to an existing geometry.
Modifies the ART::IGeometry to take into account an additional shape in the source scene graph.
If returned oNeedPlanetRefresh is true, a call to ART::IPlanet::RefreshGeometry must be done after this call.
- Parameters
oNeedPlanetRefresh – returned boolean indicating if the planet needs to refresh the geometry after the call.
ioGeometry – ART::IGeometry to update.
iSceneRoot – source root of the scene containing the shape to update.
iAddedShape – RED::IShape added to the graph.
iMaterialLayerSet – The layerset to use for the access to graph materials.
ioIDToNames – Caller supplied map containing the objects ID associated to names.
- Returns
RED_OK if the operation has succeeded,
RED_BAD_PARAM if the method has received an invalid parameter,
RED_ALLOC_FAILURE if a memory allocation has failed,
Other RED_RC values from the REDsdk material setup API.
-
virtual RED_RC AddGeometryParts(bool &oNeedPlanetRefresh, RED::Object *ioGeometry, RED::Object *iSceneRoot, const RED::Vector<RED::Object*> &iAddedShapes, const RED::LayerSet &iMaterialLayerSet, RED::Map<unsigned int, RED::String> &ioIDToNames) const = 0
Adds new geometry parts to an existing geometry.
Modifies the ART::IGeometry to take into account additional shapes in the source scene graph.
If returned oNeedPlanetRefresh is true, a call to ART::IPlanet::RefreshGeometry must be done after this call.
- Parameters
oNeedPlanetRefresh – returned boolean indicating if the planet needs to refresh the geometry after the call.
ioGeometry – ART::IGeometry to update.
iSceneRoot – source root of the scene containing the shape to update.
iAddedShapes – List of RED::IShape added to the graph.
iMaterialLayerSet – The layerset to use for the access to graph materials.
ioIDToNames – Caller supplied map containing the objects ID associated to names.
- Returns
RED_OK if the operation has succeeded,
RED_BAD_PARAM if the method has received an invalid parameter,
RED_ALLOC_FAILURE if a memory allocation has failed,
Other RED_RC values from the REDsdk material setup API.
-
virtual RED_RC RemoveGeometryPart(bool &oNeedPlanetRefresh, RED::Object *ioGeometry, RED::Object *iSceneRoot, RED::Object *iRemovedShape) const = 0
Removes geometry parts.
Helper calling ART::IAssetManager::RemoveGeometryParts with one single shape.
- Parameters
oNeedPlanetRefresh – returned boolean indicating if the planet needs to refresh the geometry after the call.
ioGeometry – ART::IGeometry to update.
iSceneRoot – source root of the scene containing the shape to update.
iRemovedShape – RED::IShape to remove from the graph.
- Returns
RED_OK if the operation has succeeded,
RED_BAD_PARAM if the method has received an invalid parameter,
RED_ALLOC_FAILURE if a memory allocation has failed,
Other RED_RC values from the REDsdk material setup API.
-
virtual RED_RC RemoveGeometryParts(bool &oNeedPlanetRefresh, RED::Object *ioGeometry, RED::Object *iSceneRoot, const RED::Vector<RED::Object*> &iRemovedShapes) const = 0
Removes geometry parts.
Modifies the ART::IGeometry to take into account the removal of a list of shapes from the source scene graph. This method must be called before actually removing the shape from the source graph.
If returned oNeedPlanetRefresh is true, a call to ART::IPlanet::RefreshGeometry must be done after this call.
This method can take a bit of time when called repeatedly as it maintains the coherence inside the geometry and collapses holes made by iRemovedShapes sub graphs. If many parts have to be removed through different calls to this method, it may be worth considering rebuilding the entire geometry instead.
- Parameters
oNeedPlanetRefresh – returned boolean indicating if the planet needs to refresh the geometry after the call.
ioGeometry – ART::IGeometry to update.
iSceneRoot – source root of the scene containing the shape to update.
iRemovedShape – List of RED::IShape to remove from the graph.
- Returns
RED_OK if the operation has succeeded,
RED_BAD_PARAM if the method has received an invalid parameter,
RED_ALLOC_FAILURE if a memory allocation has failed,
Other RED_RC values from the REDsdk material setup API.
-
virtual RED_RC ClearGeometryParts(bool &oNeedPlanetRefresh, RED::Object *ioGeometry) const = 0
Removes all geometry parts.
Modifes ioGeometry and removes all parts from it in one operation. The atlas is cleaned.
If returned oNeedPlanetRefresh is true, a call to ART::IPlanet::RefreshGeometry must be done after this call.
- Parameters
oNeedPlanetRefresh – returned boolean indicating if the planet needs to refresh the geometry after the call.
ioGeometry – ART::IGeometry to update.
- Returns
RED_OK if the operation has succeeded,
RED_BAD_PARAM if the method has received an invalid geometry,
Other RED_RC values can be returned by the REDsdk API.
-
virtual RED_RC ComputeShapePaths(RED::Vector<RED::ShapePath> &oShapePaths, RED::Object *iSceneRoot, RED::Object *iShape, bool iUpward = true, bool iDownward = true, bool iIncludeShape = true) const = 0
Computes all the shape paths containing the shape in a scene graph.
- Parameters
oShapePaths – returned list of shape paths.
iSceneRoot – source root of the scene containing the shape.
iShape – RED::ITransformShape whose matrix has been updated.
iUpward – true include all the parent shapes of iShape in the paths list.
iDownward – true to include all the children shapes of iShape in the paths list.
iIncludeShape – true to include iShape in the paths list.
- Returns
RED_OK if the operation has succeeded,
RED_BAD_PARAM if the method has received an invalid parameter,
RED_ALLOC_FAILURE if a memory allocation has failed,
Other RED_RC values from the REDsdk material setup API.
-
virtual RED_RC CreateEntity(RED::Object *&oEntity) = 0
Creates a ART::IEntity object to be added to the simulation.
- Parameters
oEntity – return entity as ART::Entity.
- Returns
RED_OK if the method has succeeded,
RED_ALLOC_FAILURE if a memory allocation has failed,
Other RED_RCs from the REDsdk material API.
-
virtual RED_RC DeleteEntity(RED::Object *iEntity) = 0
Deletes a ART::Entity object.
The entity can be in the simulation or not.
Due to the multithreading, the deletion of the entity is deferred to the next world update.
- Parameters
iEntity – the entity to delete.
- Returns
RED_OK if the method has succeeded,
Other RED_RCs from the REDsdk material API.
-
virtual RED_RC LoadAnimation(RED::Vector<RED::Object*> &oAnimations, const RED::String &iPath, RED::Map<unsigned int, RED::String> *oIdToNames = NULL) = 0
Loads an animation file.
The file can be .fbx or .red file.
- Parameters
oAnimations – returned list of RED::IAnimationController objects from the file.
iPath – file path.
oIdToNames – map binding the animation ids to the animation names.
- Returns
RED_OK if the method has succeeded,
Other RED_RCs from the REDsdk material API.
-
SET_CID(CID_class_ARTIAssetManager)