mirror of https://github.com/aap/librw.git
fixed matfx; forgot skin file
This commit is contained in:
parent
a2b79a71aa
commit
752fceb1e3
|
@ -32,13 +32,14 @@
|
||||||
max r1.xyz, v0, c2
|
max r1.xyz, v0, c2
|
||||||
mul r1.xyz, r1, c1.x
|
mul r1.xyz, r1, c1.x
|
||||||
mul r0.xyz, r0, r1
|
mul r0.xyz, r0, r1
|
||||||
|
mul r0.xyz, r0, t0.z
|
||||||
add r1.xyz, v0, -c0
|
add r1.xyz, v0, -c0
|
||||||
mad r1.xyz, t0.z, r1, c0
|
mad r1.xyz, t0.z, r1, c0
|
||||||
mad r0.xyz, r1, v0.w, r0
|
mad r0.xyz, r1, v0.w, r0
|
||||||
mov r0.w, v0.w
|
mov r0.w, v0.w
|
||||||
mov oC0, r0
|
mov oC0, r0
|
||||||
|
|
||||||
// approximately 9 instruction slots used (1 texture, 8 arithmetic)
|
// approximately 10 instruction slots used (1 texture, 9 arithmetic)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const BYTE g_ps20_main[] =
|
const BYTE g_ps20_main[] =
|
||||||
|
@ -105,19 +106,22 @@ const BYTE g_ps20_main[] =
|
||||||
228, 128, 1, 0, 0, 160,
|
228, 128, 1, 0, 0, 160,
|
||||||
5, 0, 0, 3, 0, 0,
|
5, 0, 0, 3, 0, 0,
|
||||||
7, 128, 0, 0, 228, 128,
|
7, 128, 0, 0, 228, 128,
|
||||||
1, 0, 228, 128, 2, 0,
|
1, 0, 228, 128, 5, 0,
|
||||||
0, 3, 1, 0, 7, 128,
|
0, 3, 0, 0, 7, 128,
|
||||||
0, 0, 228, 144, 0, 0,
|
0, 0, 228, 128, 0, 0,
|
||||||
228, 161, 4, 0, 0, 4,
|
170, 176, 2, 0, 0, 3,
|
||||||
1, 0, 7, 128, 0, 0,
|
1, 0, 7, 128, 0, 0,
|
||||||
170, 176, 1, 0, 228, 128,
|
228, 144, 0, 0, 228, 161,
|
||||||
0, 0, 228, 160, 4, 0,
|
4, 0, 0, 4, 1, 0,
|
||||||
0, 4, 0, 0, 7, 128,
|
7, 128, 0, 0, 170, 176,
|
||||||
1, 0, 228, 128, 0, 0,
|
1, 0, 228, 128, 0, 0,
|
||||||
255, 144, 0, 0, 228, 128,
|
228, 160, 4, 0, 0, 4,
|
||||||
1, 0, 0, 2, 0, 0,
|
0, 0, 7, 128, 1, 0,
|
||||||
8, 128, 0, 0, 255, 144,
|
228, 128, 0, 0, 255, 144,
|
||||||
1, 0, 0, 2, 0, 8,
|
0, 0, 228, 128, 1, 0,
|
||||||
15, 128, 0, 0, 228, 128,
|
0, 2, 0, 0, 8, 128,
|
||||||
255, 255, 0, 0
|
0, 0, 255, 144, 1, 0,
|
||||||
|
0, 2, 0, 8, 15, 128,
|
||||||
|
0, 0, 228, 128, 255, 255,
|
||||||
|
0, 0
|
||||||
};
|
};
|
||||||
|
|
|
@ -16,14 +16,15 @@ float4 colorClamp : register(c2);
|
||||||
float4 main(VS_out input) : COLOR
|
float4 main(VS_out input) : COLOR
|
||||||
{
|
{
|
||||||
float4 pass1 = input.Color;
|
float4 pass1 = input.Color;
|
||||||
|
float4 envColor = max(pass1, colorClamp);
|
||||||
#ifdef TEX
|
#ifdef TEX
|
||||||
pass1 *= tex2D(diffTex, input.TexCoord0.xy);
|
pass1 *= tex2D(diffTex, input.TexCoord0.xy);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
float4 envColor = max(pass1, colorClamp);
|
|
||||||
float4 pass2 = envColor*shininess*tex2D(envTex, input.TexCoord1.xy);
|
float4 pass2 = envColor*shininess*tex2D(envTex, input.TexCoord1.xy);
|
||||||
|
|
||||||
pass1.rgb = lerp(fogColor.rgb, pass1.rgb, input.TexCoord0.z);
|
pass1.rgb = lerp(fogColor.rgb, pass1.rgb, input.TexCoord0.z);
|
||||||
|
pass2.rgb = lerp(float3(0.0, 0.0, 0.0), pass2.rgb, input.TexCoord0.z);
|
||||||
|
|
||||||
// We simulate drawing this in two passes.
|
// We simulate drawing this in two passes.
|
||||||
// First pass with standard blending, second with addition
|
// First pass with standard blending, second with addition
|
||||||
|
|
|
@ -31,18 +31,19 @@
|
||||||
dcl v0
|
dcl v0
|
||||||
dcl_2d s0
|
dcl_2d s0
|
||||||
dcl_2d s1
|
dcl_2d s1
|
||||||
texld r0, t0, s0
|
texld r0, t1, s1
|
||||||
texld r1, t1, s1
|
texld r1, t0, s0
|
||||||
mad r2.xyz, v0, r0, -c0
|
max r2.xyz, v0, c2
|
||||||
mul r0, r0, v0
|
mul r2.xyz, r2, c1.x
|
||||||
mad r2.xyz, t0.z, r2, c0
|
mul r0.xyz, r0, r2
|
||||||
max r3.xyz, r0, c2
|
mul r0.xyz, r0, t0.z
|
||||||
mul r3.xyz, r3, c1.x
|
mad r1.xyz, v0, r1, -c0
|
||||||
mul r1.xyz, r1, r3
|
mul r2.w, r1.w, v0.w
|
||||||
mad r0.xyz, r2, r0.w, r1
|
mad r1.xyz, t0.z, r1, c0
|
||||||
mov oC0, r0
|
mad r2.xyz, r1, r2.w, r0
|
||||||
|
mov oC0, r2
|
||||||
|
|
||||||
// approximately 10 instruction slots used (2 texture, 8 arithmetic)
|
// approximately 11 instruction slots used (2 texture, 9 arithmetic)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const BYTE g_ps20_main[] =
|
const BYTE g_ps20_main[] =
|
||||||
|
@ -109,32 +110,35 @@ const BYTE g_ps20_main[] =
|
||||||
15, 160, 31, 0, 0, 2,
|
15, 160, 31, 0, 0, 2,
|
||||||
0, 0, 0, 144, 1, 8,
|
0, 0, 0, 144, 1, 8,
|
||||||
15, 160, 66, 0, 0, 3,
|
15, 160, 66, 0, 0, 3,
|
||||||
0, 0, 15, 128, 0, 0,
|
0, 0, 15, 128, 1, 0,
|
||||||
228, 176, 0, 8, 228, 160,
|
228, 176, 1, 8, 228, 160,
|
||||||
66, 0, 0, 3, 1, 0,
|
66, 0, 0, 3, 1, 0,
|
||||||
15, 128, 1, 0, 228, 176,
|
15, 128, 0, 0, 228, 176,
|
||||||
1, 8, 228, 160, 4, 0,
|
0, 8, 228, 160, 11, 0,
|
||||||
0, 4, 2, 0, 7, 128,
|
0, 3, 2, 0, 7, 128,
|
||||||
0, 0, 228, 144, 0, 0,
|
0, 0, 228, 144, 2, 0,
|
||||||
228, 128, 0, 0, 228, 161,
|
228, 160, 5, 0, 0, 3,
|
||||||
|
2, 0, 7, 128, 2, 0,
|
||||||
|
228, 128, 1, 0, 0, 160,
|
||||||
5, 0, 0, 3, 0, 0,
|
5, 0, 0, 3, 0, 0,
|
||||||
15, 128, 0, 0, 228, 128,
|
|
||||||
0, 0, 228, 144, 4, 0,
|
|
||||||
0, 4, 2, 0, 7, 128,
|
|
||||||
0, 0, 170, 176, 2, 0,
|
|
||||||
228, 128, 0, 0, 228, 160,
|
|
||||||
11, 0, 0, 3, 3, 0,
|
|
||||||
7, 128, 0, 0, 228, 128,
|
7, 128, 0, 0, 228, 128,
|
||||||
2, 0, 228, 160, 5, 0,
|
2, 0, 228, 128, 5, 0,
|
||||||
0, 3, 3, 0, 7, 128,
|
0, 3, 0, 0, 7, 128,
|
||||||
3, 0, 228, 128, 1, 0,
|
0, 0, 228, 128, 0, 0,
|
||||||
0, 160, 5, 0, 0, 3,
|
170, 176, 4, 0, 0, 4,
|
||||||
1, 0, 7, 128, 1, 0,
|
1, 0, 7, 128, 0, 0,
|
||||||
228, 128, 3, 0, 228, 128,
|
228, 144, 1, 0, 228, 128,
|
||||||
4, 0, 0, 4, 0, 0,
|
0, 0, 228, 161, 5, 0,
|
||||||
7, 128, 2, 0, 228, 128,
|
0, 3, 2, 0, 8, 128,
|
||||||
0, 0, 255, 128, 1, 0,
|
1, 0, 255, 128, 0, 0,
|
||||||
228, 128, 1, 0, 0, 2,
|
255, 144, 4, 0, 0, 4,
|
||||||
0, 8, 15, 128, 0, 0,
|
1, 0, 7, 128, 0, 0,
|
||||||
228, 128, 255, 255, 0, 0
|
170, 176, 1, 0, 228, 128,
|
||||||
|
0, 0, 228, 160, 4, 0,
|
||||||
|
0, 4, 2, 0, 7, 128,
|
||||||
|
1, 0, 228, 128, 2, 0,
|
||||||
|
255, 128, 0, 0, 228, 128,
|
||||||
|
1, 0, 0, 2, 0, 8,
|
||||||
|
15, 128, 2, 0, 228, 128,
|
||||||
|
255, 255, 0, 0
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
#include "standardConstants.h"
|
||||||
|
|
||||||
|
float4x4 boneMatrices[64] : register(c41);
|
||||||
|
|
||||||
|
struct VS_in
|
||||||
|
{
|
||||||
|
float4 Position : POSITION;
|
||||||
|
float3 Normal : NORMAL;
|
||||||
|
float2 TexCoord : TEXCOORD0;
|
||||||
|
float4 Prelight : COLOR0;
|
||||||
|
float4 Weights : BLENDWEIGHT;
|
||||||
|
int4 Indices : BLENDINDICES;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct VS_out {
|
||||||
|
float4 Position : POSITION;
|
||||||
|
float3 TexCoord0 : TEXCOORD0; // also fog
|
||||||
|
float4 Color : COLOR0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
VS_out main(in VS_in input)
|
||||||
|
{
|
||||||
|
VS_out output;
|
||||||
|
|
||||||
|
int j;
|
||||||
|
float3 SkinVertex = float3(0.0, 0.0, 0.0);
|
||||||
|
float3 SkinNormal = float3(0.0, 0.0, 0.0);
|
||||||
|
for(j = 0; j < 4; j++){
|
||||||
|
SkinVertex += mul(boneMatrices[input.Indices[j]], input.Position).xyz * input.Weights[j];
|
||||||
|
SkinNormal += mul((float3x3)boneMatrices[input.Indices[j]], input.Normal).xyz * input.Weights[j];
|
||||||
|
}
|
||||||
|
|
||||||
|
output.Position = mul(combinedMat, float4(SkinVertex, 1.0));
|
||||||
|
float3 Vertex = mul(worldMat, float4(SkinVertex, 1.0)).xyz;
|
||||||
|
float3 Normal = mul(normalMat, SkinNormal);
|
||||||
|
|
||||||
|
output.TexCoord0.xy = input.TexCoord;
|
||||||
|
|
||||||
|
output.Color = float4(0.0, 0.0, 0.0, 1.0);
|
||||||
|
if(surfPrelight > 0.0)
|
||||||
|
output.Color = input.Prelight;
|
||||||
|
|
||||||
|
output.Color.rgb += ambientLight.rgb * surfAmbient;
|
||||||
|
|
||||||
|
int i;
|
||||||
|
#ifdef DIRECTIONALS
|
||||||
|
for(i = 0; i < numDirLights; i++)
|
||||||
|
output.Color.xyz += DoDirLight(lights[i+firstDirLight], Normal)*surfDiffuse;
|
||||||
|
#endif
|
||||||
|
#ifdef POINTLIGHTS
|
||||||
|
for(i = 0; i < numPointLights; i++)
|
||||||
|
output.Color.xyz += DoPointLight(lights[i+firstPointLight], Vertex.xyz, Normal)*surfDiffuse;
|
||||||
|
#endif
|
||||||
|
#ifdef SPOTLIGHTS
|
||||||
|
for(i = 0; i < numSpotLights; i++)
|
||||||
|
output.Color.xyz += DoSpotLight(lights[i+firstSpotLight], Vertex.xyz, Normal)*surfDiffuse;
|
||||||
|
#endif
|
||||||
|
// PS2 clamps before material color
|
||||||
|
output.Color = clamp(output.Color, 0.0, 1.0);
|
||||||
|
output.Color *= matCol;
|
||||||
|
|
||||||
|
output.TexCoord0.z = clamp((output.Position.w - fogEnd)*fogRange, fogDisable, 1.0);
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
Loading…
Reference in New Issue