|
@@ -6,7 +6,9 @@
|
|
|
#include "Fog.hlsl"
|
|
#include "Fog.hlsl"
|
|
|
|
|
|
|
|
void VS(float4 iPos : POSITION,
|
|
void VS(float4 iPos : POSITION,
|
|
|
- float3 iNormal : NORMAL,
|
|
|
|
|
|
|
+ #ifndef BILLBOARD
|
|
|
|
|
+ float3 iNormal : NORMAL,
|
|
|
|
|
+ #endif
|
|
|
float2 iTexCoord : TEXCOORD0,
|
|
float2 iTexCoord : TEXCOORD0,
|
|
|
#if defined(LIGHTMAP) || defined(AO)
|
|
#if defined(LIGHTMAP) || defined(AO)
|
|
|
float2 iTexCoord2 : TEXCOORD1,
|
|
float2 iTexCoord2 : TEXCOORD1,
|
|
@@ -52,7 +54,7 @@ void VS(float4 iPos : POSITION,
|
|
|
out float2 oTexCoord2 : TEXCOORD7,
|
|
out float2 oTexCoord2 : TEXCOORD7,
|
|
|
#endif
|
|
#endif
|
|
|
#endif
|
|
#endif
|
|
|
- out float4 oPos : POSITION)
|
|
|
|
|
|
|
+ out float4 oPos : OUTPOSITION)
|
|
|
{
|
|
{
|
|
|
float4x3 modelMatrix = iModelMatrix;
|
|
float4x3 modelMatrix = iModelMatrix;
|
|
|
float3 worldPos = GetWorldPos(modelMatrix);
|
|
float3 worldPos = GetWorldPos(modelMatrix);
|
|
@@ -140,18 +142,18 @@ void PS(
|
|
|
#endif
|
|
#endif
|
|
|
#endif
|
|
#endif
|
|
|
#ifdef PREPASS
|
|
#ifdef PREPASS
|
|
|
- out float4 oDepth : COLOR1,
|
|
|
|
|
|
|
+ out float4 oDepth : OUTCOLOR1,
|
|
|
#endif
|
|
#endif
|
|
|
#ifdef DEFERRED
|
|
#ifdef DEFERRED
|
|
|
- out float4 oAlbedo : COLOR1,
|
|
|
|
|
- out float4 oNormal : COLOR2,
|
|
|
|
|
- out float4 oDepth : COLOR3,
|
|
|
|
|
|
|
+ out float4 oAlbedo : OUTCOLOR1,
|
|
|
|
|
+ out float4 oNormal : OUTCOLOR2,
|
|
|
|
|
+ out float4 oDepth : OUTCOLOR3,
|
|
|
#endif
|
|
#endif
|
|
|
- out float4 oColor : COLOR0)
|
|
|
|
|
|
|
+ out float4 oColor : OUTCOLOR0)
|
|
|
{
|
|
{
|
|
|
// Get material diffuse albedo
|
|
// Get material diffuse albedo
|
|
|
#ifdef DIFFMAP
|
|
#ifdef DIFFMAP
|
|
|
- float4 diffInput = tex2D(sDiffMap, iTexCoord.xy);
|
|
|
|
|
|
|
+ float4 diffInput = Sample2D(DiffMap, iTexCoord.xy);
|
|
|
#ifdef ALPHAMASK
|
|
#ifdef ALPHAMASK
|
|
|
if (diffInput.a < 0.5)
|
|
if (diffInput.a < 0.5)
|
|
|
discard;
|
|
discard;
|
|
@@ -163,7 +165,7 @@ void PS(
|
|
|
|
|
|
|
|
// Get material specular albedo
|
|
// Get material specular albedo
|
|
|
#ifdef SPECMAP
|
|
#ifdef SPECMAP
|
|
|
- float3 specColor = cMatSpecColor.rgb * tex2D(sSpecMap, iTexCoord.xy).rgb;
|
|
|
|
|
|
|
+ float3 specColor = cMatSpecColor.rgb * Sample2D(SpecMap, iTexCoord.xy).rgb;
|
|
|
#else
|
|
#else
|
|
|
float3 specColor = cMatSpecColor.rgb;
|
|
float3 specColor = cMatSpecColor.rgb;
|
|
|
#endif
|
|
#endif
|
|
@@ -171,7 +173,7 @@ void PS(
|
|
|
// Get normal
|
|
// Get normal
|
|
|
#ifdef NORMALMAP
|
|
#ifdef NORMALMAP
|
|
|
float3x3 tbn = float3x3(iTangent.xyz, float3(iTexCoord.zw, iTangent.w), iNormal);
|
|
float3x3 tbn = float3x3(iTangent.xyz, float3(iTexCoord.zw, iTangent.w), iNormal);
|
|
|
- float3 normal = normalize(mul(DecodeNormal(tex2D(sNormalMap, iTexCoord.xy)), tbn));
|
|
|
|
|
|
|
+ float3 normal = normalize(mul(DecodeNormal(Sample2D(NormalMap, iTexCoord.xy)), tbn));
|
|
|
#else
|
|
#else
|
|
|
float3 normal = normalize(iNormal);
|
|
float3 normal = normalize(iNormal);
|
|
|
#endif
|
|
#endif
|
|
@@ -196,9 +198,9 @@ void PS(
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(SPOTLIGHT)
|
|
#if defined(SPOTLIGHT)
|
|
|
- lightColor = iSpotPos.w > 0.0 ? tex2Dproj(sLightSpotMap, iSpotPos).rgb * cLightColor.rgb : 0.0;
|
|
|
|
|
|
|
+ lightColor = iSpotPos.w > 0.0 ? Sample2DProj(LightSpotMap, iSpotPos).rrr * cLightColor.rgb : 0.0;
|
|
|
#elif defined(CUBEMASK)
|
|
#elif defined(CUBEMASK)
|
|
|
- lightColor = texCUBE(sLightCubeMap, iCubeMaskVec).rgb * cLightColor.rgb;
|
|
|
|
|
|
|
+ lightColor = SampleCube(LightCubeMap, iCubeMaskVec).rgb * cLightColor.rgb;
|
|
|
#else
|
|
#else
|
|
|
lightColor = cLightColor.rgb;
|
|
lightColor = cLightColor.rgb;
|
|
|
#endif
|
|
#endif
|
|
@@ -231,16 +233,16 @@ void PS(
|
|
|
float3 finalColor = iVertexLight * diffColor.rgb;
|
|
float3 finalColor = iVertexLight * diffColor.rgb;
|
|
|
#ifdef AO
|
|
#ifdef AO
|
|
|
// If using AO, the vertex light ambient is black, calculate occluded ambient here
|
|
// If using AO, the vertex light ambient is black, calculate occluded ambient here
|
|
|
- finalColor += tex2D(sEmissiveMap, iTexCoord2).rgb * cAmbientColor * diffColor.rgb;
|
|
|
|
|
|
|
+ finalColor += Sample2D(EmissiveMap, iTexCoord2).rgb * cAmbientColor * diffColor.rgb;
|
|
|
#endif
|
|
#endif
|
|
|
#ifdef ENVCUBEMAP
|
|
#ifdef ENVCUBEMAP
|
|
|
- finalColor += cMatEnvMapColor * texCUBE(sEnvCubeMap, reflect(iReflectionVec, normal)).rgb;
|
|
|
|
|
|
|
+ finalColor += cMatEnvMapColor * SampleCube(EnvCubeMap, reflect(iReflectionVec, normal)).rgb;
|
|
|
#endif
|
|
#endif
|
|
|
#ifdef LIGHTMAP
|
|
#ifdef LIGHTMAP
|
|
|
- finalColor += tex2D(sEmissiveMap, iTexCoord2).rgb * diffColor.rgb;
|
|
|
|
|
|
|
+ finalColor += Sample2D(EmissiveMap, iTexCoord2).rgb * diffColor.rgb;
|
|
|
#endif
|
|
#endif
|
|
|
#ifdef EMISSIVEMAP
|
|
#ifdef EMISSIVEMAP
|
|
|
- finalColor += cMatEmissiveColor * tex2D(sEmissiveMap, iTexCoord.xy).rgb;
|
|
|
|
|
|
|
+ finalColor += cMatEmissiveColor * Sample2D(EmissiveMap, iTexCoord.xy).rgb;
|
|
|
#else
|
|
#else
|
|
|
finalColor += cMatEmissiveColor;
|
|
finalColor += cMatEmissiveColor;
|
|
|
#endif
|
|
#endif
|
|
@@ -254,26 +256,26 @@ void PS(
|
|
|
float3 finalColor = iVertexLight * diffColor.rgb;
|
|
float3 finalColor = iVertexLight * diffColor.rgb;
|
|
|
#ifdef AO
|
|
#ifdef AO
|
|
|
// If using AO, the vertex light ambient is black, calculate occluded ambient here
|
|
// If using AO, the vertex light ambient is black, calculate occluded ambient here
|
|
|
- finalColor += tex2D(sEmissiveMap, iTexCoord2).rgb * cAmbientColor * diffColor.rgb;
|
|
|
|
|
|
|
+ finalColor += Sample2D(EmissiveMap, iTexCoord2).rgb * cAmbientColor * diffColor.rgb;
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef MATERIAL
|
|
#ifdef MATERIAL
|
|
|
// Add light pre-pass accumulation result
|
|
// Add light pre-pass accumulation result
|
|
|
// Lights are accumulated at half intensity. Bring back to full intensity now
|
|
// Lights are accumulated at half intensity. Bring back to full intensity now
|
|
|
- float4 lightInput = 2.0 * tex2Dproj(sLightBuffer, iScreenPos);
|
|
|
|
|
|
|
+ float4 lightInput = 2.0 * Sample2DProj(LightBuffer, iScreenPos);
|
|
|
float3 lightSpecColor = lightInput.a * (lightInput.rgb / GetIntensity(lightInput.rgb));
|
|
float3 lightSpecColor = lightInput.a * (lightInput.rgb / GetIntensity(lightInput.rgb));
|
|
|
|
|
|
|
|
finalColor += lightInput.rgb * diffColor.rgb + lightSpecColor * specColor;
|
|
finalColor += lightInput.rgb * diffColor.rgb + lightSpecColor * specColor;
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ENVCUBEMAP
|
|
#ifdef ENVCUBEMAP
|
|
|
- finalColor += cMatEnvMapColor * texCUBE(sEnvCubeMap, reflect(iReflectionVec, normal)).rgb;
|
|
|
|
|
|
|
+ finalColor += cMatEnvMapColor * SampleCube(EnvCubeMap, reflect(iReflectionVec, normal)).rgb;
|
|
|
#endif
|
|
#endif
|
|
|
#ifdef LIGHTMAP
|
|
#ifdef LIGHTMAP
|
|
|
- finalColor += tex2D(sEmissiveMap, iTexCoord2).rgb * diffColor.rgb;
|
|
|
|
|
|
|
+ finalColor += Sample2D(EmissiveMap, iTexCoord2).rgb * diffColor.rgb;
|
|
|
#endif
|
|
#endif
|
|
|
#ifdef EMISSIVEMAP
|
|
#ifdef EMISSIVEMAP
|
|
|
- finalColor += cMatEmissiveColor * tex2D(sEmissiveMap, iTexCoord.xy).rgb;
|
|
|
|
|
|
|
+ finalColor += cMatEmissiveColor * Sample2D(EmissiveMap, iTexCoord.xy).rgb;
|
|
|
#else
|
|
#else
|
|
|
finalColor += cMatEmissiveColor;
|
|
finalColor += cMatEmissiveColor;
|
|
|
#endif
|
|
#endif
|