Direct3D11 common shader changes.

This commit is contained in:
rextimmy 2016-03-20 21:50:21 +10:00
parent 1ff6f221fb
commit 3a9b50f702
283 changed files with 3547 additions and 1834 deletions

View file

@ -21,7 +21,7 @@
//-----------------------------------------------------------------------------
#include "torque.hlsl"
#include "shaderModel.hlsl"
// With advanced lighting we get soft particles.
#ifdef TORQUE_LINEAR_DEPTH
#define SOFTPARTICLES
@ -29,11 +29,11 @@
#ifdef SOFTPARTICLES
#include "shadergen:/autogenConditioners.h"
#include "shaderModelAutoGen.hlsl"
uniform float oneOverSoftness;
uniform float oneOverFar;
uniform sampler2D prepassTex : register(S1);
TORQUE_UNIFORM_SAMPLER2D(prepassTex, 1);
//uniform float3 vEye;
uniform float4 prePassTargetParams;
#endif
@ -42,14 +42,14 @@
struct Conn
{
float4 hpos : TORQUE_POSITION;
float4 color : TEXCOORD0;
float2 uv0 : TEXCOORD1;
float4 pos : TEXCOORD2;
float4 pos : TEXCOORD2;
};
uniform sampler2D diffuseMap : register(S0);
uniform sampler2D paraboloidLightMap : register(S2);
TORQUE_UNIFORM_SAMPLER2D(diffuseMap, 0);
TORQUE_UNIFORM_SAMPLER2D(paraboloidLightMap, 2);
float4 lmSample( float3 nrm )
{
@ -69,14 +69,14 @@ float4 lmSample( float3 nrm )
// Atlasing front and back maps, so scale
lmCoord.x *= 0.5;
return tex2D(paraboloidLightMap, lmCoord);
return TORQUE_TEX2D(paraboloidLightMap, lmCoord);
}
uniform float alphaFactor;
uniform float alphaScale;
float4 main( Conn IN ) : COLOR
float4 main( Conn IN ) : TORQUE_TARGET0
{
float softBlend = 1;
@ -84,7 +84,7 @@ float4 main( Conn IN ) : COLOR
float2 tc = IN.pos.xy * float2(1.0, -1.0) / IN.pos.w;
tc = viewportCoordToRenderTarget(saturate( ( tc + 1.0 ) * 0.5 ), prePassTargetParams);
float sceneDepth = prepassUncondition( prepassTex, tc ).w;
float sceneDepth = TORQUE_PREPASS_UNCONDITION(prepassTex, tc).w;
float depth = IN.pos.w * oneOverFar;
float diff = sceneDepth - depth;
#ifdef CLIP_Z
@ -96,7 +96,7 @@ float4 main( Conn IN ) : COLOR
softBlend = saturate( diff * oneOverSoftness );
#endif
float4 diffuse = tex2D( diffuseMap, IN.uv0 );
float4 diffuse = TORQUE_TEX2D( diffuseMap, IN.uv0 );
//return float4( lmSample(float3(0, 0, -1)).rgb, IN.color.a * diffuse.a * softBlend * alphaScale);