Jump to content

engineRemoveShaderFromWorldTexture - Not working


Annas

Recommended Posts

Hi all, the issuse that i can't remove shader from a shaded object.

This funcition is working perfect, means 'engineApplyShaderToWorldTexture' is working, but i need it, if 'textureName' that comes to the function named 'DefaultTexture' , it will remove the shader, means back the object with the official shader that it got from TXD.

function applyShader ( element, textureName ) 
-- HERE 
    local shaderElement = dxCreateShader ( "shader/shader.fx" ) 
    if (textureName == "DefaultTexture") then 
        engineRemoveShaderFromWorldTexture ( shaderElement, "*", element ) 
        destroyElement(shaderElement) 
        return 
    end 
---------------- 
    local textureElement = dxCreateTexture ( ":CSTmodels/textures/"..textureName..".jpg" ) 
  
    if ( shaderElement and textureElement ) then 
        dxSetShaderValue ( shaderElement, "Tex0", textureElement ) 
        engineApplyShaderToWorldTexture ( shaderElement, "*", element ) 
    end 
end 
addEvent("CSTcityzones.applyShader", true) 
addEventHandler("CSTcityzones.applyShader", root, applyShader) 
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...