EngineApplyShaderToWorldTexture: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 17: | Line 17: | ||
{{New feature/item|4.0140|1.3.0|4140| | {{New feature/item|4.0140|1.3.0|4140| | ||
*'''targetElement:''' The element to restrict applying the shader to. If this is not set the shader will be applied to everything using the texture name. Valid element types for targetElement are [[vehicle|vehicles]] and [[Object|objects]]. | *'''targetElement:''' The element to restrict applying the shader to. If this is not set the shader will be applied to everything using the texture name. Valid element types for targetElement are [[vehicle|vehicles]] and [[Object|objects]]. | ||
{{New feature/item|4.0150|1.3.0|4418| | |||
:'''targetElement''' can be a [[ped|ped]], with the restriction that the shader cannot contain a vertex shader. | |||
}} | }} | ||
}} | |||
===Returns=== | ===Returns=== | ||
Returns ''true'' if the shader was successfully applied, ''false'' otherwise. | Returns ''true'' if the shader was successfully applied, ''false'' otherwise. | ||
Line 56: | Line 60: | ||
{{ChangelogHeader}} | {{ChangelogHeader}} | ||
{{ChangelogItem|1.3.0-9.04140|Added targetElement argument}} | {{ChangelogItem|1.3.0-9.04140|Added targetElement argument}} | ||
{{ChangelogItem|1.3.0-9.04418|Added peds to allowed element types}} | |||
==See Also== | ==See Also== | ||
{{Engine_functions}} | {{Engine_functions}} | ||
{{Drawing_functions}} | {{Drawing_functions}} |
Revision as of 13:16, 26 July 2012
This function applies a shader to one or more world textures.
Note: 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 [, element targetElement ] )
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.
Optional Arguments
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" )
This untested example will apply a shader to the current vehicle of the local player
myShader = dxCreateShader( "hello.fx" ) addEventHandler("onClientVehicleEnter", root, function(thePlayer, seat) local theVehicle = source if seat == 0 and thePlayer == localPlayer then engineApplyShaderToWorldTexture( myShader, "vehiclegrunge256", theVehicle ) engineApplyShaderToWorldTexture( myShader, "?emap*", theVehicle ) end end ) addEventHandler("onClientVehicleExit", root, function(thePlayer, seat) local theVehicle = source if seat == 0 and thePlayer == localPlayer then engineRemoveShaderFromWorldTexture( myShader, "vehiclegrunge256", theVehicle ) engineRemoveShaderFromWorldTexture( myShader, "?emap*", theVehicle ) end end )
Changelog
Version | Description |
---|
1.3.0-9.04140 | Added targetElement argument |
1.3.0-9.04418 | Added peds to allowed element types |
See Also
- engineAddImage
- engineApplyShaderToWorldTexture
- engineFreeModel
- engineGetModelFlags
- engineGetModelIDFromName
- engineGetModelLODDistance
- engineGetModelNameFromID
- engineGetModelPhysicalPropertiesGroup
- engineGetModelTextureNames
- engineGetModelTextures
- engineGetModelTXDID
- engineGetModelVisibleTime
- engineGetObjectGroupPhysicalProperty
- engineGetSurfaceProperties
- engineGetVisibleTextureNames
- engineImageGetFilesCount
- engineImageGetFiles
- engineImageGetFile
- engineImageLinkDFF
- engineImageLinkTXD
- engineImportTXD
- engineLoadCOL
- engineLoadDFF
- engineLoadIMG
- engineLoadIFP
- engineLoadTXD
- engineRemoveImage
- engineRemoveShaderFromWorldTexture
- engineReplaceAnimation
- engineReplaceCOL
- engineReplaceModel
- engineRequestModel
- engineResetModelFlags
- engineResetModelLODDistance
- engineResetSurfaceProperties
- engineRestoreAnimation
- engineRestoreCOL
- engineRestoreDFFImage
- engineRestoreModel
- engineRestoreModelPhysicalPropertiesGroup
- engineRestoreObjectGroupPhysicalProperties
- engineRestoreTXDImage
- engineRestreamWorld
- engineSetAsynchronousLoading
- engineSetModelFlag
- engineSetModelFlags
- engineSetModelLODDistance
- engineSetModelPhysicalPropertiesGroup
- engineSetModelVisibleTime
- engineSetObjectGroupPhysicalProperty
- engineSetSurfaceProperties
- engineStreamingFreeUpMemory
- engineStreamingGetUsedMemory
- dxConvertPixels
- dxCreateFont
- dxCreateRenderTarget
- dxCreateScreenSource
- dxCreateShader
- dxCreateTexture
- dxDrawCircle
- dxDrawImage
- dxDrawImageSection
- dxDrawLine
- dxDrawLine3D
- dxDrawMaterialLine3D
- dxDrawMaterialPrimitive
- dxDrawMaterialPrimitive3D
- dxDrawMaterialSectionLine3D
- dxDrawPrimitive
- dxDrawPrimitive3D
- dxDrawRectangle
- dxDrawText
- dxDrawWiredSphere
- dxGetBlendMode
- dxGetFontHeight
- dxGetMaterialSize
- dxGetPixelColor
- dxGetPixelsSize
- dxGetPixelsFormat
- dxGetStatus
- dxGetTextSize
- dxGetTextWidth
- dxGetTexturePixels
- dxIsAspectRatioAdjustmentEnabled
- dxSetAspectRatioAdjustmentEnabled
- dxSetBlendMode
- dxSetPixelColor
- dxSetRenderTarget
- dxSetShaderValue
- dxSetShaderTessellation
- dxSetShaderTransform
- dxSetTestMode
- dxSetTextureEdge
- dxSetTexturePixels
- dxUpdateScreenSource