MTA:Eir/functions/isWorldDualAlphaRenderingEnabled: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ This function returns whether world dual alpha rendering is enabled. If enabled, first all opaque pixels of entities are rendered and then the alpha pixels, depending ...")
 
Line 16: Line 16:
This snippet notifies the user upon join whether this server wants to have alpha issues or not.
This snippet notifies the user upon join whether this server wants to have alpha issues or not.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
addEventHandler( "onClientJoin", root,
addEvent( "onClientReady", true );
addEventHandler( "onClientReady", root,
     function()
     function()
         if not ( isWorldDualAlphaRenderingEnabled() ) then
         if not ( isWorldDualAlphaRenderingEnabled() ) then
Line 23: Line 24:
     end
     end
);
);
-- Somewhere along the lines:
triggerEvent( "onClientReady" );
</syntaxhighlight>
</syntaxhighlight>
</section>
</section>

Revision as of 09:41, 11 December 2013

This function returns whether world dual alpha rendering is enabled. If enabled, first all opaque pixels of entities are rendered and then the alpha pixels, depending on whether they are closer to the screen or not. Otherwise the original rendering method is used which does not use two-pass depth layer rendering.

By enabling world dual alpha rendering, rendering artifacts related to alpha such as seeing through solid surfaces are avoided. By default, it is disabled.

Syntax

bool isWorldDualAlphaRenderingEnabled ()

Returns

Returns true if world dual alpha rendering is enabled, false otherwise.

Example

Click to collapse [-]
Client

This snippet notifies the user upon join whether this server wants to have alpha issues or not.

addEvent( "onClientReady", true );
addEventHandler( "onClientReady", root,
    function()
        if not ( isWorldDualAlphaRenderingEnabled() ) then
            outputChatBox( "This server may have alpha issues." );
        end
    end
);

-- Somewhere along the lines:
triggerEvent( "onClientReady" );