|
|
@@ -8,6 +8,10 @@ void VS(float4 iPos : POSITION,
|
|
|
#ifdef INSTANCED
|
|
|
float4x3 iModelInstance : TEXCOORD2,
|
|
|
#endif
|
|
|
+ #ifdef VERTEXCOLOR
|
|
|
+ float4 iColor : COLOR0,
|
|
|
+ out float4 oColor : COLOR0,
|
|
|
+ #endif
|
|
|
float2 iTexCoord : TEXCOORD0,
|
|
|
out float2 oTexCoord : TEXCOORD0,
|
|
|
out float4 oWorldPos : TEXCOORD1,
|
|
|
@@ -25,6 +29,10 @@ void VS(float4 iPos : POSITION,
|
|
|
pos = GetPositionInstanced(iPos, iModelInstance, oPos);
|
|
|
#endif
|
|
|
|
|
|
+ #ifdef VERTEXCOLOR
|
|
|
+ oColor = iColor;
|
|
|
+ #endif
|
|
|
+
|
|
|
// Store world-oriented view position in case it is needed
|
|
|
oWorldPos = float4(pos.xyz - cCameraPos, GetDepth(oPos));
|
|
|
oScreenPos = GetScreenPos(oPos);
|
|
|
@@ -34,19 +42,26 @@ void VS(float4 iPos : POSITION,
|
|
|
void PS(float2 iTexCoord : TEXCOORD0,
|
|
|
float4 iWorldPos : TEXCOORD1,
|
|
|
float4 iScreenPos : TEXCOORD2,
|
|
|
+ #ifdef VERTEXCOLOR
|
|
|
+ float4 iColor : COLOR0,
|
|
|
+ #endif
|
|
|
out float4 oColor : COLOR0)
|
|
|
{
|
|
|
#ifdef DIFFMAP
|
|
|
float4 diffInput = tex2D(sDiffMap, iTexCoord);
|
|
|
- float3 diffColor = cMatDiffColor.rgb * diffInput.rgb;
|
|
|
#ifdef ALPHAMASK
|
|
|
if (diffInput.a < 0.5)
|
|
|
discard;
|
|
|
#endif
|
|
|
+ float3 diffColor = cMatDiffColor.rgb * diffInput.rgb;
|
|
|
#else
|
|
|
float3 diffColor = cMatDiffColor.rgb;
|
|
|
#endif
|
|
|
|
|
|
+ #ifdef VERTEXCOLOR
|
|
|
+ diffColor *= iColor.rgb;
|
|
|
+ #endif
|
|
|
+
|
|
|
#ifdef SPECMAP
|
|
|
float specStrength = cMatSpecProperties.x * tex2D(sSpecMap, iTexCoord).g;
|
|
|
#else
|