mirror of
https://github.com/aap/librw.git
synced 2024-11-25 05:05:42 +00:00
implement more options for matfx
This commit is contained in:
parent
bb7fb68531
commit
58357e37e1
@ -33,9 +33,10 @@ static void *matfx_env_tex_PS;
|
|||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
VSLOC_texMat = VSLOC_afterLights,
|
VSLOC_texMat = VSLOC_afterLights,
|
||||||
|
VSLOC_colorClamp = VSLOC_texMat + 4,
|
||||||
|
VSLOC_envColor,
|
||||||
|
|
||||||
PSLOC_shininess = 1,
|
PSLOC_shininess = 1,
|
||||||
PSLOC_colorClamp = 2
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -88,6 +89,8 @@ uploadEnvMatrix(Frame *frame)
|
|||||||
Matrix::invert(&invMat, frame->getLTM());
|
Matrix::invert(&invMat, frame->getLTM());
|
||||||
convMatrix(&invMtx, &invMat);
|
convMatrix(&invMtx, &invMat);
|
||||||
invMtx.pos.set(0.0f, 0.0f, 0.0f);
|
invMtx.pos.set(0.0f, 0.0f, 0.0f);
|
||||||
|
float uscale = fabs(normal2texcoord.right.x);
|
||||||
|
normal2texcoord.right.x = MatFX::envMapFlipU ? -uscale : uscale;
|
||||||
RawMatrix::mult(&envMtx, &invMtx, &normal2texcoord);
|
RawMatrix::mult(&envMtx, &invMtx, &normal2texcoord);
|
||||||
d3ddevice->SetVertexShaderConstantF(VSLOC_texMat, (float*)&envMtx, 4);
|
d3ddevice->SetVertexShaderConstantF(VSLOC_texMat, (float*)&envMtx, 4);
|
||||||
}
|
}
|
||||||
@ -118,10 +121,16 @@ matfxRender_EnvMap(InstanceDataHeader *header, InstanceData *inst, int32 lightBi
|
|||||||
fxparams.disableFBA = env->fbAlpha ? 0.0f : 1.0f;
|
fxparams.disableFBA = env->fbAlpha ? 0.0f : 1.0f;
|
||||||
d3ddevice->SetPixelShaderConstantF(PSLOC_shininess, (float*)&fxparams, 1);
|
d3ddevice->SetPixelShaderConstantF(PSLOC_shininess, (float*)&fxparams, 1);
|
||||||
// This clamps the vertex color below. With it we can achieve both PC and PS2 style matfx
|
// This clamps the vertex color below. With it we can achieve both PC and PS2 style matfx
|
||||||
if(MatFX::modulateEnvMap)
|
if(MatFX::envMapApplyLight)
|
||||||
d3ddevice->SetPixelShaderConstantF(PSLOC_colorClamp, zero, 1);
|
d3ddevice->SetVertexShaderConstantF(VSLOC_colorClamp, zero, 1);
|
||||||
else
|
else
|
||||||
d3ddevice->SetPixelShaderConstantF(PSLOC_colorClamp, one, 1);
|
d3ddevice->SetVertexShaderConstantF(VSLOC_colorClamp, one, 1);
|
||||||
|
RGBAf envcol[4];
|
||||||
|
if(MatFX::envMapUseMatColor)
|
||||||
|
convColor(envcol, &m->color);
|
||||||
|
else
|
||||||
|
convColor(envcol, &MatFX::envMapColor);
|
||||||
|
d3ddevice->SetVertexShaderConstantF(VSLOC_envColor, (float*)&envcol, 1);
|
||||||
|
|
||||||
// Pick a shader
|
// Pick a shader
|
||||||
if((lightBits & VSLIGHT_MASK) == 0)
|
if((lightBits & VSLIGHT_MASK) == 0)
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
//
|
//
|
||||||
// Parameters:
|
// Parameters:
|
||||||
//
|
//
|
||||||
// float4 colorClamp;
|
|
||||||
// sampler2D envTex;
|
// sampler2D envTex;
|
||||||
// float4 fogColor;
|
// float4 fogColor;
|
||||||
// float4 fxparams;
|
// float4 fxparams;
|
||||||
@ -19,7 +18,6 @@
|
|||||||
// ------------ ----- ----
|
// ------------ ----- ----
|
||||||
// fogColor c0 1
|
// fogColor c0 1
|
||||||
// fxparams c1 1
|
// fxparams c1 1
|
||||||
// colorClamp c2 1
|
|
||||||
// envTex s1 1
|
// envTex s1 1
|
||||||
//
|
//
|
||||||
|
|
||||||
@ -27,10 +25,10 @@
|
|||||||
dcl t0.xyz
|
dcl t0.xyz
|
||||||
dcl t1.xy
|
dcl t1.xy
|
||||||
dcl v0
|
dcl v0
|
||||||
|
dcl v1.xyz
|
||||||
dcl_2d s1
|
dcl_2d s1
|
||||||
texld r0, t1, s1
|
texld r0, t1, s1
|
||||||
max r1.xyz, v0, c2
|
mul r1.xyz, v1, c1.x
|
||||||
mul r1.xyz, r1, c1.x
|
|
||||||
mul r0.xyz, r0, r1
|
mul r0.xyz, r0, r1
|
||||||
mul r0.xyz, r0, t0.z
|
mul r0.xyz, r0, t0.z
|
||||||
max r0.w, v0.w, c1.y
|
max r0.w, v0.w, c1.y
|
||||||
@ -41,91 +39,86 @@
|
|||||||
mov r0.w, v0.w
|
mov r0.w, v0.w
|
||||||
mov oC0, r0
|
mov oC0, r0
|
||||||
|
|
||||||
// approximately 12 instruction slots used (1 texture, 11 arithmetic)
|
// approximately 11 instruction slots used (1 texture, 10 arithmetic)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const BYTE g_ps20_main[] =
|
const BYTE g_ps20_main[] =
|
||||||
{
|
{
|
||||||
0, 2, 255, 255, 254, 255,
|
0, 2, 255, 255, 254, 255,
|
||||||
60, 0, 67, 84, 65, 66,
|
53, 0, 67, 84, 65, 66,
|
||||||
28, 0, 0, 0, 185, 0,
|
28, 0, 0, 0, 156, 0,
|
||||||
0, 0, 0, 2, 255, 255,
|
0, 0, 0, 2, 255, 255,
|
||||||
4, 0, 0, 0, 28, 0,
|
3, 0, 0, 0, 28, 0,
|
||||||
0, 0, 0, 1, 0, 0,
|
0, 0, 0, 1, 0, 0,
|
||||||
178, 0, 0, 0, 108, 0,
|
149, 0, 0, 0, 88, 0,
|
||||||
0, 0, 2, 0, 2, 0,
|
0, 0, 3, 0, 1, 0,
|
||||||
1, 0, 10, 0, 120, 0,
|
1, 0, 6, 0, 96, 0,
|
||||||
0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0,
|
||||||
136, 0, 0, 0, 3, 0,
|
112, 0, 0, 0, 2, 0,
|
||||||
1, 0, 1, 0, 6, 0,
|
0, 0, 1, 0, 2, 0,
|
||||||
144, 0, 0, 0, 0, 0,
|
124, 0, 0, 0, 0, 0,
|
||||||
0, 0, 160, 0, 0, 0,
|
0, 0, 140, 0, 0, 0,
|
||||||
2, 0, 0, 0, 1, 0,
|
2, 0, 1, 0, 1, 0,
|
||||||
2, 0, 120, 0, 0, 0,
|
6, 0, 124, 0, 0, 0,
|
||||||
0, 0, 0, 0, 169, 0,
|
|
||||||
0, 0, 2, 0, 1, 0,
|
|
||||||
1, 0, 6, 0, 120, 0,
|
|
||||||
0, 0, 0, 0, 0, 0,
|
|
||||||
99, 111, 108, 111, 114, 67,
|
|
||||||
108, 97, 109, 112, 0, 171,
|
|
||||||
1, 0, 3, 0, 1, 0,
|
|
||||||
4, 0, 1, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 101, 110,
|
0, 0, 0, 0, 101, 110,
|
||||||
118, 84, 101, 120, 0, 171,
|
118, 84, 101, 120, 0, 171,
|
||||||
4, 0, 12, 0, 1, 0,
|
4, 0, 12, 0, 1, 0,
|
||||||
1, 0, 1, 0, 0, 0,
|
1, 0, 1, 0, 0, 0,
|
||||||
0, 0, 0, 0, 102, 111,
|
0, 0, 0, 0, 102, 111,
|
||||||
103, 67, 111, 108, 111, 114,
|
103, 67, 111, 108, 111, 114,
|
||||||
0, 102, 120, 112, 97, 114,
|
0, 171, 171, 171, 1, 0,
|
||||||
97, 109, 115, 0, 112, 115,
|
3, 0, 1, 0, 4, 0,
|
||||||
95, 50, 95, 48, 0, 77,
|
1, 0, 0, 0, 0, 0,
|
||||||
105, 99, 114, 111, 115, 111,
|
0, 0, 102, 120, 112, 97,
|
||||||
102, 116, 32, 40, 82, 41,
|
114, 97, 109, 115, 0, 112,
|
||||||
32, 72, 76, 83, 76, 32,
|
115, 95, 50, 95, 48, 0,
|
||||||
83, 104, 97, 100, 101, 114,
|
77, 105, 99, 114, 111, 115,
|
||||||
32, 67, 111, 109, 112, 105,
|
111, 102, 116, 32, 40, 82,
|
||||||
108, 101, 114, 32, 57, 46,
|
41, 32, 72, 76, 83, 76,
|
||||||
50, 57, 46, 57, 53, 50,
|
32, 83, 104, 97, 100, 101,
|
||||||
46, 51, 49, 49, 49, 0,
|
114, 32, 67, 111, 109, 112,
|
||||||
171, 171, 31, 0, 0, 2,
|
105, 108, 101, 114, 32, 57,
|
||||||
0, 0, 0, 128, 0, 0,
|
46, 50, 57, 46, 57, 53,
|
||||||
7, 176, 31, 0, 0, 2,
|
50, 46, 51, 49, 49, 49,
|
||||||
0, 0, 0, 128, 1, 0,
|
0, 171, 171, 171, 31, 0,
|
||||||
3, 176, 31, 0, 0, 2,
|
0, 2, 0, 0, 0, 128,
|
||||||
0, 0, 0, 128, 0, 0,
|
0, 0, 7, 176, 31, 0,
|
||||||
15, 144, 31, 0, 0, 2,
|
0, 2, 0, 0, 0, 128,
|
||||||
0, 0, 0, 144, 1, 8,
|
1, 0, 3, 176, 31, 0,
|
||||||
15, 160, 66, 0, 0, 3,
|
0, 2, 0, 0, 0, 128,
|
||||||
0, 0, 15, 128, 1, 0,
|
0, 0, 15, 144, 31, 0,
|
||||||
228, 176, 1, 8, 228, 160,
|
0, 2, 0, 0, 0, 128,
|
||||||
11, 0, 0, 3, 1, 0,
|
1, 0, 7, 144, 31, 0,
|
||||||
7, 128, 0, 0, 228, 144,
|
0, 2, 0, 0, 0, 144,
|
||||||
2, 0, 228, 160, 5, 0,
|
1, 8, 15, 160, 66, 0,
|
||||||
0, 3, 1, 0, 7, 128,
|
0, 3, 0, 0, 15, 128,
|
||||||
1, 0, 228, 128, 1, 0,
|
1, 0, 228, 176, 1, 8,
|
||||||
0, 160, 5, 0, 0, 3,
|
228, 160, 5, 0, 0, 3,
|
||||||
0, 0, 7, 128, 0, 0,
|
1, 0, 7, 128, 1, 0,
|
||||||
228, 128, 1, 0, 228, 128,
|
228, 144, 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,
|
||||||
0, 0, 170, 176, 11, 0,
|
1, 0, 228, 128, 5, 0,
|
||||||
0, 3, 0, 0, 8, 128,
|
0, 3, 0, 0, 7, 128,
|
||||||
0, 0, 255, 144, 1, 0,
|
0, 0, 228, 128, 0, 0,
|
||||||
85, 160, 5, 0, 0, 3,
|
170, 176, 11, 0, 0, 3,
|
||||||
0, 0, 7, 128, 0, 0,
|
|
||||||
255, 128, 0, 0, 228, 128,
|
|
||||||
2, 0, 0, 3, 1, 0,
|
|
||||||
7, 128, 0, 0, 228, 144,
|
|
||||||
0, 0, 228, 161, 4, 0,
|
|
||||||
0, 4, 1, 0, 7, 128,
|
|
||||||
0, 0, 170, 176, 1, 0,
|
|
||||||
228, 128, 0, 0, 228, 160,
|
|
||||||
4, 0, 0, 4, 0, 0,
|
|
||||||
7, 128, 1, 0, 228, 128,
|
|
||||||
0, 0, 255, 144, 0, 0,
|
|
||||||
228, 128, 1, 0, 0, 2,
|
|
||||||
0, 0, 8, 128, 0, 0,
|
0, 0, 8, 128, 0, 0,
|
||||||
255, 144, 1, 0, 0, 2,
|
255, 144, 1, 0, 85, 160,
|
||||||
0, 8, 15, 128, 0, 0,
|
5, 0, 0, 3, 0, 0,
|
||||||
228, 128, 255, 255, 0, 0
|
7, 128, 0, 0, 255, 128,
|
||||||
|
0, 0, 228, 128, 2, 0,
|
||||||
|
0, 3, 1, 0, 7, 128,
|
||||||
|
0, 0, 228, 144, 0, 0,
|
||||||
|
228, 161, 4, 0, 0, 4,
|
||||||
|
1, 0, 7, 128, 0, 0,
|
||||||
|
170, 176, 1, 0, 228, 128,
|
||||||
|
0, 0, 228, 160, 4, 0,
|
||||||
|
0, 4, 0, 0, 7, 128,
|
||||||
|
1, 0, 228, 128, 0, 0,
|
||||||
|
255, 144, 0, 0, 228, 128,
|
||||||
|
1, 0, 0, 2, 0, 0,
|
||||||
|
8, 128, 0, 0, 255, 144,
|
||||||
|
1, 0, 0, 2, 0, 8,
|
||||||
|
15, 128, 0, 0, 228, 128,
|
||||||
|
255, 255, 0, 0
|
||||||
};
|
};
|
||||||
|
@ -3,6 +3,7 @@ struct VS_out {
|
|||||||
float3 TexCoord0 : TEXCOORD0;
|
float3 TexCoord0 : TEXCOORD0;
|
||||||
float2 TexCoord1 : TEXCOORD1;
|
float2 TexCoord1 : TEXCOORD1;
|
||||||
float4 Color : COLOR0;
|
float4 Color : COLOR0;
|
||||||
|
float4 EnvColor : COLOR1;
|
||||||
};
|
};
|
||||||
|
|
||||||
sampler2D diffTex : register(s0);
|
sampler2D diffTex : register(s0);
|
||||||
@ -11,7 +12,6 @@ sampler2D envTex : register(s1);
|
|||||||
float4 fogColor : register(c0);
|
float4 fogColor : register(c0);
|
||||||
|
|
||||||
float4 fxparams : register(c1);
|
float4 fxparams : register(c1);
|
||||||
float4 colorClamp : register(c2);
|
|
||||||
|
|
||||||
#define shininess (fxparams.x)
|
#define shininess (fxparams.x)
|
||||||
#define disableFBA (fxparams.y)
|
#define disableFBA (fxparams.y)
|
||||||
@ -19,12 +19,11 @@ 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 pass2 = envColor*shininess*tex2D(envTex, input.TexCoord1.xy);
|
float4 pass2 = input.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);
|
pass2.rgb = lerp(float3(0.0, 0.0, 0.0), pass2.rgb, input.TexCoord0.z);
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#include "standardConstants.h"
|
#include "standardConstants.h"
|
||||||
|
|
||||||
float4x4 texMat : register(c41);
|
float4x4 texMat : register(c41);
|
||||||
|
float4 colorClamp : register(c45);
|
||||||
|
float4 envColor : register(c46);
|
||||||
|
|
||||||
struct VS_in
|
struct VS_in
|
||||||
{
|
{
|
||||||
@ -15,6 +17,7 @@ struct VS_out {
|
|||||||
float3 TexCoord0 : TEXCOORD0; // also fog
|
float3 TexCoord0 : TEXCOORD0; // also fog
|
||||||
float2 TexCoord1 : TEXCOORD1;
|
float2 TexCoord1 : TEXCOORD1;
|
||||||
float4 Color : COLOR0;
|
float4 Color : COLOR0;
|
||||||
|
float4 EnvColor : COLOR1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -47,6 +50,7 @@ VS_out main(in VS_in input)
|
|||||||
#endif
|
#endif
|
||||||
// PS2 clamps before material color
|
// PS2 clamps before material color
|
||||||
output.Color = clamp(output.Color, 0.0, 1.0);
|
output.Color = clamp(output.Color, 0.0, 1.0);
|
||||||
|
output.EnvColor = max(output.Color, colorClamp) * envColor;
|
||||||
output.Color *= matCol;
|
output.Color *= matCol;
|
||||||
|
|
||||||
output.TexCoord0.z = clamp((output.Position.w - fogEnd)*fogRange, fogDisable, 1.0);
|
output.TexCoord0.z = clamp((output.Position.w - fogEnd)*fogRange, fogDisable, 1.0);
|
||||||
|
@ -9,7 +9,9 @@
|
|||||||
// Parameters:
|
// Parameters:
|
||||||
//
|
//
|
||||||
// float4 ambientLight;
|
// float4 ambientLight;
|
||||||
|
// float4 colorClamp;
|
||||||
// float4x4 combinedMat;
|
// float4x4 combinedMat;
|
||||||
|
// float4 envColor;
|
||||||
// int4 firstLight;
|
// int4 firstLight;
|
||||||
// float4 fogData;
|
// float4 fogData;
|
||||||
//
|
//
|
||||||
@ -48,6 +50,8 @@
|
|||||||
// firstLight c16 1
|
// firstLight c16 1
|
||||||
// lights c17 24
|
// lights c17 24
|
||||||
// texMat c41 4
|
// texMat c41 4
|
||||||
|
// colorClamp c45 1
|
||||||
|
// envColor c46 1
|
||||||
//
|
//
|
||||||
|
|
||||||
vs_2_0
|
vs_2_0
|
||||||
@ -141,79 +145,91 @@
|
|||||||
mad r0.xy, c41, r1.x, r0
|
mad r0.xy, c41, r1.x, r0
|
||||||
mad r0.xy, c43, r1.z, r0
|
mad r0.xy, c43, r1.z, r0
|
||||||
add oT1.xy, r0, c44
|
add oT1.xy, r0, c44
|
||||||
|
max r1, r2, c45
|
||||||
|
mul oD1, r1, c46
|
||||||
add r0.x, r0.w, -c14.y
|
add r0.x, r0.w, -c14.y
|
||||||
mul r0.x, r0.x, c14.z
|
mul r0.x, r0.x, c14.z
|
||||||
max r0.x, r0.x, c14.w
|
max r0.x, r0.x, c14.w
|
||||||
min oT0.z, r0.x, c11.z
|
min oT0.z, r0.x, c11.z
|
||||||
mov oT0.xy, v2
|
mov oT0.xy, v2
|
||||||
|
|
||||||
// approximately 99 instruction slots used
|
// approximately 101 instruction slots used
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const BYTE g_vs20_main[] =
|
const BYTE g_vs20_main[] =
|
||||||
{
|
{
|
||||||
0, 2, 254, 255, 254, 255,
|
0, 2, 254, 255, 254, 255,
|
||||||
165, 0, 67, 84, 65, 66,
|
180, 0, 67, 84, 65, 66,
|
||||||
28, 0, 0, 0, 94, 2,
|
28, 0, 0, 0, 154, 2,
|
||||||
0, 0, 0, 2, 254, 255,
|
0, 0, 0, 2, 254, 255,
|
||||||
13, 0, 0, 0, 28, 0,
|
15, 0, 0, 0, 28, 0,
|
||||||
0, 0, 0, 1, 0, 0,
|
0, 0, 0, 1, 0, 0,
|
||||||
87, 2, 0, 0, 32, 1,
|
147, 2, 0, 0, 72, 1,
|
||||||
0, 0, 2, 0, 15, 0,
|
0, 0, 2, 0, 15, 0,
|
||||||
1, 0, 62, 0, 48, 1,
|
1, 0, 62, 0, 88, 1,
|
||||||
0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0,
|
||||||
64, 1, 0, 0, 2, 0,
|
104, 1, 0, 0, 2, 0,
|
||||||
0, 0, 4, 0, 2, 0,
|
45, 0, 1, 0, 182, 0,
|
||||||
76, 1, 0, 0, 0, 0,
|
88, 1, 0, 0, 0, 0,
|
||||||
0, 0, 92, 1, 0, 0,
|
0, 0, 115, 1, 0, 0,
|
||||||
2, 0, 16, 0, 1, 0,
|
2, 0, 0, 0, 4, 0,
|
||||||
66, 0, 104, 1, 0, 0,
|
2, 0, 128, 1, 0, 0,
|
||||||
0, 0, 0, 0, 120, 1,
|
0, 0, 0, 0, 144, 1,
|
||||||
0, 0, 2, 0, 14, 0,
|
0, 0, 2, 0, 46, 0,
|
||||||
1, 0, 58, 0, 48, 1,
|
1, 0, 186, 0, 88, 1,
|
||||||
0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0,
|
||||||
128, 1, 0, 0, 2, 0,
|
153, 1, 0, 0, 2, 0,
|
||||||
17, 0, 24, 0, 70, 0,
|
16, 0, 1, 0, 66, 0,
|
||||||
204, 1, 0, 0, 0, 0,
|
164, 1, 0, 0, 0, 0,
|
||||||
0, 0, 220, 1, 0, 0,
|
0, 0, 180, 1, 0, 0,
|
||||||
2, 0, 12, 0, 1, 0,
|
2, 0, 14, 0, 1, 0,
|
||||||
50, 0, 48, 1, 0, 0,
|
58, 0, 88, 1, 0, 0,
|
||||||
0, 0, 0, 0, 227, 1,
|
0, 0, 0, 0, 188, 1,
|
||||||
0, 0, 2, 0, 8, 0,
|
0, 0, 2, 0, 17, 0,
|
||||||
3, 0, 34, 0, 240, 1,
|
24, 0, 70, 0, 8, 2,
|
||||||
0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0,
|
||||||
0, 2, 0, 0, 1, 0,
|
24, 2, 0, 0, 2, 0,
|
||||||
0, 0, 1, 0, 2, 0,
|
12, 0, 1, 0, 50, 0,
|
||||||
16, 2, 0, 0, 0, 0,
|
88, 1, 0, 0, 0, 0,
|
||||||
0, 0, 32, 2, 0, 0,
|
0, 0, 31, 2, 0, 0,
|
||||||
1, 0, 1, 0, 1, 0,
|
2, 0, 8, 0, 3, 0,
|
||||||
6, 0, 16, 2, 0, 0,
|
34, 0, 44, 2, 0, 0,
|
||||||
0, 0, 0, 0, 47, 2,
|
0, 0, 0, 0, 60, 2,
|
||||||
0, 0, 1, 0, 2, 0,
|
0, 0, 1, 0, 0, 0,
|
||||||
1, 0, 10, 0, 16, 2,
|
1, 0, 2, 0, 76, 2,
|
||||||
0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0,
|
||||||
61, 2, 0, 0, 2, 0,
|
92, 2, 0, 0, 1, 0,
|
||||||
13, 0, 1, 0, 54, 0,
|
1, 0, 1, 0, 6, 0,
|
||||||
48, 1, 0, 0, 0, 0,
|
76, 2, 0, 0, 0, 0,
|
||||||
0, 0, 71, 2, 0, 0,
|
0, 0, 107, 2, 0, 0,
|
||||||
2, 0, 41, 0, 4, 0,
|
1, 0, 2, 0, 1, 0,
|
||||||
166, 0, 76, 1, 0, 0,
|
10, 0, 76, 2, 0, 0,
|
||||||
0, 0, 0, 0, 78, 2,
|
0, 0, 0, 0, 121, 2,
|
||||||
0, 0, 2, 0, 4, 0,
|
0, 0, 2, 0, 13, 0,
|
||||||
4, 0, 18, 0, 76, 1,
|
1, 0, 54, 0, 88, 1,
|
||||||
0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0,
|
||||||
97, 109, 98, 105, 101, 110,
|
131, 2, 0, 0, 2, 0,
|
||||||
116, 76, 105, 103, 104, 116,
|
41, 0, 4, 0, 166, 0,
|
||||||
0, 171, 171, 171, 1, 0,
|
128, 1, 0, 0, 0, 0,
|
||||||
3, 0, 1, 0, 4, 0,
|
0, 0, 138, 2, 0, 0,
|
||||||
1, 0, 0, 0, 0, 0,
|
2, 0, 4, 0, 4, 0,
|
||||||
0, 0, 99, 111, 109, 98,
|
18, 0, 128, 1, 0, 0,
|
||||||
105, 110, 101, 100, 77, 97,
|
0, 0, 0, 0, 97, 109,
|
||||||
116, 0, 3, 0, 3, 0,
|
98, 105, 101, 110, 116, 76,
|
||||||
4, 0, 4, 0, 1, 0,
|
|
||||||
0, 0, 0, 0, 0, 0,
|
|
||||||
102, 105, 114, 115, 116, 76,
|
|
||||||
105, 103, 104, 116, 0, 171,
|
105, 103, 104, 116, 0, 171,
|
||||||
|
171, 171, 1, 0, 3, 0,
|
||||||
|
1, 0, 4, 0, 1, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
99, 111, 108, 111, 114, 67,
|
||||||
|
108, 97, 109, 112, 0, 99,
|
||||||
|
111, 109, 98, 105, 110, 101,
|
||||||
|
100, 77, 97, 116, 0, 171,
|
||||||
|
3, 0, 3, 0, 4, 0,
|
||||||
|
4, 0, 1, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 101, 110,
|
||||||
|
118, 67, 111, 108, 111, 114,
|
||||||
|
0, 102, 105, 114, 115, 116,
|
||||||
|
76, 105, 103, 104, 116, 0,
|
||||||
1, 0, 2, 0, 1, 0,
|
1, 0, 2, 0, 1, 0,
|
||||||
4, 0, 1, 0, 0, 0,
|
4, 0, 1, 0, 0, 0,
|
||||||
0, 0, 0, 0, 102, 111,
|
0, 0, 0, 0, 102, 111,
|
||||||
@ -226,13 +242,13 @@ const BYTE g_vs20_main[] =
|
|||||||
0, 0, 112, 111, 115, 105,
|
0, 0, 112, 111, 115, 105,
|
||||||
116, 105, 111, 110, 0, 100,
|
116, 105, 111, 110, 0, 100,
|
||||||
105, 114, 101, 99, 116, 105,
|
105, 114, 101, 99, 116, 105,
|
||||||
111, 110, 0, 171, 135, 1,
|
111, 110, 0, 171, 195, 1,
|
||||||
0, 0, 144, 1, 0, 0,
|
0, 0, 204, 1, 0, 0,
|
||||||
160, 1, 0, 0, 144, 1,
|
220, 1, 0, 0, 204, 1,
|
||||||
0, 0, 169, 1, 0, 0,
|
0, 0, 229, 1, 0, 0,
|
||||||
144, 1, 0, 0, 5, 0,
|
204, 1, 0, 0, 5, 0,
|
||||||
0, 0, 1, 0, 12, 0,
|
0, 0, 1, 0, 12, 0,
|
||||||
8, 0, 3, 0, 180, 1,
|
8, 0, 3, 0, 240, 1,
|
||||||
0, 0, 109, 97, 116, 67,
|
0, 0, 109, 97, 116, 67,
|
||||||
111, 108, 0, 110, 111, 114,
|
111, 108, 0, 110, 111, 114,
|
||||||
109, 97, 108, 77, 97, 116,
|
109, 97, 108, 77, 97, 116,
|
||||||
@ -497,18 +513,23 @@ const BYTE g_vs20_main[] =
|
|||||||
0, 0, 228, 128, 2, 0,
|
0, 0, 228, 128, 2, 0,
|
||||||
0, 3, 1, 0, 3, 224,
|
0, 3, 1, 0, 3, 224,
|
||||||
0, 0, 228, 128, 44, 0,
|
0, 0, 228, 128, 44, 0,
|
||||||
228, 160, 2, 0, 0, 3,
|
228, 160, 11, 0, 0, 3,
|
||||||
0, 0, 1, 128, 0, 0,
|
1, 0, 15, 128, 2, 0,
|
||||||
255, 128, 14, 0, 85, 161,
|
228, 128, 45, 0, 228, 160,
|
||||||
5, 0, 0, 3, 0, 0,
|
5, 0, 0, 3, 1, 0,
|
||||||
1, 128, 0, 0, 0, 128,
|
15, 208, 1, 0, 228, 128,
|
||||||
14, 0, 170, 160, 11, 0,
|
46, 0, 228, 160, 2, 0,
|
||||||
0, 3, 0, 0, 1, 128,
|
0, 3, 0, 0, 1, 128,
|
||||||
0, 0, 0, 128, 14, 0,
|
0, 0, 255, 128, 14, 0,
|
||||||
255, 160, 10, 0, 0, 3,
|
85, 161, 5, 0, 0, 3,
|
||||||
0, 0, 4, 224, 0, 0,
|
0, 0, 1, 128, 0, 0,
|
||||||
0, 128, 11, 0, 170, 160,
|
0, 128, 14, 0, 170, 160,
|
||||||
1, 0, 0, 2, 0, 0,
|
11, 0, 0, 3, 0, 0,
|
||||||
3, 224, 2, 0, 228, 144,
|
1, 128, 0, 0, 0, 128,
|
||||||
255, 255, 0, 0
|
14, 0, 255, 160, 10, 0,
|
||||||
|
0, 3, 0, 0, 4, 224,
|
||||||
|
0, 0, 0, 128, 11, 0,
|
||||||
|
170, 160, 1, 0, 0, 2,
|
||||||
|
0, 0, 3, 224, 2, 0,
|
||||||
|
228, 144, 255, 255, 0, 0
|
||||||
};
|
};
|
||||||
|
@ -8,7 +8,9 @@
|
|||||||
// Parameters:
|
// Parameters:
|
||||||
//
|
//
|
||||||
// float4 ambientLight;
|
// float4 ambientLight;
|
||||||
|
// float4 colorClamp;
|
||||||
// float4x4 combinedMat;
|
// float4x4 combinedMat;
|
||||||
|
// float4 envColor;
|
||||||
// float4 fogData;
|
// float4 fogData;
|
||||||
// float4 matCol;
|
// float4 matCol;
|
||||||
// float3x3 normalMat;
|
// float3x3 normalMat;
|
||||||
@ -27,6 +29,8 @@
|
|||||||
// fogData c14 1
|
// fogData c14 1
|
||||||
// ambientLight c15 1
|
// ambientLight c15 1
|
||||||
// texMat c41 4
|
// texMat c41 4
|
||||||
|
// colorClamp c45 1
|
||||||
|
// envColor c46 1
|
||||||
//
|
//
|
||||||
|
|
||||||
vs_2_0
|
vs_2_0
|
||||||
@ -47,7 +51,9 @@
|
|||||||
mov r0.w, v3.w
|
mov r0.w, v3.w
|
||||||
max r0, r0, c4.x
|
max r0, r0, c4.x
|
||||||
min r0, r0, c4.y
|
min r0, r0, c4.y
|
||||||
|
max r1, r0, c45
|
||||||
mul oD0, r0, c12
|
mul oD0, r0, c12
|
||||||
|
mul oD1, r1, c46
|
||||||
mul r0, v0.y, c1
|
mul r0, v0.y, c1
|
||||||
mad r0, c0, v0.x, r0
|
mad r0, c0, v0.x, r0
|
||||||
mad r0, c2, v0.z, r0
|
mad r0, c2, v0.z, r0
|
||||||
@ -59,56 +65,66 @@
|
|||||||
min oT0.z, r0.x, c4.y
|
min oT0.z, r0.x, c4.y
|
||||||
mov oT0.xy, v2
|
mov oT0.xy, v2
|
||||||
|
|
||||||
// approximately 23 instruction slots used
|
// approximately 25 instruction slots used
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const BYTE g_vs20_main[] =
|
const BYTE g_vs20_main[] =
|
||||||
{
|
{
|
||||||
0, 2, 254, 255, 254, 255,
|
0, 2, 254, 255, 254, 255,
|
||||||
88, 0, 67, 84, 65, 66,
|
103, 0, 67, 84, 65, 66,
|
||||||
28, 0, 0, 0, 40, 1,
|
28, 0, 0, 0, 100, 1,
|
||||||
0, 0, 0, 2, 254, 255,
|
0, 0, 0, 2, 254, 255,
|
||||||
7, 0, 0, 0, 28, 0,
|
9, 0, 0, 0, 28, 0,
|
||||||
0, 0, 0, 1, 0, 0,
|
0, 0, 0, 1, 0, 0,
|
||||||
33, 1, 0, 0, 168, 0,
|
93, 1, 0, 0, 208, 0,
|
||||||
0, 0, 2, 0, 15, 0,
|
0, 0, 2, 0, 15, 0,
|
||||||
1, 0, 62, 0, 184, 0,
|
1, 0, 62, 0, 224, 0,
|
||||||
0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0,
|
||||||
200, 0, 0, 0, 2, 0,
|
240, 0, 0, 0, 2, 0,
|
||||||
0, 0, 4, 0, 2, 0,
|
45, 0, 1, 0, 182, 0,
|
||||||
212, 0, 0, 0, 0, 0,
|
224, 0, 0, 0, 0, 0,
|
||||||
0, 0, 228, 0, 0, 0,
|
0, 0, 251, 0, 0, 0,
|
||||||
2, 0, 14, 0, 1, 0,
|
2, 0, 0, 0, 4, 0,
|
||||||
58, 0, 184, 0, 0, 0,
|
2, 0, 8, 1, 0, 0,
|
||||||
0, 0, 0, 0, 236, 0,
|
0, 0, 0, 0, 24, 1,
|
||||||
0, 0, 2, 0, 12, 0,
|
0, 0, 2, 0, 46, 0,
|
||||||
1, 0, 50, 0, 184, 0,
|
1, 0, 186, 0, 224, 0,
|
||||||
0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0,
|
||||||
243, 0, 0, 0, 2, 0,
|
33, 1, 0, 0, 2, 0,
|
||||||
8, 0, 3, 0, 34, 0,
|
14, 0, 1, 0, 58, 0,
|
||||||
0, 1, 0, 0, 0, 0,
|
224, 0, 0, 0, 0, 0,
|
||||||
0, 0, 16, 1, 0, 0,
|
0, 0, 41, 1, 0, 0,
|
||||||
2, 0, 13, 0, 1, 0,
|
2, 0, 12, 0, 1, 0,
|
||||||
54, 0, 184, 0, 0, 0,
|
50, 0, 224, 0, 0, 0,
|
||||||
0, 0, 0, 0, 26, 1,
|
0, 0, 0, 0, 48, 1,
|
||||||
0, 0, 2, 0, 41, 0,
|
0, 0, 2, 0, 8, 0,
|
||||||
4, 0, 166, 0, 212, 0,
|
3, 0, 34, 0, 60, 1,
|
||||||
0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0,
|
||||||
97, 109, 98, 105, 101, 110,
|
76, 1, 0, 0, 2, 0,
|
||||||
116, 76, 105, 103, 104, 116,
|
13, 0, 1, 0, 54, 0,
|
||||||
0, 171, 171, 171, 1, 0,
|
224, 0, 0, 0, 0, 0,
|
||||||
3, 0, 1, 0, 4, 0,
|
0, 0, 86, 1, 0, 0,
|
||||||
1, 0, 0, 0, 0, 0,
|
2, 0, 41, 0, 4, 0,
|
||||||
0, 0, 99, 111, 109, 98,
|
166, 0, 8, 1, 0, 0,
|
||||||
105, 110, 101, 100, 77, 97,
|
0, 0, 0, 0, 97, 109,
|
||||||
116, 0, 3, 0, 3, 0,
|
98, 105, 101, 110, 116, 76,
|
||||||
4, 0, 4, 0, 1, 0,
|
105, 103, 104, 116, 0, 171,
|
||||||
|
171, 171, 1, 0, 3, 0,
|
||||||
|
1, 0, 4, 0, 1, 0,
|
||||||
0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0,
|
||||||
102, 111, 103, 68, 97, 116,
|
99, 111, 108, 111, 114, 67,
|
||||||
97, 0, 109, 97, 116, 67,
|
108, 97, 109, 112, 0, 99,
|
||||||
111, 108, 0, 110, 111, 114,
|
111, 109, 98, 105, 110, 101,
|
||||||
109, 97, 108, 77, 97, 116,
|
100, 77, 97, 116, 0, 171,
|
||||||
0, 171, 171, 171, 3, 0,
|
3, 0, 3, 0, 4, 0,
|
||||||
|
4, 0, 1, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 101, 110,
|
||||||
|
118, 67, 111, 108, 111, 114,
|
||||||
|
0, 102, 111, 103, 68, 97,
|
||||||
|
116, 97, 0, 109, 97, 116,
|
||||||
|
67, 111, 108, 0, 110, 111,
|
||||||
|
114, 109, 97, 108, 77, 97,
|
||||||
|
116, 0, 171, 171, 3, 0,
|
||||||
3, 0, 3, 0, 3, 0,
|
3, 0, 3, 0, 3, 0,
|
||||||
1, 0, 0, 0, 0, 0,
|
1, 0, 0, 0, 0, 0,
|
||||||
0, 0, 115, 117, 114, 102,
|
0, 0, 115, 117, 114, 102,
|
||||||
@ -170,35 +186,40 @@ const BYTE g_vs20_main[] =
|
|||||||
0, 160, 10, 0, 0, 3,
|
0, 160, 10, 0, 0, 3,
|
||||||
0, 0, 15, 128, 0, 0,
|
0, 0, 15, 128, 0, 0,
|
||||||
228, 128, 4, 0, 85, 160,
|
228, 128, 4, 0, 85, 160,
|
||||||
|
11, 0, 0, 3, 1, 0,
|
||||||
|
15, 128, 0, 0, 228, 128,
|
||||||
|
45, 0, 228, 160, 5, 0,
|
||||||
|
0, 3, 0, 0, 15, 208,
|
||||||
|
0, 0, 228, 128, 12, 0,
|
||||||
|
228, 160, 5, 0, 0, 3,
|
||||||
|
1, 0, 15, 208, 1, 0,
|
||||||
|
228, 128, 46, 0, 228, 160,
|
||||||
5, 0, 0, 3, 0, 0,
|
5, 0, 0, 3, 0, 0,
|
||||||
15, 208, 0, 0, 228, 128,
|
15, 128, 0, 0, 85, 144,
|
||||||
12, 0, 228, 160, 5, 0,
|
1, 0, 228, 160, 4, 0,
|
||||||
0, 3, 0, 0, 15, 128,
|
|
||||||
0, 0, 85, 144, 1, 0,
|
|
||||||
228, 160, 4, 0, 0, 4,
|
|
||||||
0, 0, 15, 128, 0, 0,
|
|
||||||
228, 160, 0, 0, 0, 144,
|
|
||||||
0, 0, 228, 128, 4, 0,
|
|
||||||
0, 4, 0, 0, 15, 128,
|
0, 4, 0, 0, 15, 128,
|
||||||
2, 0, 228, 160, 0, 0,
|
0, 0, 228, 160, 0, 0,
|
||||||
170, 144, 0, 0, 228, 128,
|
0, 144, 0, 0, 228, 128,
|
||||||
4, 0, 0, 4, 0, 0,
|
4, 0, 0, 4, 0, 0,
|
||||||
15, 128, 3, 0, 228, 160,
|
15, 128, 2, 0, 228, 160,
|
||||||
0, 0, 255, 144, 0, 0,
|
0, 0, 170, 144, 0, 0,
|
||||||
228, 128, 2, 0, 0, 3,
|
228, 128, 4, 0, 0, 4,
|
||||||
1, 0, 1, 128, 0, 0,
|
0, 0, 15, 128, 3, 0,
|
||||||
255, 128, 14, 0, 85, 161,
|
228, 160, 0, 0, 255, 144,
|
||||||
1, 0, 0, 2, 0, 0,
|
0, 0, 228, 128, 2, 0,
|
||||||
15, 192, 0, 0, 228, 128,
|
0, 3, 1, 0, 1, 128,
|
||||||
5, 0, 0, 3, 0, 0,
|
0, 0, 255, 128, 14, 0,
|
||||||
1, 128, 1, 0, 0, 128,
|
85, 161, 1, 0, 0, 2,
|
||||||
14, 0, 170, 160, 11, 0,
|
0, 0, 15, 192, 0, 0,
|
||||||
0, 3, 0, 0, 1, 128,
|
228, 128, 5, 0, 0, 3,
|
||||||
0, 0, 0, 128, 14, 0,
|
0, 0, 1, 128, 1, 0,
|
||||||
255, 160, 10, 0, 0, 3,
|
0, 128, 14, 0, 170, 160,
|
||||||
0, 0, 4, 224, 0, 0,
|
11, 0, 0, 3, 0, 0,
|
||||||
0, 128, 4, 0, 85, 160,
|
1, 128, 0, 0, 0, 128,
|
||||||
1, 0, 0, 2, 0, 0,
|
14, 0, 255, 160, 10, 0,
|
||||||
3, 224, 2, 0, 228, 144,
|
0, 3, 0, 0, 4, 224,
|
||||||
255, 255, 0, 0
|
0, 0, 0, 128, 4, 0,
|
||||||
|
85, 160, 1, 0, 0, 2,
|
||||||
|
0, 0, 3, 224, 2, 0,
|
||||||
|
228, 144, 255, 255, 0, 0
|
||||||
};
|
};
|
||||||
|
@ -9,7 +9,9 @@
|
|||||||
// Parameters:
|
// Parameters:
|
||||||
//
|
//
|
||||||
// float4 ambientLight;
|
// float4 ambientLight;
|
||||||
|
// float4 colorClamp;
|
||||||
// float4x4 combinedMat;
|
// float4x4 combinedMat;
|
||||||
|
// float4 envColor;
|
||||||
// int4 firstLight;
|
// int4 firstLight;
|
||||||
// float4 fogData;
|
// float4 fogData;
|
||||||
//
|
//
|
||||||
@ -42,6 +44,8 @@
|
|||||||
// firstLight c16 1
|
// firstLight c16 1
|
||||||
// lights c17 24
|
// lights c17 24
|
||||||
// texMat c41 4
|
// texMat c41 4
|
||||||
|
// colorClamp c45 1
|
||||||
|
// envColor c46 1
|
||||||
//
|
//
|
||||||
|
|
||||||
vs_2_0
|
vs_2_0
|
||||||
@ -76,73 +80,85 @@
|
|||||||
max r1, r2, c4.x
|
max r1, r2, c4.x
|
||||||
min r1, r1, c4.z
|
min r1, r1, c4.z
|
||||||
mul oD0, r1, c12
|
mul oD0, r1, c12
|
||||||
mul r1.xy, r0.y, c42
|
mul r2.xy, r0.y, c42
|
||||||
mad r0.xy, c41, r0.x, r1
|
mad r0.xy, c41, r0.x, r2
|
||||||
mad r0.xy, c43, r0.z, r0
|
mad r0.xy, c43, r0.z, r0
|
||||||
add oT1.xy, r0, c44
|
add oT1.xy, r0, c44
|
||||||
|
max r1, r1, c45
|
||||||
|
mul oD1, r1, c46
|
||||||
add r0.x, r0.w, -c14.y
|
add r0.x, r0.w, -c14.y
|
||||||
mul r0.x, r0.x, c14.z
|
mul r0.x, r0.x, c14.z
|
||||||
max r0.x, r0.x, c14.w
|
max r0.x, r0.x, c14.w
|
||||||
min oT0.z, r0.x, c4.z
|
min oT0.z, r0.x, c4.z
|
||||||
mov oT0.xy, v2
|
mov oT0.xy, v2
|
||||||
|
|
||||||
// approximately 38 instruction slots used
|
// approximately 40 instruction slots used
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const BYTE g_vs20_main[] =
|
const BYTE g_vs20_main[] =
|
||||||
{
|
{
|
||||||
0, 2, 254, 255, 254, 255,
|
0, 2, 254, 255, 254, 255,
|
||||||
141, 0, 67, 84, 65, 66,
|
156, 0, 67, 84, 65, 66,
|
||||||
28, 0, 0, 0, 252, 1,
|
28, 0, 0, 0, 56, 2,
|
||||||
0, 0, 0, 2, 254, 255,
|
0, 0, 0, 2, 254, 255,
|
||||||
10, 0, 0, 0, 28, 0,
|
12, 0, 0, 0, 28, 0,
|
||||||
0, 0, 0, 1, 0, 0,
|
0, 0, 0, 1, 0, 0,
|
||||||
245, 1, 0, 0, 228, 0,
|
49, 2, 0, 0, 12, 1,
|
||||||
0, 0, 2, 0, 15, 0,
|
0, 0, 2, 0, 15, 0,
|
||||||
1, 0, 62, 0, 244, 0,
|
1, 0, 62, 0, 28, 1,
|
||||||
0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0,
|
||||||
4, 1, 0, 0, 2, 0,
|
44, 1, 0, 0, 2, 0,
|
||||||
0, 0, 4, 0, 2, 0,
|
45, 0, 1, 0, 182, 0,
|
||||||
16, 1, 0, 0, 0, 0,
|
28, 1, 0, 0, 0, 0,
|
||||||
0, 0, 32, 1, 0, 0,
|
0, 0, 55, 1, 0, 0,
|
||||||
2, 0, 16, 0, 1, 0,
|
2, 0, 0, 0, 4, 0,
|
||||||
66, 0, 44, 1, 0, 0,
|
2, 0, 68, 1, 0, 0,
|
||||||
0, 0, 0, 0, 60, 1,
|
0, 0, 0, 0, 84, 1,
|
||||||
0, 0, 2, 0, 14, 0,
|
0, 0, 2, 0, 46, 0,
|
||||||
1, 0, 58, 0, 244, 0,
|
1, 0, 186, 0, 28, 1,
|
||||||
0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0,
|
||||||
68, 1, 0, 0, 2, 0,
|
93, 1, 0, 0, 2, 0,
|
||||||
17, 0, 24, 0, 70, 0,
|
16, 0, 1, 0, 66, 0,
|
||||||
144, 1, 0, 0, 0, 0,
|
104, 1, 0, 0, 0, 0,
|
||||||
0, 0, 160, 1, 0, 0,
|
0, 0, 120, 1, 0, 0,
|
||||||
2, 0, 12, 0, 1, 0,
|
2, 0, 14, 0, 1, 0,
|
||||||
50, 0, 244, 0, 0, 0,
|
58, 0, 28, 1, 0, 0,
|
||||||
0, 0, 0, 0, 167, 1,
|
0, 0, 0, 0, 128, 1,
|
||||||
0, 0, 2, 0, 8, 0,
|
0, 0, 2, 0, 17, 0,
|
||||||
3, 0, 34, 0, 180, 1,
|
24, 0, 70, 0, 204, 1,
|
||||||
0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0,
|
||||||
196, 1, 0, 0, 1, 0,
|
220, 1, 0, 0, 2, 0,
|
||||||
0, 0, 1, 0, 2, 0,
|
12, 0, 1, 0, 50, 0,
|
||||||
212, 1, 0, 0, 0, 0,
|
28, 1, 0, 0, 0, 0,
|
||||||
0, 0, 228, 1, 0, 0,
|
0, 0, 227, 1, 0, 0,
|
||||||
2, 0, 13, 0, 1, 0,
|
2, 0, 8, 0, 3, 0,
|
||||||
54, 0, 244, 0, 0, 0,
|
34, 0, 240, 1, 0, 0,
|
||||||
0, 0, 0, 0, 238, 1,
|
0, 0, 0, 0, 0, 2,
|
||||||
0, 0, 2, 0, 41, 0,
|
0, 0, 1, 0, 0, 0,
|
||||||
4, 0, 166, 0, 16, 1,
|
1, 0, 2, 0, 16, 2,
|
||||||
0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0,
|
||||||
97, 109, 98, 105, 101, 110,
|
32, 2, 0, 0, 2, 0,
|
||||||
116, 76, 105, 103, 104, 116,
|
13, 0, 1, 0, 54, 0,
|
||||||
0, 171, 171, 171, 1, 0,
|
28, 1, 0, 0, 0, 0,
|
||||||
3, 0, 1, 0, 4, 0,
|
0, 0, 42, 2, 0, 0,
|
||||||
1, 0, 0, 0, 0, 0,
|
2, 0, 41, 0, 4, 0,
|
||||||
0, 0, 99, 111, 109, 98,
|
166, 0, 68, 1, 0, 0,
|
||||||
105, 110, 101, 100, 77, 97,
|
0, 0, 0, 0, 97, 109,
|
||||||
116, 0, 3, 0, 3, 0,
|
98, 105, 101, 110, 116, 76,
|
||||||
4, 0, 4, 0, 1, 0,
|
|
||||||
0, 0, 0, 0, 0, 0,
|
|
||||||
102, 105, 114, 115, 116, 76,
|
|
||||||
105, 103, 104, 116, 0, 171,
|
105, 103, 104, 116, 0, 171,
|
||||||
|
171, 171, 1, 0, 3, 0,
|
||||||
|
1, 0, 4, 0, 1, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
99, 111, 108, 111, 114, 67,
|
||||||
|
108, 97, 109, 112, 0, 99,
|
||||||
|
111, 109, 98, 105, 110, 101,
|
||||||
|
100, 77, 97, 116, 0, 171,
|
||||||
|
3, 0, 3, 0, 4, 0,
|
||||||
|
4, 0, 1, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 101, 110,
|
||||||
|
118, 67, 111, 108, 111, 114,
|
||||||
|
0, 102, 105, 114, 115, 116,
|
||||||
|
76, 105, 103, 104, 116, 0,
|
||||||
1, 0, 2, 0, 1, 0,
|
1, 0, 2, 0, 1, 0,
|
||||||
4, 0, 1, 0, 0, 0,
|
4, 0, 1, 0, 0, 0,
|
||||||
0, 0, 0, 0, 102, 111,
|
0, 0, 0, 0, 102, 111,
|
||||||
@ -155,13 +171,13 @@ const BYTE g_vs20_main[] =
|
|||||||
0, 0, 112, 111, 115, 105,
|
0, 0, 112, 111, 115, 105,
|
||||||
116, 105, 111, 110, 0, 100,
|
116, 105, 111, 110, 0, 100,
|
||||||
105, 114, 101, 99, 116, 105,
|
105, 114, 101, 99, 116, 105,
|
||||||
111, 110, 0, 171, 75, 1,
|
111, 110, 0, 171, 135, 1,
|
||||||
0, 0, 84, 1, 0, 0,
|
0, 0, 144, 1, 0, 0,
|
||||||
100, 1, 0, 0, 84, 1,
|
160, 1, 0, 0, 144, 1,
|
||||||
0, 0, 109, 1, 0, 0,
|
0, 0, 169, 1, 0, 0,
|
||||||
84, 1, 0, 0, 5, 0,
|
144, 1, 0, 0, 5, 0,
|
||||||
0, 0, 1, 0, 12, 0,
|
0, 0, 1, 0, 12, 0,
|
||||||
8, 0, 3, 0, 120, 1,
|
8, 0, 3, 0, 180, 1,
|
||||||
0, 0, 109, 97, 116, 67,
|
0, 0, 109, 97, 116, 67,
|
||||||
111, 108, 0, 110, 111, 114,
|
111, 108, 0, 110, 111, 114,
|
||||||
109, 97, 108, 77, 97, 116,
|
109, 97, 108, 77, 97, 116,
|
||||||
@ -267,29 +283,34 @@ const BYTE g_vs20_main[] =
|
|||||||
0, 3, 0, 0, 15, 208,
|
0, 3, 0, 0, 15, 208,
|
||||||
1, 0, 228, 128, 12, 0,
|
1, 0, 228, 128, 12, 0,
|
||||||
228, 160, 5, 0, 0, 3,
|
228, 160, 5, 0, 0, 3,
|
||||||
1, 0, 3, 128, 0, 0,
|
2, 0, 3, 128, 0, 0,
|
||||||
85, 128, 42, 0, 228, 160,
|
85, 128, 42, 0, 228, 160,
|
||||||
4, 0, 0, 4, 0, 0,
|
4, 0, 0, 4, 0, 0,
|
||||||
3, 128, 41, 0, 228, 160,
|
3, 128, 41, 0, 228, 160,
|
||||||
0, 0, 0, 128, 1, 0,
|
0, 0, 0, 128, 2, 0,
|
||||||
228, 128, 4, 0, 0, 4,
|
228, 128, 4, 0, 0, 4,
|
||||||
0, 0, 3, 128, 43, 0,
|
0, 0, 3, 128, 43, 0,
|
||||||
228, 160, 0, 0, 170, 128,
|
228, 160, 0, 0, 170, 128,
|
||||||
0, 0, 228, 128, 2, 0,
|
0, 0, 228, 128, 2, 0,
|
||||||
0, 3, 1, 0, 3, 224,
|
0, 3, 1, 0, 3, 224,
|
||||||
0, 0, 228, 128, 44, 0,
|
0, 0, 228, 128, 44, 0,
|
||||||
228, 160, 2, 0, 0, 3,
|
228, 160, 11, 0, 0, 3,
|
||||||
0, 0, 1, 128, 0, 0,
|
1, 0, 15, 128, 1, 0,
|
||||||
255, 128, 14, 0, 85, 161,
|
228, 128, 45, 0, 228, 160,
|
||||||
5, 0, 0, 3, 0, 0,
|
5, 0, 0, 3, 1, 0,
|
||||||
1, 128, 0, 0, 0, 128,
|
15, 208, 1, 0, 228, 128,
|
||||||
14, 0, 170, 160, 11, 0,
|
46, 0, 228, 160, 2, 0,
|
||||||
0, 3, 0, 0, 1, 128,
|
0, 3, 0, 0, 1, 128,
|
||||||
0, 0, 0, 128, 14, 0,
|
0, 0, 255, 128, 14, 0,
|
||||||
255, 160, 10, 0, 0, 3,
|
85, 161, 5, 0, 0, 3,
|
||||||
0, 0, 4, 224, 0, 0,
|
0, 0, 1, 128, 0, 0,
|
||||||
0, 128, 4, 0, 170, 160,
|
0, 128, 14, 0, 170, 160,
|
||||||
1, 0, 0, 2, 0, 0,
|
11, 0, 0, 3, 0, 0,
|
||||||
3, 224, 2, 0, 228, 144,
|
1, 128, 0, 0, 0, 128,
|
||||||
255, 255, 0, 0
|
14, 0, 255, 160, 10, 0,
|
||||||
|
0, 3, 0, 0, 4, 224,
|
||||||
|
0, 0, 0, 128, 4, 0,
|
||||||
|
170, 160, 1, 0, 0, 2,
|
||||||
|
0, 0, 3, 224, 2, 0,
|
||||||
|
228, 144, 255, 255, 0, 0
|
||||||
};
|
};
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
//
|
//
|
||||||
// Parameters:
|
// Parameters:
|
||||||
//
|
//
|
||||||
// float4 colorClamp;
|
|
||||||
// sampler2D diffTex;
|
// sampler2D diffTex;
|
||||||
// sampler2D envTex;
|
// sampler2D envTex;
|
||||||
// float4 fogColor;
|
// float4 fogColor;
|
||||||
@ -20,7 +19,6 @@
|
|||||||
// ------------ ----- ----
|
// ------------ ----- ----
|
||||||
// fogColor c0 1
|
// fogColor c0 1
|
||||||
// fxparams c1 1
|
// fxparams c1 1
|
||||||
// colorClamp c2 1
|
|
||||||
// diffTex s0 1
|
// diffTex s0 1
|
||||||
// envTex s1 1
|
// envTex s1 1
|
||||||
//
|
//
|
||||||
@ -29,12 +27,12 @@
|
|||||||
dcl t0.xyz
|
dcl t0.xyz
|
||||||
dcl t1.xy
|
dcl t1.xy
|
||||||
dcl v0
|
dcl v0
|
||||||
|
dcl v1.xyz
|
||||||
dcl_2d s0
|
dcl_2d s0
|
||||||
dcl_2d s1
|
dcl_2d s1
|
||||||
texld r0, t1, s1
|
texld r0, t1, s1
|
||||||
texld r1, t0, s0
|
texld r1, t0, s0
|
||||||
max r2.xyz, v0, c2
|
mul r2.xyz, v1, c1.x
|
||||||
mul r2.xyz, r2, c1.x
|
|
||||||
mul r0.xyz, r0, r2
|
mul r0.xyz, r0, r2
|
||||||
mul r0.xyz, r0, t0.z
|
mul r0.xyz, r0, t0.z
|
||||||
mul r2.w, r1.w, v0.w
|
mul r2.w, r1.w, v0.w
|
||||||
@ -45,38 +43,30 @@
|
|||||||
mad r2.xyz, r1, r2.w, r0
|
mad r2.xyz, r1, r2.w, r0
|
||||||
mov oC0, r2
|
mov oC0, r2
|
||||||
|
|
||||||
// approximately 13 instruction slots used (2 texture, 11 arithmetic)
|
// approximately 12 instruction slots used (2 texture, 10 arithmetic)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const BYTE g_ps20_main[] =
|
const BYTE g_ps20_main[] =
|
||||||
{
|
{
|
||||||
0, 2, 255, 255, 254, 255,
|
0, 2, 255, 255, 254, 255,
|
||||||
71, 0, 67, 84, 65, 66,
|
64, 0, 67, 84, 65, 66,
|
||||||
28, 0, 0, 0, 229, 0,
|
28, 0, 0, 0, 200, 0,
|
||||||
0, 0, 0, 2, 255, 255,
|
0, 0, 0, 2, 255, 255,
|
||||||
5, 0, 0, 0, 28, 0,
|
4, 0, 0, 0, 28, 0,
|
||||||
0, 0, 0, 1, 0, 0,
|
0, 0, 0, 1, 0, 0,
|
||||||
222, 0, 0, 0, 128, 0,
|
193, 0, 0, 0, 108, 0,
|
||||||
0, 0, 2, 0, 2, 0,
|
0, 0, 3, 0, 0, 0,
|
||||||
1, 0, 10, 0, 140, 0,
|
1, 0, 2, 0, 116, 0,
|
||||||
0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0,
|
||||||
156, 0, 0, 0, 3, 0,
|
132, 0, 0, 0, 3, 0,
|
||||||
0, 0, 1, 0, 2, 0,
|
|
||||||
164, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 180, 0, 0, 0,
|
|
||||||
3, 0, 1, 0, 1, 0,
|
|
||||||
6, 0, 188, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 204, 0,
|
|
||||||
0, 0, 2, 0, 0, 0,
|
|
||||||
1, 0, 2, 0, 140, 0,
|
|
||||||
0, 0, 0, 0, 0, 0,
|
|
||||||
213, 0, 0, 0, 2, 0,
|
|
||||||
1, 0, 1, 0, 6, 0,
|
1, 0, 1, 0, 6, 0,
|
||||||
140, 0, 0, 0, 0, 0,
|
140, 0, 0, 0, 0, 0,
|
||||||
0, 0, 99, 111, 108, 111,
|
0, 0, 156, 0, 0, 0,
|
||||||
114, 67, 108, 97, 109, 112,
|
2, 0, 0, 0, 1, 0,
|
||||||
0, 171, 1, 0, 3, 0,
|
2, 0, 168, 0, 0, 0,
|
||||||
1, 0, 4, 0, 1, 0,
|
0, 0, 0, 0, 184, 0,
|
||||||
|
0, 0, 2, 0, 1, 0,
|
||||||
|
1, 0, 6, 0, 168, 0,
|
||||||
0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0,
|
||||||
100, 105, 102, 102, 84, 101,
|
100, 105, 102, 102, 84, 101,
|
||||||
120, 0, 4, 0, 12, 0,
|
120, 0, 4, 0, 12, 0,
|
||||||
@ -87,63 +77,65 @@ const BYTE g_ps20_main[] =
|
|||||||
1, 0, 1, 0, 1, 0,
|
1, 0, 1, 0, 1, 0,
|
||||||
0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0,
|
||||||
102, 111, 103, 67, 111, 108,
|
102, 111, 103, 67, 111, 108,
|
||||||
111, 114, 0, 102, 120, 112,
|
111, 114, 0, 171, 171, 171,
|
||||||
97, 114, 97, 109, 115, 0,
|
1, 0, 3, 0, 1, 0,
|
||||||
112, 115, 95, 50, 95, 48,
|
4, 0, 1, 0, 0, 0,
|
||||||
0, 77, 105, 99, 114, 111,
|
0, 0, 0, 0, 102, 120,
|
||||||
115, 111, 102, 116, 32, 40,
|
112, 97, 114, 97, 109, 115,
|
||||||
82, 41, 32, 72, 76, 83,
|
0, 112, 115, 95, 50, 95,
|
||||||
76, 32, 83, 104, 97, 100,
|
48, 0, 77, 105, 99, 114,
|
||||||
101, 114, 32, 67, 111, 109,
|
111, 115, 111, 102, 116, 32,
|
||||||
112, 105, 108, 101, 114, 32,
|
40, 82, 41, 32, 72, 76,
|
||||||
57, 46, 50, 57, 46, 57,
|
83, 76, 32, 83, 104, 97,
|
||||||
53, 50, 46, 51, 49, 49,
|
100, 101, 114, 32, 67, 111,
|
||||||
49, 0, 171, 171, 31, 0,
|
109, 112, 105, 108, 101, 114,
|
||||||
0, 2, 0, 0, 0, 128,
|
32, 57, 46, 50, 57, 46,
|
||||||
0, 0, 7, 176, 31, 0,
|
57, 53, 50, 46, 51, 49,
|
||||||
0, 2, 0, 0, 0, 128,
|
49, 49, 0, 171, 171, 171,
|
||||||
1, 0, 3, 176, 31, 0,
|
31, 0, 0, 2, 0, 0,
|
||||||
0, 2, 0, 0, 0, 128,
|
0, 128, 0, 0, 7, 176,
|
||||||
0, 0, 15, 144, 31, 0,
|
31, 0, 0, 2, 0, 0,
|
||||||
0, 2, 0, 0, 0, 144,
|
0, 128, 1, 0, 3, 176,
|
||||||
0, 8, 15, 160, 31, 0,
|
31, 0, 0, 2, 0, 0,
|
||||||
0, 2, 0, 0, 0, 144,
|
0, 128, 0, 0, 15, 144,
|
||||||
1, 8, 15, 160, 66, 0,
|
31, 0, 0, 2, 0, 0,
|
||||||
0, 3, 0, 0, 15, 128,
|
0, 128, 1, 0, 7, 144,
|
||||||
1, 0, 228, 176, 1, 8,
|
31, 0, 0, 2, 0, 0,
|
||||||
228, 160, 66, 0, 0, 3,
|
0, 144, 0, 8, 15, 160,
|
||||||
1, 0, 15, 128, 0, 0,
|
31, 0, 0, 2, 0, 0,
|
||||||
228, 176, 0, 8, 228, 160,
|
0, 144, 1, 8, 15, 160,
|
||||||
11, 0, 0, 3, 2, 0,
|
66, 0, 0, 3, 0, 0,
|
||||||
7, 128, 0, 0, 228, 144,
|
15, 128, 1, 0, 228, 176,
|
||||||
2, 0, 228, 160, 5, 0,
|
1, 8, 228, 160, 66, 0,
|
||||||
0, 3, 2, 0, 7, 128,
|
0, 3, 1, 0, 15, 128,
|
||||||
2, 0, 228, 128, 1, 0,
|
0, 0, 228, 176, 0, 8,
|
||||||
0, 160, 5, 0, 0, 3,
|
228, 160, 5, 0, 0, 3,
|
||||||
0, 0, 7, 128, 0, 0,
|
2, 0, 7, 128, 1, 0,
|
||||||
228, 128, 2, 0, 228, 128,
|
228, 144, 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,
|
||||||
0, 0, 170, 176, 5, 0,
|
2, 0, 228, 128, 5, 0,
|
||||||
0, 3, 2, 0, 8, 128,
|
|
||||||
1, 0, 255, 128, 0, 0,
|
|
||||||
255, 144, 4, 0, 0, 4,
|
|
||||||
1, 0, 7, 128, 0, 0,
|
|
||||||
228, 144, 1, 0, 228, 128,
|
|
||||||
0, 0, 228, 161, 4, 0,
|
|
||||||
0, 4, 1, 0, 7, 128,
|
|
||||||
0, 0, 170, 176, 1, 0,
|
|
||||||
228, 128, 0, 0, 228, 160,
|
|
||||||
11, 0, 0, 3, 0, 0,
|
|
||||||
8, 128, 2, 0, 255, 128,
|
|
||||||
1, 0, 85, 160, 5, 0,
|
|
||||||
0, 3, 0, 0, 7, 128,
|
0, 3, 0, 0, 7, 128,
|
||||||
0, 0, 255, 128, 0, 0,
|
0, 0, 228, 128, 0, 0,
|
||||||
228, 128, 4, 0, 0, 4,
|
170, 176, 5, 0, 0, 3,
|
||||||
2, 0, 7, 128, 1, 0,
|
2, 0, 8, 128, 1, 0,
|
||||||
228, 128, 2, 0, 255, 128,
|
255, 128, 0, 0, 255, 144,
|
||||||
0, 0, 228, 128, 1, 0,
|
4, 0, 0, 4, 1, 0,
|
||||||
0, 2, 0, 8, 15, 128,
|
7, 128, 0, 0, 228, 144,
|
||||||
2, 0, 228, 128, 255, 255,
|
1, 0, 228, 128, 0, 0,
|
||||||
0, 0
|
228, 161, 4, 0, 0, 4,
|
||||||
|
1, 0, 7, 128, 0, 0,
|
||||||
|
170, 176, 1, 0, 228, 128,
|
||||||
|
0, 0, 228, 160, 11, 0,
|
||||||
|
0, 3, 0, 0, 8, 128,
|
||||||
|
2, 0, 255, 128, 1, 0,
|
||||||
|
85, 160, 5, 0, 0, 3,
|
||||||
|
0, 0, 7, 128, 0, 0,
|
||||||
|
255, 128, 0, 0, 228, 128,
|
||||||
|
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
|
||||||
};
|
};
|
||||||
|
@ -1065,8 +1065,6 @@ setViewMatrix(float32 *mat)
|
|||||||
|
|
||||||
Shader *lastShaderUploaded;
|
Shader *lastShaderUploaded;
|
||||||
|
|
||||||
#define U(i) currentShader->uniformLocations[i]
|
|
||||||
|
|
||||||
void
|
void
|
||||||
setMaterial(const RGBA &color, const SurfaceProperties &surfaceprops, float extraSurfProp)
|
setMaterial(const RGBA &color, const SurfaceProperties &surfaceprops, float extraSurfProp)
|
||||||
{
|
{
|
||||||
|
@ -28,6 +28,7 @@ static Shader *envShader;
|
|||||||
static int32 u_texMatrix;
|
static int32 u_texMatrix;
|
||||||
static int32 u_fxparams;
|
static int32 u_fxparams;
|
||||||
static int32 u_colorClamp;
|
static int32 u_colorClamp;
|
||||||
|
static int32 u_envColor;
|
||||||
|
|
||||||
void
|
void
|
||||||
matfxDefaultRender(InstanceDataHeader *header, InstanceData *inst, uint32 flags)
|
matfxDefaultRender(InstanceDataHeader *header, InstanceData *inst, uint32 flags)
|
||||||
@ -73,6 +74,8 @@ uploadEnvMatrix(Frame *frame)
|
|||||||
Matrix::invert(&invMat, frame->getLTM());
|
Matrix::invert(&invMat, frame->getLTM());
|
||||||
convMatrix(&invMtx, &invMat);
|
convMatrix(&invMtx, &invMat);
|
||||||
invMtx.pos.set(0.0f, 0.0f, 0.0f);
|
invMtx.pos.set(0.0f, 0.0f, 0.0f);
|
||||||
|
float uscale = fabs(normal2texcoord.right.x);
|
||||||
|
normal2texcoord.right.x = MatFX::envMapFlipU ? -uscale : uscale;
|
||||||
RawMatrix::mult(&envMtx, &invMtx, &normal2texcoord);
|
RawMatrix::mult(&envMtx, &invMtx, &normal2texcoord);
|
||||||
}
|
}
|
||||||
setUniform(u_texMatrix, &envMtx);
|
setUniform(u_texMatrix, &envMtx);
|
||||||
@ -106,10 +109,16 @@ matfxEnvRender(InstanceDataHeader *header, InstanceData *inst, uint32 flags, Mat
|
|||||||
static float zero[4];
|
static float zero[4];
|
||||||
static float one[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
|
static float one[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
|
||||||
// This clamps the vertex color below. With it we can achieve both PC and PS2 style matfx
|
// This clamps the vertex color below. With it we can achieve both PC and PS2 style matfx
|
||||||
if(MatFX::modulateEnvMap)
|
if(MatFX::envMapApplyLight)
|
||||||
setUniform(u_colorClamp, zero);
|
setUniform(u_colorClamp, zero);
|
||||||
else
|
else
|
||||||
setUniform(u_colorClamp, one);
|
setUniform(u_colorClamp, one);
|
||||||
|
RGBAf envcol[4];
|
||||||
|
if(MatFX::envMapUseMatColor)
|
||||||
|
convColor(envcol, &m->color);
|
||||||
|
else
|
||||||
|
convColor(envcol, &MatFX::envMapColor);
|
||||||
|
setUniform(u_envColor, envcol);
|
||||||
|
|
||||||
rw::SetRenderState(VERTEXALPHA, 1);
|
rw::SetRenderState(VERTEXALPHA, 1);
|
||||||
rw::SetRenderState(SRCBLEND, BLENDONE);
|
rw::SetRenderState(SRCBLEND, BLENDONE);
|
||||||
@ -195,6 +204,7 @@ initMatFX(void)
|
|||||||
u_texMatrix = registerUniform("u_texMatrix", UNIFORM_MAT4);
|
u_texMatrix = registerUniform("u_texMatrix", UNIFORM_MAT4);
|
||||||
u_fxparams = registerUniform("u_fxparams", UNIFORM_VEC4);
|
u_fxparams = registerUniform("u_fxparams", UNIFORM_VEC4);
|
||||||
u_colorClamp = registerUniform("u_colorClamp", UNIFORM_VEC4);
|
u_colorClamp = registerUniform("u_colorClamp", UNIFORM_VEC4);
|
||||||
|
u_envColor = registerUniform("u_envColor", UNIFORM_VEC4);
|
||||||
|
|
||||||
Driver::registerPlugin(PLATFORM_GL3, 0, ID_MATFX,
|
Driver::registerPlugin(PLATFORM_GL3, 0, ID_MATFX,
|
||||||
matfxOpen, matfxClose);
|
matfxOpen, matfxClose);
|
||||||
|
@ -2,12 +2,12 @@ uniform sampler2D tex0;
|
|||||||
uniform sampler2D tex1;
|
uniform sampler2D tex1;
|
||||||
|
|
||||||
uniform vec4 u_fxparams;
|
uniform vec4 u_fxparams;
|
||||||
uniform vec4 u_colorClamp;
|
|
||||||
|
|
||||||
#define shininess (u_fxparams.x)
|
#define shininess (u_fxparams.x)
|
||||||
#define disableFBA (u_fxparams.y)
|
#define disableFBA (u_fxparams.y)
|
||||||
|
|
||||||
FSIN vec4 v_color;
|
FSIN vec4 v_color;
|
||||||
|
FSIN vec4 v_envColor;
|
||||||
FSIN vec2 v_tex0;
|
FSIN vec2 v_tex0;
|
||||||
FSIN vec2 v_tex1;
|
FSIN vec2 v_tex1;
|
||||||
FSIN float v_fog;
|
FSIN float v_fog;
|
||||||
@ -16,10 +16,9 @@ void
|
|||||||
main(void)
|
main(void)
|
||||||
{
|
{
|
||||||
vec4 pass1 = v_color;
|
vec4 pass1 = v_color;
|
||||||
vec4 envColor = max(pass1, u_colorClamp);
|
|
||||||
pass1 *= texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));
|
pass1 *= texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));
|
||||||
|
|
||||||
vec4 pass2 = envColor*shininess*texture(tex1, vec2(v_tex1.x, 1.0-v_tex1.y));
|
vec4 pass2 = v_envColor*shininess*texture(tex1, vec2(v_tex1.x, 1.0-v_tex1.y));
|
||||||
|
|
||||||
pass1.rgb = mix(u_fogColor.rgb, pass1.rgb, v_fog);
|
pass1.rgb = mix(u_fogColor.rgb, pass1.rgb, v_fog);
|
||||||
pass2.rgb = mix(vec3(0.0, 0.0, 0.0), pass2.rgb, v_fog);
|
pass2.rgb = mix(vec3(0.0, 0.0, 0.0), pass2.rgb, v_fog);
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
uniform mat4 u_texMatrix;
|
uniform mat4 u_texMatrix;
|
||||||
|
uniform vec4 u_colorClamp;
|
||||||
|
uniform vec4 u_envColor;
|
||||||
|
|
||||||
VSIN(ATTRIB_POS) vec3 in_pos;
|
VSIN(ATTRIB_POS) vec3 in_pos;
|
||||||
|
|
||||||
VSOUT vec4 v_color;
|
VSOUT vec4 v_color;
|
||||||
|
VSOUT vec4 v_envColor;
|
||||||
VSOUT vec2 v_tex0;
|
VSOUT vec2 v_tex0;
|
||||||
VSOUT vec2 v_tex1;
|
VSOUT vec2 v_tex1;
|
||||||
VSOUT float v_fog;
|
VSOUT float v_fog;
|
||||||
@ -21,6 +24,7 @@ main(void)
|
|||||||
v_color.rgb += u_ambLight.rgb*surfAmbient;
|
v_color.rgb += u_ambLight.rgb*surfAmbient;
|
||||||
v_color.rgb += DoDynamicLight(Vertex.xyz, Normal)*surfDiffuse;
|
v_color.rgb += DoDynamicLight(Vertex.xyz, Normal)*surfDiffuse;
|
||||||
v_color = clamp(v_color, 0.0, 1.0);
|
v_color = clamp(v_color, 0.0, 1.0);
|
||||||
|
v_envColor = max(v_color, u_colorClamp) * u_envColor;
|
||||||
v_color *= u_matColor;
|
v_color *= u_matColor;
|
||||||
|
|
||||||
v_fog = DoFog(gl_Position.w);
|
v_fog = DoFog(gl_Position.w);
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
const char *matfx_env_vert_src =
|
const char *matfx_env_vert_src =
|
||||||
"uniform mat4 u_texMatrix;\n"
|
"uniform mat4 u_texMatrix;\n"
|
||||||
|
"uniform vec4 u_colorClamp;\n"
|
||||||
|
"uniform vec4 u_envColor;\n"
|
||||||
|
|
||||||
"VSIN(ATTRIB_POS) vec3 in_pos;\n"
|
"VSIN(ATTRIB_POS) vec3 in_pos;\n"
|
||||||
|
|
||||||
"VSOUT vec4 v_color;\n"
|
"VSOUT vec4 v_color;\n"
|
||||||
|
"VSOUT vec4 v_envColor;\n"
|
||||||
"VSOUT vec2 v_tex0;\n"
|
"VSOUT vec2 v_tex0;\n"
|
||||||
"VSOUT vec2 v_tex1;\n"
|
"VSOUT vec2 v_tex1;\n"
|
||||||
"VSOUT float v_fog;\n"
|
"VSOUT float v_fog;\n"
|
||||||
@ -22,6 +25,7 @@ const char *matfx_env_vert_src =
|
|||||||
" v_color.rgb += u_ambLight.rgb*surfAmbient;\n"
|
" v_color.rgb += u_ambLight.rgb*surfAmbient;\n"
|
||||||
" v_color.rgb += DoDynamicLight(Vertex.xyz, Normal)*surfDiffuse;\n"
|
" v_color.rgb += DoDynamicLight(Vertex.xyz, Normal)*surfDiffuse;\n"
|
||||||
" v_color = clamp(v_color, 0.0, 1.0);\n"
|
" v_color = clamp(v_color, 0.0, 1.0);\n"
|
||||||
|
" v_envColor = max(v_color, u_colorClamp) * u_envColor;\n"
|
||||||
" v_color *= u_matColor;\n"
|
" v_color *= u_matColor;\n"
|
||||||
|
|
||||||
" v_fog = DoFog(gl_Position.w);\n"
|
" v_fog = DoFog(gl_Position.w);\n"
|
||||||
@ -32,12 +36,12 @@ const char *matfx_env_frag_src =
|
|||||||
"uniform sampler2D tex1;\n"
|
"uniform sampler2D tex1;\n"
|
||||||
|
|
||||||
"uniform vec4 u_fxparams;\n"
|
"uniform vec4 u_fxparams;\n"
|
||||||
"uniform vec4 u_colorClamp;\n"
|
|
||||||
|
|
||||||
"#define shininess (u_fxparams.x)\n"
|
"#define shininess (u_fxparams.x)\n"
|
||||||
"#define disableFBA (u_fxparams.y)\n"
|
"#define disableFBA (u_fxparams.y)\n"
|
||||||
|
|
||||||
"FSIN vec4 v_color;\n"
|
"FSIN vec4 v_color;\n"
|
||||||
|
"FSIN vec4 v_envColor;\n"
|
||||||
"FSIN vec2 v_tex0;\n"
|
"FSIN vec2 v_tex0;\n"
|
||||||
"FSIN vec2 v_tex1;\n"
|
"FSIN vec2 v_tex1;\n"
|
||||||
"FSIN float v_fog;\n"
|
"FSIN float v_fog;\n"
|
||||||
@ -46,10 +50,9 @@ const char *matfx_env_frag_src =
|
|||||||
"main(void)\n"
|
"main(void)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
" vec4 pass1 = v_color;\n"
|
" vec4 pass1 = v_color;\n"
|
||||||
" vec4 envColor = max(pass1, u_colorClamp);\n"
|
|
||||||
" pass1 *= texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));\n"
|
" pass1 *= texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));\n"
|
||||||
|
|
||||||
" vec4 pass2 = envColor*shininess*texture(tex1, vec2(v_tex1.x, 1.0-v_tex1.y));\n"
|
" vec4 pass2 = v_envColor*shininess*texture(tex1, vec2(v_tex1.x, 1.0-v_tex1.y));\n"
|
||||||
|
|
||||||
" pass1.rgb = mix(u_fogColor.rgb, pass1.rgb, v_fog);\n"
|
" pass1.rgb = mix(u_fogColor.rgb, pass1.rgb, v_fog);\n"
|
||||||
" pass2.rgb = mix(vec3(0.0, 0.0, 0.0), pass2.rgb, v_fog);\n"
|
" pass2.rgb = mix(vec3(0.0, 0.0, 0.0), pass2.rgb, v_fog);\n"
|
||||||
|
@ -24,7 +24,11 @@
|
|||||||
|
|
||||||
namespace rw {
|
namespace rw {
|
||||||
|
|
||||||
bool32 MatFX::modulateEnvMap;
|
bool32 MatFX::envMapFlipU;
|
||||||
|
bool32 MatFX::envMapApplyLight;
|
||||||
|
bool32 MatFX::envMapUseMatColor;
|
||||||
|
RGBA MatFX::envMapColor = { 255, 255, 255, 255 };
|
||||||
|
|
||||||
|
|
||||||
// Atomic
|
// Atomic
|
||||||
|
|
||||||
|
@ -307,6 +307,7 @@ struct RawMatrix
|
|||||||
V3d pos;
|
V3d pos;
|
||||||
float32 posw;
|
float32 posw;
|
||||||
|
|
||||||
|
// NB: this is dst = src2*src1, i.e. src1 is applied first, then src2
|
||||||
static void mult(RawMatrix *dst, RawMatrix *src1, RawMatrix *src2);
|
static void mult(RawMatrix *dst, RawMatrix *src1, RawMatrix *src2);
|
||||||
static void transpose(RawMatrix *dst, RawMatrix *src);
|
static void transpose(RawMatrix *dst, RawMatrix *src);
|
||||||
static void setIdentity(RawMatrix *dst);
|
static void setIdentity(RawMatrix *dst);
|
||||||
|
@ -160,7 +160,10 @@ struct MatFX
|
|||||||
static void disableEffects(Atomic *atomic);
|
static void disableEffects(Atomic *atomic);
|
||||||
static bool32 getEffects(Atomic *atomic);
|
static bool32 getEffects(Atomic *atomic);
|
||||||
|
|
||||||
static bool32 modulateEnvMap;
|
static bool32 envMapFlipU; // PS2 does this for some reason
|
||||||
|
static bool32 envMapApplyLight; // modulate env map by lighting
|
||||||
|
static bool32 envMapUseMatColor; // modulate env map by material color
|
||||||
|
static RGBA envMapColor; // if !envMapUseMatColor, use this
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MatFXGlobals
|
struct MatFXGlobals
|
||||||
|
Loading…
Reference in New Issue
Block a user