    

 ## On this page

  

 

 # Test008

 Last update: 16.07.2025 

Animated textured sphere.

See [Test006.cpp](_test006_8cpp-example.html) for more information about animations.

This is another animation example that simply transforms a node matrix over a period of time. The underlying code in the ANSYSViewer extracts a quaternion from the matrix and interpolates between quaternions at the defined times.

The animation in this example merely rotates the sphere about its Z axis.

A custom shader is used that demonstrates the usage of a 2D texture coordinate. The 2D texture coordinates in this example are similar to latitude and longitude. &lt;script src="./ansys251/nexus/viewer-loader.js"&gt;&lt;/script&gt;

/\*

 \* Copyright 2018-2021 ANSYS, Inc. Unauthorized use, distribution, or duplication is prohibited.

 \* 

 \* Restricted Rights Legend

 \*

 \* Use, duplication, or disclosure of this

 \* software and its documentation by the

 \* Government is subject to restrictions as

 \* set forth in subdivision \[(b)(3)(ii)\] of

 \* the Rights in Technical Data and Computer

 \* Software clause at 52.227-7013.

 \*/

\#include &lt;vector&gt;

 

\#include "GLTFWriter.h"

\#include "test.h"

 

using namespace ANSYS::AVZ;

 

// Lighted Textured Sphere

TESTFUNC(LightedTexturedSphere)

{

 <a id="_a0" name="_a0"></a>[GLTFWriter::GLTF](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_g_l_t_f.xhtml) *gltf = GLTFWriter::GLTF::Create("MyApp", "1.0", functionName.c_str(), type);

 if (!gltf)

 throw std::runtime_error("Can't create GLTF");

 

 // SCENE

 <a id="_a1" name="_a1"></a>[GLTFWriter::Scene](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_scene.xhtml) *scene = GLTFWriter::Scene::Create(gltf, "TestScene", "m", 1.0, GLTFWriter::Scene::BT_SOLID, 0.5, 0.5, 0.5);

 if (!scene) {

 GLTFWriter::GLTF::Destroy(gltf);

 throw std::runtime_error("Can't create scene");

 }

 

 // ANIMATION

 <a id="_a2" name="_a2"></a>[GLTFWriter::Animation](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_animation.xhtml) *animation = GLTFWriter::Animation::Create(gltf, "My Animation");

 // create a reusable time

 <a id="_a3" name="_a3"></a>[GLTFWriter::Attribute](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_attribute.xhtml) *time = 0;

 {

 float _time[4];

 unsigned int i = 0;

 _time[i++] = 0; // time 0

 _time[i++] = 10; // time 1

 _time[i++] = 20; // time 2

 _time[i++] = 30; // time 3

 time = GLTFWriter::Attribute::Create(gltf, "TIME", GLTFWriter::Attribute::AT_FLOAT, 4, _time);

 }

 

 // ANIMATION SAMPLER for sampling matrix

 <a id="_a4" name="_a4"></a>[GLTFWriter::AnimationSampler](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_animation_sampler.xhtml) *sampler = 0;

 {

 float _mat[4 * 16];

 unsigned int i = 0;

 

 // time 0

 GLTFWriter::Test::Matrix4 m0; // identity

 for (unsigned int j = 0; j &lt; 16; ++j)

 _mat[i++] = (float)m0[j];

 

 // time 1

 GLTFWriter::Test::Matrix4 m1; // identity

 GLTFWriter::Test::Matrix4 r1;

 r1.LoadRotation(GLTFWriter::Test::Vector3(0, 0, 0), GLTFWriter::Test::Vector3(0, 1, 0), DegreesToRadians(120));

 m1 *= r1;

 for (unsigned int j = 0; j &lt; 16; ++j)

 _mat[i++] = (float)m1[j];

 

 // time 2

 GLTFWriter::Test::Matrix4 m2; // identity

 GLTFWriter::Test::Matrix4 r2;

 r2.LoadRotation(GLTFWriter::Test::Vector3(0, 0, 0), GLTFWriter::Test::Vector3(0, 1, 0), DegreesToRadians(240));

 m2 *= r2;

 for (unsigned int j = 0; j &lt; 16; ++j)

 _mat[i++] = (float)m2[j];

 

 // time 3

 GLTFWriter::Test::Matrix4 m3; // identity

 GLTFWriter::Test::Matrix4 r3;

 r3.LoadRotation(GLTFWriter::Test::Vector3(0, 0, 0), GLTFWriter::Test::Vector3(0, 1, 0), DegreesToRadians(360));

 m3 *= r3;

 for (unsigned int j = 0; j &lt; 16; ++j)

 _mat[i++] = (float)m3[j];

 

 [GLTFWriter::Attribute](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_attribute.xhtml) *matrix = GLTFWriter::Attribute::Create(gltf, "MATRIX", GLTFWriter::Attribute::AT_FLOAT_MAT4, 4, _mat);

 

 sampler = GLTFWriter::AnimationSampler::Create(gltf, time, matrix);

 }

 

 // LIGHTS

 {

 // LIGHT NODE

 <a id="_a5" name="_a5"></a>[GLTFWriter::Node](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_node.xhtml) *lightNode = GLTFWriter::Node::CreateLight(gltf);

 if (!lightNode || !scene-&gt;<a id="a6" name="a6"></a>[SetLight](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_scene.xhtml#ac92acb916999693ccaaefe8a81962c67)(lightNode)) {

 GLTFWriter::GLTF::Destroy(gltf);

 throw std::runtime_error("Can't create light");

 }

 

 // LIGHTS

 <a id="_a7" name="_a7"></a>[GLTFWriter::Light](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_light.xhtml) *light1 = GLTFWriter::Light::CreateAmbient(gltf);

 lightNode-&gt;<a id="a8" name="a8"></a>[AppendLight](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_node.xhtml#a576db36280a02127b5eb662f0566543b)(light1);

 

 [GLTFWriter::Light](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_light.xhtml) *light2 = GLTFWriter::Light::CreateDirectional(gltf, 1, 1, 1, -1, -1, -1);

 lightNode-&gt;[AppendLight](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_node.xhtml#a576db36280a02127b5eb662f0566543b)(light2);

 }

 

 // CAMERA

 {

 // CAMERA

 <a id="_a9" name="_a9"></a>[GLTFWriter::Camera](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_camera.xhtml) *camera = GLTFWriter::Camera::CreatePerspective(gltf);

 // CAMERA NODE

 std::vector&lt;double&gt; mat(16);

 mat[0] = 0.5;

 mat[1] = 0;

 mat[2] = 0;

 mat[3] = 0;

 mat[4] = 0;

 mat[5] = 0.5;

 mat[6] = 0;

 mat[7] = 0;

 mat[8] = 0;

 mat[9] = 0;

 mat[10] = 0.5;

 mat[11] = 0;

 mat[12] = 0;

 mat[13] = 0;

 mat[14] = 0;

 mat[15] = 1;

 [GLTFWriter::Node](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_node.xhtml) *cameraNode = GLTFWriter::Node::CreateCamera(gltf, camera, "TestCamera", &amp;mat[0]);

 scene-&gt;<a id="a10" name="a10"></a>[SetCamera](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_scene.xhtml#ae84fba7ea3c00159c2eae7adbfbfa61d)(cameraNode);

 }

 

 // generate vertices, normals, and texture coordinates for a ball

 std::vector&lt;float&gt; vertices;

 std::vector&lt;float&gt; normals;

 std::vector&lt;float&gt; texCoords;

 std::vector&lt;unsigned short&gt; triangles;

 GLTFWriter::Test::MakeTexturedSphere(0, 0, 0, 0.5, 64, vertices, normals, texCoords, triangles);

 

 // MESH NODE

 {

 // NODE

 std::vector&lt;double&gt; mat(16);

 mat[0] = 1;

 mat[1] = 0;

 mat[2] = 0;

 mat[3] = 0;

 mat[4] = 0;

 mat[5] = 1;

 mat[6] = 0;

 mat[7] = 0;

 mat[8] = 0;

 mat[9] = 0;

 mat[10] = 1;

 mat[11] = 0;

 mat[12] = 0;

 mat[13] = 0;

 mat[14] = 0;

 mat[15] = 1;

 [GLTFWriter::Node](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_node.xhtml) *node = GLTFWriter::Node::CreateMesh(gltf, "Sphere", true, &amp;mat[0]);

 if (!node || !scene-&gt;<a id="a11" name="a11"></a>[AppendMesh](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_scene.xhtml#a76e34d4c05fe34dde0fcc4913ad63981)(node)) {

 GLTFWriter::GLTF::Destroy(gltf);

 throw std::runtime_error("Can't create mesh node");

 }

 

 // MESH

 <a id="_a12" name="_a12"></a>[GLTFWriter::Mesh](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_mesh.xhtml) *mesh = GLTFWriter::Mesh::Create(gltf);

 if (!mesh || !node-&gt;<a id="a13" name="a13"></a>[AppendMesh](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_node.xhtml#a68c9eec5fe03405e52b3558a62f8faec)(mesh)) {

 GLTFWriter::GLTF::Destroy(gltf);

 throw std::runtime_error("Can't create mesh");

 }

 

 // TEXTURE

 <a id="_a14" name="_a14"></a>[GLTFWriter::Texture](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_texture.xhtml) *texture = GLTFWriter::Test::CreateTexture(gltf, "earth.png");

 

 // VERTEX SHADER

 std::string vsText(std::string("precision highp float;\\n") +

 "uniform mat4 u\_projectionMatrix;\\n" +

 "uniform mat4 u\_modelViewMatrix;\\n" +

 "attribute vec3 a\_position;\\n" +

 "uniform mat3 u\_normalMatrix;\\n" +

 "attribute vec3 a\_normal;\\n" +

 "varying vec3 v\_eyePosition;\\n" +

 "varying vec3 v\_normal;\\n" +

 "attribute vec2 a\_texCoord0;\\n" +

 "varying vec2 v\_texCoord0;\\n" +

 "void main() {\\n" +

 "vec4 l\_position = vec4(a\_position, 1.0);\\n" +

 "vec4 l\_eyePosition = u\_modelViewMatrix \* l\_position;\\n" +

 "v\_eyePosition = l\_eyePosition.xyz / l\_eyePosition.w;\\n" +

 "v\_normal = u\_normalMatrix \* a\_normal;\\n" +

 "v\_texCoord0 = a\_texCoord0;\\n" +

 "gl\_Position = u\_projectionMatrix \* l\_eyePosition;\\n" +

 "}\\n");

 std::vector&lt;const char *&gt; uVertex;

 uVertex.push_back("u\_modelViewMatrix");

 uVertex.push_back("u\_projectionMatrix");

 uVertex.push_back("u\_normalMatrix");

 std::vector&lt;const char *&gt; aVertex;

 aVertex.push_back("a\_position");

 aVertex.push_back("a\_normal");

 aVertex.push_back("a\_texCoord0");

 <a id="_a15" name="_a15"></a>[GLTFWriter::Shader](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_shader.xhtml) *vertexShader = GLTFWriter::Shader::Create(gltf, vsText.c_str(), (unsigned int)aVertex.size(), &amp;aVertex[0], (unsigned int)uVertex.size(), &amp;uVertex[0]);

 

 // FRAGMENT SHADER

 std::string fsText(std::string("precision highp float;\\n") +

 "uniform vec3 u\_light0Position;\\n" +

 "uniform vec3 u\_light1Ambient;\\n" +

 "uniform sampler2D u\_texture0;\\n" +

 "varying vec3 v\_eyePosition;\\n" +

 "varying vec3 v\_normal;\\n" +

 "varying vec2 v\_texCoord0;\\n" +

 "void main() {\\n" +

 "vec4 l\_color = vec4(1.0, 1.0, 1.0, 1.0);\\n" +

 "vec3 l\_normal = normalize(v\_normal);\\n" +

 "vec4 l\_texelColor = texture2D(u\_texture0, v\_texCoord0);\\n" +

 "l\_color \*= l\_texelColor;\\n" +

 "vec3 l\_frontAmbient = u\_light1Ambient \* l\_color.rgb;\\n" +

 "vec3 l\_frontDiffuse = vec3(0.0, 0.0, 0.0);\\n" +

 "vec3 l\_frontSpecular = vec3(0.0, 0.0, 0.0);\\n" +

 "vec3 l\_VP = normalize(u\_light0Position - v\_eyePosition);\\n" +

 "float l\_nDotVP = dot(l\_normal, l\_VP);\\n" +

 "if (!gl\_FrontFacing)\\n" + // two sided lighting

 "l\_nDotVP = -l\_nDotVP;\\n" +

 "if (l\_nDotVP &gt; 0.0) {\\n" + // front faced

 "l\_frontDiffuse += l\_nDotVP \* l\_color.rgb;\\n" +

 "vec3 l\_halfVector = normalize(l\_VP + vec3(0.0, 0.0, 1.0));\\n" + // eye is always looking down Z axis

 "float l\_nDotHV = dot(l\_normal, l\_halfVector);\\n" +

 "if (!gl\_FrontFacing)\\n" + // two sided lighting

 "l\_nDotHV = -l\_nDotHV;\\n"

 "if (l\_nDotHV &gt; 0.0)\\n" + // specular

 "l\_frontSpecular += pow(l\_nDotHV, 100.0) \* vec3(1.0, 1.0, 1.0);\\n" +

 "}\\n" + // front faced

 "l\_color = vec4(l\_frontAmbient + l\_frontDiffuse + l\_frontSpecular, l\_color.a);\\n" +

 "l\_color = clamp(l\_color, 0.0, 1.0);\\n" +

 "gl\_FragColor = l\_color;\\n" +

 "}\\n");

 std::vector&lt;const char *&gt; uFragment;

 uFragment.push_back("u\_light0Position");

 uFragment.push_back("u\_light1Ambient");

 uFragment.push_back("u\_texture0");

 [GLTFWriter::Shader](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_shader.xhtml) *fragmentShader = GLTFWriter::Shader::Create(gltf, fsText.c_str(), 0, 0, (unsigned int)uFragment.size(), &amp;uFragment[0]);

 

 // PROGRAM

 <a id="_a16" name="_a16"></a>[GLTFWriter::Program](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_program.xhtml) *program = GLTFWriter::Program::Create(gltf, vertexShader, fragmentShader);

 

 // TECHNIQUE

 <a id="_a17" name="_a17"></a>[GLTFWriter::Technique](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_technique.xhtml) *technique = GLTFWriter::Technique::Create(gltf, program);

 if (!technique ||

 // TECHNIQUE PARAMETERS

 !technique-&gt;<a id="a18" name="a18"></a>[AppendParameter](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_technique.xhtml#ae55c184b6165d5f1ea88e3db34522ba9)(GLTFWriter::Parameter::Create(gltf, "u\_light0Position", "light0Position", GLTFWriter::Parameter::PT_FLOAT_VEC3, GLTFWriter::Value::Create(gltf, "", 0.0, 0.0, 1.0))) ||

 !technique-&gt;[AppendParameter](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_technique.xhtml#ae55c184b6165d5f1ea88e3db34522ba9)(GLTFWriter::Parameter::Create(gltf, "u\_light1Ambient", "light1Ambient", GLTFWriter::Parameter::PT_FLOAT_VEC3, GLTFWriter::Value::Create(gltf, "", 0.0, 0.0, 0.0))) ||

 !technique-&gt;[AppendParameter](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_technique.xhtml#ae55c184b6165d5f1ea88e3db34522ba9)(GLTFWriter::Parameter::CreateModelViewMatrix(gltf, "u\_modelViewMatrix")) ||

 !technique-&gt;[AppendParameter](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_technique.xhtml#ae55c184b6165d5f1ea88e3db34522ba9)(GLTFWriter::Parameter::CreateProjectionMatrix(gltf, "u\_projectionMatrix")) ||

 !technique-&gt;[AppendParameter](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_technique.xhtml#ae55c184b6165d5f1ea88e3db34522ba9)(GLTFWriter::Parameter::CreateNormalMatrix(gltf, "u\_normalMatrix")) ||

 !technique-&gt;[AppendParameter](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_technique.xhtml#ae55c184b6165d5f1ea88e3db34522ba9)(GLTFWriter::Parameter::Create(gltf, "u\_texture0", "texture0", GLTFWriter::Parameter::PT_SAMPLER_2D)) ||

 !technique-&gt;[AppendParameter](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_technique.xhtml#ae55c184b6165d5f1ea88e3db34522ba9)(GLTFWriter::Parameter::Create(gltf, "a\_position", "POSITION", GLTFWriter::Parameter::PT_FLOAT_VEC3)) ||

 !technique-&gt;[AppendParameter](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_technique.xhtml#ae55c184b6165d5f1ea88e3db34522ba9)(GLTFWriter::Parameter::Create(gltf, "a\_normal", "NORMAL", GLTFWriter::Parameter::PT_FLOAT_VEC3)) ||

 !technique-&gt;[AppendParameter](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_technique.xhtml#ae55c184b6165d5f1ea88e3db34522ba9)(GLTFWriter::Parameter::Create(gltf, "a\_texCoord0", "TEXCOORD0", GLTFWriter::Parameter::PT_FLOAT_VEC2)) ||

 // TECHNIQUE STATES

 !technique-&gt;<a id="a19" name="a19"></a>[AppendState](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_technique.xhtml#a8b2b0766157324d5a2093a3fca36379f)(GLTFWriter::State::Create(gltf, GLTFWriter::State::ST_BLENDENABLE, 1)) ||

 !technique-&gt;[AppendState](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_technique.xhtml#a8b2b0766157324d5a2093a3fca36379f)(GLTFWriter::State::Create(gltf, GLTFWriter::State::ST_DEPTHTESTENABLE, 1))) {

 GLTFWriter::GLTF::Destroy(gltf);

 throw std::runtime_error("Can't create technique");

 }

 

 // MATERIAL

 <a id="_a20" name="_a20"></a>[GLTFWriter::Material](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_material.xhtml) *material = GLTFWriter::Material::Create(gltf, technique);

 if (!material ||

 // MATERIAL UNIFORM VALUES

 !material-&gt;<a id="a21" name="a21"></a>[AppendValue](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_material.xhtml#a2f8a41e41af7d9b8cd498506f6510dd7)(GLTFWriter::Value::Create(gltf, "light0Position", 100.0, 100.0, 100.0)) ||

 !material-&gt;[AppendValue](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_material.xhtml#a2f8a41e41af7d9b8cd498506f6510dd7)(GLTFWriter::Value::Create(gltf, "light1Ambient", 0.3, 0.3, 0.3)) ||

 !material-&gt;[AppendValue](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_material.xhtml#a2f8a41e41af7d9b8cd498506f6510dd7)(GLTFWriter::Value::Create(gltf, "texture0", texture-&gt;GetID())) ||

 // this is a solid object, that we want to have an interior color so when it is clipped we see the solid interior color

 !material-&gt;[AppendValue](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_material.xhtml#a2f8a41e41af7d9b8cd498506f6510dd7)(GLTFWriter::Value::Create(gltf, "solidColor", 0.6, 0.4, 0.2, 1.0))) {

 GLTFWriter::GLTF::Destroy(gltf);

 throw std::runtime_error("Can't create material");

 }

 

 // POSITION ATTRIBUTE

 const unsigned int numVertices = (unsigned int)vertices.size() / 3;

 [GLTFWriter::Attribute](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_attribute.xhtml) *vertex = GLTFWriter::Attribute::Create(gltf, "POSITION", GLTFWriter::Attribute::AT_FLOAT_VEC3, numVertices, &amp;vertices[0]);

 

 // INDICES

 <a id="_a22" name="_a22"></a>[GLTFWriter::Index](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_index.xhtml) *index = GLTFWriter::Index::Create(gltf, (unsigned int)triangles.size(), &amp;triangles[0]);

 

 // TEXCOORD ATTRIBUTE

 [GLTFWriter::Attribute](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_attribute.xhtml) *texCoord = GLTFWriter::Attribute::Create(gltf, "TEXCOORD0", GLTFWriter::Attribute::AT_FLOAT_VEC2, numVertices, &amp;texCoords[0]);

 

 // NORMAL ATTRIBUTE

 [GLTFWriter::Attribute](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_attribute.xhtml) *normal = GLTFWriter::Attribute::Create(gltf, "NORMAL", GLTFWriter::Attribute::AT_FLOAT_VEC3, numVertices, &amp;normals[0]);

 

 // PRIMITIVE

 <a id="_a23" name="_a23"></a>[GLTFWriter::Primitive](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_primitive.xhtml) *primitive = GLTFWriter::Primitive::Create(gltf, GLTFWriter::Primitive::PT_TRIANGLES, material, index);

 if (!primitive ||

 !primitive-&gt;<a id="a24" name="a24"></a>[AppendAttribute](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_primitive.xhtml#ac4144b4cc35eec9c11b07cc7352d209e)(vertex) ||

 !primitive-&gt;[AppendAttribute](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_primitive.xhtml#ac4144b4cc35eec9c11b07cc7352d209e)(normal) ||

 !primitive-&gt;[AppendAttribute](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_primitive.xhtml#ac4144b4cc35eec9c11b07cc7352d209e)(texCoord) ||

 !mesh-&gt;<a id="a25" name="a25"></a>[AppendPrimitive](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_mesh.xhtml#afb99ec25e2eebb4390c17f8770e4c23b)(primitive)) {

 GLTFWriter::GLTF::Destroy(gltf);

 throw std::runtime_error("Can't create primitive");

 }

 

 animation-&gt;<a id="a26" name="a26"></a>[AppendChannel](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_animation.xhtml#a3963dbc5049f56224031b9d748f5ecfa)(sampler, node, "matrix");

 }

 

 if (!gltf-&gt;<a id="a27" name="a27"></a>[Write](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_g_l_t_f.xhtml#a0bf3a4ec615dc8810776dd82a65eba91)()) {

 GLTFWriter::GLTF::Destroy(gltf);

 throw std::runtime_error("Error creating file");

 }

 

 [GLTFWriter::GLTF::GLTFError](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_g_l_t_f.xhtml#a5b8141dc8536bc10d1a72996ad6f98b4) error = gltf-&gt;<a id="a28" name="a28"></a>[GetError](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_g_l_t_f.xhtml#a63295f8f31619517e94cf27d3a8b9ea8)();

 

 GLTFWriter::GLTF::Destroy(gltf);

 

 if (error != GLTFWriter::GLTF::GLTF_ERROR_NONE)

 throw std::runtime_error("Error creating file");

}

[ANSYS::AVZ::GLTFWriter::AnimationSampler](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_animation_sampler.xhtml)

Animation samplers define mechanisms for defining how animation channels change over time.

**Definition:** [GLTFAnimation.h:35](_g_l_t_f_animation_8h_source.xhtml#l00034)



[ANSYS::AVZ::GLTFWriter::Animation](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_animation.xhtml)

Animations define mechanisms for changing over time, node properties and material values.

**Definition:** [GLTFAnimation.h:69](_g_l_t_f_animation_8h_source.xhtml#l00068)



[ANSYS::AVZ::GLTFWriter::Animation::AppendChannel](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_animation.xhtml#a3963dbc5049f56224031b9d748f5ecfa)

virtual bool AppendChannel(AnimationSampler *sampler, Node *target, const char *path)=0



[ANSYS::AVZ::GLTFWriter::Attribute](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_attribute.xhtml)

Attributes define the per element index values for elements defined by Index.

**Definition:** [GLTFAttribute.h:32](_g_l_t_f_attribute_8h_source.xhtml#l00031)



[ANSYS::AVZ::GLTFWriter::Camera](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_camera.xhtml)

Cameras define an orthographic or perspective projection of the scene.

**Definition:** [GLTFCamera.h:28](_g_l_t_f_camera_8h_source.xhtml#l00027)



[ANSYS::AVZ::GLTFWriter::GLTF](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_g_l_t_f.xhtml)

This is the main class of the GLTFWriter.

**Definition:** [GLTFGLTF.h:32](_g_l_t_f_g_l_t_f_8h_source.xhtml#l00031)



[ANSYS::AVZ::GLTFWriter::GLTF::Write](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_g_l_t_f.xhtml#a0bf3a4ec615dc8810776dd82a65eba91)

virtual bool Write(bool formatJSON=false)=0



[ANSYS::AVZ::GLTFWriter::GLTF::GLTFError](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_g_l_t_f.xhtml#a5b8141dc8536bc10d1a72996ad6f98b4)

GLTFError

**Definition:** [GLTFGLTF.h:35](_g_l_t_f_g_l_t_f_8h_source.xhtml#l00035)



[ANSYS::AVZ::GLTFWriter::GLTF::GetError](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_g_l_t_f.xhtml#a63295f8f31619517e94cf27d3a8b9ea8)

virtual GLTFError GetError()=0



[ANSYS::AVZ::GLTFWriter::Index](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_index.xhtml)

Indexes define elements within primitives.

**Definition:** [GLTFIndex.h:29](_g_l_t_f_index_8h_source.xhtml#l00028)



[ANSYS::AVZ::GLTFWriter::Light](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_light.xhtml)

Lights define the light objects that can be added to a light node.

**Definition:** [GLTFLight.h:31](_g_l_t_f_light_8h_source.xhtml#l00030)



[ANSYS::AVZ::GLTFWriter::Material](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_material.xhtml)

Materials describe how primitives are rendered.

**Definition:** [GLTFMaterial.h:30](_g_l_t_f_material_8h_source.xhtml#l00029)



[ANSYS::AVZ::GLTFWriter::Material::AppendValue](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_material.xhtml#a2f8a41e41af7d9b8cd498506f6510dd7)

virtual bool AppendValue(Value *value)=0



[ANSYS::AVZ::GLTFWriter::Mesh](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_mesh.xhtml)

Meshes define the renderable objects that can be added to a node.

**Definition:** [GLTFMesh.h:104](_g_l_t_f_mesh_8h_source.xhtml#l00103)



[ANSYS::AVZ::GLTFWriter::Mesh::AppendPrimitive](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_mesh.xhtml#afb99ec25e2eebb4390c17f8770e4c23b)

virtual bool AppendPrimitive(Primitive *primitive)=0



[ANSYS::AVZ::GLTFWriter::Node](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_node.xhtml)

Nodes are the GLTFWriter class that contain the data that is defined in the GLTF file.

**Definition:** [GLTFNode.h:31](_g_l_t_f_node_8h_source.xhtml#l00030)



[ANSYS::AVZ::GLTFWriter::Node::AppendLight](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_node.xhtml#a576db36280a02127b5eb662f0566543b)

virtual bool AppendLight(Light *light)=0



[ANSYS::AVZ::GLTFWriter::Node::AppendMesh](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_node.xhtml#a68c9eec5fe03405e52b3558a62f8faec)

virtual bool AppendMesh(Mesh *mesh)=0



[ANSYS::AVZ::GLTFWriter::Primitive](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_primitive.xhtml)

Primitives are the renderable parts of meshes.

**Definition:** [GLTFMesh.h:30](_g_l_t_f_mesh_8h_source.xhtml#l00029)



[ANSYS::AVZ::GLTFWriter::Primitive::AppendAttribute](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_primitive.xhtml#ac4144b4cc35eec9c11b07cc7352d209e)

virtual bool AppendAttribute(Attribute *attribute)=0



[ANSYS::AVZ::GLTFWriter::Program](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_program.xhtml)

Programs are the GLSL executable code for rendering the primitives.

**Definition:** [GLTFProgram.h:28](_g_l_t_f_program_8h_source.xhtml#l00027)



[ANSYS::AVZ::GLTFWriter::Scene](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_scene.xhtml)

Scenes are the GLTFWriter class that create the view of the data that is defined in the GLTF file.

**Definition:** [GLTFScene.h:29](_g_l_t_f_scene_8h_source.xhtml#l00028)



[ANSYS::AVZ::GLTFWriter::Scene::AppendMesh](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_scene.xhtml#a76e34d4c05fe34dde0fcc4913ad63981)

virtual bool AppendMesh(Node *mesh)=0



[ANSYS::AVZ::GLTFWriter::Scene::SetLight](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_scene.xhtml#ac92acb916999693ccaaefe8a81962c67)

virtual bool SetLight(Node *light)=0



[ANSYS::AVZ::GLTFWriter::Scene::SetCamera](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_scene.xhtml#ae84fba7ea3c00159c2eae7adbfbfa61d)

virtual bool SetCamera(Node *camera)=0



[ANSYS::AVZ::GLTFWriter::Shader](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_shader.xhtml)

Shaders are the GLSL executable code for vertex and fragment.

**Definition:** [GLTFShader.h:26](_g_l_t_f_shader_8h_source.xhtml#l00025)



[ANSYS::AVZ::GLTFWriter::Technique](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_technique.xhtml)

Techniques performs the rendering of primitives.

**Definition:** [GLTFTechnique.h:240](_g_l_t_f_technique_8h_source.xhtml#l00239)



[ANSYS::AVZ::GLTFWriter::Technique::AppendState](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_technique.xhtml#a8b2b0766157324d5a2093a3fca36379f)

virtual bool AppendState(State *state)=0



[ANSYS::AVZ::GLTFWriter::Technique::AppendParameter](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_technique.xhtml#ae55c184b6165d5f1ea88e3db34522ba9)

virtual bool AppendParameter(Parameter *parameter)=0



[ANSYS::AVZ::GLTFWriter::Texture](class_a_n_s_y_s_1_1_a_v_z_1_1_g_l_t_f_writer_1_1_texture.xhtml)

Textures are images that can be used to color a primitive.

**Definition:** [GLTFTexture.h:28](_g_l_t_f_texture_8h_source.xhtml#l00027)