local vehicleTXD = engineLoadTXD("skodafinal.txd");
engineImportTXD(vehicleTXD, 597);
myShader = dxCreateShader( "indicatorshader.fx" )
local vehicleDFF = engineLoadDFF("skodafinal.dff", 597);
engineReplaceModel(vehicleDFF, 597);
local shader = dxCreateShader("indicatorshader.fx");
outputChatBox("Loaded indicator lights shader and car model!");
function bindTurnIndicators(player)
bindKey(player, "mouse1", "down", "vehicle_left")
bindKey(player, "mouse2", "down", "vehicle_right")
end
for m,n in ipairs(getElementsByType("vehicle")) do
if (getElementModel(n) == 597) then
engineApplyShaderToWorldTexture(shader, "p", n);
engineApplyShaderToWorldTexture(shader, "l", n);
end
end
function vehicle_left
dxSetShaderValue(myShader, "intensity", 1);
end
function vehicle_left
dxSetShaderValue(myShader, "intensity", 0);
end
This is my Lua now. But i have an error: https://imgur.com/MI7v97c
texture Tex0;
float4x4 World;
float4x4 View;
float4x4 Projection;
float4x4 WorldViewProjection;
float Time;
float intensity;
sampler Sampler0 = sampler_state
{
Texture = (Tex0);
};
struct VSInput
{
float3 Position : POSITION;
float4 Diffuse : COLOR0;
float2 TexCoord : TEXCOORD0;
};
struct PSInput
{
float4 Diffuse : COLOR0;
float2 TexCoord : TEXCOORD0;
};
struct VSOutput
{
PSInput psInput;
float4 Position : POSITION;
};
VSOutput PassthroughVS(VSInput input)
{
VSOutput output;
output.psInput.Diffuse = input.Diffuse;
output.psInput.TexCoord = input.TexCoord;
//-- Transform vertex position (You nearly always have to do something like this)
output.Position = mul(float4(input.Position, 1), WorldViewProjection);
return output;
}
float4 IndicatorMultiply(PSInput input) : COLOR0
{
return float4(1, 1, 0, 1);
}
technique indicators
{
pass P0
{
VertexShader = compile vs_2_0 PassthroughVS();
PixelShader = compile ps_2_0 IndicatorMultiply();
}
};
And this is my shader now, i only add "float Intensity" string.