rpd Namespace Reference

Classes

struct  AssetData
 Struct that describes different kinds of data for a 3D asset. More...
 
struct  AssetGeometryData
 Struct that bundles different kinds of mesh / vertex data. More...
 
struct  BakingDataSource
 
class  BakingDataSourceVector
 Vector class, storing elements of type BakingDataSource. More...
 
struct  BakingOutputInfo
 Stats / info object for output received from texture baking. More...
 
class  Chart
 Basic structure for a UV Chart. More...
 
class  ChartPtrVector
 Vector of ChartPtr elements. More...
 
struct  CommonProgressUpdate
 
class  DoubleVector
 Vector class, storing elements of type double. More...
 
class  FloatVector
 Vector class, storing elements of type float. More...
 
class  Metrics
 Storage structure for information (metrics). More...
 
struct  PackingParams
 Parameter object for UV atlas packing. More...
 
class  PipelineMetrics
 
struct  RenderingParams
 Parameter object for rendering. More...
 
struct  SegmentationParams
 Parameter object for segmentation into charts. More...
 
struct  SimplificationParams
 Parameter object for mesh simplification. More...
 
struct  SimplificationProgressUpdate
 
struct  SurfaceAttribute
 
class  SurfaceAttributeVector
 Vector class, storing elements of type SurfaceAttribute. More...
 
struct  TextureBakingParams
 Parameter object for texture baking. More...
 
struct  TextureMap
 
class  TextureMapVector
 Vector class, storing elements of type TextureMap. More...
 
class  UIntVector
 Vector class, storing elements of type std::uint32_t. More...
 
struct  UnwrappingParams
 Parameter object for unwrapping (UV coordinate generation). More...
 

Typedefs

typedef ChartChartPtr
 Pointer to a chart. More...
 

Enumerations

enum  DataType { SCALAR = 1, VEC2 = 2, VEC3 = 3, VEC4 = 4 }
 
enum  VertexAttributeSemantic { SEMANTIC_DONT_CARE = 0, SEMANTIC_COLOR_RGBA = 1 }
 
enum  ResultCode { SUCCESS, ERR_INVALID_INPUT, ERR_MEMORY_LIMIT, ERR_UNKNOWN }
 Return codes, used for different RapidCompact functions. More...
 
enum  SimplificationType { TARGET_NUM_VERTICES = 0, TARGET_NUM_FACES = 1 }
 
enum  UnwrappingMethod {
  ISOMETRIC = 0, FORWARD_BIJECTIVE = 1, FIXED_BOUNDARY = 2, FAST_CONFORMAL = 3,
  CONFORMAL = 4
}
 Specifies an unwrapping / parameterization method. More...
 
enum  LoggingVerbosity {
  NONE = 0, ERRORS = 1, WARNINGS = 2, INFOS = 3,
  DEBUG = 4
}
 Specifies verbosity of RapidCompact's logging. More...
 

Functions

RPD_API ResultCode bakeMaps (const AssetGeometryData &targetGeometryData, const AssetGeometryData &sourceGeometryData, const BakingDataSourceVector &bakingDataSources, TextureMapVector &bakedMaps, const TextureBakingParams &bakingParams=TextureBakingParams(), BakingOutputInfo *bakingOutputInfo=0, CommonProgressUpdate *progressUpdate=0)
 Generates texture maps for an asset with UVs, using corresponding data from another asset. More...
 
RPD_API ResultCode bakeVertexOcclusion (const UIntVector &triIndicesPos, const DoubleVector &positions3D, const DoubleVector *normals3D, DoubleVector &vertexOcclusion, size_t numSamples=100, CommonProgressUpdate *progressUpdate=0)
 Generates per-vertex occlusion values in [0.0, 1.0]. More...
 
RPD_API ResultCode computeVertexNormals (const UIntVector &triIndicesPos, const DoubleVector &positions, double hardAngleDeg, UIntVector &resultNormalIndices, DoubleVector &resultVertexNormals)
 
RPD_API ResultCode buildUVChartsAndAtlas (const UIntVector &triIndicesPos, const DoubleVector &positions3D, ChartPtrVector &charts, const SegmentationParams &segmentationParams=SegmentationParams(), const UnwrappingParams &unwrappingParams=UnwrappingParams(), const PackingParams &packingParams=PackingParams(), rpd::UIntVector *newTriIdxToOldTriIdx=0)
 Generates UVs by segmenting, unwrapping and packing charts into a common atlas. More...
 
RPD_API ResultCode mergeToSingleChart (const ChartPtrVector &charts, ChartPtr &singleChart)
 Merges the given vector of charts to a single chart. More...
 
RPD_API ResultCode makeSingleIndexed (const rpd::UIntVector **triIndexData, rpd::DoubleVector **vertexAttributeData, rpd::UIntVector &vertexAttributeDims, rpd::UIntVector &newIndexData)
 
RPD_API ResultCode packIntoSingleAtlas (ChartPtrVector &charts, const rpd::DoubleVector &positions3D, const PackingParams &packingParams=PackingParams(), CommonProgressUpdate *progressUpdate=nullptr, Metrics *pMetrics=nullptr)
 Packs the given charts into a common atlas. More...
 
RPD_API ResultCode renderImage (const AssetData &asset, const SurfaceAttributeVector &materialColor, TextureMap &target, const RenderingParams &params=RenderingParams(), CommonProgressUpdate *progressUpdate=0)
 Renders an image of the given model with the given parameters. More...
 
RPD_API ResultCode segment (const rpd::UIntVector &triIndicesPos, const rpd::DoubleVector &positions3D, ChartPtrVector &charts, const SegmentationParams &params=SegmentationParams(), rpd::UIntVector *newTriIdxToOldTriIdx=0, CommonProgressUpdate *progressUpdate=0)
 Segments the given 3D geometry into a set of well-developable charts for UV mapping. More...
 
RPD_API ResultCode simplifyGeometry (rpd::UIntVector &triIndicesPos, rpd::DoubleVector &positions3D, const SimplificationParams &params, rpd::DoubleVector *vertexWeights=nullptr, const SimplificationProgressUpdate *updateFunct=nullptr, Metrics *pMetrics=nullptr)
 Simplifies the given 3D mesh until the given target constraints are met. More...
 
size_t RPD_API getNumComponents (MapDataType dataType)
 
RPD_API ResultCode unwrap (ChartPtrVector &charts, const rpd::DoubleVector &positions3D, const UnwrappingParams &params=UnwrappingParams(), rpd::UIntVector *newTriIdxToOldTriIdx=0, CommonProgressUpdate *progressUpdate=0)
 Unwraps (parameterizes) the given charts. More...
 
RPD_API LoggingVerbosity getLoggingVerbosity ()
 Returns the currently set logging verbosity. More...
 
RPD_API void setLoggingVerbosity (LoggingVerbosity loggingVerbosity)
 Sets the logging verbosity. More...
 
RPD_API std::ostream & getErrorStream ()
 Returns the currently set error stream object for logging. More...
 
RPD_API std::ostream & getWarningStream ()
 Returns the currently set warning stream object for logging. More...
 
RPD_API std::ostream & getInfoStream ()
 Returns the currently set info message stream object for logging. More...
 
RPD_API void setErrorStream (std::ostream &errorStr)
 Sets the error stream object for logging. More...
 
RPD_API void setWarningStream (std::ostream &warningStr)
 Sets the warning stream object for logging. More...
 
RPD_API void setInfoStream (std::ostream &infoStr)
 Sets the info message stream object for logging. More...
 
RPD_API void setNumThreads (int numThreads)
 Sets the maximum number of concurrent threads that RapidCompact can use. More...
 
RPD_API const char * getVersionString ()
 Gets RapidCompact version string. More...
 
RPD_API const char * getVersionStringWithoutSuffix ()
 Gets RapidCompact version string without optional suffix. More...
 
RPD_API int getMajorVersion ()
 Gets RapidCompact major version number. More...
 
RPD_API int getMinorVersion ()
 Gets RapidCompact minor version number. More...
 

Variables

const size_t MAX_GENERIC_ATTRIBUTES = 8
 
class RPD_API BakingDataSourceVectorImpl
 
class RPD_API ChartPtrVectorImpl
 
class RPD_API SurfaceAttributeVectorImpl
 
class RPD_API TextureMapVectorImpl
 
const std::uint32_t UnassignedIndex = 0xFFFFFFFF
 
class RPD_API UIntVectorImpl
 
class RPD_API FloatVectorImpl
 
class RPD_API DoubleVectorImpl
 

Typedef Documentation

◆ ChartPtr

typedef Chart* rpd::ChartPtr

Pointer to a chart.

If you create the chart yourself, it should be obtained via Chart::Create.

Enumeration Type Documentation

◆ DataType

Enumerator
SCALAR 
VEC2 
VEC3 
VEC4 

◆ LoggingVerbosity

Specifies verbosity of RapidCompact's logging.

Enumerator
NONE 

do not output anything

ERRORS 

output only errors

WARNINGS 

output errors and warnings

INFOS 

output errors, warnings and info messages

DEBUG 

verbose output of information for debugging

◆ ResultCode

Return codes, used for different RapidCompact functions.

Enumerator
SUCCESS 

operation was successful

ERR_INVALID_INPUT 

input to operation was invalid

ERR_MEMORY_LIMIT 

memory limit reached

ERR_UNKNOWN 

unknown error

◆ SimplificationType

Specifies the type of simplification target

Enumerator
TARGET_NUM_VERTICES 

target number is interpreted as vertex count

TARGET_NUM_FACES 

target number is interpreted as face count

◆ UnwrappingMethod

Specifies an unwrapping / parameterization method.

Enumerator
ISOMETRIC 

isometric unwrapping, preserving areas and angles as good as possible

FORWARD_BIJECTIVE 

slower isometric unwrapping that is guaranteed to be free of self-overlaps (no cutting necessary)

FIXED_BOUNDARY 

quick and simple fixed-boundary unwrapping, pinning the boundary of the chart to a circle

FAST_CONFORMAL 

very fast and useful conformal unwrapping method - preserves angles, but not areas

CONFORMAL 

robust, efficient and high-quality conformal unwrapping - angles are preserved best with this method

◆ VertexAttributeSemantic

Enumerator
SEMANTIC_DONT_CARE 
SEMANTIC_COLOR_RGBA 

Function Documentation

◆ bakeMaps()

RPD_API ResultCode rpd::bakeMaps ( const AssetGeometryData targetGeometryData,
const AssetGeometryData sourceGeometryData,
const BakingDataSourceVector bakingDataSources,
TextureMapVector bakedMaps,
const TextureBakingParams bakingParams = TextureBakingParams(),
BakingOutputInfo bakingOutputInfo = 0,
CommonProgressUpdate progressUpdate = 0 
)

Generates texture maps for an asset with UVs, using corresponding data from another asset.

This function generates, for each of the given baking sources, texture content for the corresponding entry within the given array of maps. This means that the first baking source will be used to generate the first texture, and so on. The basic mesh data that needs to be provided in any case are triangle indices and 3D positions for the source asset, and the same data plus UV indices and UV coordinates for the target asset.

Parameters
[in]targetDatavertex / mesh data for the target, must include indices and values for 3D positions and 2D UVs
[in]sourceDatavertex / mesh data for the source, must include 3D indices and positions
[in]bakingDataSourcessource information to be used for baking (one entry for each target)
[in,out]bakedMapstexture maps to be filled with the baking result (one entry for each source)
[in]bakingParamsparameter object with additional options (can be default)
[in]bakingOutputInfooptional parameter to receive additional output info/stats
[in]progressUpdateoptional update functor, to be used for progress notification

◆ bakeVertexOcclusion()

RPD_API ResultCode rpd::bakeVertexOcclusion ( const UIntVector triIndicesPos,
const DoubleVector positions3D,
const DoubleVector normals3D,
DoubleVector vertexOcclusion,
size_t  numSamples = 100,
CommonProgressUpdate progressUpdate = 0 
)

Generates per-vertex occlusion values in [0.0, 1.0].

The input is an indexed triangle mesh with or without vertex normals. The output are occlusion values in the unit range, where 1.0 corresponds to maximum occlusion and 0 means no occlusion. If you want high-quality occlusion independent from the mesh resolution instead, consider the option of baking occlusion into a texture map.

Parameters
[in]triIndicesPosinput triangle indices
[in]positions3Dinput vertex positions
[in]normals3Dinput per-vertex normals (optional)
[in,out]vertexOcclusionresulting per-vertex occlusion values (between 0.0 and 1.0)
[in]updateFunctoptional update functor, to be used for progress notification
See also
bakeMaps

◆ buildUVChartsAndAtlas()

RPD_API ResultCode rpd::buildUVChartsAndAtlas ( const UIntVector triIndicesPos,
const DoubleVector positions3D,
ChartPtrVector charts,
const SegmentationParams segmentationParams = SegmentationParams(),
const UnwrappingParams unwrappingParams = UnwrappingParams(),
const PackingParams packingParams = PackingParams(),
rpd::UIntVector newTriIdxToOldTriIdx = 0 
)

Generates UVs by segmenting, unwrapping and packing charts into a common atlas.

This function fist segments the given 3D geometry into a new set of well-developable charts of disc topology by creating new indices, then, unwraps them, and arranges them inside a single atlas by assigning them UV coordinates in a common unit range [0, 1]. The given packingParams, such as padding and minimum chart size, will be treated as a hint. RapidCompact will, for example, try to use the given padding as the minimum possible distance between charts inside the atlas. However, it can (in principle) not be guaranteed that, for an arbitrary long list of charts, the given padding will be globally applicable inside the atlas.

Parameters
[in]triIndicesPostriangle indices
[in]positions3Dcoordinates of the 3D vertices
[out]chartsresulting charts, containing new triangle indices (3D and UV) and UV coordinates
[in]segmentationParamssegmentation parameters
[in]unwrappingParamsunwrapping parameters
[in]packingParamspacking parameters
[out]newTriIdxToOldTriIdxresulting mapping from new to old triangles (optional)

◆ computeVertexNormals()

RPD_API ResultCode rpd::computeVertexNormals ( const UIntVector triIndicesPos,
const DoubleVector positions,
double  hardAngleDeg,
UIntVector resultNormalIndices,
DoubleVector resultVertexNormals 
)

◆ getErrorStream()

RPD_API std::ostream& rpd::getErrorStream ( )

Returns the currently set error stream object for logging.

◆ getInfoStream()

RPD_API std::ostream& rpd::getInfoStream ( )

Returns the currently set info message stream object for logging.

◆ getLoggingVerbosity()

RPD_API LoggingVerbosity rpd::getLoggingVerbosity ( )

Returns the currently set logging verbosity.

◆ getMajorVersion()

RPD_API int rpd::getMajorVersion ( )

Gets RapidCompact major version number.

◆ getMinorVersion()

RPD_API int rpd::getMinorVersion ( )

Gets RapidCompact minor version number.

◆ getNumComponents()

size_t RPD_API rpd::getNumComponents ( MapDataType  dataType)
inline

◆ getVersionString()

RPD_API const char* rpd::getVersionString ( )

Gets RapidCompact version string.

◆ getVersionStringWithoutSuffix()

RPD_API const char* rpd::getVersionStringWithoutSuffix ( )

Gets RapidCompact version string without optional suffix.

◆ getWarningStream()

RPD_API std::ostream& rpd::getWarningStream ( )

Returns the currently set warning stream object for logging.

◆ makeSingleIndexed()

RPD_API ResultCode rpd::makeSingleIndexed ( const rpd::UIntVector **  triIndexData,
rpd::DoubleVector **  vertexAttributeData,
rpd::UIntVector vertexAttributeDims,
rpd::UIntVector newIndexData 
)

◆ mergeToSingleChart()

RPD_API ResultCode rpd::mergeToSingleChart ( const ChartPtrVector charts,
ChartPtr singleChart 
)

Merges the given vector of charts to a single chart.

All chart pointers within the charts vector must be different from singleChart. Naturally, all charts should also correspond to the same shared vector of 3D positions, as their 3D position indices will be merged.

Parameters
[in,out]chartscharts that should be merged
[in,out]singleChartresulting chart

◆ packIntoSingleAtlas()

RPD_API ResultCode rpd::packIntoSingleAtlas ( ChartPtrVector charts,
const rpd::DoubleVector positions3D,
const PackingParams packingParams = PackingParams(),
CommonProgressUpdate progressUpdate = nullptr,
Metrics pMetrics = nullptr 
)

Packs the given charts into a common atlas.

This is done by assigning them non-overlapping UV coordinates in unit range [0, 1].

The given params, such as padding and minimum chart size, will be treated as a hint. RapidCompact will, for example, try to use the given padding as the minimum possible distance between charts inside the atlas. However, it can (in principle) not be guaranteed that, for an arbitrary long list of charts, the given padding will be globally applicable inside the atlas.

Parameters
[in,out]chartscharts that should be packed
[in]positions3Dcoordinates of the 3D vertices
[in]paramspacking parameters
[in]progressUpdateprogress notifier (optional)

◆ renderImage()

RPD_API ResultCode rpd::renderImage ( const AssetData asset,
const SurfaceAttributeVector materialColor,
TextureMap target,
const RenderingParams params = RenderingParams(),
CommonProgressUpdate progressUpdate = 0 
)

Renders an image of the given model with the given parameters.

The image rendered by this function can be used for previews / thumbnails, for example. The target texture object must be managed (allocated) by the surrounding application.

Parameters
[in]assetAsset to render
[in]materialColorPer-material base color info (texture or single value)
[in,out]targetTarget texture image
[in]paramsRendering parameters, such as camera settings
[in]progressUpdateOptional progress notifier

◆ segment()

RPD_API ResultCode rpd::segment ( const rpd::UIntVector triIndicesPos,
const rpd::DoubleVector positions3D,
ChartPtrVector charts,
const SegmentationParams params = SegmentationParams(),
rpd::UIntVector newTriIdxToOldTriIdx = 0,
CommonProgressUpdate progressUpdate = 0 
)

Segments the given 3D geometry into a set of well-developable charts for UV mapping.

The output charts are guaranteed to have disc topology, unless the ensureDiscTopology flag of \SegmentationParams is explicitly disabled.

Parameters
[in]triIndicesPostriangle indices
[in]positions3Dcoordinates of the 3D vertices
[out]chartsresulting charts
[in]paramssegmentation parameters
[out]newTriIdxToOldTriIdxresulting mapping from new to old triangles (optional)
[in]progressUpdateprogress notifier (optional)

◆ setErrorStream()

RPD_API void rpd::setErrorStream ( std::ostream &  errorStr)

Sets the error stream object for logging.

Parameters
[in]errorStrstandard output stream object to be used

◆ setInfoStream()

RPD_API void rpd::setInfoStream ( std::ostream &  infoStr)

Sets the info message stream object for logging.

Parameters
[in]infoStrstandard output stream object to be used

◆ setLoggingVerbosity()

RPD_API void rpd::setLoggingVerbosity ( LoggingVerbosity  loggingVerbosity)

Sets the logging verbosity.

Parameters
[in]loggingVerbosityverbosity to be used

◆ setNumThreads()

RPD_API void rpd::setNumThreads ( int  numThreads)

Sets the maximum number of concurrent threads that RapidCompact can use.

Parameters
[in]numThreadsmaximum number of threads

◆ setWarningStream()

RPD_API void rpd::setWarningStream ( std::ostream &  warningStr)

Sets the warning stream object for logging.

Parameters
[in]warningStrstandard output stream object to be used

◆ simplifyGeometry()

RPD_API ResultCode rpd::simplifyGeometry ( rpd::UIntVector triIndicesPos,
rpd::DoubleVector positions3D,
const SimplificationParams params,
rpd::DoubleVector vertexWeights = nullptr,
const SimplificationProgressUpdate updateFunct = nullptr,
Metrics pMetrics = nullptr 
)

Simplifies the given 3D mesh until the given target constraints are met.

The mesh is provided as a simple indexed triangle list. The simplification parameters can be used to specify the method used for simplifiying the geometry, as well as the target resolution.

Parameters
[in,out]triIndicesPostriangle indices
[in,out]positions3Dcoordinates of the 3D vertices
[in]paramssimplification parameters
[in,out]vertexWeightsoptional per-vertex weights to be used (and also updated) during simplification @params[in] updateFunct optional update functor, to be used for progress notification
[in,out]pMetricsoptional structure that may be filled with metrics (information) by the called function
See also
SimplificationParams

◆ unwrap()

RPD_API ResultCode rpd::unwrap ( ChartPtrVector charts,
const rpd::DoubleVector positions3D,
const UnwrappingParams params = UnwrappingParams(),
rpd::UIntVector newTriIdxToOldTriIdx = 0,
CommonProgressUpdate progressUpdate = 0 
)

Unwraps (parameterizes) the given charts.

This is done by computing, for each chart, UV coordinates. The UV connectivity of each given chart must be a manifold with zero genus and at least one boundary. Parameterizing charts with holes (multiple boundaries) is possible. If overlaps are supposed to be removed, triangles may be reordered (otherwise not).

Parameters
[in,out]chartscharts to be unwrapped
[in]positions3D3D positions of the vertices used by the charts
[in]paramsunwrapping parameters
[out]newTriIdxToOldTriIdxresulting mapping from new to old triangles (optional)
[in]progressUpdateprogress notifier (optional)

Variable Documentation

◆ BakingDataSourceVectorImpl

class RPD_API rpd::BakingDataSourceVectorImpl

◆ ChartPtrVectorImpl

class RPD_API rpd::ChartPtrVectorImpl

◆ DoubleVectorImpl

class RPD_API rpd::DoubleVectorImpl

◆ FloatVectorImpl

class RPD_API rpd::FloatVectorImpl

◆ MAX_GENERIC_ATTRIBUTES

const size_t rpd::MAX_GENERIC_ATTRIBUTES = 8

◆ SurfaceAttributeVectorImpl

class RPD_API rpd::SurfaceAttributeVectorImpl

◆ TextureMapVectorImpl

class RPD_API rpd::TextureMapVectorImpl

◆ UIntVectorImpl

class RPD_API rpd::UIntVectorImpl

◆ UnassignedIndex

const std::uint32_t rpd::UnassignedIndex = 0xFFFFFFFF

Special constant indicating an unassigned index.