Skip to main content

Post-processing tools 2023 R2

ANSYS::Nexus::GLTFWriter::Utils::Repack Class Reference

Last update: 17.04.2023

Manages repacking of indices from unsigned int type to unsigned short type. This only works for POINTS, LINES, or TRIANGLES. More...

#include <GLTFWriter.h>

Public Member Functions

virtual unsigned int NumPacks () const =0
 
virtual unsigned int NumAttributes (unsigned int packNum) const =0
 
virtual const int * ConstructRepackAttribute (const unsigned int *indices, unsigned int attributeSize, const int *attributeData, unsigned int packNum)=0
 
virtual const float * ConstructRepackAttribute (const unsigned int *indices, unsigned int attributeSize, const float *attributeData, unsigned int packNum)=0
 
virtual unsigned int NumElements (unsigned int packNum) const =0
 
virtual const unsigned short * ConstructRepackIndex (const unsigned int *indices, unsigned int packNum)=0
 

Static Public Member Functions

static RepackCreate (unsigned int elementCount, unsigned int elementSize, const unsigned int *indices)
 
static void Destroy (Repack *packer)
 

Detailed Description

Manages repacking of indices from unsigned int type to unsigned short type. This only works for POINTS, LINES, or TRIANGLES.


How it works
Suppose you have 20 vertices that are used to form 13 triangles.
Suppose the indices are:
[ 0, 7, 17, 9, 5, 19, 1, 12, 15, 8, 18, 17, 19, 5, 13, 2, 5, 13, 4, 5, 16, 4, 9, 7, 18, 14, 4, 11, 18, 13, 8, 5, 9, 2, 1, 19, 3, 0, 4]
To facilitate this example, suppose we want a maximum index of 8 instead of the maximum unsigned short of 65535.
The repacking algorithm could regroup the indices as:
[ 9, 5, 19, 19, 5, 13, 2, 5, 13, 4, 5, 16, 8, 5, 9, 2, 1, 19]
[ 0, 7, 17, 8, 18, 17, 4, 9, 7, 18, 14, 4, 3, 0, 4]
[ 1, 12, 15, 11, 18, 13]
The index values are changed to:
[ 1, 0, 2, 2, 0, 3, 4, 0, 3, 5, 0, 6, 7, 0, 1, 4, 8, 2]
[ 5, 3, 4, 6, 1, 4, 0, 7, 3, 1, 2, 0, 8, 5, 0]
[ 0, 1, 2, 3, 4, 5]


Definition at line 105 of file GLTFUtils.h.

Member Function Documentation

◆ ConstructRepackAttribute() [1/2]

virtual const float* ANSYS::Nexus::GLTFWriter::Utils::Repack::ConstructRepackAttribute ( const unsigned int *  indices,
unsigned int  attributeSize,
const float *  attributeData,
unsigned int  packNum 
)
pure virtual

Creates packing of attribute data for packing packNum.

Returns
packed attribute. Do not delete this pointer.
Parameters
[in]indicesIndexes into attribute.
[in]attributeSizeNumber of typename T per attribute.
[in]attributeDataattribute data.
[in]packNumPacking index.

◆ ConstructRepackAttribute() [2/2]

virtual const int* ANSYS::Nexus::GLTFWriter::Utils::Repack::ConstructRepackAttribute ( const unsigned int *  indices,
unsigned int  attributeSize,
const int *  attributeData,
unsigned int  packNum 
)
pure virtual

Creates packing of attribute data for packing packNum.

Returns
packed attribute. Do not delete this pointer.
Parameters
[in]indicesIndexes into attribute.
[in]attributeSizeNumber of typename T per attribute.
[in]attributeDataattribute data.
[in]packNumPacking index.

◆ ConstructRepackIndex()

virtual const unsigned short* ANSYS::Nexus::GLTFWriter::Utils::Repack::ConstructRepackIndex ( const unsigned int *  indices,
unsigned int  packNum 
)
pure virtual

Creates packing of indices for packing packNum.

Returns
packed index. Do not delete this pointer.
Parameters
[in]indicesIndexes into attributes.
[in]packNumPacking index.

◆ Create()

static Repack* ANSYS::Nexus::GLTFWriter::Utils::Repack::Create ( unsigned int  elementCount,
unsigned int  elementSize,
const unsigned int *  indices 
)
static

Constructs a repacking object for repacking indices from unsigned int to unsigned short.

Parameters
[in]elementCountNumber of elements to repack.
[in]elementSizeNumber of attributes per element.
[in]indicesIndexes into attributes of size elementSize * elementCount.
Examples
Test002.cpp, and Test013.cpp.

◆ Destroy()

static void ANSYS::Nexus::GLTFWriter::Utils::Repack::Destroy ( Repack packer)
static

Deallocates all storage owned by Repack object.

Examples
Test002.cpp, and Test013.cpp.

◆ NumAttributes()

virtual unsigned int ANSYS::Nexus::GLTFWriter::Utils::Repack::NumAttributes ( unsigned int  packNum) const
pure virtual
Returns
Number of attributes in packing given by packNum.
Parameters
[in]packNumPacking index.

◆ NumElements()

virtual unsigned int ANSYS::Nexus::GLTFWriter::Utils::Repack::NumElements ( unsigned int  packNum) const
pure virtual

Number of elements in packing given by packNum.

Returns
Number of elements.
Parameters
[in]packNumPacking index.

◆ NumPacks()

virtual unsigned int ANSYS::Nexus::GLTFWriter::Utils::Repack::NumPacks ( ) const
pure virtual

Number of packings required to repack unsigned int indices into unsigned short indices.

Returns
Number of packings.

The documentation for this class was generated from the following file:
  • D:/ANSYSDev/NoBackup/branches/EnSight-Second-Coming/webgl_viewer/gltfwriterlib/include/GLTFUtils.h