Changed nvc and dual pass code.

This commit is contained in:
aap 2014-11-29 18:34:36 +01:00
parent 49ddc29312
commit f4514ad6b2
3 changed files with 38 additions and 47 deletions

View File

@ -382,15 +382,15 @@ RpAtomic* TwoPassAlphaRender(RpAtomic* atomic)
int nZWrite;
int nAlphaBlending;
RwRenderStateGet(rwRENDERSTATEALPHATESTFUNCTIONREF, &nPushedAlpha);
// RwRenderStateGet(rwRENDERSTATEALPHATESTFUNCTIONREF, &nPushedAlpha);
RwRenderStateGet(rwRENDERSTATEZWRITEENABLE, &nZWrite);
RwRenderStateGet(rwRENDERSTATEVERTEXALPHAENABLE, &nAlphaBlending);
RwRenderStateGet(rwRENDERSTATEALPHATESTFUNCTION, &nAlphaFunction);
// 1st pass
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, FALSE);
RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTIONREF, reinterpret_cast<void*>(255));
RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTION, reinterpret_cast<void*>(rwALPHATESTFUNCTIONEQUAL));
// RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTIONREF, reinterpret_cast<void*>(255));
RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTION, reinterpret_cast<void*>(rwALPHATESTFUNCTIONGREATEREQUAL));
atomic = AtomicDefaultRenderCallBack(atomic);
@ -404,7 +404,7 @@ RpAtomic* TwoPassAlphaRender(RpAtomic* atomic)
AtomicDefaultRenderCallBack(atomic);
}
RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTIONREF, reinterpret_cast<void*>(nPushedAlpha));
// RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTIONREF, reinterpret_cast<void*>(nPushedAlpha));
RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTION, reinterpret_cast<void*>(nAlphaFunction));
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, reinterpret_cast<void*>(nZWrite));
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, reinterpret_cast<void*>(nAlphaBlending));

View File

@ -26,9 +26,8 @@ VS_OUTPUT NVC_vertex_shader( in VS_INPUT In )
Out.Position = mul(proj, mul(view, mul(world, In.Position)));
Out.Texture = In.Texture;
Out.Color = lerp(In.DayColor, In.NightColor, fEnvVars[0]);
Out.Color.rgb += AmbientLight.rgb;
Out.Color.a *= (255.0/128.0) * fEnvVars[1];
Out.Color.rgb = lerp(In.DayColor, In.NightColor, fEnvVars[0]).rgb + AmbientLight.rgb;
Out.Color.a = In.NightColor.a * fEnvVars[1];
Out.Color = saturate(Out.Color);
return Out;

View File

@ -1,10 +1,6 @@
#if 0
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111
//
// fxc /T vs_2_0 /E NVC_vertex_shader /Fh ..\SilentPatch\nvc.h
// ..\SilentPatch\nvc.fx
//
// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
//
// Parameters:
//
@ -27,7 +23,7 @@
//
vs_2_0
def c14, 1.9921875, 0, 1, 0
def c14, 0, 1, 0, 0
dcl_position v0
dcl_texcoord v1
dcl_color v2
@ -44,17 +40,16 @@
mad r1, c10, r0.x, r1
mad r1, c12, r0.z, r1
mad oPos, c13, r0.w, r1
mov r0, v3
add r0, -r0, v2
mad r0, c0.x, r0, v3
mul r0.w, r0.w, c0.y
add r1.xyz, r0, c1
mul r1.w, r0.w, c14.x
max r0, r1, c14.y
min oD0, r0, c14.z
mov r0.xyz, v3
add r0.xyz, -r0, v2
mad r0.xyz, c0.x, r0, v3
add r0.xyz, r0, c1
mul r0.w, v2.w, c0.y
max r0, r0, c14.x
min oD0, r0, c14.y
mov oT0.xy, v1
// approximately 21 instruction slots used
// approximately 20 instruction slots used
#endif
const BYTE g_vs20_NVC_vertex_shader[] =
@ -105,12 +100,12 @@ const BYTE g_vs20_NVC_vertex_shader[] =
83, 76, 32, 83, 104, 97,
100, 101, 114, 32, 67, 111,
109, 112, 105, 108, 101, 114,
32, 57, 46, 50, 57, 46,
57, 53, 50, 46, 51, 49,
49, 49, 0, 171, 81, 0,
32, 54, 46, 51, 46, 57,
54, 48, 48, 46, 49, 54,
51, 56, 52, 0, 81, 0,
0, 5, 14, 0, 15, 160,
0, 0, 255, 63, 0, 0,
0, 0, 0, 0, 128, 63,
0, 0, 0, 0, 0, 0,
128, 63, 0, 0, 0, 0,
0, 0, 0, 0, 31, 0,
0, 2, 0, 0, 0, 128,
0, 0, 15, 144, 31, 0,
@ -158,28 +153,25 @@ const BYTE g_vs20_NVC_vertex_shader[] =
0, 0, 15, 192, 13, 0,
228, 160, 0, 0, 255, 128,
1, 0, 228, 128, 1, 0,
0, 2, 0, 0, 15, 128,
0, 2, 0, 0, 7, 128,
3, 0, 228, 144, 2, 0,
0, 3, 0, 0, 15, 128,
0, 3, 0, 0, 7, 128,
0, 0, 228, 129, 2, 0,
228, 144, 4, 0, 0, 4,
0, 0, 15, 128, 0, 0,
0, 0, 7, 128, 0, 0,
0, 160, 0, 0, 228, 128,
3, 0, 228, 144, 5, 0,
0, 3, 0, 0, 8, 128,
0, 0, 255, 128, 0, 0,
85, 160, 2, 0, 0, 3,
1, 0, 7, 128, 0, 0,
228, 128, 1, 0, 228, 160,
5, 0, 0, 3, 1, 0,
8, 128, 0, 0, 255, 128,
14, 0, 0, 160, 11, 0,
0, 3, 0, 0, 15, 128,
1, 0, 228, 128, 14, 0,
85, 160, 10, 0, 0, 3,
0, 0, 15, 208, 0, 0,
228, 128, 14, 0, 170, 160,
1, 0, 0, 2, 0, 0,
3, 224, 1, 0, 228, 144,
255, 255, 0, 0
3, 0, 228, 144, 2, 0,
0, 3, 0, 0, 7, 128,
0, 0, 228, 128, 1, 0,
228, 160, 5, 0, 0, 3,
0, 0, 8, 128, 2, 0,
255, 144, 0, 0, 85, 160,
11, 0, 0, 3, 0, 0,
15, 128, 0, 0, 228, 128,
14, 0, 0, 160, 10, 0,
0, 3, 0, 0, 15, 208,
0, 0, 228, 128, 14, 0,
85, 160, 1, 0, 0, 2,
0, 0, 3, 224, 1, 0,
228, 144, 255, 255, 0, 0
};