MTA:Eir/functions/engineGetWorldRenderMode: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ This function modifies the rendering order, the rendering complexity and the render-states assigned to world entity rendering. It allows you to switch between renderin...")
 
No edit summary
 
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
This function modifies the rendering order, the rendering complexity and the render-states assigned to world entity rendering. It allows you to switch between rendering modes. Each has unique properties as to how entities are ordered for rendering and how their alpha is treated. This function has been created to fight rendering artifacts on the GTA:SA world.
This function returns the rendering mode that the GTA:SA is assigned to use by scripts. Each render mode has unique properties as to how the world entities are rendered. Use different render modes in different parts of the world to archive best quality rendering.


==Syntax==  
==Syntax==  

Latest revision as of 04:04, 11 January 2014

This function returns the rendering mode that the GTA:SA is assigned to use by scripts. Each render mode has unique properties as to how the world entities are rendered. Use different render modes in different parts of the world to archive best quality rendering.

Syntax

string engineGetWorldRenderMode()

Returns

Returns a string containing the rendering mode of the GTA:SA engine. Can be either original, meshlocal_alphafix or scene_alphafix.

Example

Click to collapse [-]
Client

This snippet allows you to switch between rendering modes using the F3 key.

local renderModeSwitch =
{
    original = "meshlocal_alphafix",
    meshlocal_alphafix = "scene_alphafix",
    scene_alphafix = "original"
};

addEventHandler( "onClientRender", root,
    function()
        local screenWidth, screenHeight = guiGetScreenSize();
        
        local currentMode = engineGetWorldRenderMode();
    
        dxDrawText( "Current RenderMode: " .. currentMode, screenWidth - 300, 5 );
    end
);

addEventHandler( "onClientKey", root,
    function( key, state )
        if ( key == "F3" ) and ( state == true ) then
            engineSetWorldRenderMode( renderModeSwitch[ engineGetWorldRenderMode() ] );
        end
    end
);