# class ComputeCaster

ComputeCaster is the interface used to cast general values, using a GPU based shader.

# Properties

Property Description
CasterSource The CasterSource object. Sets all the upstream data needed for the caster (MappingImage, SourceMaterials, SourceTextures, etc.) so those settings will be ignored if this is set. (Inherited from MaterialCaster)
DebugOutputShaderFolder Debug setting. If set, the caster will output the generated shader files to the folder, named as [MaterialName]_[MaterialChannel].shader. The folder must exist, and be writeable.
DestMaterialId The DestMaterialId object. If set, only the parts of the destination map that. To disable, set to -1. (Inherited from MaterialCaster)
MappingImage The MappingImage object. The MappingImage object contains the mapping between the Geometry and SourceGeometry objects. (Inherited from MaterialCaster)
Name The name of the ComputeCaster object. (Inherited from Object)
OutputFilePath The OutputFilePath file path, where the output image will be placed. Note that the extension will be appended the file path if it differs from the OutputImageFileFormat set in the caster settings object. Either OutputImage or OutputFilePath must be set. If OutputImage is set, then OutputFilePath is ignored. (Inherited from MaterialCaster)
OutputImage The OutputImage object that will receive the image. The current contents of the image will be removed, and the image will be written to the Colors field of the ImageData object. Either OutputImage or OutputFilePath must be set. If OutputImage is set, then OutputFilePath is ignored. (Inherited from MaterialCaster)
Scene The Scene object that will receive the data. Note that the scene object is only used when baking to geometry data, such as tessellated attributes or vertex data. (Inherited from MaterialCaster)
SourceMaterials The SourceMaterials object. The SourceMaterials object contains all materials of the the source geometry. The source geometry must have a "MaterialIds" field that indices the material table. (Inherited from MaterialCaster)
SourceTextures The SourceTextures object. The SourceTextures object contains all textures of the the source geometry. (Inherited from MaterialCaster)

# Methods

Method Description
AddObserver Adds a user-defined observer object to the interface, that will receive events from the interface. (Inherited from Object)
Clear Clear all internal states of the object. This will NOT clear the parameters set in the object. (Inherited from ProcessingObject)
GetClass Get the name of the ComputeCaster class. (Inherited from Object)
GetComputeCasterSettings The Compute Caster settings object.
GetMaterialCasterSettings The settings object. (Inherited from MaterialCaster)
GetPercentDone Returns the current progress of the processing as a value between 0 and 100. (Inherited from ProcessingObject)
IsA Returns true if ComputeCaster is a or is a descendant of the class named as the type parameter. (Inherited from Object)
IsNull Returns true if the ComputeCaster object is invalid. (Inherited from Object)
IsSameObjectAs Returns true if the ComputeCaster object is valid. (Inherited from Object)
NewCopy Create a new clone of the material caster, copying all settings. (Inherited from MaterialCaster)
NonNull Returns true if the ComputeCaster object is valid. (Inherited from Object)
PrintInfo Prints the content/info of the ComputeCaster object to the log. (Inherited from Object)
RemoveObserver Removes a previously added observer object. (Inherited from Object)
RunProcessing Runs the processing the object is designed for. If the process succeeds, the return value is NoError. If the process fails, and the error is recoverable, an error code is returned. (Inherited from ProcessingObject)
ToJSON Get settings as JSON for debugging purposes. (Inherited from ProcessingObject)

# 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 spComputeCaster, and if this is the case, returns the object cast into spComputeCaster. (Inherited from Object)

# Properties details

# CasterSource

The CasterSource object. Sets all the upstream data needed for the caster (MappingImage, SourceMaterials, SourceTextures, etc.) so those settings will be ignored if this is set.

# Syntax

// Setter
void SetCasterSource( const spMaterialCasterSource & value ) const;

// Getter
spMaterialCasterSource GetCasterSource() const;

# SetCasterSource parameters

Type Name Min Max Description
MaterialCasterSource value The caster source data object.

# GetCasterSource return value

Type: MaterialCasterSource

# DebugOutputShaderFolder

Debug setting. If set, the caster will output the generated shader files to the folder, named as [MaterialName]_[MaterialChannel].shader. The folder must exist, and be writeable.

# Syntax

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

// Getter
spString GetDebugOutputShaderFolder() const;

# SetDebugOutputShaderFolder parameters

Type Name Min Max Description
const char * value The desired DebugOutputShaderFolder string.

# GetDebugOutputShaderFolder return value

Type: spString

# DestMaterialId

The DestMaterialId object. If set, only the parts of the destination map that. To disable, set to -1.

# Syntax

// Setter
void SetDestMaterialId( rid value ) const;

// Getter
rid GetDestMaterialId() const;

# SetDestMaterialId parameters

Type Name Min Max Description
rid value The value to which DestMaterialId will be set.

# GetDestMaterialId return value

Type: rid

# MappingImage

The MappingImage object. The MappingImage object contains the mapping between the Geometry and SourceGeometry objects.

# Syntax

// Setter
void SetMappingImage( const spMappingImage & value ) const;

// Getter
spMappingImage GetMappingImage() const;

# SetMappingImage parameters

Type Name Min Max Description
MappingImage value The mapping image to which MappingImage will be set.

# GetMappingImage return value

Type: MappingImage

# Name

The name of the ComputeCaster 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

# OutputFilePath

The OutputFilePath file path, where the output image will be placed. Note that the extension will be appended the file path if it differs from the OutputImageFileFormat set in the caster settings object. Either OutputImage or OutputFilePath must be set. If OutputImage is set, then OutputFilePath is ignored.

# Syntax

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

// Getter
spString GetOutputFilePath() const;

# SetOutputFilePath parameters

Type Name Min Max Description
const char * value The string to which OutputFilePath will be set.

# GetOutputFilePath return value

Type: spString

# OutputImage

The OutputImage object that will receive the image. The current contents of the image will be removed, and the image will be written to the Colors field of the ImageData object. Either OutputImage or OutputFilePath must be set. If OutputImage is set, then OutputFilePath is ignored.

# Syntax

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

// Getter
spImageData GetOutputImage() const;

# SetOutputImage parameters

Type Name Min Max Description
ImageData value The image data to which OutputImage will be set.

# GetOutputImage return value

Type: ImageData

# Scene

The Scene object that will receive the data. Note that the scene object is only used when baking to geometry data, such as tessellated attributes or vertex data.

# Syntax

// Setter
void SetScene( const spScene & value ) const;

// Getter
spScene GetScene() const;

# SetScene parameters

Type Name Min Max Description
Scene value The scene object.

# GetScene return value

Type: Scene

# SourceMaterials

The SourceMaterials object. The SourceMaterials object contains all materials of the the source geometry. The source geometry must have a "MaterialIds" field that indices the material table.

# Syntax

// Setter
void SetSourceMaterials( const spMaterialTable & value ) const;

// Getter
spMaterialTable GetSourceMaterials() const;

# SetSourceMaterials parameters

Type Name Min Max Description
MaterialTable value The material table to which SourceMaterials will be set.

# GetSourceMaterials return value

Type: MaterialTable

# SourceTextures

The SourceTextures object. The SourceTextures object contains all textures of the the source geometry.

# Syntax

// Setter
void SetSourceTextures( const spTextureTable & value ) const;

// Getter
spTextureTable GetSourceTextures() const;

# SetSourceTextures parameters

Type Name Min Max Description
TextureTable value The texture table to which SourceTextures will be set.

# GetSourceTextures return value

Type: TextureTable

# 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

# Clear

Clear all internal states of the object. This will NOT clear the parameters set in the object.

# Syntax

void Clear() const;

# Parameters

Clear takes no parameters.

# GetClass

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

# Syntax

spString GetClass() const;

# Parameters

GetClass takes no parameters.

# Return value

Type: spString

# GetComputeCasterSettings

The Compute Caster settings object.

# Syntax

spComputeCasterSettings GetComputeCasterSettings() const;

# Parameters

GetComputeCasterSettings takes no parameters.

# Return value

Type: ComputeCasterSettings

# GetMaterialCasterSettings

The settings object.

# Syntax

spMaterialCasterSettings GetMaterialCasterSettings() const;

# Parameters

GetMaterialCasterSettings takes no parameters.

# Return value

Type: MaterialCasterSettings

# GetPercentDone

Returns the current progress of the processing as a value between 0 and 100.

# Syntax

real GetPercentDone() const;

# Parameters

GetPercentDone takes no parameters.

# Return value

Type: real

# IsA

Returns true if ComputeCaster 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 ComputeCaster is, or is a descendant of.

# Return value

Type: bool

# IsNull

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

# Syntax

bool IsNull() const;

# Parameters

IsNull takes no parameters.

# Return value

Type: bool

# IsSameObjectAs

Returns true if the ComputeCaster 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

# NewCopy

Create a new clone of the material caster, copying all settings.

# Syntax

spMaterialCaster NewCopy() const;

# Parameters

Type Name Min Max Description

# Return value

Type: MaterialCaster

# NonNull

Returns true if the ComputeCaster 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 ComputeCaster 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.

# RunProcessing

Runs the processing the object is designed for. If the process succeeds, the return value is NoError. If the process fails, and the error is recoverable, an error code is returned.

# Syntax

Simplygon::EErrorCodes RunProcessing() const;

# Parameters

RunProcessing takes no parameters.

# Return value

Type: EErrorCodes

Key Value Comment
NoError 0 No error, the initialization or process has finished, and with no errors
NoLicense -1 no license was found (or licence expired)
NotInitialized -2 the SDK is not initialized, or no process object has been loaded/created
AlreadyInitialized -3 the SDK is already initialized
DLLOrDependenciesNotFound -4 the specified file was not found. This might also mean that a .dll cannot be loaded because there is a missing dependency, such as the runtime environment.
InvalidInputParam -5 an invalid parameter was passed to the method
FailedTesting -6 the reduction failed post-testing
DLLAndHeaderFileIsNotMatching -7 the Simplygon DLL and header file interface versions do not match
DLLFailedToLoad -8 the Simplygon DLL failed loading, probably because of a missing dependency
LicenseNotForThisApplication -9 the license is not made for this application of Simplygon
LicenseNotForThisPlatform -10 the license is not made for this platform of Simplygon
LicenseNotForThisVersion -11 the license is not made for this version of Simplygon
FailedToCreatePipelineSerializer -12 failed to create pipeline serializer
FailedToRunPipeline -13 failed to run pipeline
UnhandledException -14 an unhandled exception was encountered
FileError -15 a file read/write failed.
InvalidPath -16 a path is invalid or a file/directory is missing.
DependencyMissing -17 a needed dependency is missing. see log for info on what is missing.
UnexpectedError -18 an unexpected error happened.
FailedToUploadFreeLicenseAsset -50 failed to upload free license asset
ExceptionalError -1000 An exceptional and fatal error occurred, and has been reported to the error handler. The library is placed in an exceptional state, and you should unload and reload the Simplygon library to avoid memory leaks.
FailedToResolveLicenseServerHostName -10001 cannot reach the licensing server, cant look up server, check DNS
FailedToConnectToLicenseServer -10002 cannot contact the licensing server, check firewall/proxy server
FailedToConnectToLicenseServerAndSendData -10003 Failed to connect to the license server. Please check that your internet connection is working and outgoing connections to license.simplygon.com port 443 are not blocked by a firewall or proxy.
FailedToConnectToLicenseServerAndReceiveData -10004 cannot receive data from the licensing server, check firewall/proxy server
DataFromLicenseServerIsCorrupt -10005 data from licensing server is corrupted, try again, check connection
LicenseHasExpired -10006 the license has expired
LicenseIsInvalid -10007 the license data is corrupted, please reinstall the license key
LicenseNotForThisProduct -10008 the license is not for this product, please contact licensing, and replace license key
NoNetworkCardFound -10009 no network card was found on the machine
LicenseDecodeFailed -10010 could not decode license, it is corrupted
LicenseLockNotMatchingMachine -10011 the license is locked to another machine
ConnectionToLicenseServerLost -10012 Connection to license server lost
LicenseHashDataCorrupt -10013 could not decode license, it is corrupted
LicenseExpired -10014 the license is invalid, please contact licensing
LicenseNotLockedForThisMachine -10020 the license is locked to another machine
YourLicenseRequiresLatestWindows10 -10024 your license requires latest Windows 10 version
LicenseServerReturnedBadRequest -10400 Bad license request. Please reach out to SimplygonSupport[at]microsoft.com for support
ProcessingCap -10403 You have reached the maximum number of processings for your license. Please try again in 24 hours or reach out to SimplygonSales@microsoft.com for support..
UnknownLicenseKey -10404 You are using an unknown license key. Please verify so you typed in the license key correctly and try again
LicenseIsNotActive -10410 You are using an inactive license key. Please reach out to SimplygonSales[at]microsoft.com for support
MaxNodesReachForThisLicense -10409 You have reached the maximum number of nodes for your license. After 48 hours of not using Simplygon on a machine the license will be released and can be installed on another machine
YourLicenseRequiresLatestSimplygon -10426 The license key you are using requires you to update to the latest version before you can use Simplygon
LicenseServerReturnServerError -10501 Bad license request. Please reach out to SimplygonSupport[at]microsoft.com for support
ProcessingValidationError -20001 The process was aborted, because of a validation error. Either the process settings or the input data was invalid, or a combination thereof. Use GetErrorMessages in the main Simplygon object to retrieve error messages, and see the log for details. Note that the library is not left in an exceptional state, and it is safe to continue processing other scenes.

# ToJSON

Get settings as JSON for debugging purposes.

# Syntax

spString ToJSON() const;

# Parameters

ToJSON takes no parameters.

# Return value

Type: spString

# 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 spComputeCaster, and if this is the case, returns the object cast into spComputeCaster. (Inherited from Object)

# Syntax

static spComputeCaster SafeCast( const spObject & object ) const;

# Parameters

Type Name Min Max Description
Object object Object to cast.

# Return value

Type: ComputeCaster