aboutsummaryrefslogtreecommitdiff
path: root/tools/ArtistTools/source/BlastPlugin/Shaders
diff options
context:
space:
mode:
authorAnton Novoselov <[email protected]>2017-08-08 20:14:22 +0300
committerAnton Novoselov <[email protected]>2017-08-08 20:14:22 +0300
commitd41654b469fa51870b5952c836c04d9da17f32d3 (patch)
tree64f8f437eef394630355f281d35ca1d53e5c4d6c /tools/ArtistTools/source/BlastPlugin/Shaders
parentadd +x for packman script (diff)
downloadblast-d41654b469fa51870b5952c836c04d9da17f32d3.tar.xz
blast-d41654b469fa51870b5952c836c04d9da17f32d3.zip
Updated to CL 22627414:
* docs updates * authoring fixes * stress solver crash fixes
Diffstat (limited to 'tools/ArtistTools/source/BlastPlugin/Shaders')
-rw-r--r--tools/ArtistTools/source/BlastPlugin/Shaders/common_buffers_ex.hlsl3
-rw-r--r--tools/ArtistTools/source/BlastPlugin/Shaders/model_simple_textured_ex.hlsl56
2 files changed, 43 insertions, 16 deletions
diff --git a/tools/ArtistTools/source/BlastPlugin/Shaders/common_buffers_ex.hlsl b/tools/ArtistTools/source/BlastPlugin/Shaders/common_buffers_ex.hlsl
index 0076599..d6a37b0 100644
--- a/tools/ArtistTools/source/BlastPlugin/Shaders/common_buffers_ex.hlsl
+++ b/tools/ArtistTools/source/BlastPlugin/Shaders/common_buffers_ex.hlsl
@@ -42,6 +42,9 @@ cbuffer World : register(b1)
float specularPower;
float3 dirLightColor;
float specularIntensity;
+ float g_flatNormal;
+ float g_wireFrameOver;
+ float g_useLighting;
Light g_Light[4];
};
diff --git a/tools/ArtistTools/source/BlastPlugin/Shaders/model_simple_textured_ex.hlsl b/tools/ArtistTools/source/BlastPlugin/Shaders/model_simple_textured_ex.hlsl
index 152174c..6d8e819 100644
--- a/tools/ArtistTools/source/BlastPlugin/Shaders/model_simple_textured_ex.hlsl
+++ b/tools/ArtistTools/source/BlastPlugin/Shaders/model_simple_textured_ex.hlsl
@@ -10,8 +10,9 @@ Texture2D envTexture : register(t3);
struct VS_INPUT
{
float3 position : POSITION0;
- float3 normal : NORMAL0;
- float3 tangent : TANGENT0;
+ float3 normal : VERTEX_NORMAL;
+ float3 faceNormal : FACE_NORMAL;
+ float3 tangent : TANGENT;
float2 uv : TEXCOORD0;
float health : TEXCOORD1;
};
@@ -36,8 +37,9 @@ VS_OUTPUT VS(VS_INPUT iV)
oV.worldPos = worldSpacePos;
// normals
- float3 worldNormal = mul(float4(iV.normal, 0.0f), worldMatrix);
- oV.normal = worldNormal;
+ float3 normal = (g_flatNormal > 0) ? normalize(iV.faceNormal) : normalize(iV.normal);
+ normal = mul(float4(normal, 0.0f), worldMatrix);
+ oV.normal = normal;
oV.tangent = normalize(iV.tangent);
@@ -75,11 +77,44 @@ inline float3 computeSpecularLighting(
float4 PS(VS_OUTPUT iV) : SV_Target0
{
+ if(g_wireFrameOver > 0)
+ return float4(0,0,0,1);
+
float3 diffuseColor = m_diffuseColor.xyz;
if(m_useDiffuseTexture > 0)
{
diffuseColor = diffuseTexture.Sample(defaultSampler, iV.uv).xyz;
}
+
+ if(selected > 0)
+ {
+ if(diffuseColor.r > 0.5)
+ {
+ diffuseColor.r = 0.5;
+ }
+ else
+ {
+ diffuseColor.r += 0.5;
+ }
+ return float4(diffuseColor, 1.0f);
+ }
+
+ if (g_useLighting < 0)
+ {
+ if(selected > 0)
+ {
+ if(diffuseColor.r > 0.5)
+ {
+ diffuseColor.r = 0.5;
+ }
+ else
+ {
+ diffuseColor.r += 0.5;
+ }
+ }
+ return float4(diffuseColor, 1.0f);
+ }
+
float3 specularColor = m_specularColor.xyz;
if(m_useSpecularTexture > 0)
{
@@ -144,17 +179,6 @@ float4 PS(VS_OUTPUT iV) : SV_Target0
}
color.rgb = (ambient + diffuse) * albedo + specular;
-
- if(selected > 0)
- {
- if(color.r > 0.5)
- {
- color.r = 0.5;
- }
- else
- {
- color.r += 0.5;
- }
- }
+
return color;
} \ No newline at end of file