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 nZWrite;
int nAlphaBlending; int nAlphaBlending;
RwRenderStateGet(rwRENDERSTATEALPHATESTFUNCTIONREF, &nPushedAlpha); // RwRenderStateGet(rwRENDERSTATEALPHATESTFUNCTIONREF, &nPushedAlpha);
RwRenderStateGet(rwRENDERSTATEZWRITEENABLE, &nZWrite); RwRenderStateGet(rwRENDERSTATEZWRITEENABLE, &nZWrite);
RwRenderStateGet(rwRENDERSTATEVERTEXALPHAENABLE, &nAlphaBlending); RwRenderStateGet(rwRENDERSTATEVERTEXALPHAENABLE, &nAlphaBlending);
RwRenderStateGet(rwRENDERSTATEALPHATESTFUNCTION, &nAlphaFunction); RwRenderStateGet(rwRENDERSTATEALPHATESTFUNCTION, &nAlphaFunction);
// 1st pass // 1st pass
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, FALSE); RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, FALSE);
RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTIONREF, reinterpret_cast<void*>(255)); // RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTIONREF, reinterpret_cast<void*>(255));
RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTION, reinterpret_cast<void*>(rwALPHATESTFUNCTIONEQUAL)); RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTION, reinterpret_cast<void*>(rwALPHATESTFUNCTIONGREATEREQUAL));
atomic = AtomicDefaultRenderCallBack(atomic); atomic = AtomicDefaultRenderCallBack(atomic);
@ -404,7 +404,7 @@ RpAtomic* TwoPassAlphaRender(RpAtomic* atomic)
AtomicDefaultRenderCallBack(atomic); AtomicDefaultRenderCallBack(atomic);
} }
RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTIONREF, reinterpret_cast<void*>(nPushedAlpha)); // RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTIONREF, reinterpret_cast<void*>(nPushedAlpha));
RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTION, reinterpret_cast<void*>(nAlphaFunction)); RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTION, reinterpret_cast<void*>(nAlphaFunction));
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, reinterpret_cast<void*>(nZWrite)); RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, reinterpret_cast<void*>(nZWrite));
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, reinterpret_cast<void*>(nAlphaBlending)); 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.Position = mul(proj, mul(view, mul(world, In.Position)));
Out.Texture = In.Texture; Out.Texture = In.Texture;
Out.Color = lerp(In.DayColor, In.NightColor, fEnvVars[0]); Out.Color.rgb = lerp(In.DayColor, In.NightColor, fEnvVars[0]).rgb + AmbientLight.rgb;
Out.Color.rgb += AmbientLight.rgb; Out.Color.a = In.NightColor.a * fEnvVars[1];
Out.Color.a *= (255.0/128.0) * fEnvVars[1];
Out.Color = saturate(Out.Color); Out.Color = saturate(Out.Color);
return Out; return Out;

View file

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