# class Texture

Texture describes a texture object, containing either image data or a path that is referenced by texture nodes in materials.

# Properties

Property Description
ColorSpace Used to override how Simplygon interprets the color space of the texture. Set to Undefined to not override, and let the color space be defined by the underlying image data object.
FilePath The file path of the texture. This path has two meanings: It can point to an existing file to use as image data for the texture if the image data object is not set. If the image data object is set on the texture, it is the path to where the image should be saved if the owning scene is exported. If you run a pipeline through the batch tool and Simplygon Grid, the returned texture object will have the image data embedded in the texture objects and this path indicates where it should be saved if the texture are to be stored separately. Use ExportImageData() to write out embedded data to the file path, then use GetFilePath() to get the final path for the texture image file.
ImageData Set/Get a named texture image data. If this is defined, it will be used instead of the texture file defined in GetFilePath/SetFilePath(). See the help for GetFilePath() for additional information regarding the file path meaning in conjunction with embedded image data objects.
Name The name of the Texture object. (Inherited from Object)

# Methods

Method Description
AddObserver Adds a user-defined observer object to the interface, that will receive events from the interface. (Inherited from Object)
Equals Check for equality against other texture. If the texture is external, this method checks whether the path to the data is equal, otherwise it will compare the embedded image data of this texture.
ExportImageData Write out the embedded image data to the file indicated by the set file path. Once this method returns, use GetFilePath() to get the potentially updated final file path used to write the image data file.
GetClass Get the name of the Texture class. (Inherited from Object)
IsA Returns true if Texture is a or is a descendant of the class named as the type parameter. (Inherited from Object)
IsNull Returns true if the Texture object is invalid. (Inherited from Object)
IsSameObjectAs Returns true if the Texture object is valid. (Inherited from Object)
NonNull Returns true if the Texture object is valid. (Inherited from Object)
PrintInfo Prints the content/info of the Texture object to the log. (Inherited from Object)
RemoveObserver Removes a previously added observer object. (Inherited from Object)

# Static methods

Method Description
IsClassA Returns true if the class is a or is a descendant of the class named as the type parameter. (Inherited from Object)
SafeCast SafeCast makes sure the input object is of a class that can be cast into spTexture, and if this is the case, returns the object cast into spTexture. (Inherited from Object)

# Properties details

# ColorSpace

Used to override how Simplygon interprets the color space of the texture. Set to Undefined to not override, and let the color space be defined by the underlying image data object.

# Syntax

// Setter
void SetColorSpace( Simplygon::EImageColorSpace value ) const;

// Getter
Simplygon::EImageColorSpace GetColorSpace() const;

# SetColorSpace parameters

Type Name Min Max Description
EImageColorSpace value The value to set ColorSpace to.

# GetColorSpace return value

Type: EImageColorSpace

Default: EImageColorSpace::Undefined

Key Value Comment
Undefined 0 The color space is undefined, or using the color space of an input image data.
Linear 1 The color space is linear (linear gamma).
sRGB 2 The color space is sRGB (nominal gamma of 2.2).

# FilePath

The file path of the texture. This path has two meanings: It can point to an existing file to use as image data for the texture if the image data object is not set. If the image data object is set on the texture, it is the path to where the image should be saved if the owning scene is exported. If you run a pipeline through the batch tool and Simplygon Grid, the returned texture object will have the image data embedded in the texture objects and this path indicates where it should be saved if the texture are to be stored separately. Use ExportImageData() to write out embedded data to the file path, then use GetFilePath() to get the final path for the texture image file.

# Syntax

// Setter
void SetFilePath( const char * value ) const;

// Getter
spString GetFilePath() const;

# SetFilePath parameters

Type Name Min Max Description
const char * value The path of the texture image data file.

# GetFilePath return value

Type: spString

# ImageData

Set/Get a named texture image data. If this is defined, it will be used instead of the texture file defined in GetFilePath/SetFilePath(). See the help for GetFilePath() for additional information regarding the file path meaning in conjunction with embedded image data objects.

# Syntax

// Setter
void SetImageData( const spImageData & value ) const;

// Getter
spImageData GetImageData() const;

# SetImageData parameters

Type Name Min Max Description
ImageData value The image data object containing the texture data.

# GetImageData return value

Type: ImageData

# Name

The name of the Texture object. (Inherited from Object)

# Syntax

// Setter
void SetName( const char * name ) const;

// Getter
spString GetName() const;

# SetName parameters

Type Name Min Max Description
const char * name New name of the object.

# GetName return value

Type: spString

# Methods details

# AddObserver

Adds a user-defined observer object to the interface, that will receive events from the interface. (Inherited from Object)

# Syntax

rid AddObserver( const spObserver & observer ) const;

# Parameters

Type Name Min Max Description
Observer observer Observer is the object that will receive events.

# Return value

Type: rid

# Equals

Check for equality against other texture. If the texture is external, this method checks whether the path to the data is equal, otherwise it will compare the embedded image data of this texture.

# Syntax

bool Equals( const spTexture & other ) const;

# Parameters

Type Name Min Max Description
Texture other The other texture to compare against.

# Return value

Type: bool

# ExportImageData

Write out the embedded image data to the file indicated by the set file path. Once this method returns, use GetFilePath() to get the potentially updated final file path used to write the image data file.

# Syntax

bool ExportImageData() const;

# Parameters

Type Name Min Max Description

# Return value

Type: bool

# GetClass

Get the name of the Texture class. (Inherited from Object)

# Syntax

spString GetClass() const;

# Parameters

GetClass takes no parameters.

# Return value

Type: spString

# IsA

Returns true if Texture is a or is a descendant of the class named as the type parameter. (Inherited from Object)

# Syntax

bool IsA( const char * type ) const;

# Parameters

Type Name Min Max Description
const char * type Name of the class to check if Texture is, or is a descendant of.

# Return value

Type: bool

# IsNull

Returns true if the Texture object is invalid. (Inherited from Object)

# Syntax

bool IsNull() const;

# Parameters

IsNull takes no parameters.

# Return value

Type: bool

# IsSameObjectAs

Returns true if the Texture object is valid. (Inherited from Object)

# Syntax

bool IsSameObjectAs( const spObject & object ) const;

# Parameters

Type Name Min Max Description
Object object Object to compare with.

# Return value

Type: bool

# NonNull

Returns true if the Texture object is valid. (Inherited from Object)

# Syntax

bool NonNull() const;

# Parameters

NonNull takes no parameters.

# Return value

Type: bool

# PrintInfo

Prints the content/info of the Texture object to the log. (Inherited from Object)

# Syntax

void PrintInfo() const;

# Parameters

PrintInfo takes no parameters.

# RemoveObserver

Removes a previously added observer object. (Inherited from Object)

# Syntax

void RemoveObserver( rid observerId ) const;

# Parameters

Type Name Min Max Description
rid observerId ObserverId is the id returned by AddObserver when the observer was added.

# Static methods details

# IsClassA

Returns true if the class is a or is a descendant of the class named as the type parameter. (Inherited from Object)

# Syntax

static bool IsClassA( const char * type ) const;

# Parameters

Type Name Min Max Description
const char * type Name of the class to check if the class is, or is a descendant of.

# Return value

Type: bool

# SafeCast

SafeCast makes sure the input object is of a class that can be cast into spTexture, and if this is the case, returns the object cast into spTexture. (Inherited from Object)

# Syntax

static spTexture SafeCast( const spObject & object ) const;

# Parameters

Type Name Min Max Description
Object object Object to cast.

# Return value

Type: Texture