From 4a7266d420622185f4adca335545b247382f6c0a Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 31 Dec 2018 13:09:39 +0100 Subject: [PATCH] =?UTF-8?q?samples:=20float4=E2=86=92float3=20for=20vtx=5F?= =?UTF-8?q?normal=20in=20cartoon=20&=20fireflies=20samples?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It seems that Cg's glslv profile causes the w coordinate of the normal column to be random. Fixes #494 Fixes #495 --- samples/cartoon-shader/normalGen.sha | 18 ++++++++---------- samples/fireflies/model.sha | 4 ++-- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/samples/cartoon-shader/normalGen.sha b/samples/cartoon-shader/normalGen.sha index a3642b0630..53b994b1ae 100644 --- a/samples/cartoon-shader/normalGen.sha +++ b/samples/cartoon-shader/normalGen.sha @@ -3,14 +3,14 @@ //Cg profile arbvp1 arbfp1 void vshader(float4 vtx_position : POSITION, - float4 vtx_normal : NORMAL, - out float4 l_position : POSITION, - out float3 l_color : TEXCOORD0, - uniform float4x4 mat_modelproj, - uniform float4x4 itp_modelview) + float3 vtx_normal : NORMAL, + out float4 l_position : POSITION, + out float3 l_color : TEXCOORD0, + uniform float4x4 mat_modelproj, + uniform float4x4 itp_modelview) { - l_position=mul(mat_modelproj, vtx_position); - l_color=(float3)mul(itp_modelview, vtx_normal); + l_position = mul(mat_modelproj, vtx_position); + l_color = (float3)mul(itp_modelview, float4(vtx_normal, 0)); } void fshader(float3 l_color: TEXCOORD0, @@ -18,8 +18,6 @@ void fshader(float3 l_color: TEXCOORD0, { l_color = normalize(l_color); l_color = l_color/2; - o_color.rgb = l_color + float4(0.5, 0.5, 0.5, 0.5); + o_color.rgb = l_color.rgb + float3(0.5, 0.5, 0.5); o_color.a = 1; } - - diff --git a/samples/fireflies/model.sha b/samples/fireflies/model.sha index f1867ee5da..0c2e7fd920 100644 --- a/samples/fireflies/model.sha +++ b/samples/fireflies/model.sha @@ -4,7 +4,7 @@ void vshader(float4 vtx_position : POSITION, float2 vtx_texcoord0 : TEXCOORD0, - float4 vtx_normal : NORMAL, + float3 vtx_normal : NORMAL, float4 vtx_color : COLOR, out float4 l_position : POSITION, out float2 l_texcoord0 : TEXCOORD0, @@ -16,7 +16,7 @@ void vshader(float4 vtx_position : POSITION, l_position=mul(mat_modelproj, vtx_position); l_texcoord0 = vtx_texcoord0; l_color = vtx_color; - l_normal = (float3)mul(itp_modelview, vtx_normal); + l_normal = (float3)mul(itp_modelview, float4(vtx_normal, 0)); } void fshader(float2 l_texcoord0: TEXCOORD0,