ANSYS::AVZ::GLTFWriter::Utils::Repack Class Reference
Last update: 16.07.2025#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 Repack * | Create (unsigned int elementCount, unsigned int elementSize, const unsigned int *indices) |
| static void | Destroy (Repack *packer) |
Detailed Description
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]
- Examples
- Test002.cpp, and Test013.cpp.
Definition at line 105 of file GLTFUtils.h.
Constructor & Destructor Documentation
◆ ~Repack()
|
inlineprotectedvirtual |
Definition at line 108 of file GLTFUtils.h.
Member Function Documentation
◆ ConstructRepackAttribute() [1/2]
|
pure virtual |
Creates packing of attribute data for packing packNum.
- Returns
- packed attribute. Do not delete this pointer.
- Parameters
-
[in] indices Indexes into attribute. [in] attributeSize Number of typename T per attribute. [in] attributeData attribute data. [in] packNum Packing index.
◆ ConstructRepackAttribute() [2/2]
|
pure virtual |
Creates packing of attribute data for packing packNum.
- Returns
- packed attribute. Do not delete this pointer.
- Parameters
-
[in] indices Indexes into attribute. [in] attributeSize Number of typename T per attribute. [in] attributeData attribute data. [in] packNum Packing index.
- Examples
- Test002.cpp, and Test013.cpp.
◆ ConstructRepackIndex()
|
pure virtual |
Creates packing of indices for packing packNum.
- Returns
- packed index. Do not delete this pointer.
- Parameters
-
[in] indices Indexes into attributes. [in] packNum Packing index.
- Examples
- Test002.cpp, and Test013.cpp.
◆ Create()
|
static |
Constructs a repacking object for repacking indices from unsigned int to unsigned short.
- Parameters
-
[in] elementCount Number of elements to repack. [in] elementSize Number of attributes per element. [in] indices Indexes into attributes of size elementSize * elementCount.
◆ Destroy()
|
static |
Deallocates all storage owned by Repack object.
◆ NumAttributes()
|
pure virtual |
- Returns
- Number of attributes in packing given by packNum.
- Parameters
-
[in] packNum Packing index.
- Examples
- Test002.cpp, and Test013.cpp.
◆ NumElements()
|
pure virtual |
Number of elements in packing given by packNum.
- Returns
- Number of elements.
- Parameters
-
[in] packNum Packing index.
- Examples
- Test002.cpp, and Test013.cpp.
◆ NumPacks()
|
pure virtual |
Number of packings required to repack unsigned int indices into unsigned short indices.
- Returns
- Number of packings.
- Examples
- Test002.cpp, and Test013.cpp.
The documentation for this class was generated from the following file:
- D:/Product-src/webgl_viewer/gltfwriterlib/include/GLTFUtils.h