API Documentation
Static Public Member Functions | List of all members
nkGraphics::MeshUtils Class Referencefinal

Offers capabilities to ease the manipulation of meshes in some contexts. More...

Static Public Member Functions

static PackedMeshData packIntoMeshData (const nkMemory::BufferView< VertexData > &meshInfo, const VertexComposition &composition)
 
static void fillMeshFromDecodedData (DecodedMeshData &data, Mesh *mesh, const MeshFillOptions &options=MeshFillOptions())
 
static BoundingBox computeBounds (const nkMemory::BufferView< unsigned char > &vertexBuffer, unsigned int byteStride, const MeshInputLayoutAttribute &positionAttribute, LogManager *logManager)
 
static AttributeGenerationOutput computeNormals (const AttributeGenerationInfo &inputInfo, LogManager *logManager)
 
static void computeNormals (const AttributeGenerationInfo &inputInfo, AttributeGenerationOutput &outputInfo, LogManager *logManager)
 
static AttributeGenerationOutput computeBinormals (const AttributeGenerationInfo &inputInfo, LogManager *logManager)
 
static void computeBinormals (const AttributeGenerationInfo &inputInfo, AttributeGenerationOutput &outputInfo, LogManager *logManager)
 
static AttributeGenerationOutput computeTangents (const AttributeGenerationInfo &inputInfo, LogManager *logManager)
 
static void computeTangents (const AttributeGenerationInfo &inputInfo, AttributeGenerationOutput &outputInfo, LogManager *logManager)
 

Detailed Description

Offers capabilities to ease the manipulation of meshes in some contexts.

Member Function Documentation

◆ packIntoMeshData()

static PackedMeshData nkGraphics::MeshUtils::packIntoMeshData ( const nkMemory::BufferView< VertexData > &  meshInfo,
const VertexComposition composition 
)
static

Translates a high-level structure representation of vertices into low-level data a mesh can use.

Parameters
meshInfoThe vertices the mesh should be composed of.
compositionExpected composition of output data.
Returns
Data once tightly packed, ready to be fed to a mesh.
Remarks
Composition will drive which attributes will be taken from the VertexData structure on input. This will impact resulting buffer and layout.

◆ fillMeshFromDecodedData()

static void nkGraphics::MeshUtils::fillMeshFromDecodedData ( DecodedMeshData data,
Mesh mesh,
const MeshFillOptions options = MeshFillOptions() 
)
static

Fills a mesh from a decoded mesh data. This will reset the mesh to be an exact match of provided decoded data.

Parameters
dataThe decoded data to use as input.
meshThe mesh to fill using decoded data.
optionsThe options altering how the filling operation will occur.

◆ computeBounds()

static BoundingBox nkGraphics::MeshUtils::computeBounds ( const nkMemory::BufferView< unsigned char > &  vertexBuffer,
unsigned int  byteStride,
const MeshInputLayoutAttribute positionAttribute,
LogManager logManager 
)
static

Computes axis-aligned bounds for a given position buffer.

Parameters
vertexBufferThe buffer giving the positions to compute the bounds from.
byteStrideThe stride of the buffer.
positionAttributeAn attribute describing how to find back the position information from the buffer.
logManagerTarget log manager, if logging is necessary.
Returns
Resulting axis-aligned bounding box, wrapping the whole point cloud provided.

◆ computeNormals() [1/2]

static AttributeGenerationOutput nkGraphics::MeshUtils::computeNormals ( const AttributeGenerationInfo inputInfo,
LogManager logManager 
)
static

Compute normals from a given vertex buffer.
This operation requires the position buffer only.

Parameters
inputInfoA description of the input data.
logManagerTarget log manager, if logging is necessary.
Returns
Generation result.
Remarks
This overload will automatically create the output buffer based on input information provided. Buffer will then be used when outputting the attributes. The structure will hold all information client code requires to interpret the data and provide it to a mesh.

◆ computeNormals() [2/2]

static void nkGraphics::MeshUtils::computeNormals ( const AttributeGenerationInfo inputInfo,
AttributeGenerationOutput outputInfo,
LogManager logManager 
)
static

Compute normals from a given vertex buffer.
This operation requires the position buffer only.

Parameters
inputInfoA description of the input data.
outputInfoThe output info to work from, and generate data into.
logManagerTarget log manager, if logging is necessary.
Remarks
This overload will use the outputInfo provided. It allows to make it generate data into a preallocated buffer with custom offset and stride. The format for normals will be R32G32B32_FLOAT.

◆ computeBinormals() [1/2]

static AttributeGenerationOutput nkGraphics::MeshUtils::computeBinormals ( const AttributeGenerationInfo inputInfo,
LogManager logManager 
)
static

Compute binormals from a given vertex buffer set.
This operation requires the position and texture coordinate buffers.

Parameters
inputInfoA description of the input data.
logManagerTarget log manager, if logging is necessary.
Returns
Generation result.
Remarks
This overload will automatically create the output buffer based on input information provided. Buffer will then be used when outputting the attributes. The structure will hold all information client code requires to interpret the data and provide it to a mesh.

◆ computeBinormals() [2/2]

static void nkGraphics::MeshUtils::computeBinormals ( const AttributeGenerationInfo inputInfo,
AttributeGenerationOutput outputInfo,
LogManager logManager 
)
static

Compute binormals from a given vertex buffer set.
This operation requires the position and texture coordinate buffers.

Parameters
inputInfoA description of the input data.
outputInfoThe output info to work from, and generate data into.
logManagerTarget log manager, if logging is necessary.
Remarks
This overload will use the outputInfo provided. It allows to make it generate data into a preallocated buffer with custom offset and stride. The format for binormals will be R32G32B32_FLOAT.

◆ computeTangents() [1/2]

static AttributeGenerationOutput nkGraphics::MeshUtils::computeTangents ( const AttributeGenerationInfo inputInfo,
LogManager logManager 
)
static

Compute tangents from a given vertex buffer set.
This operation requires the position and texture coordinate buffers.

Parameters
inputInfoA description of the input data.
logManagerTarget log manager, if logging is necessary.
Returns
Generation result.
Remarks
This overload will automatically create the output buffer based on input information provided. Buffer will then be used when outputting the attributes. The structure will hold all information client code requires to interpret the data and provide it to a mesh.

◆ computeTangents() [2/2]

static void nkGraphics::MeshUtils::computeTangents ( const AttributeGenerationInfo inputInfo,
AttributeGenerationOutput outputInfo,
LogManager logManager 
)
static

Compute tangents from a given vertex buffer set.
This operation requires the position and texture coordinate buffers.

Parameters
inputInfoA description of the input data.
outputInfoThe output info to work from, and generate data into.
logManagerTarget log manager, if logging is necessary.
Remarks
This overload will use the outputInfo provided. It allows to make it generate data into a preallocated buffer with custom offset and stride. The format for tangents will be R32G32B32_FLOAT.

The documentation for this class was generated from the following file: