    

 ## On this page

  

 

 # Test006

 Last update: 16.07.2025 

Animation.

This example shows how to add animation to a scene. Animations involve creating samplers that describe values of properties at defined times. The ANSYSViewer interpolates the property to generate values at times that fall between the defined times. The samplers are added to the animation as channels. The channels defined which property to animate.

Only some properties can be animated:

- node - matrix
- node - visible
- material - Any value

In this example the matrix property and visible property of nodes are changed along with the color value of a material. &lt;script src="/ansys/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::Nexus;

 

// Simple creation of animated lighted solid color box

TESTFUNC(Animation)

{

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

 if (!gltf)

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

 

 // SCENE

 GLTFWriter::Scene *scene = <a id="a1" name="a1"></a>[GLTFWriter::Scene::Create](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_scene.xhtml#aac8bcb85d4361abba99053b3c56eb08b)(gltf, "TestScene", "m", 1.0, <a id="a2" name="a2"></a>[GLTFWriter::Scene::BT\_SOLID](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_scene.xhtml#ac17baf491cdba3613b0aa39719a3dbd8aeea551002921bb989b3ed35678ec982b), 0.5, 0.5, 0.5);

 if (!scene) {

 <a id="a3" name="a3"></a>[GLTFWriter::GLTF::Destroy](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_g_l_t_f.xhtml#a586171eb8e873e909db02a7eb4d80f5c)(gltf);

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

 }

 

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

 if (!animation) {

 [GLTFWriter::GLTF::Destroy](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_g_l_t_f.xhtml#a586171eb8e873e909db02a7eb4d80f5c)(gltf);

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

 }

 

 // create a reusable time

 GLTFWriter::Attribute *time1 = 0;

 {

 float _time[3];

 unsigned int i = 0;

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

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

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

 time1 = <a id="a5" name="a5"></a>[GLTFWriter::Attribute::Create](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_attribute.xhtml#a74b97d3bfc2585fe4d67a663a79abfa1)(gltf, "TIME", <a id="a6" name="a6"></a>[GLTFWriter::Attribute::AT\_FLOAT](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_attribute.xhtml#aa787c451052ac912fd9af91c4ff54ddba6d124c894e5bdc043eeebec0f852e857), 3, _time);

 }

 

 // ANIMATION SAMPLER1 for sampling matrix

 GLTFWriter::AnimationSampler *sampler1 = 0;

 {

 float _mat[3 * 16];

 unsigned int i = 0;

 

 // time 0

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

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

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

 

 // time 1

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

 GLTFWriter::Test::Matrix4 t2;

 t2.LoadTranslate(GLTFWriter::Test::Vector3(0, 0, 0));

 m2 *= t2;

 GLTFWriter::Test::Matrix4 r2;

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

 m2 *= r2;

 GLTFWriter::Test::Matrix4 s2;

 s2.LoadScale(GLTFWriter::Test::Vector3(1, 1, 1));

 m2 *= s2;

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

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

 

 // time 2

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

 GLTFWriter::Test::Matrix4 t3;

 t3.LoadTranslate(GLTFWriter::Test::Vector3(0, 0, 0));

 m3 *= t3;

 GLTFWriter::Test::Matrix4 r3;

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

 m3 *= r3;

 GLTFWriter::Test::Matrix4 s3;

 s3.LoadScale(GLTFWriter::Test::Vector3(1, 1, 1));

 m3 *= s3;

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

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

 

 GLTFWriter::Attribute *matrix = [GLTFWriter::Attribute::Create](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_attribute.xhtml#a74b97d3bfc2585fe4d67a663a79abfa1)(gltf, "MATRIX", <a id="a7" name="a7"></a>[GLTFWriter::Attribute::AT\_FLOAT\_MAT4](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_attribute.xhtml#aa787c451052ac912fd9af91c4ff54ddba13e136aa2ada6dbe9a5253695b6abf65), 3, _mat);

 

 sampler1 = <a id="a8" name="a8"></a>[GLTFWriter::AnimationSampler::Create](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_animation_sampler.xhtml#a2afd0c2eb27fa32e2ae6773a88139a26)(gltf, time1, matrix);

 }

 // ANIMATION SAMPLER2 for sampling matrix

 GLTFWriter::AnimationSampler *sampler2 = 0;

 {

 float _mat[3 * 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 t1;

 t1.LoadTranslate(GLTFWriter::Test::Vector3(0, 0, 0));

 m1 *= t1;

 GLTFWriter::Test::Matrix4 r1;

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

 m1 *= r1;

 GLTFWriter::Test::Matrix4 s1;

 s1.LoadScale(GLTFWriter::Test::Vector3(3, 3, 3));

 m1 *= s1;

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

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

 

 // time 2

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

 GLTFWriter::Test::Matrix4 t2;

 t2.LoadTranslate(GLTFWriter::Test::Vector3(0, 0, 0));

 m2 *= t2;

 GLTFWriter::Test::Matrix4 r2;

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

 m2 *= r2;

 GLTFWriter::Test::Matrix4 s2;

 s2.LoadScale(GLTFWriter::Test::Vector3(1, 1, 1));

 m2 *= s2;

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

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

 

 GLTFWriter::Attribute *matrix = [GLTFWriter::Attribute::Create](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_attribute.xhtml#a74b97d3bfc2585fe4d67a663a79abfa1)(gltf, "MATRIX", [GLTFWriter::Attribute::AT\_FLOAT\_MAT4](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_attribute.xhtml#aa787c451052ac912fd9af91c4ff54ddba13e136aa2ada6dbe9a5253695b6abf65), 3, _mat);

 

 sampler2 = [GLTFWriter::AnimationSampler::Create](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_animation_sampler.xhtml#a2afd0c2eb27fa32e2ae6773a88139a26)(gltf, time1, matrix);

 }

 // ANIMATION SAMPLER3 for sampling color

 GLTFWriter::AnimationSampler *sampler3 = 0;

 {

 float _time[3];

 unsigned int i = 0;

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

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

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

 GLTFWriter::Attribute *time = [GLTFWriter::Attribute::Create](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_attribute.xhtml#a74b97d3bfc2585fe4d67a663a79abfa1)(gltf, "TIME", [GLTFWriter::Attribute::AT\_FLOAT](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_attribute.xhtml#aa787c451052ac912fd9af91c4ff54ddba6d124c894e5bdc043eeebec0f852e857), 3, _time);

 

 float _col[3 * 4];

 i = 0;

 

 // time 0

 _col[i++] = 1;

 _col[i++] = 0;

 _col[i++] = 0;

 _col[i++] = 0.5;

 

 // time 1

 _col[i++] = 1;

 _col[i++] = 1;

 _col[i++] = 0;

 _col[i++] = 0.75;

 

 // time 2

 _col[i++] = 0;

 _col[i++] = 1;

 _col[i++] = 0;

 _col[i++] = 1;

 

 GLTFWriter::Attribute *color = [GLTFWriter::Attribute::Create](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_attribute.xhtml#a74b97d3bfc2585fe4d67a663a79abfa1)(gltf, "COLOR", <a id="a9" name="a9"></a>[GLTFWriter::Attribute::AT\_FLOAT\_VEC4](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_attribute.xhtml#aa787c451052ac912fd9af91c4ff54ddba5af14585a5eb16f52089b1baf55db718), 3, _col);

 

 sampler3 = [GLTFWriter::AnimationSampler::Create](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_animation_sampler.xhtml#a2afd0c2eb27fa32e2ae6773a88139a26)(gltf, time, color);

 }

 // ANIMATION SAMPLER4 for sampling visibility

 GLTFWriter::AnimationSampler *sampler4 = 0;

 {

 float _time[2];

 unsigned int i = 0;

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

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

 GLTFWriter::Attribute *time = [GLTFWriter::Attribute::Create](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_attribute.xhtml#a74b97d3bfc2585fe4d67a663a79abfa1)(gltf, "TIME", [GLTFWriter::Attribute::AT\_FLOAT](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_attribute.xhtml#aa787c451052ac912fd9af91c4ff54ddba6d124c894e5bdc043eeebec0f852e857), 2, _time);

 

 int _vis[2];

 i = 0;

 

 // time 0

 _vis[i++] = 1;

 

 // time 1

 _vis[i++] = 0;

 

 GLTFWriter::Attribute *visibility = [GLTFWriter::Attribute::Create](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_attribute.xhtml#a74b97d3bfc2585fe4d67a663a79abfa1)(gltf, "VISIBILITY", <a id="a10" name="a10"></a>[GLTFWriter::Attribute::AT\_INT](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_attribute.xhtml#aa787c451052ac912fd9af91c4ff54ddba61b89340f40b606720433dcd8da573e4), 2, _vis);

 

 sampler4 = [GLTFWriter::AnimationSampler::Create](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_animation_sampler.xhtml#a2afd0c2eb27fa32e2ae6773a88139a26)(gltf, time, visibility);

 }

 

 // LIGHTS

 {

 // LIGHT NODE

 GLTFWriter::Node *lightNode = <a id="a11" name="a11"></a>[GLTFWriter::Node::CreateLight](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_node.xhtml#a7883624afdcaae45b6018944a040a01c)(gltf);

 if (!lightNode || !scene-&gt;SetLight(lightNode)) {

 [GLTFWriter::GLTF::Destroy](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_g_l_t_f.xhtml#a586171eb8e873e909db02a7eb4d80f5c)(gltf);

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

 }

 

 // LIGHTS

 GLTFWriter::Light *light1 = <a id="a12" name="a12"></a>[GLTFWriter::Light::CreateAmbient](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_light.xhtml#a14a825d32570498d64b6a427fb4f8207)(gltf);

 lightNode-&gt;AppendLight(light1);

 

 GLTFWriter::Light *light2 = <a id="a13" name="a13"></a>[GLTFWriter::Light::CreateDirectional](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_light.xhtml#aa54e23609ac5f7a1a6808b62ee48163d)(gltf, 1, 1, 1, -1, -1, -3);

 lightNode-&gt;AppendLight(light2);

 }

 

 // CAMERA

 {

 // CAMERA

 GLTFWriter::Camera *camera = <a id="a14" name="a14"></a>[GLTFWriter::Camera::CreateOrthographic](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_camera.xhtml#acab0b8344a7bb8b65c9690d221705377)(gltf);

 // CAMERA 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 *cameraNode = <a id="a15" name="a15"></a>[GLTFWriter::Node::CreateCamera](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_node.xhtml#af6c4767cc8271d9d39816d278538197a)(gltf, camera, "TestCamera", &amp;mat[0]);

 scene-&gt;SetCamera(cameraNode);

 }

 

 // 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 *node = <a id="a16" name="a16"></a>[GLTFWriter::Node::CreateMesh](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_node.xhtml#a4dd14791b2b9e65c115aa7a9e3f340e8)(gltf, "3D Box 1 with an extremely really long meaningless name", false, &amp;mat[0]);

 if (!node || !scene-&gt;AppendMesh(node)) {

 [GLTFWriter::GLTF::Destroy](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_g_l_t_f.xhtml#a586171eb8e873e909db02a7eb4d80f5c)(gltf);

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

 }

 

 // MESH

 GLTFWriter::Mesh *mesh = <a id="a17" name="a17"></a>[GLTFWriter::Mesh::Create](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_mesh.xhtml#a9f7803b1b1eb72e4005665ca33f42788)(gltf);

 if (!mesh || !node-&gt;AppendMesh(mesh)) {

 [GLTFWriter::GLTF::Destroy](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_g_l_t_f.xhtml#a586171eb8e873e909db02a7eb4d80f5c)(gltf);

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

 }

 

 // PRIMITIVE

 std::pair&lt;GLTFWriter::Primitive *, GLTFWriter::Material *&gt; pm = GLTFWriter::Test::CreateSolidColoredBoxPrimitive(gltf, -1, 0, 0, 1, 1, 1, 1, 0, 0, 0.5);

 mesh-&gt;AppendPrimitive(pm.first);

 

 animation-&gt;AppendChannel(sampler1, node, "matrix");

 animation-&gt;AppendChannel(sampler3, pm.second, "color");

 animation-&gt;AppendChannel(sampler4, node, "visible");

 }

 

 // MESH NODE

 {

 GLTFWriter::Test::Matrix4 mat; // identity

 mat.LoadTranslate(GLTFWriter::Test::Vector3(1, 0, 0));

 

 // NODE

 GLTFWriter::Node *node = [GLTFWriter::Node::CreateMesh](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_node.xhtml#a4dd14791b2b9e65c115aa7a9e3f340e8)(gltf, "3D Box 2", true, &amp;(mat.Get())[0]);

 if (!node || !scene-&gt;AppendMesh(node)) {

 [GLTFWriter::GLTF::Destroy](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_g_l_t_f.xhtml#a586171eb8e873e909db02a7eb4d80f5c)(gltf);

 throw std::runtime_error("Can't create 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 *n = [GLTFWriter::Node::CreateMesh](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_node.xhtml#a4dd14791b2b9e65c115aa7a9e3f340e8)(gltf, "", true, &amp;mat[0]);

 if (!n || !node-&gt;AppendChild(n)) {

 [GLTFWriter::GLTF::Destroy](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_g_l_t_f.xhtml#a586171eb8e873e909db02a7eb4d80f5c)(gltf);

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

 }

 

 // MESH

 GLTFWriter::Mesh *mesh = [GLTFWriter::Mesh::Create](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_mesh.xhtml#a9f7803b1b1eb72e4005665ca33f42788)(gltf);

 if (!mesh || !n-&gt;AppendMesh(mesh)) {

 [GLTFWriter::GLTF::Destroy](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_g_l_t_f.xhtml#a586171eb8e873e909db02a7eb4d80f5c)(gltf);

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

 }

 

 // PRIMITIVE

 std::pair&lt;GLTFWriter::Primitive *, GLTFWriter::Material *&gt; pm = GLTFWriter::Test::CreateSolidColoredBoxPrimitive(gltf, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0.5);

 mesh-&gt;AppendPrimitive(pm.first);

 

 animation-&gt;AppendChannel(sampler2, n, "matrix");

 }

 }

 

 // MESH NODE

 {

 // NODE

 GLTFWriter::Node *node = [GLTFWriter::Node::CreateMesh](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_node.xhtml#a4dd14791b2b9e65c115aa7a9e3f340e8)(gltf, "3D Box 3");

 if (!node || !scene-&gt;AppendMesh(node)) {

 [GLTFWriter::GLTF::Destroy](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_g_l_t_f.xhtml#a586171eb8e873e909db02a7eb4d80f5c)(gltf);

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

 }

 

 // MESH

 GLTFWriter::Mesh *mesh = [GLTFWriter::Mesh::Create](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_mesh.xhtml#a9f7803b1b1eb72e4005665ca33f42788)(gltf);

 if (!mesh || !node-&gt;AppendMesh(mesh)) {

 [GLTFWriter::GLTF::Destroy](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_g_l_t_f.xhtml#a586171eb8e873e909db02a7eb4d80f5c)(gltf);

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

 }

 

 // PRIMITIVE

 std::pair&lt;GLTFWriter::Primitive *, GLTFWriter::Material *&gt; pm = GLTFWriter::Test::CreateSolidColoredBoxPrimitive(gltf, 0, 0, 0, 3, 1, 2, 1, 0.5, 0, 0.25);

 mesh-&gt;AppendPrimitive(pm.first);

 }

 

 if (!gltf-&gt;Write()) {

 [GLTFWriter::GLTF::Destroy](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_g_l_t_f.xhtml#a586171eb8e873e909db02a7eb4d80f5c)(gltf);

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

 }

 

 <a id="a18" name="a18"></a>[GLTFWriter::GLTF::GLTFError](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_g_l_t_f.xhtml#acf83a4d185d959503cb9f3f2c2e9fafe) error = gltf-&gt;GetError();

 

 [GLTFWriter::GLTF::Destroy](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_g_l_t_f.xhtml#a586171eb8e873e909db02a7eb4d80f5c)(gltf);

 

 if (error != <a id="a19" name="a19"></a>[GLTFWriter::GLTF::GLTF\_ERROR\_NONE](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_g_l_t_f.xhtml#acf83a4d185d959503cb9f3f2c2e9fafea049c3b804e69ae05c02f4c2dedf4e0ea))

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

}

[ANSYS::Nexus::GLTFWriter::AnimationSampler::Create](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_animation_sampler.xhtml#a2afd0c2eb27fa32e2ae6773a88139a26)

static AnimationSampler * Create(GLTF *gltf, Attribute *input, Attribute *output, AnimationSamplerType type=AST_LINEAR)



[ANSYS::Nexus::GLTFWriter::Animation::Create](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_animation.xhtml#a7b04ab1754e0cba0a61952a88534ffa0)

static Animation * Create(GLTF *gltf, const char *name=0)



[ANSYS::Nexus::GLTFWriter::Attribute::Create](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_attribute.xhtml#a74b97d3bfc2585fe4d67a663a79abfa1)

static Attribute * Create(GLTF *gltf, const char *name, AttributeType type, unsigned int count, const int *data, Buffer *buffer=0)



[ANSYS::Nexus::GLTFWriter::Attribute::AT\_FLOAT\_MAT4](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_attribute.xhtml#aa787c451052ac912fd9af91c4ff54ddba13e136aa2ada6dbe9a5253695b6abf65)

@ AT_FLOAT_MAT4

4x4 (16) AT_FLOATs

**Definition:** [GLTFAttribute.h:47](_g_l_t_f_attribute_8h_source.xhtml#l00048)



[ANSYS::Nexus::GLTFWriter::Attribute::AT\_FLOAT\_VEC4](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_attribute.xhtml#aa787c451052ac912fd9af91c4ff54ddba5af14585a5eb16f52089b1baf55db718)

@ AT_FLOAT_VEC4

4 AT_FLOATs

**Definition:** [GLTFAttribute.h:45](_g_l_t_f_attribute_8h_source.xhtml#l00045)



[ANSYS::Nexus::GLTFWriter::Attribute::AT\_INT](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_attribute.xhtml#aa787c451052ac912fd9af91c4ff54ddba61b89340f40b606720433dcd8da573e4)

@ AT_INT

4 byte integer

**Definition:** [GLTFAttribute.h:40](_g_l_t_f_attribute_8h_source.xhtml#l00040)



[ANSYS::Nexus::GLTFWriter::Attribute::AT\_FLOAT](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_attribute.xhtml#aa787c451052ac912fd9af91c4ff54ddba6d124c894e5bdc043eeebec0f852e857)

@ AT_FLOAT

4 byte float

**Definition:** [GLTFAttribute.h:42](_g_l_t_f_attribute_8h_source.xhtml#l00042)



[ANSYS::Nexus::GLTFWriter::Camera::CreateOrthographic](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_camera.xhtml#acab0b8344a7bb8b65c9690d221705377)

static Camera * CreateOrthographic(GLTF *gltf, const char *name=0, float xmag=1, float ymag=1, float zfar=1000, float znear=-1000)



[ANSYS::Nexus::GLTFWriter::GLTF::Destroy](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_g_l_t_f.xhtml#a586171eb8e873e909db02a7eb4d80f5c)

static void Destroy(GLTF *gltf)



[ANSYS::Nexus::GLTFWriter::GLTF::Create](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_g_l_t_f.xhtml#ab7ba6d114c76cb60baf41aa6f13e9494)

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



[ANSYS::Nexus::GLTFWriter::GLTF::GLTFError](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_g_l_t_f.xhtml#acf83a4d185d959503cb9f3f2c2e9fafe)

GLTFError

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



[ANSYS::Nexus::GLTFWriter::GLTF::GLTF\_ERROR\_NONE](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_g_l_t_f.xhtml#acf83a4d185d959503cb9f3f2c2e9fafea049c3b804e69ae05c02f4c2dedf4e0ea)

@ GLTF_ERROR_NONE

No Error.

**Definition:** [GLTFGLTF.h:36](_g_l_t_f_g_l_t_f_8h_source.xhtml#l00036)



[ANSYS::Nexus::GLTFWriter::Light::CreateAmbient](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_light.xhtml#a14a825d32570498d64b6a427fb4f8207)

static Light * CreateAmbient(GLTF *gltf, float colR=0.3, float colG=0.3, float colB=0.3)



[ANSYS::Nexus::GLTFWriter::Light::CreateDirectional](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_light.xhtml#aa54e23609ac5f7a1a6808b62ee48163d)

static Light * CreateDirectional(GLTF *gltf, float colR=1, float colG=1, float colB=1, float dirX=0, float dirY=0, float dirZ=-1, float specColR=1, float specColG=1, float specColB=1, float shininess=100)



[ANSYS::Nexus::GLTFWriter::Mesh::Create](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_mesh.xhtml#a9f7803b1b1eb72e4005665ca33f42788)

static Mesh * Create(GLTF *gltf)



[ANSYS::Nexus::GLTFWriter::Node::CreateMesh](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_node.xhtml#a4dd14791b2b9e65c115aa7a9e3f340e8)

static Node * CreateMesh(GLTF *gltf, const char *name=0, bool visible=true, const double *matrix=0)



[ANSYS::Nexus::GLTFWriter::Node::CreateLight](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_node.xhtml#a7883624afdcaae45b6018944a040a01c)

static Node * CreateLight(GLTF *gltf)



[ANSYS::Nexus::GLTFWriter::Node::CreateCamera](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_node.xhtml#af6c4767cc8271d9d39816d278538197a)

static Node * CreateCamera(GLTF *gltf, Camera *camera, const char *name=0, const double *matrix=0)



[ANSYS::Nexus::GLTFWriter::Scene::Create](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_scene.xhtml#aac8bcb85d4361abba99053b3c56eb08b)

static Scene * Create(GLTF *gltf, const char *name=0, const char *units=0, float scale=1, Scene::BackgroundType backgroundType=Scene::BT_NONE, float r1=0, float g1=0, float b1=0, float r2=0, float g2=0, float b2=0)



[ANSYS::Nexus::GLTFWriter::Scene::BT\_SOLID](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_scene.xhtml#ac17baf491cdba3613b0aa39719a3dbd8aeea551002921bb989b3ed35678ec982b)

@ BT_SOLID

Make solid color from color 1.

**Definition:** [GLTFScene.h:35](_g_l_t_f_scene_8h_source.xhtml#l00035)