    

 ## On this page

  

 

 # GLTFTexture

 Last update: 16.07.2025 

<a id="l00001" name="l00001"></a> 1/\*

<a id="l00002" name="l00002"></a> 2 \* Copyright 2018-2021 ANSYS, Inc. Unauthorized use, distribution, or duplication is prohibited.

<a id="l00003" name="l00003"></a> 3 \* 

<a id="l00004" name="l00004"></a> 4 \* Restricted Rights Legend

<a id="l00005" name="l00005"></a> 5 \*

<a id="l00006" name="l00006"></a> 6 \* Use, duplication, or disclosure of this

<a id="l00007" name="l00007"></a> 7 \* software and its documentation by the

<a id="l00008" name="l00008"></a> 8 \* Government is subject to restrictions as

<a id="l00009" name="l00009"></a> 9 \* set forth in subdivision \[(b)(3)(ii)\] of

<a id="l00010" name="l00010"></a> 10 \* the Rights in Technical Data and Computer

<a id="l00011" name="l00011"></a> 11 \* Software clause at 52.227-7013.

<a id="l00012" name="l00012"></a> 12 \*/

<a id="l00013" name="l00013"></a> 13\#ifndef \_\_INCLUDED\_GLTF\_GLTFTEXTURE\_\_

<a id="l00014" name="l00014"></a> 14\#define \_\_INCLUDED\_GLTF\_GLTFTEXTURE\_\_

<a id="l00015" name="l00015"></a> 15 

<a id="l00016" name="l00016"></a> 16\#include "GLTFCommon.h"

<a id="l00017" name="l00017"></a> 17\#include "GLTFObject.h"

<a id="l00018" name="l00018"></a> 18 

<a id="l00019" name="l00019"></a> 19namespace [ANSYS](namespace_a_n_s_y_s.xhtml) { namespace Nexus { namespace GLTFWriter {

<a id="l00020" name="l00020"></a> 20 class GLTF;

<a id="l00021" name="l00021"></a> 21 class Image;

<a id="l00022" name="l00022"></a> 22 class Sampler;

<a id="l00023" name="l00023"></a> 23 

<a id="l00027" name="l00027"></a>[ 27](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_texture.xhtml) class [Texture](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_texture.xhtml) : public Object

<a id="l00028" name="l00028"></a> 28 {

<a id="l00029" name="l00029"></a> 29 public:

<a id="l00031" name="l00031"></a>[ 31](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_texture.xhtml#aba6db4f52b9f0a1a866bce302b6d8964) enum [TextureFormat](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_texture.xhtml#aba6db4f52b9f0a1a866bce302b6d8964)

<a id="l00032" name="l00032"></a> 32 {

<a id="l00033" name="l00033"></a> 33// TF\_ALPHA = 6406,

<a id="l00034" name="l00034"></a>[ 34](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_texture.xhtml#aba6db4f52b9f0a1a866bce302b6d8964aaa8ea9a0e6b83932a6a882b1655e8e59) [TF\_RGB](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_texture.xhtml#aba6db4f52b9f0a1a866bce302b6d8964aaa8ea9a0e6b83932a6a882b1655e8e59) = 6407, 

<a id="l00035" name="l00035"></a> 35 [TF\_RGBA](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_texture.xhtml#aba6db4f52b9f0a1a866bce302b6d8964ab39a20cf05b8cbdd813d3278664879af) = 6408 

<a id="l00036" name="l00036"></a> 36// TF\_LUMINANCE = 6409,

<a id="l00037" name="l00037"></a> 37// TF\_LUMINANCE\_ALPHA = 6410

<a id="l00038" name="l00038"></a>[ 38](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_texture.xhtml#aba6db4f52b9f0a1a866bce302b6d8964ab39a20cf05b8cbdd813d3278664879af) };

<a id="l00039" name="l00039"></a> 39 

<a id="l00041" name="l00041"></a>[ 41](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_texture.xhtml#a97a19c95bbcdc6bbf5951636a4d70e53) enum [TextureTarget](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_texture.xhtml#a97a19c95bbcdc6bbf5951636a4d70e53)

<a id="l00042" name="l00042"></a> 42 {

<a id="l00043" name="l00043"></a> 43 [TT\_TEXTURE\_2D](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_texture.xhtml#a97a19c95bbcdc6bbf5951636a4d70e53ace1a5ae468e3deb5b78b1d5ed9f61263) = 3553 

<a id="l00044" name="l00044"></a> 44// TT\_TEXTURE\_CUBE\_MAP = 34067

<a id="l00045" name="l00045"></a>[ 45](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_texture.xhtml#a97a19c95bbcdc6bbf5951636a4d70e53ace1a5ae468e3deb5b78b1d5ed9f61263) };

<a id="l00046" name="l00046"></a> 46 

<a id="l00047" name="l00047"></a> 47 protected:

<a id="l00048" name="l00048"></a> 48 virtual [~Texture](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_texture.xhtml)() {}

<a id="l00049" name="l00049"></a> 49 

<a id="l00050" name="l00050"></a> 50 public:

<a id="l00053" name="l00053"></a>[ 53](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_texture.xhtml#a0620594b07e1f58eb9d56e317e17e15d) static GLTFWRITERSPEC [Texture](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_texture.xhtml) *[Create](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_texture.xhtml#a0620594b07e1f58eb9d56e317e17e15d)([GLTF](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_g_l_t_f.xhtml) *gltf, 

<a id="l00054" name="l00054"></a> 54 [TextureFormat](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_texture.xhtml#aba6db4f52b9f0a1a866bce302b6d8964) format, 

<a id="l00055" name="l00055"></a> 55 [TextureTarget](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_texture.xhtml#a97a19c95bbcdc6bbf5951636a4d70e53) target, 

<a id="l00056" name="l00056"></a> 56 [Sampler](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_sampler.xhtml) *sampler, 

<a id="l00057" name="l00057"></a> 57 [Image](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_image.xhtml) *image 

<a id="l00058" name="l00058"></a> 58 );

<a id="l00061" name="l00061"></a>[ 61](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_texture.xhtml#a91fb237cf671d1789553916dc9719b06) static GLTFWRITERSPEC [Texture](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_texture.xhtml) *[Create](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_texture.xhtml#a91fb237cf671d1789553916dc9719b06)([GLTF](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_g_l_t_f.xhtml) *gltf, 

<a id="l00062" name="l00062"></a> 62 [TextureFormat](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_texture.xhtml#aba6db4f52b9f0a1a866bce302b6d8964) format, 

<a id="l00063" name="l00063"></a> 63 unsigned int numColors, 

<a id="l00064" name="l00064"></a> 64 const unsigned char *colors, 

<a id="l00065" name="l00065"></a> 65 bool smooth = true, 

<a id="l00066" name="l00066"></a> 66 unsigned int numBands = 0, 

<a id="l00067" name="l00067"></a> 67 const float *bandLocations = 0 

<a id="l00068" name="l00068"></a> 68 );

<a id="l00071" name="l00071"></a>[ 71](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_texture.xhtml#a28b712b6fb29aff21e61da62fc0ac2ca) static GLTFWRITERSPEC [Texture](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_texture.xhtml) *[Create](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_texture.xhtml#a28b712b6fb29aff21e61da62fc0ac2ca)([GLTF](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_g_l_t_f.xhtml) *gltf, 

<a id="l00072" name="l00072"></a> 72 [TextureFormat](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_texture.xhtml#aba6db4f52b9f0a1a866bce302b6d8964) format, 

<a id="l00073" name="l00073"></a> 73 unsigned int width, 

<a id="l00074" name="l00074"></a> 74 unsigned int height, 

<a id="l00075" name="l00075"></a> 75 unsigned char *data 

<a id="l00076" name="l00076"></a> 76 );

<a id="l00077" name="l00077"></a> 77 };

<a id="l00078" name="l00078"></a> 78 

<a id="l00079" name="l00079"></a> 79} } }

<a id="l00080" name="l00080"></a> 80 

<a id="l00081" name="l00081"></a> 81\#endif

[ANSYS::Nexus::GLTFWriter::GLTF](class_a_n_s_y_s_1_1_nexus_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::Nexus::GLTFWriter::Image](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_image.xhtml)

Images define texture data.

**Definition:** [GLTFImage.h:27](_g_l_t_f_image_8h_source.xhtml#l00026)



[ANSYS::Nexus::GLTFWriter::Sampler](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_sampler.xhtml)

Samplers define how values are generated from textures with the give texture coordinates.

**Definition:** [GLTFSampler.h:26](_g_l_t_f_sampler_8h_source.xhtml#l00025)



[ANSYS::Nexus::GLTFWriter::Texture](class_a_n_s_y_s_1_1_nexus_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)



[ANSYS::Nexus::GLTFWriter::Texture::Create](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_texture.xhtml#a0620594b07e1f58eb9d56e317e17e15d)

static Texture * Create(GLTF *gltf, TextureFormat format, TextureTarget target, Sampler *sampler, Image *image)



[ANSYS::Nexus::GLTFWriter::Texture::Create](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_texture.xhtml#a28b712b6fb29aff21e61da62fc0ac2ca)

static Texture * Create(GLTF *gltf, TextureFormat format, unsigned int width, unsigned int height, unsigned char *data)



[ANSYS::Nexus::GLTFWriter::Texture::Create](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_texture.xhtml#a91fb237cf671d1789553916dc9719b06)

static Texture * Create(GLTF *gltf, TextureFormat format, unsigned int numColors, const unsigned char *colors, bool smooth=true, unsigned int numBands=0, const float *bandLocations=0)



[ANSYS::Nexus::GLTFWriter::Texture::TextureTarget](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_texture.xhtml#a97a19c95bbcdc6bbf5951636a4d70e53)

TextureTarget

**Definition:** [GLTFTexture.h:42](_g_l_t_f_texture_8h_source.xhtml#l00041)



[ANSYS::Nexus::GLTFWriter::Texture::TT\_TEXTURE\_2D](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_texture.xhtml#a97a19c95bbcdc6bbf5951636a4d70e53ace1a5ae468e3deb5b78b1d5ed9f61263)

@ TT_TEXTURE_2D

texture is 2 dimensional.

**Definition:** [GLTFTexture.h:43](_g_l_t_f_texture_8h_source.xhtml#l00045)



[ANSYS::Nexus::GLTFWriter::Texture::TextureFormat](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_texture.xhtml#aba6db4f52b9f0a1a866bce302b6d8964)

TextureFormat

**Definition:** [GLTFTexture.h:32](_g_l_t_f_texture_8h_source.xhtml#l00031)



[ANSYS::Nexus::GLTFWriter::Texture::TF\_RGB](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_texture.xhtml#aba6db4f52b9f0a1a866bce302b6d8964aaa8ea9a0e6b83932a6a882b1655e8e59)

@ TF_RGB

3 unsigned chars per pixel.

**Definition:** [GLTFTexture.h:34](_g_l_t_f_texture_8h_source.xhtml#l00034)



[ANSYS::Nexus::GLTFWriter::Texture::TF\_RGBA](class_a_n_s_y_s_1_1_nexus_1_1_g_l_t_f_writer_1_1_texture.xhtml#aba6db4f52b9f0a1a866bce302b6d8964ab39a20cf05b8cbdd813d3278664879af)

@ TF_RGBA

4 unsigned chars per pixel.

**Definition:** [GLTFTexture.h:35](_g_l_t_f_texture_8h_source.xhtml#l00038)



[ANSYS](namespace_a_n_s_y_s.xhtml)

GLTFWriter API Documentation.

**Definition:** [GLTFAnimation.h:19](_g_l_t_f_animation_8h_source.xhtml#l00019)