IGeometry
Functions
const Matrix & |
|
double |
|
int |
|
void |
|
double |
|
void |
|
double |
|
int |
|
Object * |
|
int |
|
Object * |
|
Object * |
|
void |
|
bool |
|
bool |
|
void |
|
int |
|
void |
|
double |
|
void |
|
int |
|
void |
|
void |
|
int |
|
Object * |
|
void |
|
bool |
|
bool |
|
const Map < int, bool > & |
|
bool |
Detailed Description
-
class IGeometry : public RED::IREDObject
Geometry interface for mesh manipulation.
Public Functions
-
SET_CID(CID_class_ARTIGeometry)
-
virtual RED_RC GetVerticesCount(int &oCount, ART::GEOMETRY_SHAPE iShape) const = 0
Gets the number of vertices of the meshes under the geometry.
- Parameters
oCount – returned number of vertices.
iShape – the mesh shape to get the vertices count.
- Returns
RED_OK if the method has succeeded,
RED_FAIL otherwise.
-
virtual RED_RC SetRootMatrix(const RED::Matrix &iMatrix) = 0
Sets the root shape matrix of the geometry.
- Parameters
iMatrix – the new root shape matrix.
- Returns
RED_OK if the method has succeeded,
RED_FAIL otherwise.
-
virtual RED_RC SetGICaches(const RED::Vector<RED::Vector<RED::Object*>> &iGICaches, const RED::Vector<RED::Vector<RED::Object*>> &iGICachesBakedLights, const RED::Vector<RED::Object*> &iAOCaches, float iLandscapeAO) = 0
Sets the GI cache data.
If the geometry is a reference geometry, GI caches received are stored by it and will be deleted by it. These caches must have been generated or loaded by the ART::IAssetManager. A set of caches retrieved from the resource manager can be set once into a geometry reference, otherwise redundant destructions will occur. If the geometry is an instance geometry, GI caches are only pointed to.
- Parameters
iGICaches – List of GI caches for each sun position of the geodesic sphere.
iGICachesBakedLights – List of GI caches for each baked light.
iAOCaches – List of ambient occlusion caches.
iLandscapeAO; – The value of the AO field surrounding the geometry.
- Returns
RED_OK if the method has succeeded,
RED_FAIL otherwise.
-
virtual RED_RC SetGICachesMultiplier(double iMult) = 0
Apply an intensity multiplier to the geometry GI caches.
The value of iMultiplier is applied to the GI cache of the geometry in order to strengthen or to weaken the GI of that geometry in the context of a given scene, relatively to other elements displayed.
- Parameters
iMult – Intensity multiplier applied to GI caches. Must be positive or zero.
- Returns
RED_OK if the method has succeeded,
RED_BAD_PARAM if iGICacheMult was negative.
-
virtual double GetGICachesMultiplier() const = 0
- Returns
The GI caches intensity multiplier value.
-
virtual int GetGISamplesCount() const = 0
Gets the number of samples stored in the GI cache of the geometry (does not consider light caches).
- Returns
the number of GI cache samples.
-
virtual RED_RC SetGroundAOCache(const RED::Vector<unsigned char> &iGroundAO, int iGroundAORes, const double iGroundBC[3]) = 0
Sets the geometry ambient occlusion cache for the ground.
- Parameters
iGroundAO – ground AO cache.
iGroundAORes – Size in pixels of the ground AO cache which is (res x res).
iGroundBC – bounding circle of the ground AO (x, y, radius).
- Returns
RED_OK if the method has succeeded,
RED_BAD_PARAM if the method has received an invalid parameter,
RED_FAIL otherwise.
-
virtual RED_RC SetVertexGI(const RED::Vector<unsigned char> &iGIValues, int iGISizeOpaque, int iGISizeTranspar, int iGISizeMasked, int iGISizePBROpaque, double iGIMult) = 0
Sets the vertex GI color.
This function must be called in place of ART::IGeometry::SetGICache to get a cheaper global illumination.
The array of values must contains all the GI values for opaque mesh vertices followed by all the AO values for transparent mesh vertices and then masked and PBR. Its size is iAOSizeOpaque + iAOSizeTranspar + iAOSizeMasked + iAOSizePBROpaque.
Values are supplied using colors: (R,G,B) unsigned chars for each vertex. So the side of iGIValues is x 3 the number of vertices.
If no values are supplied (empty array and zero sizes), a dark grey tint is setup ( 64, 64, 64 ).
The number of vertices in a geometry can be queried using ART::IGeometry::GetVerticesCount. The ART::IAssetManager::GenerateGeometryVertexGI calculates AO and GI values for a given geometry.
- Parameters
iGIValues – GIvalues for each vertices of the geometry.
iGISizeOpaque – Number of values for the opaque mesh.
iGISizeTranspar – Number of values for the transparent mesh.
iGISizeMasked – Number of values for the masked mesh.
iGISizePBROpaque – Number of values for the PBR opaque mesh.
iGIMult – Multiplier of the GI intensity. GI values are clamped to white.
- Returns
RED_OK if the method has succeeded,
RED_FAIL otherwise.
-
virtual RED_RC GetVertexGI(RED::Vector<unsigned char> &oGIValues, int &oGISizeOpaque, int &oGISizeTranspar, int &oGISizeMasked, int &oGISizePBROpaque) = 0
Access vertex GI values.
- Parameters
oGIValues – GIvalues for each vertices of the geometry.
oGISizeOpaque – Number of values for the opaque mesh.
oGISizeTranspar – Number of values for the transparent mesh.
oGISizeMasked – Number of values for the masked mesh.
oGISizePBROpaque – Number of values for the PBR opaque mesh.
-
virtual RED_RC SetVertexAO(const RED::Vector<unsigned char> &iAOValues, int iAOSizeOpaque, int iAOSizeTranspar, int iAOSizeMasked, int iAOSizePBROpaque, double iAOProfile) = 0
Sets the vertex AO values.
This function must be called in place of ART::IGeometry::SetGICache to get a cheaper ambient occlusion.
The array of values must contains all the AO values for opaque mesh vertices followed by all the AO values for transparent mesh vertices and then masked and PBR. Its size is iAOSizeOpaque + iAOSizeTranspar + iAOSizeMasked + iAOSizePBROpaque.
Values are supplied as unsigned char, 255 being no occlusion, 0 being fully occluded. If no values are supplied (empty array and zero sizes) a white (255) AO is being setup.
The number of vertices in a geometry can be queried using ART::IGeometry::GetVerticesCount. The ART::IAssetManager::GenerateGeometryVertexGI calculates AO and GI values for a given geometry.
- Parameters
iAOValues – Ambient occlusion values for each vertex of the geometry.
iAOSizeOpaque – Number of values for the opaque mesh.
iAOSizeTranspar – Number of values for the transparent mesh.
iAOSizeMasked – Number of values for the masked mesh.
iAOSizePBROpaque – Number of values for the PBR opaque mesh.
iAOProfile – Profiling of the AO ao = pow( ao, iAOProfile ).
- Returns
RED_OK if the method has succeeded,
RED_FAIL otherwise.
-
virtual RED_RC GetVertexAO(RED::Vector<unsigned char> &oAOValues, int &oAOSizeOpaque, int &oAOSizeTranspar, int &oAOSizeMasked, int &oAOSizePBROpaque) = 0
Access the vertex AO values.
- Parameters
oAOValues – Ambient occlusion values for each vertex of the geometry.
oAOSizeOpaque – Number of values for the opaque mesh.
oAOSizeTranspar – Number of values for the transparent mesh.
oAOSizeMasked – Number of values for the masked mesh.
oAOSizePBROpaque – Number of values for the PBR opaque mesh.
-
virtual void SetTextureLodBias(double iTextureLodBias) = 0
Sets the texture lod bias value.
- Parameters
iTextureLodBias – texture lod bias value.
-
virtual double GetTextureLodBias() const = 0
Gets the texture lod bias value.
- Returns
the texture lod bias value.
-
virtual void SetTextureDefinition(double iTextureDefinition) = 0
Sets the texture texel definition in pixel per meter.
- Parameters
iTextureDefinition – texture definition value.
-
virtual double GetTextureDefinition() const = 0
Gets the atlas texture definition in pixel per meter.
This value is used to control the mipmap change threshold.
- Returns
the texture definition (pix/m).
-
virtual int GetLightsCount() const = 0
Gets the number of lights associated to the geometry.
- Returns
the number of lights.
-
virtual RED::Object *GetLight(int iIndex) const = 0
Gets the light by its index.
- Parameters
iIndex – the index of the light.
- Returns
the light as ART::ILight.
-
virtual int GetReflectionProbesCount() const = 0
Gets the number of reflection probes in the geometry.
- Returns
the number of reflection probes.
-
virtual RED::Object *GetReflectionProbe(int iIndex) const = 0
Gets a reflection probe by its index.
- Parameters
iIndex – Index of the reflection probe to retrieve.
- Returns
the reflection probe as a ART::IReflectionProbe.
-
virtual RED_RC AddReflectionProbe(RED::Object *iReflectionProbe) = 0
Adds a reflection probe to the geometry.
- Parameters
iReflectionProbe – The ART::ReflectionProbe object to add to the geometry.
- Returns
RED_OK if the method has succeeded,
RED_BAD_PARAM if iReflectionProbe is not a valid ART::ReflectionProbe object,
RED_FAIL otherwise.
-
virtual RED_RC InsertReflectionProbe(RED::Object *iReflectionProbe, int iIndex) = 0
Adds a reflection probe to the geometry at a given index.
- Parameters
iReflectionProbe – The ART::ReflectionProbe object to add to the geometry.
iIndex – Position where to insert the reflection probe.
- Returns
RED_OK if the method has succeeded,
RED_BAD_PARAM if iReflectionProbe is not a valid ART::ReflectionProbe object,
RED_FAIL otherwise.
-
virtual RED_RC DestroyReflectionProbe(int iIndex) = 0
Removes and deletes the reflection probe at the given index from the geometry.
- Parameters
iIndex – Position where to remove the reflection probe.
- Returns
RED_OK if the method has succeeded,
RED_BAD_PARAM if iIndex is not a valid index,
RED_FAIL otherwise.
-
virtual RED::Object *GetPlanet() const = 0
Gets the planet holding the geometry.
- Returns
the planet as a ART::IPlanet, NULL if it has none.
-
virtual void SetAutomaticSetOnGround(bool iAuto) = 0
Defines if the geometry should be placed on the planet ground or not.
This method works with the ART::IPlanet::AddGeometry call. On adding a geometry, if iAuto is true, the geometry is automatically set on the landscape ground. If iAuto is false, the geometry remains at the specified input position. By default, a geometry is automatically set on ground.
- Parameters
iAuto – true to automatically set the geometry on the ground when it gets added to a planet.
-
virtual bool IsAutomaticSetOnGround() const = 0
- Returns
true if the geometry has an automatic on ground placement.
-
virtual bool HasPrivateShadowMap() const = 0
Tests whether the geometry uses a private shadow map or not.
- Returns
true if the geometry uses a private shadow map. False otherwise.
-
virtual void SetPrivateShadowMap(bool iPrivate) = 0
Sets a private shadow map for this geometry.
The private shadow map replaces the global CSM for this geometry.
- Parameters
iPrivate – true to use a private shadow map.
-
virtual int GetPrivateShadowMapSize() const = 0
Gets the private shadow map size.
- Returns
the private shadow map size in pixel.
-
virtual void SetPrivateShadowMapSize(int iSize) = 0
Sets the private shadow map size.
- Parameters
iSize – size to set to the private shadow map.
-
virtual double GetPrivateShadowBias() const = 0
Gets the private shadow bias.
- Returns
the private shadow bias.
-
virtual void SetPrivateShadowBias(double iBias) = 0
Sets the private shadow bias used in shading.
- Parameters
iBias – bias to set to the private shadow.
-
virtual int GetCSMCount() const = 0
- Returns
The number of star cascaded shadow maps for which this geometry casts shadows.
-
virtual void SetCSMCount(int iCSMCount) = 0
Sets the number of star cascaded shadow maps for which this geometry casts shadows.
- Parameters
iCSMCount – The number of CSMs to consider. Silently clamped to [ 0, world->GetStarCSMCount() ].
-
virtual void GetMemoryUsage(RED::uint64 &oCPU, RED::uint64 &oGPU) const = 0
Get the memory used by the geometry, both CPU and GPU.
Memory returned is approximative and based on the amount of data stored, not on allocated memory that may be paged or not by the system.
- Parameters
oCPU – CPU memory being used.
oGPU – GPU memory being used.
-
virtual int GetMaterialsCount() const = 0
Gets the number of materials in the geometry.
- Returns
the number of materials.
-
virtual RED::Object *GetMaterial(int iIndex) const = 0
Gets a material by its index.
- Parameters
iIndex – Index of the material to retrieve.
- Returns
the material at the iIndex position as a ART::IMaterial.
-
virtual RED_RC RefreshMaterial(bool &oNeedPlanetRefresh, int iMaterialIndex = -1, bool iCreateAtlas = true, bool iSkipMeshRebuild = false) = 0
Refreshes the materials of the geometry.
This method must be called to apply any ART::IMaterial update to the geometry materials.
If the geometry have multiple instances, this method must be called once on a single instance. The other instances must be updated using the ART::IGeometry::InstanceSetup method.
If oNeedPlanetRefresh is true after calling this function, a call to ART::IPlanet::RefreshGeometry is necessary to visualize the refresh.
- Parameters
oNeedPlanetRefresh – returned boolean indicating if the planet needs to refresh the geometry after the call.
iMaterialIndex – index of the material to update. -1 to force update all the materials.
iCreateAtlas – This parameter should be equal to the same parameter in ART::IAssetManager::CreateGeometry. If false, no atlas creation will take place.
iSkipMeshRebuild – If true, the mesh layout will not be updated and it must be done outside this method.
- Returns
RED_OK if the operation has succeeded,
Any other RED_RC otherwise.
-
virtual void SetSelected(bool iSelect) = 0
Sets the geometry selection feedback flag.
The geometry selection feedback flag can be directly set to highlight or unhighlight the geometry.
- Parameters
iSelect – Set to true to have the geometry selected and highlighted, set to false to unselect it.
-
virtual bool IsSelected() const = 0
Gets the geometry selection feedback flag.
- Returns
true if the geometry is selected, false otherwise.
-
virtual RED_RC SetSelectedSubMesh(int iID, bool iSelect) = 0
Selects sub-meshes by the material IDs they own.
- Parameters
iID – The ID to select.
iSelect – Set to true to have all sub-meshes using iID selected and highlighted, set to false to unselect them.
- Returns
RED_OK if the operation has succeeded,
RED_ALLOC_FAILURE if a memory allocation has failed,
RED_FAIL otherwise.
-
virtual bool IsSelectedSubMesh(int iID) const = 0
Tests if sub-meshes with a given material ID are selected.
- Parameters
iID – The ID to query.
- Returns
true if sub-meshes whose ID is iID are selected, false otherwise.
-
virtual const RED::Map<int, bool> &GetSelectedSubMeshes() const = 0
Gets a list of all the selected sub-meshes.
The return map is the list of sub-mesh ids associated to a boolean set to true if the sub-mesh is selected and false otherwise.
- Returns
The list of selected sub-meshes.
-
virtual RED_RC SetSelectedLight(int iIndex, bool iSelect) = 0
Selects a light by its number.
- Parameters
iIndex – The index of the light to select.
iSelect – Set to true to that light selected, set to false to unselect it.
- Returns
RED_OK if the operation has succeeded,
RED_ALLOC_FAILURE if a memory allocation has failed,
RED_FAIL otherwise.
-
virtual bool IsSelectedLight(int iIndex) const = 0
Tests if the light at the given index is selected.
- Parameters
iIndex – The index of the light to query.
- Returns
true if the iIndex-th light of the geometry is selected, false otherwise.
-
SET_CID(CID_class_ARTIGeometry)