Brad96 Posted August 16, 2013 Share Posted August 16, 2013 I want to explain this, each line please ... try to understand texShader = dxCreateShader ( "shader/texreplace.fx" ) vehiclelights128 = dxCreateTexture("img/generic/vehiclelights128.png") vehiclelightson128 = dxCreateTexture("generic/vehiclelightson128.png") dxSetShaderValue(texShader,"gTexture",vehiclelights128) engineApplyShaderToWorldTexture(texShader,"vehiclelights128") dxSetShaderValue(texShader,"gTexture",vehiclelightson128) engineApplyShaderToWorldTexture(texShader,"vehiclelightson128") Link to comment
Castillo Posted August 16, 2013 Share Posted August 16, 2013 You want to know what each line does? texShader = dxCreateShader ( "shader/texreplace.fx" ) -- Creates a shader element vehiclelights128 = dxCreateTexture("img/generic/vehiclelights128.png") -- Creates a texture element vehiclelightson128 = dxCreateTexture("generic/vehiclelightson128.png") -- Creates a texture element dxSetShaderValue(texShader,"gTexture",vehiclelights128) -- Sets the value of a shader element engineApplyShaderToWorldTexture(texShader,"vehiclelights128") -- Applies a shader to one or more world textures. dxSetShaderValue(texShader,"gTexture",vehiclelightson128) -- Sets the value of a shader element engineApplyShaderToWorldTexture(texShader,"vehiclelightson128") -- Applies a shader to one or more world textures. Link to comment
Brad96 Posted August 16, 2013 Author Share Posted August 16, 2013 Solid Thanks I appreciate that, but you could get more in detail - Sets the value of a shading member? I do not understand what you mean and referred to when he says "gTexture"? thanx Link to comment
Castillo Posted August 16, 2013 Share Posted August 16, 2013 Is "gTexture" because the shader you are using assigned that parameter name. Link to comment
Brad96 Posted August 16, 2013 Author Share Posted August 16, 2013 as I get more information about this parameter? Link to comment
Castillo Posted August 16, 2013 Share Posted August 16, 2013 Is on your shader file, I really haven't got knowledge about shader scripting. Link to comment
Brad96 Posted August 16, 2013 Author Share Posted August 16, 2013 the truth, just trying to see how each line to understand Link to comment
bandi94 Posted August 16, 2013 Share Posted August 16, 2013 in the shader file (.fx) is a variable (like a "local value"). That variable is used in the shader to make it dynamic (like the color for the nitro). So when you call "dxSetShaderValue" it will change the variable. (for the nitro you can pass the color, so when you set greend , the shander will be green, after that you set red =>> the shader will be red.) In your case is "gTexture" witch in the shader is the .png file you wanna add for the shader (vehiclelights) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now