HU/dxCreateShader: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Line 15: Line 15:
===Tetszőleges paraméterek===
===Tetszőleges paraméterek===
''A felsorolt tetszőlegesen választható paraméterek csak akkor helytállóak, ha ezeket az [[engineApplyShaderToWorldTexture]]-val használják''
''A felsorolt tetszőlegesen választható paraméterek csak akkor helytállóak, ha ezeket az [[engineApplyShaderToWorldTexture]]-val használják''
*'''priority:''' If more than one shader is matched to a world texture, the shader with the highest priority will be used. If there is more than one shader with the same highest priority, the most recently created shader is used.
*'''priority:''' Ha egynél több árnyékot illesztenek a world textúrához, akkor a legmagasabb prioritású árnyék lesz használva. Ha egynél több árnyék van ugyan azon a prioritáson, akkor a legutoljára létrehozott árnyék van használatban.
*'''maxDistance:''' If non-zero, the shader will be applied to textures nearer than maxDistance only. This can speed up rendering, but (to look good) may require the shader to fade out it's own effect as the texture reaches maxDistance.
*'''maxDistance:''' If non-zero, the shader will be applied to textures nearer than maxDistance only. This can speed up rendering, but (to look good) may require the shader to fade out it's own effect as the texture reaches maxDistance.
*'''layered:''' When set to true, the shader will be drawn in a separate render pass. Several layered shaders can be drawn on the same world texture. (To avoid [http://en.wikipedia.org/wiki/Z-fighting Z fighting] artifacts, you may have to add '''DepthBias<nowiki>=</nowiki>-0.0002;''' to the technique pass, but this might cause visual artifacts when applied on vehicles)
*'''layered:''' When set to true, the shader will be drawn in a separate render pass. Several layered shaders can be drawn on the same world texture. (To avoid [http://en.wikipedia.org/wiki/Z-fighting Z fighting] artifacts, you may have to add '''DepthBias<nowiki>=</nowiki>-0.0002;''' to the technique pass, but this might cause visual artifacts when applied on vehicles)

Revision as of 12:21, 18 October 2018

Ez a function létrehoz egy árnyék elemet, mely a dxDraw függvényekben használható. A sikeres árnyék létrehozása nem garantált, hacsak a Effect File nem tartalmaz olyan biztonsági módszereket, amely minden számítógépén működni fog.


[[{{{image}}}|link=|]] Tipp: Nagyon ajánlott a dxSetTestMode használata, amikor a dxCreateShader-t használva írunk és tesztelünk scripteket.

Szintaxis

element, string dxCreateShader ( string filepath [, float priority = 0, float maxDistance = 0, bool layered = false, string elementTypes = "world,vehicle,object,other" ] )

OOP Syntax Help! I don't understand this!

Method: DxShader(...)


Kötelező paraméterek

Tetszőleges paraméterek

A felsorolt tetszőlegesen választható paraméterek csak akkor helytállóak, ha ezeket az engineApplyShaderToWorldTexture-val használják

  • priority: Ha egynél több árnyékot illesztenek a world textúrához, akkor a legmagasabb prioritású árnyék lesz használva. Ha egynél több árnyék van ugyan azon a prioritáson, akkor a legutoljára létrehozott árnyék van használatban.
  • maxDistance: If non-zero, the shader will be applied to textures nearer than maxDistance only. This can speed up rendering, but (to look good) may require the shader to fade out it's own effect as the texture reaches maxDistance.
  • layered: When set to true, the shader will be drawn in a separate render pass. Several layered shaders can be drawn on the same world texture. (To avoid Z fighting artifacts, you may have to add DepthBias=-0.0002; to the technique pass, but this might cause visual artifacts when applied on vehicles)
  • elementTypes: A comma seperated list of element types to restrict this shader to. Valid element types are:
    • world - Textures in the GTA world
    • ped - Player and ped textures
    • vehicle - Vehicles textures
    • object - Objects textures
    • other - Element textures which are not peds, vehicles or objects
    • all - Everything

Visszatérési érték

  • element: Egy árnyék elem, ha sikeres, false, ha érvénytelen paraméterek lettek megadva. Mindig ellenőrizze, hogy ez a function false értéked ad-e vissz.
  • string: A használt módszer neve

Példa

addEventHandler( "onClientRender", root,
    function()
        if myShader then
            dxDrawImage( 100, 350, 300, 350, myShader )
        end
    end
)

-- Use 'toggle' command to switch shader on and off
addCommandHandler( "toggle",
    function()
        if not myShader then
            myShader = dxCreateShader( "fancything.fx" )  -- Create shader
        else        
            destroyElement( myShader )                    -- Destroy shader
            myShader = nil
        end
    end
)

Changelog

Version Description
1.3.0-9.04435 Added layered and elementTypes arguments

Lásd még

Fordította