Skip to main content

Post-processing tools 2023 R2

ANSYS::Nexus::GLTFWriter::Texture Class Reference

Last update: 17.04.2023

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

#include <GLTFWriter.h>

Inheritance diagram for ANSYS::Nexus::GLTFWriter::Texture:

Public Types

enum  TextureFormat { TF_RGB = 6407 , TF_RGBA = 6408 }
 
enum  TextureTarget { TT_TEXTURE_2D = 3553 }
 

Static Public Member Functions

static TextureCreate (GLTF *gltf, TextureFormat format, TextureTarget target, Sampler *sampler, Image *image)
 
static TextureCreate (GLTF *gltf, TextureFormat format, unsigned int numColors, const unsigned char *colors, bool smooth=true, unsigned int numBands=0, const float *bandLocations=0)
 
static TextureCreate (GLTF *gltf, TextureFormat format, unsigned int width, unsigned int height, unsigned char *data)
 

Detailed Description

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

Definition at line 27 of file GLTFTexture.h.

Member Enumeration Documentation

◆ TextureFormat

Format of image data or color data

Enumerator
TF_RGB 

3 unsigned chars per pixel.

TF_RGBA 

4 unsigned chars per pixel.

Definition at line 31 of file GLTFTexture.h.

◆ TextureTarget

Texture targets

Enumerator
TT_TEXTURE_2D 

texture is 2 dimensional.

Definition at line 41 of file GLTFTexture.h.

Member Function Documentation

◆ Create() [1/3]

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

Creates a texture from an Image and Sampler.

Returns
Texture object. Do not delete this pointer.
Parameters
[in]gltfGLTF object.
[in]formatTexture::TextureFormat describing image data.
[in]targetMust be Texture::TextureTarget = TT_TEXTURE_2D.
[in]samplerSampler object.
[in]imageImage object.
Examples
Test001.cpp, Test002.cpp, Test005.cpp, Test009.cpp, Test013.cpp, and Test014.cpp.

◆ Create() [2/3]

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

Creates a texture from a 1D array of colors. Colors are linearly (not logaritmically) interpolated. The Sampler and Image are created internally.

Returns
Texture object. Do not delete this pointer.
Parameters
[in]gltfGLTF object.
[in]formatTexture::TextureFormat describing color data.
[in]numColorsNumber of colors in colors.
[in]colors1D array of RGB or RGBA tuple of colors.
[in]smoothOptional, flag indicating whether to create banded texture or smooth gradient texture.
[in]numBandsOptional, If smooth is false, indicates number of bands to create from colors
[in]bandLocationsOptional, If smooth is false, indicates locations of start of band within texture, specified as fraction from 0 to 1. bandLocation size is specified by numBands.

◆ Create() [3/3]

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

Creates a texture from a 2D array of colors. The Sampler and Image are created internally.

Returns
Texture object. Do not delete this pointer.
Parameters
[in]gltfGLTF object.
[in]formatTexture::TextureFormat describing color array data.
[in]widthWidth of image data.
[in]heightHeight of image data.
[in]data2D array of RGB or RGBA tuple of colors

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