EngineApplyShaderToWorldTexture: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 4: Line 4:
Only available in 1.1
Only available in 1.1
}}
}}
This function applies a [[shader]] to one texture of a model. The shader inherits the render states of the original when it is drawn, so texture stage 0 will already be set to the original texture.
This function applies a [[shader]] to one or more world textures. The shader inherits the render states of the original when it is drawn, so texture stage 0 will already be set to the original texture.


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool engineApplyShaderToModel ( element shader, int modelID, string textureName )
bool engineApplyShaderToWorldTexture ( element shader, string textureName )
</syntaxhighlight>  
</syntaxhighlight>  


===Required Arguments===  
===Required Arguments===  
*'''shader:''' The shader which is to be applied
*'''shader:''' The shader which is to be applied
*'''modelID:''' The model id to find the texture
*'''textureName :''' The name of the world texture to apply the shader to. Wildcard matching e.g. "ro?ds*" can be used to apply to more than one texture at a time.
*'''textureName :''' The name of the texture in the model to apply the shader to


===Returns===
===Returns===
Returns ''true'' if the shader was successfully applied to the model, ''false'' otherwise.
Returns ''true'' if the shader was successfully applied, ''false'' otherwise.


==Example==
==Example==
This example will apply a shader to the "des_logwall" texture of model 11490 (also known as "des_house"). This is the house where players are spawned in the 'play' resource.
This example will apply a shader to the "des_logwall" world texture (which is used by the house near the 'play' gamemode spawn point)
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
myShader = dxCreateShader( "hello.fx" )
myShader = dxCreateShader( "hello.fx" )
engineApplyShaderToModel ( myShader, 11490, "des_logwall" )
engineApplyShaderToWorldTexture( myShader, "des_logwall" )
</syntaxhighlight>
</syntaxhighlight>



Revision as of 19:02, 20 July 2011

Only available in 1.1 This function applies a shader to one or more world textures. The shader inherits the render states of the original when it is drawn, so texture stage 0 will already be set to the original texture.

Syntax

bool engineApplyShaderToWorldTexture ( element shader, string textureName )

Required Arguments

  • shader: The shader which is to be applied
  • textureName : The name of the world texture to apply the shader to. Wildcard matching e.g. "ro?ds*" can be used to apply to more than one texture at a time.

Returns

Returns true if the shader was successfully applied, false otherwise.

Example

This example will apply a shader to the "des_logwall" world texture (which is used by the house near the 'play' gamemode spawn point)

myShader = dxCreateShader( "hello.fx" )
engineApplyShaderToWorldTexture( myShader, "des_logwall" )

See Also