EngineApplyShaderToWorldTexture: Difference between revisions
Jump to navigation
Jump to search
(changed 4 notes termplate to 1 tip (btw. someone should explain what appendLayers argument do)) |
mNo edit summary |
||
Line 8: | Line 8: | ||
* When using with a 'ped', ensure you have set 'ped' or 'all' in the elementTypes when calling [[dxCreateShader]]}} | * When using with a 'ped', ensure you have set 'ped' or 'all' in the elementTypes when calling [[dxCreateShader]]}} | ||
{{New feature/item| | {{New feature/item|3.0131|1.3.1|5246| | ||
* CJ body parts textures can be replaced by using: "cj_ped_head", "cj_ped_torso", "cj_ped_legs", "cj_ped_feet" and maybe some other things like "cj_ped_necklace", "cj_ped_watch" etc. Latest version of [http://wiki.multitheftauto.com/wiki/Shader_examples#Texture_names shader_tex_names] will show what is being used. | * CJ body parts textures can be replaced by using: "cj_ped_head", "cj_ped_torso", "cj_ped_legs", "cj_ped_feet" and maybe some other things like "cj_ped_necklace", "cj_ped_watch" etc. Latest version of [http://wiki.multitheftauto.com/wiki/Shader_examples#Texture_names shader_tex_names] will show what is being used. | ||
}} | }} | ||
Line 21: | Line 21: | ||
===Optional Arguments=== | ===Optional Arguments=== | ||
{{New feature/item| | {{New feature/item|3.0130|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| | {{New feature/item|3.0131|1.3.1|4939| | ||
:'''targetElement''' can be a [[ped|ped]]. | :'''targetElement''' can be a [[ped|ped]]. | ||
}} | }} |
Revision as of 21:05, 29 July 2014
This function applies a shader to one or more world textures.
Tip:
|
- CJ body parts textures can be replaced by using: "cj_ped_head", "cj_ped_torso", "cj_ped_legs", "cj_ped_feet" and maybe some other things like "cj_ped_necklace", "cj_ped_watch" etc. Latest version of shader_tex_names will show what is being used.
Syntax
bool engineApplyShaderToWorldTexture ( element shader, string textureName [, element targetElement = nil, bool appendLayers = true ] )
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
- 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 vehicles and objects.
- targetElement can be a ped.
- appendLayers: --TODO
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 (for pixel shaders only) |
1.3.1-9.04939 | Added peds to allowed element types (full support) |
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