|
VR-Engage
2.3
|
This class provides the functionality to translate between VR-Forces terrain surface types (soil, water, cultural features, etc.) and Vortex physics materials. It maintains lookup tables for different surface type categories and provides methods to retrieve the appropriate Vortex material for a given surface.
#include <surfaceToVxMaterialMapper.h>
Public Member Functions | |
| DtSurfaceToVxMaterialMapper () | |
| virtual | ~DtSurfaceToVxMaterialMapper () |
| virtual void | init (const Vx::VxMaterialTable *materialTable) |
| Vx::VxMaterial * | getVortexMaterial (const DtSurface &surf) |
| Vx::VxMaterial * | getDefaultVortexMaterial () |
| bool | isInitialized () const |
| virtual std::vector< VortexSurfaceMaterialMapping > | materialMappings () const |
| bool | isFiltered (const DtSurface &surf) |
| VortexSurfaceInfo * | getSurfaceInfo (const DtSurface &surf) const |
Protected Member Functions | |
| void | clearMappings () |
Protected Attributes | |
| Vx::VxMaterial * | myDefaultMaterial |
| bool | myInitialized |
| std::vector< VortexSurfaceInfo * > | mySoilTypeToMaterialMap |
| std::vector< VortexSurfaceInfo * > | myBodyOfWaterTypeToMaterialMap |
| std::vector< VortexSurfaceInfo * > | myCulturalFeatureTypeToMaterialMap |
| std::vector< VortexSurfaceInfo * > | myRoughnessSoilTypeToMaterialMap |
| makVre::DtSurfaceToVxMaterialMapper::DtSurfaceToVxMaterialMapper | ( | ) |
Default constructor.
Initializes an empty material mapper with no default material.
|
virtual |
Destructor.
Cleans up all allocated surface info objects in the mapping tables.
|
virtual |
Initialize the material mapper with a Vortex material table.
Sets up the mapping between VR-Forces surface types and Vortex materials based on configuration settings in vortexConfig.lua. This includes setting up the default material, material mapping tables, and filter lists.
Reinitializing discards all prior resolved mappings. Passing nullptr leaves the mapper uninitialized.
| materialTable | Non-owning material table containing available materials, or nullptr to clear the mapper. |
| Vx::VxMaterial * makVre::DtSurfaceToVxMaterialMapper::getVortexMaterial | ( | const DtSurface & | surf | ) |
Get the Vortex material for a specific terrain surface.
Determines the appropriate Vortex material based on the surface type. For water surfaces, it uses the body of water type mapping. For cultural features, it uses the cultural feature type mapping. For ground or flimsy surfaces, it uses the soil type mapping. Otherwise, it uses the roughness soil type mapping.
| surf | The terrain surface to get the material for |
| Vx::VxMaterial * makVre::DtSurfaceToVxMaterialMapper::getDefaultVortexMaterial | ( | ) |
Get the default Vortex material.
Returns the default material that is used when a specific mapping is not found or when explicitly configured to use the default.
| bool makVre::DtSurfaceToVxMaterialMapper::isInitialized | ( | ) | const |
Checks whether the material mappings were initialized successfully.
|
virtual |
Returns snapshots of all configured terrain surface-to-material mappings.
Each snapshot contains the source category and surface type, the configuration rule, the resolved material, and relevant mapping flags.
| bool makVre::DtSurfaceToVxMaterialMapper::isFiltered | ( | const DtSurface & | surf | ) |
Check if a surface should be filtered out.
Determines if a given surface should be excluded from triangle generation based on configuration settings.
| surf | The terrain surface to check |
| VortexSurfaceInfo * makVre::DtSurfaceToVxMaterialMapper::getSurfaceInfo | ( | const DtSurface & | surf | ) | const |
Get the surface info for a specific terrain surface.
Retrieves the VortexSurfaceInfo object containing material and flags for the given terrain surface. The appropriate info is selected based on the surface type (water, cultural feature, ground, or roughness).
| surf | The terrain surface to get the info for |
|
protected |
Clears all resolved material mappings.
Releases mapping records and resets the default material and initialization state.
|
protected |
Non-owning fallback material for unmapped surfaces.
|
protected |
Whether initialization resolved a valid default material.
|
protected |
Mapping from soil types to Vortex materials.
|
protected |
Mapping from body of water types to Vortex materials.
|
protected |
Mapping from cultural feature types to Vortex materials.
|
protected |
Mapping from roughness soil types to Vortex materials.