Skip to main content

Post-processing tools 2023 R2

ANSYS::Nexus::GLTFWriter::GLTF Class Reference

Last update: 17.04.2023

This is the main class of the GLTFWriter. More...

#include <GLTFWriter.h>

Public Types

enum  GLTFError {
  GLTF_ERROR_NONE = 0 , GLTF_ERROR_DUPLICATE_VALUE , GLTF_ERROR_INCOMPATIBLE_VALUE , GLTF_ERROR_INVALID_PATH ,
  GLTF_ERROR_INVALID_TARGET , GLTF_ERROR_INVALID_TYPE , GLTF_ERROR_INVALID_VALUE , GLTF_ERROR_MEMORY ,
  GLTF_ERROR_RANGE , GLTF_ERROR_READ , GLTF_ERROR_SIZE_MISMATCH , GLTF_ERROR_VALUE_NOT_INITIALIZED ,
  GLTF_ERROR_WRITE , GLT_ERROR_MAX
}
 
enum  OutputType {
  OT_AVZ , OT_GLTF , OT_GLB1 , OT_GLTF1 ,
  OT_GLB2
}
 

Public Member Functions

virtual bool Write (bool formatJSON=false)=0
 
virtual void SetDefaultScene (const Scene *scene)=0
 
virtual GLTFError GetError ()=0
 

Static Public Member Functions

static GLTFCreate (const char *application, const char *applicationVersion, const char *filePath, OutputType fileType=OT_AVZ)
 
static void Destroy (GLTF *gltf)
 

Detailed Description

This is the main class of the GLTFWriter.

It is required to create all other classes and it is responsible for writing the GLTF files. This is the first object that should be created.

Definition at line 31 of file GLTFGLTF.h.

Member Enumeration Documentation

◆ GLTFError

Returned by GetError

Enumerator
GLTF_ERROR_NONE 

No Error.

GLTF_ERROR_DUPLICATE_VALUE 

Value is a duplicated.

GLTF_ERROR_INCOMPATIBLE_VALUE 

Value not compatible with other properties.

GLTF_ERROR_INVALID_PATH 

Path not valid.

GLTF_ERROR_INVALID_TARGET 

Animation target not valid.

GLTF_ERROR_INVALID_TYPE 

Value type not valid for other properties.

GLTF_ERROR_INVALID_VALUE 

Value is not valid.

GLTF_ERROR_MEMORY 

Memory allocation error.

GLTF_ERROR_RANGE 

Index out of range.

GLTF_ERROR_READ 

Error reading file data.

GLTF_ERROR_SIZE_MISMATCH 

Animation input/output size mismatch.

GLTF_ERROR_VALUE_NOT_INITIALIZED 

Trying to animate value that was never initialized.

GLTF_ERROR_WRITE 

Error writing file data.

Examples
Test001.cpp, Test002.cpp, Test003.cpp, Test004.cpp, Test005.cpp, Test006.cpp, Test007.cpp, Test008.cpp, Test009.cpp, Test010.cpp, Test011.cpp, Test012.cpp, Test013.cpp, and Test014.cpp.

Definition at line 35 of file GLTFGLTF.h.

◆ OutputType

Type of output to create.

Enumerator
OT_AVZ 

AVZ file for ANSYS Viewer.

OT_GLTF 

GLTF for ANSYS Viewer.

OT_GLB1 

GLB file in GLTF 1.0 spec (may not be supported)

OT_GLTF1 

GLTF 1.0 spec.

OT_GLB2 

GLB file in GLTF 2.0 spec.

Definition at line 54 of file GLTFGLTF.h.

Member Function Documentation

◆ Create()

static GLTF* ANSYS::Nexus::GLTFWriter::GLTF::Create ( const char *  application,
const char *  applicationVersion,
const char *  filePath,
OutputType  fileType = OT_AVZ 
)
static

Constructs a GLTF object.

Parameters
[in]applicationName of application that is using GLTFWriter.
[in]applicationVersionVersion of application that is using GLTFWriter.
[in]filePathFully qualified path to AVZ file or main GLTF file. Any additional files that are required will be created in the folder of this path.
[in]fileTypeOptional, GLTF::OutputType defining type of output to create. Any extension of filePath will be ignored and replaced by the appropriate extension of the fileType.
Examples
Test001.cpp, Test002.cpp, Test003.cpp, Test004.cpp, Test005.cpp, Test006.cpp, Test007.cpp, Test008.cpp, Test009.cpp, Test010.cpp, Test011.cpp, Test012.cpp, Test013.cpp, and Test014.cpp.

◆ Destroy()

static void ANSYS::Nexus::GLTFWriter::GLTF::Destroy ( GLTF gltf)
static

Destroys a GLTF object created by Create.

Parameters
[in]gltfGLTF object return by Create
Examples
Test001.cpp, Test002.cpp, Test003.cpp, Test004.cpp, Test005.cpp, Test006.cpp, Test007.cpp, Test008.cpp, Test009.cpp, Test010.cpp, Test011.cpp, Test012.cpp, Test013.cpp, and Test014.cpp.

◆ GetError()

virtual GLTFError ANSYS::Nexus::GLTFWriter::GLTF::GetError ( )
pure virtual

Returns the code for the last error. When an error occurs an error code is set. No further error is recorded until GetError is called. When GetError is called, the erorr code is reset to GLTF_ERROR_NONE.

Returns
GLTFError code.

◆ SetDefaultScene()

virtual void ANSYS::Nexus::GLTFWriter::GLTF::SetDefaultScene ( const Scene scene)
pure virtual

Sets the main scene of the GLTF file. If this call is not made, the first scene constructed for the GLTF file becomes the main scene. The default scene is the initial scene that is first displayed in the GLTF Viewer.

Parameters
[in]sceneScene that is initially displayed

◆ Write()

virtual bool ANSYS::Nexus::GLTFWriter::GLTF::Write ( bool  formatJSON = false)
pure virtual

Completes the GLTF file and writes out all data. This is the last call that should be made. Any additional GLTF objects created after this call will be ignored. This call does nothing if called a second time.

This call is optional. If it has not been called when the GLTF object is destroyed it will be called. However, any errors in writing GLTF file will be ignored.

Returns
status of write.
Parameters
[in]formatJSONFormat the JSON file for easier readability

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