From 93c246b6b1137dba0cb7ed096b5f6d8ac8e8396f Mon Sep 17 00:00:00 2001 From: aap Date: Tue, 18 Aug 2020 11:03:07 +0200 Subject: [PATCH] render pipe fixes --- rw.h | 1 + src/d3d/d3d9render.cpp | 2 +- src/d3d/d3d9skin.cpp | 16 +- src/d3d/rwd3d9.h | 2 + src/d3d/shaders/lighting.h | 5 + src/d3d/shaders/skin_VS.hlsl | 6 +- src/d3d/shaders/skin_all_VS.h | 736 ++++++++++++++---------------- src/d3d/shaders/skin_amb_VS.h | 216 ++++----- src/d3d/shaders/skin_amb_dir_VS.h | 515 ++++++++++----------- src/gl/gl3render.cpp | 2 - src/gl/rwgl3plg.h | 11 +- src/gl/shaders/default.vert | 8 +- src/gl/shaders/default_vs_gl3.inc | 8 +- src/gl/shaders/im3d.vert | 6 +- src/gl/shaders/im3d_gl3.inc | 6 +- src/gl/shaders/matfx_env.vert | 10 +- src/gl/shaders/matfx_gl3.inc | 10 +- src/gl/shaders/skin.vert | 8 +- src/gl/shaders/skin_gl3.inc | 8 +- 19 files changed, 745 insertions(+), 831 deletions(-) diff --git a/rw.h b/rw.h index 2ef5460..fb9829f 100644 --- a/rw.h +++ b/rw.h @@ -22,3 +22,4 @@ #include "src/gl/rwwdgl.h" #include "src/gl/rwgl3.h" #include "src/gl/rwgl3shader.h" +#include "src/gl/rwgl3plg.h" diff --git a/src/d3d/d3d9render.cpp b/src/d3d/d3d9render.cpp index c7e9fae..0460922 100644 --- a/src/d3d/d3d9render.cpp +++ b/src/d3d/d3d9render.cpp @@ -168,7 +168,7 @@ defaultRenderCB_Shader(Atomic *atomic, InstanceDataHeader *header) setMaterial(m->color, m->surfaceProps); - if(inst->material->texture){ + if(m->texture){ d3d::setTexture(0, m->texture); setPixelShader(default_tex_PS); }else diff --git a/src/d3d/d3d9skin.cpp b/src/d3d/d3d9skin.cpp index c727074..ae669f1 100644 --- a/src/d3d/d3d9skin.cpp +++ b/src/d3d/d3d9skin.cpp @@ -238,15 +238,16 @@ uploadSkinMatrices(Atomic *a) Skin *skin = Skin::get(a->geometry); HAnimHierarchy *hier = Skin::getHierarchy(a); Matrix *invMats = (Matrix*)skin->inverseMatrices; - Matrix tmp; + Matrix tmp, tmp2; - Matrix *m = (Matrix*)skinMatrices; + float *m = skinMatrices; if(hier->flags & HAnimHierarchy::LOCALSPACEMATRICES){ for(i = 0; i < hier->numNodes; i++){ invMats[i].flags = 0; - Matrix::mult(m, &invMats[i], &hier->matrices[i]); - m++; + Matrix::mult(&tmp, &invMats[i], &hier->matrices[i]); + RawMatrix::transpose((RawMatrix*)m, (RawMatrix*)&tmp); + m += 12; } }else{ Matrix invAtmMat; @@ -254,11 +255,12 @@ uploadSkinMatrices(Atomic *a) for(i = 0; i < hier->numNodes; i++){ invMats[i].flags = 0; Matrix::mult(&tmp, &hier->matrices[i], &invAtmMat); - Matrix::mult(m, &invMats[i], &tmp); - m++; + Matrix::mult(&tmp2, &invMats[i], &tmp); + RawMatrix::transpose((RawMatrix*)m, (RawMatrix*)&tmp2); + m += 12; } } - d3ddevice->SetVertexShaderConstantF(VSLOC_boneMatrices, skinMatrices, hier->numNodes*4); + d3ddevice->SetVertexShaderConstantF(VSLOC_boneMatrices, skinMatrices, hier->numNodes*3); } void diff --git a/src/d3d/rwd3d9.h b/src/d3d/rwd3d9.h index 9b5a25c..ea3c0e4 100644 --- a/src/d3d/rwd3d9.h +++ b/src/d3d/rwd3d9.h @@ -92,6 +92,8 @@ ObjPipeline *makeDefaultPipeline(void); // Skin plugin void initSkin(void); +void uploadSkinMatrices(Atomic *atomic); +void skinInstanceCB(Geometry *geo, InstanceDataHeader *header, bool32 reinstance); ObjPipeline *makeSkinPipeline(void); // MatFX plugin diff --git a/src/d3d/shaders/lighting.h b/src/d3d/shaders/lighting.h index 49bea92..2591c81 100644 --- a/src/d3d/shaders/lighting.h +++ b/src/d3d/shaders/lighting.h @@ -11,6 +11,11 @@ float3 DoDirLight(Light L, float3 N) return l*L.color.xyz; } +float3 DoDirLightSpec(Light L, float3 N, float3 V, float power)) +{ + return pow(saturate(dot(N, normalize(V + -L.direction.xyz))), power)*L.color.xyz; +} + float3 DoPointLight(Light L, float3 V, float3 N) { // As on PS2 diff --git a/src/d3d/shaders/skin_VS.hlsl b/src/d3d/shaders/skin_VS.hlsl index 9df0369..bede50f 100644 --- a/src/d3d/shaders/skin_VS.hlsl +++ b/src/d3d/shaders/skin_VS.hlsl @@ -1,6 +1,6 @@ #include "standardConstants.h" -float4x4 boneMatrices[64] : register(c41); +float4x3 boneMatrices[64] : register(c41); struct VS_in { @@ -27,8 +27,8 @@ VS_out main(in VS_in input) 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]; + SkinVertex += mul(input.Position, boneMatrices[input.Indices[j]]).xyz * input.Weights[j]; + SkinNormal += mul(input.Normal, (float3x3)boneMatrices[input.Indices[j]]).xyz * input.Weights[j]; } output.Position = mul(combinedMat, float4(SkinVertex, 1.0)); diff --git a/src/d3d/shaders/skin_all_VS.h b/src/d3d/shaders/skin_all_VS.h index 556b66f..67f89f3 100644 --- a/src/d3d/shaders/skin_all_VS.h +++ b/src/d3d/shaders/skin_all_VS.h @@ -9,7 +9,7 @@ // Parameters: // // float4 ambientLight; -// float4x4 boneMatrices[64]; +// float4x3 boneMatrices[64]; // float4x4 combinedMat; // int4 firstLight; // float4 fogData; @@ -47,11 +47,11 @@ // ambientLight c15 1 // firstLight c16 1 // lights c17 24 -// boneMatrices c41 256 +// boneMatrices c41 192 // vs_2_0 - def c11, 4, 0, 3, 1 + def c11, 3, 0, 1, 0 dcl_position v0 dcl_normal v1 dcl_texcoord v2 @@ -59,49 +59,46 @@ dcl_blendweight v4 dcl_blendindices v5 mul r0, v5, c11.x - mova a0.xy, r0 - mul r1.xyz, v1.y, c42[a0.x] - mad r1.xyz, c41[a0.x], v1.x, r1 - mad r1.xyz, c43[a0.x], v1.z, r1 - mul r2.xyz, v1.y, c42[a0.y] - mad r2.xyz, c41[a0.y], v1.x, r2 - mad r2.xyz, c43[a0.y], v1.z, r2 - mul r2.xyz, r2, v4.y - mad r1.xyz, r1, v4.x, r2 - mul r2.xyz, v0.y, c42[a0.y] - mad r2.xyz, c41[a0.y], v0.x, r2 - mad r2.xyz, c43[a0.y], v0.z, r2 - mad r2.xyz, c44[a0.y], v0.w, r2 - mul r2.xyz, r2, v4.y - mul r3.xyz, v0.y, c42[a0.x] - mad r3.xyz, c41[a0.x], v0.x, r3 - mad r3.xyz, c43[a0.x], v0.z, r3 - mad r3.xyz, c44[a0.x], v0.w, r3 - mad r2.xyz, r3, v4.x, r2 + mova a0.x, r0.x + dp3 r1.z, v1, c43[a0.x] + dp4 r2.x, v0, c41[a0.x] + dp4 r2.y, v0, c42[a0.x] + dp4 r2.z, v0, c43[a0.x] + dp3 r1.x, v1, c41[a0.x] + dp3 r1.y, v1, c42[a0.x] + mova a0.x, r0.y + dp3 r3.z, v1, c43[a0.x] + dp4 r4.x, v0, c41[a0.x] + dp4 r4.y, v0, c42[a0.x] + dp4 r4.z, v0, c43[a0.x] + mul r4.xyz, r4, v4.y + mad r2.xyz, r2, v4.x, r4 + dp3 r3.x, v1, c41[a0.x] + dp3 r3.y, v1, c42[a0.x] + mul r3.xyz, r3, v4.y + mad r1.xyz, r1, v4.x, r3 mova a0.x, r0.z - mul r0.xyz, v1.y, c42[a0.x] - mad r0.xyz, c41[a0.x], v1.x, r0 - mad r0.xyz, c43[a0.x], v1.z, r0 + dp3 r0.z, v1, c43[a0.x] + dp4 r3.x, v0, c41[a0.x] + dp4 r3.y, v0, c42[a0.x] + dp4 r3.z, v0, c43[a0.x] + mad r2.xyz, r3, v4.z, r2 + dp3 r0.x, v1, c41[a0.x] + dp3 r0.y, v1, c42[a0.x] mad r0.xyz, r0, v4.z, r1 - mul r1.xyz, v0.y, c42[a0.x] - mad r1.xyz, c41[a0.x], v0.x, r1 - mad r1.xyz, c43[a0.x], v0.z, r1 - mad r1.xyz, c44[a0.x], v0.w, r1 - mad r1.xyz, r1, v4.z, r2 mova a0.x, r0.w - mul r2.xyz, v1.y, c42[a0.x] - mad r2.xyz, c41[a0.x], v1.x, r2 - mad r2.xyz, c43[a0.x], v1.z, r2 - mad r0.xyz, r2, v4.w, r0 - mul r2.xyz, v0.y, c42[a0.x] - mad r2.xyz, c41[a0.x], v0.x, r2 - mad r2.xyz, c43[a0.x], v0.z, r2 - mad r2.xyz, c44[a0.x], v0.w, r2 - mad r1.xyz, r2, v4.w, r1 - mul r2.xyz, r1.y, c5 - mad r2.xyz, c4, r1.x, r2 - mad r2.xyz, c6, r1.z, r2 - add r2.xyz, r2, c7 + dp3 r1.z, v1, c43[a0.x] + dp4 r3.x, v0, c41[a0.x] + dp4 r3.y, v0, c42[a0.x] + dp4 r3.z, v0, c43[a0.x] + mad r2.xyz, r3, v4.w, r2 + dp3 r1.x, v1, c41[a0.x] + dp3 r1.y, v1, c42[a0.x] + mad r0.xyz, r1, v4.w, r0 + mul r1.xyz, r2.y, c5 + mad r1.xyz, c4, r2.x, r1 + mad r1.xyz, c6, r2.z, r1 + add r1.xyz, r1, c7 mul r3.xyz, r0.y, c9 mad r0.xyw, c8.xyzz, r0.x, r3.xyzz mad r0.xyz, c10, r0.z, r0.xyww @@ -111,21 +108,21 @@ mov r0.w, c11.y rep i0 add r1.w, r0.w, c16.x - mul r1.w, r1.w, c11.z + mul r1.w, r1.w, c11.x mova a0.x, r1.w dp3 r1.w, r0, -c19[a0.x] max r1.w, r1.w, c11.y mul r5.xyz, r1.w, c17[a0.x] mad r4.xyz, r5, c13.z, r4 - add r0.w, r0.w, c11.w + add r0.w, r0.w, c11.z endrep mov r3.xyz, r4 mov r0.w, c11.y rep i1 add r1.w, r0.w, c16.y - mul r1.w, r1.w, c11.z + mul r1.w, r1.w, c11.x mova a0.x, r1.w - add r5.xyz, r2, -c18[a0.x] + add r5.xyz, r1, -c18[a0.x] dp3 r1.w, r5, r5 rsq r1.w, r1.w mul r5.xyz, r1.w, r5 @@ -134,19 +131,19 @@ mul r5.xyz, r2.w, c17[a0.x] rcp r1.w, r1.w rcp r2.w, c17[a0.x].w - mad r1.w, r1.w, -r2.w, c11.w + mad r1.w, r1.w, -r2.w, c11.z max r1.w, r1.w, c11.y mul r5.xyz, r1.w, r5 mad r3.xyz, r5, c13.z, r3 - add r0.w, r0.w, c11.w + add r0.w, r0.w, c11.z endrep mov r4.xyz, r3 mov r0.w, c11.y rep i2 add r1.w, r0.w, c16.z - mul r1.w, r1.w, c11.z + mul r1.w, r1.w, c11.x mova a0.x, r1.w - add r5.xyz, r2, -c18[a0.x] + add r5.xyz, r1, -c18[a0.x] dp3 r1.w, r5, r5 rsq r1.w, r1.w mul r5.xyz, r1.w, r5 @@ -154,8 +151,8 @@ dp3 r3.w, r5, c19[a0.x] max r2.w, r2.w, c11.y add r3.w, r3.w, c18[a0.x].w - mov r5.w, c11.w - add r5.x, r5.w, c18[a0.x].w + mov r5.z, c11.z + add r5.x, r5.z, c18[a0.x].w rcp r5.x, r5.x mul r3.w, r3.w, r5.x slt r5.x, r3.w, c11.y @@ -165,28 +162,28 @@ mul r5.xyz, r2.w, c17[a0.x] rcp r1.w, r1.w rcp r2.w, c17[a0.x].w - mad r1.w, r1.w, -r2.w, c11.w + mad r1.w, r1.w, -r2.w, c11.z max r1.w, r1.w, c11.y mul r5.xyz, r1.w, r5 mad r4.xyz, r5, c13.z, r4 - add r0.w, r0.w, c11.w + add r0.w, r0.w, c11.z endrep mov r4.w, v3.w max r0, r4, c11.y - min r0, r0, c11.w + min r0, r0, c11.z mul oD0, r0, c12 - mul r0, r1.y, c1 - mad r0, c0, r1.x, r0 - mad r0, c2, r1.z, r0 + mul r0, r2.y, c1 + mad r0, c0, r2.x, r0 + mad r0, c2, r2.z, r0 add r0, r0, c3 mov oPos, r0 add r0.x, r0.w, -c14.y mul r0.x, r0.x, c14.z max r0.x, r0.x, c14.w - min oT0.z, r0.x, c11.w + min oT0.z, r0.x, c11.z mov oT0.xy, v2 -// approximately 136 instruction slots used +// approximately 133 instruction slots used #endif const BYTE g_vs20_main[] = @@ -202,7 +199,7 @@ const BYTE g_vs20_main[] = 1, 0, 62, 0, 48, 1, 0, 0, 0, 0, 0, 0, 64, 1, 0, 0, 2, 0, - 41, 0, 0, 1, 166, 0, + 41, 0, 192, 0, 166, 0, 80, 1, 0, 0, 0, 0, 0, 0, 96, 1, 0, 0, 2, 0, 0, 0, 4, 0, @@ -250,7 +247,7 @@ const BYTE g_vs20_main[] = 77, 97, 116, 114, 105, 99, 101, 115, 0, 171, 171, 171, 3, 0, 3, 0, 4, 0, - 4, 0, 64, 0, 0, 0, + 3, 0, 64, 0, 0, 0, 0, 0, 0, 0, 99, 111, 109, 98, 105, 110, 101, 100, 77, 97, 116, 0, 3, 0, @@ -308,9 +305,9 @@ const BYTE g_vs20_main[] = 53, 50, 46, 51, 49, 49, 49, 0, 81, 0, 0, 5, 11, 0, 15, 160, 0, 0, - 128, 64, 0, 0, 0, 0, - 0, 0, 64, 64, 0, 0, - 128, 63, 31, 0, 0, 2, + 64, 64, 0, 0, 0, 0, + 0, 0, 128, 63, 0, 0, + 0, 0, 31, 0, 0, 2, 0, 0, 0, 128, 0, 0, 15, 144, 31, 0, 0, 2, 3, 0, 0, 128, 1, 0, @@ -326,227 +323,283 @@ const BYTE g_vs20_main[] = 0, 0, 15, 128, 5, 0, 228, 144, 11, 0, 0, 160, 46, 0, 0, 2, 0, 0, - 3, 176, 0, 0, 228, 128, - 5, 0, 0, 4, 1, 0, - 7, 128, 1, 0, 85, 144, - 42, 32, 228, 160, 0, 0, - 0, 176, 4, 0, 0, 5, - 1, 0, 7, 128, 41, 32, - 228, 160, 0, 0, 0, 176, - 1, 0, 0, 144, 1, 0, - 228, 128, 4, 0, 0, 5, - 1, 0, 7, 128, 43, 32, - 228, 160, 0, 0, 0, 176, - 1, 0, 170, 144, 1, 0, - 228, 128, 5, 0, 0, 4, - 2, 0, 7, 128, 1, 0, - 85, 144, 42, 32, 228, 160, - 0, 0, 85, 176, 4, 0, - 0, 5, 2, 0, 7, 128, - 41, 32, 228, 160, 0, 0, - 85, 176, 1, 0, 0, 144, - 2, 0, 228, 128, 4, 0, - 0, 5, 2, 0, 7, 128, + 1, 176, 0, 0, 0, 128, + 8, 0, 0, 4, 1, 0, + 4, 128, 1, 0, 228, 144, 43, 32, 228, 160, 0, 0, - 85, 176, 1, 0, 170, 144, - 2, 0, 228, 128, 5, 0, - 0, 3, 2, 0, 7, 128, - 2, 0, 228, 128, 4, 0, - 85, 144, 4, 0, 0, 4, - 1, 0, 7, 128, 1, 0, - 228, 128, 4, 0, 0, 144, - 2, 0, 228, 128, 5, 0, - 0, 4, 2, 0, 7, 128, - 0, 0, 85, 144, 42, 32, - 228, 160, 0, 0, 85, 176, - 4, 0, 0, 5, 2, 0, - 7, 128, 41, 32, 228, 160, - 0, 0, 85, 176, 0, 0, - 0, 144, 2, 0, 228, 128, - 4, 0, 0, 5, 2, 0, - 7, 128, 43, 32, 228, 160, - 0, 0, 85, 176, 0, 0, - 170, 144, 2, 0, 228, 128, - 4, 0, 0, 5, 2, 0, - 7, 128, 44, 32, 228, 160, - 0, 0, 85, 176, 0, 0, - 255, 144, 2, 0, 228, 128, - 5, 0, 0, 3, 2, 0, - 7, 128, 2, 0, 228, 128, - 4, 0, 85, 144, 5, 0, - 0, 4, 3, 0, 7, 128, - 0, 0, 85, 144, 42, 32, + 0, 176, 9, 0, 0, 4, + 2, 0, 1, 128, 0, 0, + 228, 144, 41, 32, 228, 160, + 0, 0, 0, 176, 9, 0, + 0, 4, 2, 0, 2, 128, + 0, 0, 228, 144, 42, 32, 228, 160, 0, 0, 0, 176, - 4, 0, 0, 5, 3, 0, - 7, 128, 41, 32, 228, 160, - 0, 0, 0, 176, 0, 0, + 9, 0, 0, 4, 2, 0, + 4, 128, 0, 0, 228, 144, + 43, 32, 228, 160, 0, 0, + 0, 176, 8, 0, 0, 4, + 1, 0, 1, 128, 1, 0, + 228, 144, 41, 32, 228, 160, + 0, 0, 0, 176, 8, 0, + 0, 4, 1, 0, 2, 128, + 1, 0, 228, 144, 42, 32, + 228, 160, 0, 0, 0, 176, + 46, 0, 0, 2, 0, 0, + 1, 176, 0, 0, 85, 128, + 8, 0, 0, 4, 3, 0, + 4, 128, 1, 0, 228, 144, + 43, 32, 228, 160, 0, 0, + 0, 176, 9, 0, 0, 4, + 4, 0, 1, 128, 0, 0, + 228, 144, 41, 32, 228, 160, + 0, 0, 0, 176, 9, 0, + 0, 4, 4, 0, 2, 128, + 0, 0, 228, 144, 42, 32, + 228, 160, 0, 0, 0, 176, + 9, 0, 0, 4, 4, 0, + 4, 128, 0, 0, 228, 144, + 43, 32, 228, 160, 0, 0, + 0, 176, 5, 0, 0, 3, + 4, 0, 7, 128, 4, 0, + 228, 128, 4, 0, 85, 144, + 4, 0, 0, 4, 2, 0, + 7, 128, 2, 0, 228, 128, + 4, 0, 0, 144, 4, 0, + 228, 128, 8, 0, 0, 4, + 3, 0, 1, 128, 1, 0, + 228, 144, 41, 32, 228, 160, + 0, 0, 0, 176, 8, 0, + 0, 4, 3, 0, 2, 128, + 1, 0, 228, 144, 42, 32, + 228, 160, 0, 0, 0, 176, + 5, 0, 0, 3, 3, 0, + 7, 128, 3, 0, 228, 128, + 4, 0, 85, 144, 4, 0, + 0, 4, 1, 0, 7, 128, + 1, 0, 228, 128, 4, 0, 0, 144, 3, 0, 228, 128, - 4, 0, 0, 5, 3, 0, - 7, 128, 43, 32, 228, 160, - 0, 0, 0, 176, 0, 0, - 170, 144, 3, 0, 228, 128, - 4, 0, 0, 5, 3, 0, - 7, 128, 44, 32, 228, 160, - 0, 0, 0, 176, 0, 0, - 255, 144, 3, 0, 228, 128, + 46, 0, 0, 2, 0, 0, + 1, 176, 0, 0, 170, 128, + 8, 0, 0, 4, 0, 0, + 4, 128, 1, 0, 228, 144, + 43, 32, 228, 160, 0, 0, + 0, 176, 9, 0, 0, 4, + 3, 0, 1, 128, 0, 0, + 228, 144, 41, 32, 228, 160, + 0, 0, 0, 176, 9, 0, + 0, 4, 3, 0, 2, 128, + 0, 0, 228, 144, 42, 32, + 228, 160, 0, 0, 0, 176, + 9, 0, 0, 4, 3, 0, + 4, 128, 0, 0, 228, 144, + 43, 32, 228, 160, 0, 0, + 0, 176, 4, 0, 0, 4, + 2, 0, 7, 128, 3, 0, + 228, 128, 4, 0, 170, 144, + 2, 0, 228, 128, 8, 0, + 0, 4, 0, 0, 1, 128, + 1, 0, 228, 144, 41, 32, + 228, 160, 0, 0, 0, 176, + 8, 0, 0, 4, 0, 0, + 2, 128, 1, 0, 228, 144, + 42, 32, 228, 160, 0, 0, + 0, 176, 4, 0, 0, 4, + 0, 0, 7, 128, 0, 0, + 228, 128, 4, 0, 170, 144, + 1, 0, 228, 128, 46, 0, + 0, 2, 0, 0, 1, 176, + 0, 0, 255, 128, 8, 0, + 0, 4, 1, 0, 4, 128, + 1, 0, 228, 144, 43, 32, + 228, 160, 0, 0, 0, 176, + 9, 0, 0, 4, 3, 0, + 1, 128, 0, 0, 228, 144, + 41, 32, 228, 160, 0, 0, + 0, 176, 9, 0, 0, 4, + 3, 0, 2, 128, 0, 0, + 228, 144, 42, 32, 228, 160, + 0, 0, 0, 176, 9, 0, + 0, 4, 3, 0, 4, 128, + 0, 0, 228, 144, 43, 32, + 228, 160, 0, 0, 0, 176, 4, 0, 0, 4, 2, 0, 7, 128, 3, 0, 228, 128, - 4, 0, 0, 144, 2, 0, - 228, 128, 46, 0, 0, 2, - 0, 0, 1, 176, 0, 0, - 170, 128, 5, 0, 0, 4, - 0, 0, 7, 128, 1, 0, - 85, 144, 42, 32, 228, 160, - 0, 0, 0, 176, 4, 0, - 0, 5, 0, 0, 7, 128, - 41, 32, 228, 160, 0, 0, - 0, 176, 1, 0, 0, 144, - 0, 0, 228, 128, 4, 0, - 0, 5, 0, 0, 7, 128, - 43, 32, 228, 160, 0, 0, - 0, 176, 1, 0, 170, 144, - 0, 0, 228, 128, 4, 0, - 0, 4, 0, 0, 7, 128, - 0, 0, 228, 128, 4, 0, - 170, 144, 1, 0, 228, 128, - 5, 0, 0, 4, 1, 0, - 7, 128, 0, 0, 85, 144, - 42, 32, 228, 160, 0, 0, - 0, 176, 4, 0, 0, 5, - 1, 0, 7, 128, 41, 32, + 4, 0, 255, 144, 2, 0, + 228, 128, 8, 0, 0, 4, + 1, 0, 1, 128, 1, 0, + 228, 144, 41, 32, 228, 160, + 0, 0, 0, 176, 8, 0, + 0, 4, 1, 0, 2, 128, + 1, 0, 228, 144, 42, 32, 228, 160, 0, 0, 0, 176, - 0, 0, 0, 144, 1, 0, - 228, 128, 4, 0, 0, 5, - 1, 0, 7, 128, 43, 32, - 228, 160, 0, 0, 0, 176, - 0, 0, 170, 144, 1, 0, - 228, 128, 4, 0, 0, 5, - 1, 0, 7, 128, 44, 32, - 228, 160, 0, 0, 0, 176, - 0, 0, 255, 144, 1, 0, - 228, 128, 4, 0, 0, 4, - 1, 0, 7, 128, 1, 0, - 228, 128, 4, 0, 170, 144, - 2, 0, 228, 128, 46, 0, - 0, 2, 0, 0, 1, 176, - 0, 0, 255, 128, 5, 0, - 0, 4, 2, 0, 7, 128, - 1, 0, 85, 144, 42, 32, - 228, 160, 0, 0, 0, 176, - 4, 0, 0, 5, 2, 0, - 7, 128, 41, 32, 228, 160, - 0, 0, 0, 176, 1, 0, - 0, 144, 2, 0, 228, 128, - 4, 0, 0, 5, 2, 0, - 7, 128, 43, 32, 228, 160, - 0, 0, 0, 176, 1, 0, - 170, 144, 2, 0, 228, 128, 4, 0, 0, 4, 0, 0, - 7, 128, 2, 0, 228, 128, + 7, 128, 1, 0, 228, 128, 4, 0, 255, 144, 0, 0, - 228, 128, 5, 0, 0, 4, - 2, 0, 7, 128, 0, 0, - 85, 144, 42, 32, 228, 160, - 0, 0, 0, 176, 4, 0, - 0, 5, 2, 0, 7, 128, - 41, 32, 228, 160, 0, 0, - 0, 176, 0, 0, 0, 144, - 2, 0, 228, 128, 4, 0, - 0, 5, 2, 0, 7, 128, - 43, 32, 228, 160, 0, 0, - 0, 176, 0, 0, 170, 144, - 2, 0, 228, 128, 4, 0, - 0, 5, 2, 0, 7, 128, - 44, 32, 228, 160, 0, 0, - 0, 176, 0, 0, 255, 144, - 2, 0, 228, 128, 4, 0, - 0, 4, 1, 0, 7, 128, - 2, 0, 228, 128, 4, 0, - 255, 144, 1, 0, 228, 128, - 5, 0, 0, 3, 2, 0, - 7, 128, 1, 0, 85, 128, - 5, 0, 228, 160, 4, 0, - 0, 4, 2, 0, 7, 128, - 4, 0, 228, 160, 1, 0, - 0, 128, 2, 0, 228, 128, - 4, 0, 0, 4, 2, 0, - 7, 128, 6, 0, 228, 160, - 1, 0, 170, 128, 2, 0, - 228, 128, 2, 0, 0, 3, - 2, 0, 7, 128, 2, 0, - 228, 128, 7, 0, 228, 160, - 5, 0, 0, 3, 3, 0, - 7, 128, 0, 0, 85, 128, - 9, 0, 228, 160, 4, 0, - 0, 4, 0, 0, 11, 128, - 8, 0, 164, 160, 0, 0, - 0, 128, 3, 0, 164, 128, + 228, 128, 5, 0, 0, 3, + 1, 0, 7, 128, 2, 0, + 85, 128, 5, 0, 228, 160, + 4, 0, 0, 4, 1, 0, + 7, 128, 4, 0, 228, 160, + 2, 0, 0, 128, 1, 0, + 228, 128, 4, 0, 0, 4, + 1, 0, 7, 128, 6, 0, + 228, 160, 2, 0, 170, 128, + 1, 0, 228, 128, 2, 0, + 0, 3, 1, 0, 7, 128, + 1, 0, 228, 128, 7, 0, + 228, 160, 5, 0, 0, 3, + 3, 0, 7, 128, 0, 0, + 85, 128, 9, 0, 228, 160, 4, 0, 0, 4, 0, 0, - 7, 128, 10, 0, 228, 160, - 0, 0, 170, 128, 0, 0, - 244, 128, 1, 0, 0, 2, - 3, 0, 1, 128, 13, 0, - 0, 160, 4, 0, 0, 4, - 3, 0, 7, 128, 15, 0, - 228, 160, 3, 0, 0, 128, - 3, 0, 228, 144, 1, 0, + 11, 128, 8, 0, 164, 160, + 0, 0, 0, 128, 3, 0, + 164, 128, 4, 0, 0, 4, + 0, 0, 7, 128, 10, 0, + 228, 160, 0, 0, 170, 128, + 0, 0, 244, 128, 1, 0, + 0, 2, 3, 0, 1, 128, + 13, 0, 0, 160, 4, 0, + 0, 4, 3, 0, 7, 128, + 15, 0, 228, 160, 3, 0, + 0, 128, 3, 0, 228, 144, + 1, 0, 0, 2, 4, 0, + 7, 128, 3, 0, 228, 128, + 1, 0, 0, 2, 0, 0, + 8, 128, 11, 0, 85, 160, + 38, 0, 0, 1, 0, 0, + 228, 240, 2, 0, 0, 3, + 1, 0, 8, 128, 0, 0, + 255, 128, 16, 0, 0, 160, + 5, 0, 0, 3, 1, 0, + 8, 128, 1, 0, 255, 128, + 11, 0, 0, 160, 46, 0, + 0, 2, 0, 0, 1, 176, + 1, 0, 255, 128, 8, 0, + 0, 4, 1, 0, 8, 128, + 0, 0, 228, 128, 19, 32, + 228, 161, 0, 0, 0, 176, + 11, 0, 0, 3, 1, 0, + 8, 128, 1, 0, 255, 128, + 11, 0, 85, 160, 5, 0, + 0, 4, 5, 0, 7, 128, + 1, 0, 255, 128, 17, 32, + 228, 160, 0, 0, 0, 176, + 4, 0, 0, 4, 4, 0, + 7, 128, 5, 0, 228, 128, + 13, 0, 170, 160, 4, 0, + 228, 128, 2, 0, 0, 3, + 0, 0, 8, 128, 0, 0, + 255, 128, 11, 0, 170, 160, + 39, 0, 0, 0, 1, 0, + 0, 2, 3, 0, 7, 128, + 4, 0, 228, 128, 1, 0, + 0, 2, 0, 0, 8, 128, + 11, 0, 85, 160, 38, 0, + 0, 1, 1, 0, 228, 240, + 2, 0, 0, 3, 1, 0, + 8, 128, 0, 0, 255, 128, + 16, 0, 85, 160, 5, 0, + 0, 3, 1, 0, 8, 128, + 1, 0, 255, 128, 11, 0, + 0, 160, 46, 0, 0, 2, + 0, 0, 1, 176, 1, 0, + 255, 128, 2, 0, 0, 4, + 5, 0, 7, 128, 1, 0, + 228, 128, 18, 32, 228, 161, + 0, 0, 0, 176, 8, 0, + 0, 3, 1, 0, 8, 128, + 5, 0, 228, 128, 5, 0, + 228, 128, 7, 0, 0, 2, + 1, 0, 8, 128, 1, 0, + 255, 128, 5, 0, 0, 3, + 5, 0, 7, 128, 1, 0, + 255, 128, 5, 0, 228, 128, + 8, 0, 0, 3, 2, 0, + 8, 128, 0, 0, 228, 128, + 5, 0, 228, 129, 11, 0, + 0, 3, 2, 0, 8, 128, + 2, 0, 255, 128, 11, 0, + 85, 160, 5, 0, 0, 4, + 5, 0, 7, 128, 2, 0, + 255, 128, 17, 32, 228, 160, + 0, 0, 0, 176, 6, 0, + 0, 2, 1, 0, 8, 128, + 1, 0, 255, 128, 6, 0, + 0, 3, 2, 0, 8, 128, + 17, 32, 255, 160, 0, 0, + 0, 176, 4, 0, 0, 4, + 1, 0, 8, 128, 1, 0, + 255, 128, 2, 0, 255, 129, + 11, 0, 170, 160, 11, 0, + 0, 3, 1, 0, 8, 128, + 1, 0, 255, 128, 11, 0, + 85, 160, 5, 0, 0, 3, + 5, 0, 7, 128, 1, 0, + 255, 128, 5, 0, 228, 128, + 4, 0, 0, 4, 3, 0, + 7, 128, 5, 0, 228, 128, + 13, 0, 170, 160, 3, 0, + 228, 128, 2, 0, 0, 3, + 0, 0, 8, 128, 0, 0, + 255, 128, 11, 0, 170, 160, + 39, 0, 0, 0, 1, 0, 0, 2, 4, 0, 7, 128, 3, 0, 228, 128, 1, 0, 0, 2, 0, 0, 8, 128, 11, 0, 85, 160, 38, 0, - 0, 1, 0, 0, 228, 240, + 0, 1, 2, 0, 228, 240, 2, 0, 0, 3, 1, 0, 8, 128, 0, 0, 255, 128, - 16, 0, 0, 160, 5, 0, + 16, 0, 170, 160, 5, 0, 0, 3, 1, 0, 8, 128, 1, 0, 255, 128, 11, 0, - 170, 160, 46, 0, 0, 2, + 0, 160, 46, 0, 0, 2, 0, 0, 1, 176, 1, 0, - 255, 128, 8, 0, 0, 4, - 1, 0, 8, 128, 0, 0, - 228, 128, 19, 32, 228, 161, - 0, 0, 0, 176, 11, 0, - 0, 3, 1, 0, 8, 128, - 1, 0, 255, 128, 11, 0, - 85, 160, 5, 0, 0, 4, + 255, 128, 2, 0, 0, 4, 5, 0, 7, 128, 1, 0, - 255, 128, 17, 32, 228, 160, - 0, 0, 0, 176, 4, 0, - 0, 4, 4, 0, 7, 128, - 5, 0, 228, 128, 13, 0, - 170, 160, 4, 0, 228, 128, - 2, 0, 0, 3, 0, 0, - 8, 128, 0, 0, 255, 128, - 11, 0, 255, 160, 39, 0, - 0, 0, 1, 0, 0, 2, - 3, 0, 7, 128, 4, 0, - 228, 128, 1, 0, 0, 2, - 0, 0, 8, 128, 11, 0, - 85, 160, 38, 0, 0, 1, - 1, 0, 228, 240, 2, 0, + 228, 128, 18, 32, 228, 161, + 0, 0, 0, 176, 8, 0, 0, 3, 1, 0, 8, 128, - 0, 0, 255, 128, 16, 0, - 85, 160, 5, 0, 0, 3, + 5, 0, 228, 128, 5, 0, + 228, 128, 7, 0, 0, 2, 1, 0, 8, 128, 1, 0, - 255, 128, 11, 0, 170, 160, - 46, 0, 0, 2, 0, 0, - 1, 176, 1, 0, 255, 128, + 255, 128, 5, 0, 0, 3, + 5, 0, 7, 128, 1, 0, + 255, 128, 5, 0, 228, 128, + 8, 0, 0, 3, 2, 0, + 8, 128, 0, 0, 228, 128, + 5, 0, 228, 129, 8, 0, + 0, 4, 3, 0, 8, 128, + 5, 0, 228, 128, 19, 32, + 228, 160, 0, 0, 0, 176, + 11, 0, 0, 3, 2, 0, + 8, 128, 2, 0, 255, 128, + 11, 0, 85, 160, 2, 0, + 0, 4, 3, 0, 8, 128, + 3, 0, 255, 128, 18, 32, + 255, 160, 0, 0, 0, 176, + 1, 0, 0, 2, 5, 0, + 4, 128, 11, 0, 170, 160, 2, 0, 0, 4, 5, 0, - 7, 128, 2, 0, 228, 128, - 18, 32, 228, 161, 0, 0, - 0, 176, 8, 0, 0, 3, - 1, 0, 8, 128, 5, 0, - 228, 128, 5, 0, 228, 128, - 7, 0, 0, 2, 1, 0, - 8, 128, 1, 0, 255, 128, - 5, 0, 0, 3, 5, 0, - 7, 128, 1, 0, 255, 128, - 5, 0, 228, 128, 8, 0, - 0, 3, 2, 0, 8, 128, - 0, 0, 228, 128, 5, 0, - 228, 129, 11, 0, 0, 3, + 1, 128, 5, 0, 170, 128, + 18, 32, 255, 160, 0, 0, + 0, 176, 6, 0, 0, 2, + 5, 0, 1, 128, 5, 0, + 0, 128, 5, 0, 0, 3, + 3, 0, 8, 128, 3, 0, + 255, 128, 5, 0, 0, 128, + 12, 0, 0, 3, 5, 0, + 1, 128, 3, 0, 255, 128, + 11, 0, 85, 160, 4, 0, + 0, 4, 2, 0, 8, 128, + 5, 0, 0, 128, 2, 0, + 255, 129, 2, 0, 255, 128, + 11, 0, 0, 4, 3, 0, + 8, 128, 3, 0, 255, 128, + 19, 32, 255, 160, 0, 0, + 0, 176, 5, 0, 0, 3, 2, 0, 8, 128, 2, 0, - 255, 128, 11, 0, 85, 160, + 255, 128, 3, 0, 255, 128, 5, 0, 0, 4, 5, 0, 7, 128, 2, 0, 255, 128, 17, 32, 228, 160, 0, 0, @@ -558,135 +611,54 @@ const BYTE g_vs20_main[] = 4, 0, 0, 4, 1, 0, 8, 128, 1, 0, 255, 128, 2, 0, 255, 129, 11, 0, - 255, 160, 11, 0, 0, 3, + 170, 160, 11, 0, 0, 3, 1, 0, 8, 128, 1, 0, 255, 128, 11, 0, 85, 160, 5, 0, 0, 3, 5, 0, 7, 128, 1, 0, 255, 128, 5, 0, 228, 128, 4, 0, - 0, 4, 3, 0, 7, 128, + 0, 4, 4, 0, 7, 128, 5, 0, 228, 128, 13, 0, - 170, 160, 3, 0, 228, 128, + 170, 160, 4, 0, 228, 128, 2, 0, 0, 3, 0, 0, 8, 128, 0, 0, 255, 128, - 11, 0, 255, 160, 39, 0, + 11, 0, 170, 160, 39, 0, 0, 0, 1, 0, 0, 2, - 4, 0, 7, 128, 3, 0, - 228, 128, 1, 0, 0, 2, - 0, 0, 8, 128, 11, 0, - 85, 160, 38, 0, 0, 1, - 2, 0, 228, 240, 2, 0, - 0, 3, 1, 0, 8, 128, - 0, 0, 255, 128, 16, 0, - 170, 160, 5, 0, 0, 3, - 1, 0, 8, 128, 1, 0, - 255, 128, 11, 0, 170, 160, - 46, 0, 0, 2, 0, 0, - 1, 176, 1, 0, 255, 128, - 2, 0, 0, 4, 5, 0, - 7, 128, 2, 0, 228, 128, - 18, 32, 228, 161, 0, 0, - 0, 176, 8, 0, 0, 3, - 1, 0, 8, 128, 5, 0, - 228, 128, 5, 0, 228, 128, - 7, 0, 0, 2, 1, 0, - 8, 128, 1, 0, 255, 128, - 5, 0, 0, 3, 5, 0, - 7, 128, 1, 0, 255, 128, - 5, 0, 228, 128, 8, 0, - 0, 3, 2, 0, 8, 128, - 0, 0, 228, 128, 5, 0, - 228, 129, 8, 0, 0, 4, - 3, 0, 8, 128, 5, 0, - 228, 128, 19, 32, 228, 160, - 0, 0, 0, 176, 11, 0, - 0, 3, 2, 0, 8, 128, - 2, 0, 255, 128, 11, 0, - 85, 160, 2, 0, 0, 4, - 3, 0, 8, 128, 3, 0, - 255, 128, 18, 32, 255, 160, - 0, 0, 0, 176, 1, 0, - 0, 2, 5, 0, 8, 128, - 11, 0, 255, 160, 2, 0, - 0, 4, 5, 0, 1, 128, - 5, 0, 255, 128, 18, 32, - 255, 160, 0, 0, 0, 176, - 6, 0, 0, 2, 5, 0, - 1, 128, 5, 0, 0, 128, - 5, 0, 0, 3, 3, 0, - 8, 128, 3, 0, 255, 128, - 5, 0, 0, 128, 12, 0, - 0, 3, 5, 0, 1, 128, - 3, 0, 255, 128, 11, 0, - 85, 160, 4, 0, 0, 4, - 2, 0, 8, 128, 5, 0, - 0, 128, 2, 0, 255, 129, - 2, 0, 255, 128, 11, 0, - 0, 4, 3, 0, 8, 128, - 3, 0, 255, 128, 19, 32, - 255, 160, 0, 0, 0, 176, - 5, 0, 0, 3, 2, 0, - 8, 128, 2, 0, 255, 128, - 3, 0, 255, 128, 5, 0, - 0, 4, 5, 0, 7, 128, - 2, 0, 255, 128, 17, 32, - 228, 160, 0, 0, 0, 176, - 6, 0, 0, 2, 1, 0, - 8, 128, 1, 0, 255, 128, - 6, 0, 0, 3, 2, 0, - 8, 128, 17, 32, 255, 160, - 0, 0, 0, 176, 4, 0, - 0, 4, 1, 0, 8, 128, - 1, 0, 255, 128, 2, 0, - 255, 129, 11, 0, 255, 160, - 11, 0, 0, 3, 1, 0, - 8, 128, 1, 0, 255, 128, - 11, 0, 85, 160, 5, 0, - 0, 3, 5, 0, 7, 128, - 1, 0, 255, 128, 5, 0, - 228, 128, 4, 0, 0, 4, - 4, 0, 7, 128, 5, 0, - 228, 128, 13, 0, 170, 160, - 4, 0, 228, 128, 2, 0, - 0, 3, 0, 0, 8, 128, - 0, 0, 255, 128, 11, 0, - 255, 160, 39, 0, 0, 0, - 1, 0, 0, 2, 4, 0, - 8, 128, 3, 0, 255, 144, - 11, 0, 0, 3, 0, 0, - 15, 128, 4, 0, 228, 128, - 11, 0, 85, 160, 10, 0, - 0, 3, 0, 0, 15, 128, - 0, 0, 228, 128, 11, 0, - 255, 160, 5, 0, 0, 3, - 0, 0, 15, 208, 0, 0, - 228, 128, 12, 0, 228, 160, - 5, 0, 0, 3, 0, 0, - 15, 128, 1, 0, 85, 128, - 1, 0, 228, 160, 4, 0, - 0, 4, 0, 0, 15, 128, - 0, 0, 228, 160, 1, 0, - 0, 128, 0, 0, 228, 128, + 4, 0, 8, 128, 3, 0, + 255, 144, 11, 0, 0, 3, + 0, 0, 15, 128, 4, 0, + 228, 128, 11, 0, 85, 160, + 10, 0, 0, 3, 0, 0, + 15, 128, 0, 0, 228, 128, + 11, 0, 170, 160, 5, 0, + 0, 3, 0, 0, 15, 208, + 0, 0, 228, 128, 12, 0, + 228, 160, 5, 0, 0, 3, + 0, 0, 15, 128, 2, 0, + 85, 128, 1, 0, 228, 160, 4, 0, 0, 4, 0, 0, - 15, 128, 2, 0, 228, 160, - 1, 0, 170, 128, 0, 0, + 15, 128, 0, 0, 228, 160, + 2, 0, 0, 128, 0, 0, + 228, 128, 4, 0, 0, 4, + 0, 0, 15, 128, 2, 0, + 228, 160, 2, 0, 170, 128, + 0, 0, 228, 128, 2, 0, + 0, 3, 0, 0, 15, 128, + 0, 0, 228, 128, 3, 0, + 228, 160, 1, 0, 0, 2, + 0, 0, 15, 192, 0, 0, 228, 128, 2, 0, 0, 3, - 0, 0, 15, 128, 0, 0, - 228, 128, 3, 0, 228, 160, - 1, 0, 0, 2, 0, 0, - 15, 192, 0, 0, 228, 128, - 2, 0, 0, 3, 0, 0, - 1, 128, 0, 0, 255, 128, - 14, 0, 85, 161, 5, 0, + 0, 0, 1, 128, 0, 0, + 255, 128, 14, 0, 85, 161, + 5, 0, 0, 3, 0, 0, + 1, 128, 0, 0, 0, 128, + 14, 0, 170, 160, 11, 0, 0, 3, 0, 0, 1, 128, 0, 0, 0, 128, 14, 0, - 170, 160, 11, 0, 0, 3, - 0, 0, 1, 128, 0, 0, - 0, 128, 14, 0, 255, 160, - 10, 0, 0, 3, 0, 0, - 4, 224, 0, 0, 0, 128, - 11, 0, 255, 160, 1, 0, - 0, 2, 0, 0, 3, 224, - 2, 0, 228, 144, 255, 255, - 0, 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 }; diff --git a/src/d3d/shaders/skin_amb_VS.h b/src/d3d/shaders/skin_amb_VS.h index d9d5313..e0a5548 100644 --- a/src/d3d/shaders/skin_amb_VS.h +++ b/src/d3d/shaders/skin_amb_VS.h @@ -8,7 +8,7 @@ // Parameters: // // float4 ambientLight; -// float4x4 boneMatrices[64]; +// float4x3 boneMatrices[64]; // float4x4 combinedMat; // float4 fogData; // float4 matCol; @@ -24,11 +24,11 @@ // surfProps c13 1 // fogData c14 1 // ambientLight c15 1 -// boneMatrices c41 256 +// boneMatrices c41 192 // vs_2_0 - def c4, 4, 0, 1, 0 + def c4, 3, 0, 1, 0 dcl_position v0 dcl_texcoord v1 dcl_color v2 @@ -42,27 +42,23 @@ mul oD0, r0, c12 mul r0, v4, c4.x mova a0.x, r0.y - mul r1.xyz, v0.y, c42[a0.x] - mad r1.xyz, c41[a0.x], v0.x, r1 - mad r1.xyz, c43[a0.x], v0.z, r1 - mad r1.xyz, c44[a0.x], v0.w, r1 + dp4 r1.x, v0, c41[a0.x] + dp4 r1.y, v0, c42[a0.x] + dp4 r1.z, v0, c43[a0.x] mul r1.xyz, r1, v3.y mova a0.x, r0.x - mul r2.xyz, v0.y, c42[a0.x] - mad r2.xyz, c41[a0.x], v0.x, r2 - mad r2.xyz, c43[a0.x], v0.z, r2 - mad r2.xyz, c44[a0.x], v0.w, r2 + dp4 r2.x, v0, c41[a0.x] + dp4 r2.y, v0, c42[a0.x] + dp4 r2.z, v0, c43[a0.x] mad r1.xyz, r2, v3.x, r1 mova a0.xy, r0.zwzw - mul r0.xyz, v0.y, c42[a0.x] - mad r0.xyz, c41[a0.x], v0.x, r0 - mad r0.xyz, c43[a0.x], v0.z, r0 - mad r0.xyz, c44[a0.x], v0.w, r0 + dp4 r0.x, v0, c41[a0.x] + dp4 r0.y, v0, c42[a0.x] + dp4 r0.z, v0, c43[a0.x] mad r0.xyz, r0, v3.z, r1 - mul r1.xyz, v0.y, c42[a0.y] - mad r1.xyz, c41[a0.y], v0.x, r1 - mad r1.xyz, c43[a0.y], v0.z, r1 - mad r1.xyz, c44[a0.y], v0.w, r1 + dp4 r1.x, v0, c41[a0.y] + dp4 r1.y, v0, c42[a0.y] + dp4 r1.z, v0, c43[a0.y] mad r0.xyz, r1, v3.w, r0 mul r1, r0.y, c1 mad r1, c0, r0.x, r1 @@ -75,7 +71,7 @@ min oT0.z, r0.x, c4.z mov oT0.xy, v1 -// approximately 40 instruction slots used +// approximately 36 instruction slots used #endif const BYTE g_vs20_main[] = @@ -91,7 +87,7 @@ const BYTE g_vs20_main[] = 1, 0, 62, 0, 164, 0, 0, 0, 0, 0, 0, 0, 180, 0, 0, 0, 2, 0, - 41, 0, 0, 1, 166, 0, + 41, 0, 192, 0, 166, 0, 196, 0, 0, 0, 0, 0, 0, 0, 212, 0, 0, 0, 2, 0, 0, 0, 4, 0, @@ -115,7 +111,7 @@ const BYTE g_vs20_main[] = 98, 111, 110, 101, 77, 97, 116, 114, 105, 99, 101, 115, 0, 171, 171, 171, 3, 0, - 3, 0, 4, 0, 4, 0, + 3, 0, 4, 0, 3, 0, 64, 0, 0, 0, 0, 0, 0, 0, 99, 111, 109, 98, 105, 110, 101, 100, 77, 97, @@ -137,7 +133,7 @@ const BYTE g_vs20_main[] = 57, 53, 50, 46, 51, 49, 49, 49, 0, 171, 171, 171, 81, 0, 0, 5, 4, 0, - 15, 160, 0, 0, 128, 64, + 15, 160, 0, 0, 64, 64, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 31, 0, 0, 2, 0, 0, @@ -170,110 +166,88 @@ const BYTE g_vs20_main[] = 228, 144, 4, 0, 0, 160, 46, 0, 0, 2, 0, 0, 1, 176, 0, 0, 85, 128, - 5, 0, 0, 4, 1, 0, - 7, 128, 0, 0, 85, 144, + 9, 0, 0, 4, 1, 0, + 1, 128, 0, 0, 228, 144, + 41, 32, 228, 160, 0, 0, + 0, 176, 9, 0, 0, 4, + 1, 0, 2, 128, 0, 0, + 228, 144, 42, 32, 228, 160, + 0, 0, 0, 176, 9, 0, + 0, 4, 1, 0, 4, 128, + 0, 0, 228, 144, 43, 32, + 228, 160, 0, 0, 0, 176, + 5, 0, 0, 3, 1, 0, + 7, 128, 1, 0, 228, 128, + 3, 0, 85, 144, 46, 0, + 0, 2, 0, 0, 1, 176, + 0, 0, 0, 128, 9, 0, + 0, 4, 2, 0, 1, 128, + 0, 0, 228, 144, 41, 32, + 228, 160, 0, 0, 0, 176, + 9, 0, 0, 4, 2, 0, + 2, 128, 0, 0, 228, 144, 42, 32, 228, 160, 0, 0, - 0, 176, 4, 0, 0, 5, - 1, 0, 7, 128, 41, 32, - 228, 160, 0, 0, 0, 176, - 0, 0, 0, 144, 1, 0, - 228, 128, 4, 0, 0, 5, - 1, 0, 7, 128, 43, 32, - 228, 160, 0, 0, 0, 176, - 0, 0, 170, 144, 1, 0, - 228, 128, 4, 0, 0, 5, - 1, 0, 7, 128, 44, 32, - 228, 160, 0, 0, 0, 176, - 0, 0, 255, 144, 1, 0, - 228, 128, 5, 0, 0, 3, - 1, 0, 7, 128, 1, 0, - 228, 128, 3, 0, 85, 144, + 0, 176, 9, 0, 0, 4, + 2, 0, 4, 128, 0, 0, + 228, 144, 43, 32, 228, 160, + 0, 0, 0, 176, 4, 0, + 0, 4, 1, 0, 7, 128, + 2, 0, 228, 128, 3, 0, + 0, 144, 1, 0, 228, 128, 46, 0, 0, 2, 0, 0, - 1, 176, 0, 0, 0, 128, - 5, 0, 0, 4, 2, 0, - 7, 128, 0, 0, 85, 144, - 42, 32, 228, 160, 0, 0, - 0, 176, 4, 0, 0, 5, - 2, 0, 7, 128, 41, 32, + 3, 176, 0, 0, 238, 128, + 9, 0, 0, 4, 0, 0, + 1, 128, 0, 0, 228, 144, + 41, 32, 228, 160, 0, 0, + 0, 176, 9, 0, 0, 4, + 0, 0, 2, 128, 0, 0, + 228, 144, 42, 32, 228, 160, + 0, 0, 0, 176, 9, 0, + 0, 4, 0, 0, 4, 128, + 0, 0, 228, 144, 43, 32, 228, 160, 0, 0, 0, 176, - 0, 0, 0, 144, 2, 0, - 228, 128, 4, 0, 0, 5, - 2, 0, 7, 128, 43, 32, - 228, 160, 0, 0, 0, 176, - 0, 0, 170, 144, 2, 0, - 228, 128, 4, 0, 0, 5, - 2, 0, 7, 128, 44, 32, - 228, 160, 0, 0, 0, 176, - 0, 0, 255, 144, 2, 0, - 228, 128, 4, 0, 0, 4, - 1, 0, 7, 128, 2, 0, - 228, 128, 3, 0, 0, 144, - 1, 0, 228, 128, 46, 0, - 0, 2, 0, 0, 3, 176, - 0, 0, 238, 128, 5, 0, - 0, 4, 0, 0, 7, 128, - 0, 0, 85, 144, 42, 32, - 228, 160, 0, 0, 0, 176, - 4, 0, 0, 5, 0, 0, - 7, 128, 41, 32, 228, 160, - 0, 0, 0, 176, 0, 0, - 0, 144, 0, 0, 228, 128, - 4, 0, 0, 5, 0, 0, - 7, 128, 43, 32, 228, 160, - 0, 0, 0, 176, 0, 0, - 170, 144, 0, 0, 228, 128, - 4, 0, 0, 5, 0, 0, - 7, 128, 44, 32, 228, 160, - 0, 0, 0, 176, 0, 0, - 255, 144, 0, 0, 228, 128, 4, 0, 0, 4, 0, 0, 7, 128, 0, 0, 228, 128, 3, 0, 170, 144, 1, 0, - 228, 128, 5, 0, 0, 4, - 1, 0, 7, 128, 0, 0, - 85, 144, 42, 32, 228, 160, - 0, 0, 85, 176, 4, 0, - 0, 5, 1, 0, 7, 128, - 41, 32, 228, 160, 0, 0, - 85, 176, 0, 0, 0, 144, - 1, 0, 228, 128, 4, 0, - 0, 5, 1, 0, 7, 128, + 228, 128, 9, 0, 0, 4, + 1, 0, 1, 128, 0, 0, + 228, 144, 41, 32, 228, 160, + 0, 0, 85, 176, 9, 0, + 0, 4, 1, 0, 2, 128, + 0, 0, 228, 144, 42, 32, + 228, 160, 0, 0, 85, 176, + 9, 0, 0, 4, 1, 0, + 4, 128, 0, 0, 228, 144, 43, 32, 228, 160, 0, 0, - 85, 176, 0, 0, 170, 144, - 1, 0, 228, 128, 4, 0, - 0, 5, 1, 0, 7, 128, - 44, 32, 228, 160, 0, 0, - 85, 176, 0, 0, 255, 144, - 1, 0, 228, 128, 4, 0, - 0, 4, 0, 0, 7, 128, - 1, 0, 228, 128, 3, 0, - 255, 144, 0, 0, 228, 128, - 5, 0, 0, 3, 1, 0, - 15, 128, 0, 0, 85, 128, - 1, 0, 228, 160, 4, 0, - 0, 4, 1, 0, 15, 128, - 0, 0, 228, 160, 0, 0, - 0, 128, 1, 0, 228, 128, - 4, 0, 0, 4, 0, 0, - 15, 128, 2, 0, 228, 160, - 0, 0, 170, 128, 1, 0, - 228, 128, 2, 0, 0, 3, - 0, 0, 15, 128, 0, 0, - 228, 128, 3, 0, 228, 160, - 2, 0, 0, 3, 1, 0, - 1, 128, 0, 0, 255, 128, - 14, 0, 85, 161, 1, 0, - 0, 2, 0, 0, 15, 192, + 85, 176, 4, 0, 0, 4, + 0, 0, 7, 128, 1, 0, + 228, 128, 3, 0, 255, 144, 0, 0, 228, 128, 5, 0, - 0, 3, 0, 0, 1, 128, - 1, 0, 0, 128, 14, 0, - 170, 160, 11, 0, 0, 3, - 0, 0, 1, 128, 0, 0, - 0, 128, 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, - 1, 0, 228, 144, 255, 255, - 0, 0 + 0, 3, 1, 0, 15, 128, + 0, 0, 85, 128, 1, 0, + 228, 160, 4, 0, 0, 4, + 1, 0, 15, 128, 0, 0, + 228, 160, 0, 0, 0, 128, + 1, 0, 228, 128, 4, 0, + 0, 4, 0, 0, 15, 128, + 2, 0, 228, 160, 0, 0, + 170, 128, 1, 0, 228, 128, + 2, 0, 0, 3, 0, 0, + 15, 128, 0, 0, 228, 128, + 3, 0, 228, 160, 2, 0, + 0, 3, 1, 0, 1, 128, + 0, 0, 255, 128, 14, 0, + 85, 161, 1, 0, 0, 2, + 0, 0, 15, 192, 0, 0, + 228, 128, 5, 0, 0, 3, + 0, 0, 1, 128, 1, 0, + 0, 128, 14, 0, 170, 160, + 11, 0, 0, 3, 0, 0, + 1, 128, 0, 0, 0, 128, + 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, 1, 0, + 228, 144, 255, 255, 0, 0 }; diff --git a/src/d3d/shaders/skin_amb_dir_VS.h b/src/d3d/shaders/skin_amb_dir_VS.h index 31a2c60..7949749 100644 --- a/src/d3d/shaders/skin_amb_dir_VS.h +++ b/src/d3d/shaders/skin_amb_dir_VS.h @@ -8,7 +8,7 @@ // Parameters: // // float4 ambientLight; -// float4x4 boneMatrices[64]; +// float4x3 boneMatrices[64]; // float4x4 combinedMat; // int4 firstLight; // float4 fogData; @@ -40,11 +40,11 @@ // ambientLight c15 1 // firstLight c16 1 // lights c17 24 -// boneMatrices c41 256 +// boneMatrices c41 192 // vs_2_0 - def c4, 4, 0, 3, 1 + def c4, 3, 0, 1, 0 dcl_position v0 dcl_normal v1 dcl_texcoord v2 @@ -53,32 +53,32 @@ dcl_blendindices v5 mul r0, v5, c4.x mova a0.w, r0.x - mul r1.xyz, v1.y, c42[a0.w] + dp3 r1.z, v1, c43[a0.w] mova a0.w, r0.x - mad r1.xyz, c41[a0.w], v1.x, r1 + dp3 r1.x, v1, c41[a0.w] mova a0.w, r0.x - mad r1.xyz, c43[a0.w], v1.z, r1 + dp3 r1.y, v1, c42[a0.w] mova a0.w, r0.y - mul r2.xyz, v1.y, c42[a0.w] + dp3 r2.z, v1, c43[a0.w] mova a0.w, r0.y - mad r2.xyz, c41[a0.w], v1.x, r2 + dp3 r2.x, v1, c41[a0.w] mova a0.w, r0.y - mad r2.xyz, c43[a0.w], v1.z, r2 + dp3 r2.y, v1, c42[a0.w] mul r2.xyz, r2, v4.y mad r1.xyz, r1, v4.x, r2 mova a0.w, r0.z - mul r2.xyz, v1.y, c42[a0.w] + dp3 r2.z, v1, c43[a0.w] mova a0.w, r0.z - mad r2.xyz, c41[a0.w], v1.x, r2 + dp3 r2.x, v1, c41[a0.w] mova a0.w, r0.z - mad r2.xyz, c43[a0.w], v1.z, r2 + dp3 r2.y, v1, c42[a0.w] mad r1.xyz, r2, v4.z, r1 mova a0.w, r0.w - mul r2.xyz, v1.y, c42[a0.w] + dp3 r2.z, v1, c43[a0.w] mova a0.w, r0.w - mad r2.xyz, c41[a0.w], v1.x, r2 + dp3 r2.x, v1, c41[a0.w] mova a0.w, r0.w - mad r2.xyz, c43[a0.w], v1.z, r2 + dp3 r2.y, v1, c42[a0.w] mad r1.xyz, r2, v4.w, r1 mul r2.xyz, r1.y, c9 mad r1.xyw, c8.xyzz, r1.x, r2.xyzz @@ -89,54 +89,46 @@ mov r1.w, c4.y rep i0 add r2.w, r1.w, c16.x - mul r2.w, r2.w, c4.z + mul r2.w, r2.w, c4.x mova a0.w, r2.w dp3 r4.x, r1, -c19[a0.w] max r4.x, r4.x, c4.y mova a0.w, r2.w mul r4.xyz, r4.x, c17[a0.w] mad r3.xyz, r4, c13.z, r3 - add r1.w, r1.w, c4.w + add r1.w, r1.w, c4.z endrep mov r3.w, v3.w max r1, r3, c4.y - min r1, r1, c4.w + min r1, r1, c4.z mul oD0, r1, c12 mova a0.w, r0.y - mul r1.xyz, v0.y, c42[a0.w] + dp4 r1.x, v0, c41[a0.w] mova a0.w, r0.y - mad r1.xyz, c41[a0.w], v0.x, r1 + dp4 r1.y, v0, c42[a0.w] mova a0.w, r0.y - mad r1.xyz, c43[a0.w], v0.z, r1 - mova a0.w, r0.y - mad r1.xyz, c44[a0.w], v0.w, r1 + dp4 r1.z, v0, c43[a0.w] mul r1.xyz, r1, v4.y mova a0.w, r0.x - mul r2.xyz, v0.y, c42[a0.w] + dp4 r2.x, v0, c41[a0.w] mova a0.w, r0.x - mad r2.xyz, c41[a0.w], v0.x, r2 + dp4 r2.y, v0, c42[a0.w] mova a0.w, r0.x - mad r2.xyz, c43[a0.w], v0.z, r2 - mova a0.w, r0.x - mad r2.xyz, c44[a0.w], v0.w, r2 + dp4 r2.z, v0, c43[a0.w] mad r1.xyz, r2, v4.x, r1 mova a0.w, r0.z - mul r2.xyz, v0.y, c42[a0.w] + dp4 r2.x, v0, c41[a0.w] mova a0.w, r0.z - mad r2.xyz, c41[a0.w], v0.x, r2 + dp4 r2.y, v0, c42[a0.w] mova a0.w, r0.z - mad r2.xyz, c43[a0.w], v0.z, r2 - mova a0.w, r0.z - mad r0.xyz, c44[a0.w], v0.w, r2 - mad r0.xyz, r0, v4.z, r1 + dp4 r2.z, v0, c43[a0.w] + mad r0.xyz, r2, v4.z, r1 mova a0.w, r0.w - mul r1.xyz, v0.y, c42[a0.w] + dp4 r1.x, v0, c41[a0.w] mova a0.w, r0.w - mad r1.xyz, c41[a0.w], v0.x, r1 + dp4 r1.y, v0, c42[a0.w] mova a0.w, r0.w - mad r1.xyz, c43[a0.w], v0.z, r1 - mova a0.w, r0.w - mad r1.xyz, c44[a0.w], v0.w, r1 + dp4 r1.z, v0, c43[a0.w] mad r0.xyz, r1, v4.w, r0 mul r1, r0.y, c1 mad r1, c0, r0.x, r1 @@ -146,10 +138,10 @@ add r0.x, r0.w, -c14.y mul r0.x, r0.x, c14.z max r0.x, r0.x, c14.w - min oT0.z, r0.x, c4.w + min oT0.z, r0.x, c4.z mov oT0.xy, v2 -// approximately 100 instruction slots used +// approximately 92 instruction slots used #endif const BYTE g_vs20_main[] = @@ -165,7 +157,7 @@ const BYTE g_vs20_main[] = 1, 0, 62, 0, 244, 0, 0, 0, 0, 0, 0, 0, 4, 1, 0, 0, 2, 0, - 41, 0, 0, 1, 166, 0, + 41, 0, 192, 0, 166, 0, 20, 1, 0, 0, 0, 0, 0, 0, 36, 1, 0, 0, 2, 0, 0, 0, 4, 0, @@ -203,7 +195,7 @@ const BYTE g_vs20_main[] = 77, 97, 116, 114, 105, 99, 101, 115, 0, 171, 171, 171, 3, 0, 3, 0, 4, 0, - 4, 0, 64, 0, 0, 0, + 3, 0, 64, 0, 0, 0, 0, 0, 0, 0, 99, 111, 109, 98, 105, 110, 101, 100, 77, 97, 116, 0, 3, 0, @@ -255,9 +247,9 @@ const BYTE g_vs20_main[] = 46, 51, 49, 49, 49, 0, 171, 171, 81, 0, 0, 5, 4, 0, 15, 160, 0, 0, - 128, 64, 0, 0, 0, 0, - 0, 0, 64, 64, 0, 0, - 128, 63, 31, 0, 0, 2, + 64, 64, 0, 0, 0, 0, + 0, 0, 128, 63, 0, 0, + 0, 0, 31, 0, 0, 2, 0, 0, 0, 128, 0, 0, 15, 144, 31, 0, 0, 2, 3, 0, 0, 128, 1, 0, @@ -274,273 +266,238 @@ const BYTE g_vs20_main[] = 228, 144, 4, 0, 0, 160, 46, 0, 0, 2, 0, 0, 8, 176, 0, 0, 0, 128, - 5, 0, 0, 4, 1, 0, - 7, 128, 1, 0, 85, 144, - 42, 32, 228, 160, 0, 0, + 8, 0, 0, 4, 1, 0, + 4, 128, 1, 0, 228, 144, + 43, 32, 228, 160, 0, 0, 255, 176, 46, 0, 0, 2, 0, 0, 8, 176, 0, 0, - 0, 128, 4, 0, 0, 5, - 1, 0, 7, 128, 41, 32, - 228, 160, 0, 0, 255, 176, - 1, 0, 0, 144, 1, 0, - 228, 128, 46, 0, 0, 2, - 0, 0, 8, 176, 0, 0, - 0, 128, 4, 0, 0, 5, - 1, 0, 7, 128, 43, 32, - 228, 160, 0, 0, 255, 176, - 1, 0, 170, 144, 1, 0, - 228, 128, 46, 0, 0, 2, - 0, 0, 8, 176, 0, 0, - 85, 128, 5, 0, 0, 4, - 2, 0, 7, 128, 1, 0, - 85, 144, 42, 32, 228, 160, + 0, 128, 8, 0, 0, 4, + 1, 0, 1, 128, 1, 0, + 228, 144, 41, 32, 228, 160, 0, 0, 255, 176, 46, 0, 0, 2, 0, 0, 8, 176, - 0, 0, 85, 128, 4, 0, - 0, 5, 2, 0, 7, 128, - 41, 32, 228, 160, 0, 0, - 255, 176, 1, 0, 0, 144, - 2, 0, 228, 128, 46, 0, - 0, 2, 0, 0, 8, 176, - 0, 0, 85, 128, 4, 0, - 0, 5, 2, 0, 7, 128, - 43, 32, 228, 160, 0, 0, - 255, 176, 1, 0, 170, 144, - 2, 0, 228, 128, 5, 0, - 0, 3, 2, 0, 7, 128, - 2, 0, 228, 128, 4, 0, - 85, 144, 4, 0, 0, 4, - 1, 0, 7, 128, 1, 0, - 228, 128, 4, 0, 0, 144, - 2, 0, 228, 128, 46, 0, - 0, 2, 0, 0, 8, 176, - 0, 0, 170, 128, 5, 0, - 0, 4, 2, 0, 7, 128, - 1, 0, 85, 144, 42, 32, + 0, 0, 0, 128, 8, 0, + 0, 4, 1, 0, 2, 128, + 1, 0, 228, 144, 42, 32, 228, 160, 0, 0, 255, 176, 46, 0, 0, 2, 0, 0, - 8, 176, 0, 0, 170, 128, - 4, 0, 0, 5, 2, 0, - 7, 128, 41, 32, 228, 160, - 0, 0, 255, 176, 1, 0, + 8, 176, 0, 0, 85, 128, + 8, 0, 0, 4, 2, 0, + 4, 128, 1, 0, 228, 144, + 43, 32, 228, 160, 0, 0, + 255, 176, 46, 0, 0, 2, + 0, 0, 8, 176, 0, 0, + 85, 128, 8, 0, 0, 4, + 2, 0, 1, 128, 1, 0, + 228, 144, 41, 32, 228, 160, + 0, 0, 255, 176, 46, 0, + 0, 2, 0, 0, 8, 176, + 0, 0, 85, 128, 8, 0, + 0, 4, 2, 0, 2, 128, + 1, 0, 228, 144, 42, 32, + 228, 160, 0, 0, 255, 176, + 5, 0, 0, 3, 2, 0, + 7, 128, 2, 0, 228, 128, + 4, 0, 85, 144, 4, 0, + 0, 4, 1, 0, 7, 128, + 1, 0, 228, 128, 4, 0, 0, 144, 2, 0, 228, 128, 46, 0, 0, 2, 0, 0, 8, 176, 0, 0, 170, 128, - 4, 0, 0, 5, 2, 0, - 7, 128, 43, 32, 228, 160, - 0, 0, 255, 176, 1, 0, - 170, 144, 2, 0, 228, 128, + 8, 0, 0, 4, 2, 0, + 4, 128, 1, 0, 228, 144, + 43, 32, 228, 160, 0, 0, + 255, 176, 46, 0, 0, 2, + 0, 0, 8, 176, 0, 0, + 170, 128, 8, 0, 0, 4, + 2, 0, 1, 128, 1, 0, + 228, 144, 41, 32, 228, 160, + 0, 0, 255, 176, 46, 0, + 0, 2, 0, 0, 8, 176, + 0, 0, 170, 128, 8, 0, + 0, 4, 2, 0, 2, 128, + 1, 0, 228, 144, 42, 32, + 228, 160, 0, 0, 255, 176, 4, 0, 0, 4, 1, 0, 7, 128, 2, 0, 228, 128, 4, 0, 170, 144, 1, 0, 228, 128, 46, 0, 0, 2, 0, 0, 8, 176, 0, 0, - 255, 128, 5, 0, 0, 4, - 2, 0, 7, 128, 1, 0, - 85, 144, 42, 32, 228, 160, - 0, 0, 255, 176, 46, 0, - 0, 2, 0, 0, 8, 176, - 0, 0, 255, 128, 4, 0, - 0, 5, 2, 0, 7, 128, - 41, 32, 228, 160, 0, 0, - 255, 176, 1, 0, 0, 144, - 2, 0, 228, 128, 46, 0, - 0, 2, 0, 0, 8, 176, - 0, 0, 255, 128, 4, 0, - 0, 5, 2, 0, 7, 128, - 43, 32, 228, 160, 0, 0, - 255, 176, 1, 0, 170, 144, - 2, 0, 228, 128, 4, 0, - 0, 4, 1, 0, 7, 128, - 2, 0, 228, 128, 4, 0, - 255, 144, 1, 0, 228, 128, - 5, 0, 0, 3, 2, 0, - 7, 128, 1, 0, 85, 128, - 9, 0, 228, 160, 4, 0, - 0, 4, 1, 0, 11, 128, - 8, 0, 164, 160, 1, 0, - 0, 128, 2, 0, 164, 128, - 4, 0, 0, 4, 1, 0, - 7, 128, 10, 0, 228, 160, - 1, 0, 170, 128, 1, 0, - 244, 128, 1, 0, 0, 2, - 2, 0, 1, 128, 13, 0, - 0, 160, 4, 0, 0, 4, - 2, 0, 7, 128, 15, 0, - 228, 160, 2, 0, 0, 128, - 3, 0, 228, 144, 1, 0, - 0, 2, 3, 0, 7, 128, - 2, 0, 228, 128, 1, 0, - 0, 2, 1, 0, 8, 128, - 4, 0, 85, 160, 38, 0, - 0, 1, 0, 0, 228, 240, - 2, 0, 0, 3, 2, 0, - 8, 128, 1, 0, 255, 128, - 16, 0, 0, 160, 5, 0, - 0, 3, 2, 0, 8, 128, - 2, 0, 255, 128, 4, 0, - 170, 160, 46, 0, 0, 2, - 0, 0, 8, 176, 2, 0, 255, 128, 8, 0, 0, 4, - 4, 0, 1, 128, 1, 0, - 228, 128, 19, 32, 228, 161, - 0, 0, 255, 176, 11, 0, - 0, 3, 4, 0, 1, 128, - 4, 0, 0, 128, 4, 0, - 85, 160, 46, 0, 0, 2, - 0, 0, 8, 176, 2, 0, - 255, 128, 5, 0, 0, 4, - 4, 0, 7, 128, 4, 0, - 0, 128, 17, 32, 228, 160, - 0, 0, 255, 176, 4, 0, - 0, 4, 3, 0, 7, 128, - 4, 0, 228, 128, 13, 0, - 170, 160, 3, 0, 228, 128, - 2, 0, 0, 3, 1, 0, - 8, 128, 1, 0, 255, 128, - 4, 0, 255, 160, 39, 0, - 0, 0, 1, 0, 0, 2, - 3, 0, 8, 128, 3, 0, - 255, 144, 11, 0, 0, 3, - 1, 0, 15, 128, 3, 0, - 228, 128, 4, 0, 85, 160, - 10, 0, 0, 3, 1, 0, - 15, 128, 1, 0, 228, 128, - 4, 0, 255, 160, 5, 0, - 0, 3, 0, 0, 15, 208, - 1, 0, 228, 128, 12, 0, - 228, 160, 46, 0, 0, 2, - 0, 0, 8, 176, 0, 0, - 85, 128, 5, 0, 0, 4, - 1, 0, 7, 128, 0, 0, - 85, 144, 42, 32, 228, 160, + 2, 0, 4, 128, 1, 0, + 228, 144, 43, 32, 228, 160, 0, 0, 255, 176, 46, 0, 0, 2, 0, 0, 8, 176, - 0, 0, 85, 128, 4, 0, - 0, 5, 1, 0, 7, 128, - 41, 32, 228, 160, 0, 0, - 255, 176, 0, 0, 0, 144, - 1, 0, 228, 128, 46, 0, - 0, 2, 0, 0, 8, 176, - 0, 0, 85, 128, 4, 0, - 0, 5, 1, 0, 7, 128, - 43, 32, 228, 160, 0, 0, - 255, 176, 0, 0, 170, 144, - 1, 0, 228, 128, 46, 0, - 0, 2, 0, 0, 8, 176, - 0, 0, 85, 128, 4, 0, - 0, 5, 1, 0, 7, 128, - 44, 32, 228, 160, 0, 0, - 255, 176, 0, 0, 255, 144, + 0, 0, 255, 128, 8, 0, + 0, 4, 2, 0, 1, 128, + 1, 0, 228, 144, 41, 32, + 228, 160, 0, 0, 255, 176, + 46, 0, 0, 2, 0, 0, + 8, 176, 0, 0, 255, 128, + 8, 0, 0, 4, 2, 0, + 2, 128, 1, 0, 228, 144, + 42, 32, 228, 160, 0, 0, + 255, 176, 4, 0, 0, 4, + 1, 0, 7, 128, 2, 0, + 228, 128, 4, 0, 255, 144, 1, 0, 228, 128, 5, 0, - 0, 3, 1, 0, 7, 128, + 0, 3, 2, 0, 7, 128, + 1, 0, 85, 128, 9, 0, + 228, 160, 4, 0, 0, 4, + 1, 0, 11, 128, 8, 0, + 164, 160, 1, 0, 0, 128, + 2, 0, 164, 128, 4, 0, + 0, 4, 1, 0, 7, 128, + 10, 0, 228, 160, 1, 0, + 170, 128, 1, 0, 244, 128, + 1, 0, 0, 2, 2, 0, + 1, 128, 13, 0, 0, 160, + 4, 0, 0, 4, 2, 0, + 7, 128, 15, 0, 228, 160, + 2, 0, 0, 128, 3, 0, + 228, 144, 1, 0, 0, 2, + 3, 0, 7, 128, 2, 0, + 228, 128, 1, 0, 0, 2, + 1, 0, 8, 128, 4, 0, + 85, 160, 38, 0, 0, 1, + 0, 0, 228, 240, 2, 0, + 0, 3, 2, 0, 8, 128, + 1, 0, 255, 128, 16, 0, + 0, 160, 5, 0, 0, 3, + 2, 0, 8, 128, 2, 0, + 255, 128, 4, 0, 0, 160, + 46, 0, 0, 2, 0, 0, + 8, 176, 2, 0, 255, 128, + 8, 0, 0, 4, 4, 0, + 1, 128, 1, 0, 228, 128, + 19, 32, 228, 161, 0, 0, + 255, 176, 11, 0, 0, 3, + 4, 0, 1, 128, 4, 0, + 0, 128, 4, 0, 85, 160, + 46, 0, 0, 2, 0, 0, + 8, 176, 2, 0, 255, 128, + 5, 0, 0, 4, 4, 0, + 7, 128, 4, 0, 0, 128, + 17, 32, 228, 160, 0, 0, + 255, 176, 4, 0, 0, 4, + 3, 0, 7, 128, 4, 0, + 228, 128, 13, 0, 170, 160, + 3, 0, 228, 128, 2, 0, + 0, 3, 1, 0, 8, 128, + 1, 0, 255, 128, 4, 0, + 170, 160, 39, 0, 0, 0, + 1, 0, 0, 2, 3, 0, + 8, 128, 3, 0, 255, 144, + 11, 0, 0, 3, 1, 0, + 15, 128, 3, 0, 228, 128, + 4, 0, 85, 160, 10, 0, + 0, 3, 1, 0, 15, 128, 1, 0, 228, 128, 4, 0, - 85, 144, 46, 0, 0, 2, + 170, 160, 5, 0, 0, 3, + 0, 0, 15, 208, 1, 0, + 228, 128, 12, 0, 228, 160, + 46, 0, 0, 2, 0, 0, + 8, 176, 0, 0, 85, 128, + 9, 0, 0, 4, 1, 0, + 1, 128, 0, 0, 228, 144, + 41, 32, 228, 160, 0, 0, + 255, 176, 46, 0, 0, 2, 0, 0, 8, 176, 0, 0, - 0, 128, 5, 0, 0, 4, - 2, 0, 7, 128, 0, 0, - 85, 144, 42, 32, 228, 160, + 85, 128, 9, 0, 0, 4, + 1, 0, 2, 128, 0, 0, + 228, 144, 42, 32, 228, 160, 0, 0, 255, 176, 46, 0, 0, 2, 0, 0, 8, 176, - 0, 0, 0, 128, 4, 0, - 0, 5, 2, 0, 7, 128, - 41, 32, 228, 160, 0, 0, - 255, 176, 0, 0, 0, 144, - 2, 0, 228, 128, 46, 0, + 0, 0, 85, 128, 9, 0, + 0, 4, 1, 0, 4, 128, + 0, 0, 228, 144, 43, 32, + 228, 160, 0, 0, 255, 176, + 5, 0, 0, 3, 1, 0, + 7, 128, 1, 0, 228, 128, + 4, 0, 85, 144, 46, 0, 0, 2, 0, 0, 8, 176, - 0, 0, 0, 128, 4, 0, - 0, 5, 2, 0, 7, 128, - 43, 32, 228, 160, 0, 0, - 255, 176, 0, 0, 170, 144, - 2, 0, 228, 128, 46, 0, - 0, 2, 0, 0, 8, 176, - 0, 0, 0, 128, 4, 0, - 0, 5, 2, 0, 7, 128, - 44, 32, 228, 160, 0, 0, - 255, 176, 0, 0, 255, 144, - 2, 0, 228, 128, 4, 0, + 0, 0, 0, 128, 9, 0, + 0, 4, 2, 0, 1, 128, + 0, 0, 228, 144, 41, 32, + 228, 160, 0, 0, 255, 176, + 46, 0, 0, 2, 0, 0, + 8, 176, 0, 0, 0, 128, + 9, 0, 0, 4, 2, 0, + 2, 128, 0, 0, 228, 144, + 42, 32, 228, 160, 0, 0, + 255, 176, 46, 0, 0, 2, + 0, 0, 8, 176, 0, 0, + 0, 128, 9, 0, 0, 4, + 2, 0, 4, 128, 0, 0, + 228, 144, 43, 32, 228, 160, + 0, 0, 255, 176, 4, 0, 0, 4, 1, 0, 7, 128, 2, 0, 228, 128, 4, 0, 0, 144, 1, 0, 228, 128, 46, 0, 0, 2, 0, 0, 8, 176, 0, 0, 170, 128, - 5, 0, 0, 4, 2, 0, - 7, 128, 0, 0, 85, 144, - 42, 32, 228, 160, 0, 0, + 9, 0, 0, 4, 2, 0, + 1, 128, 0, 0, 228, 144, + 41, 32, 228, 160, 0, 0, 255, 176, 46, 0, 0, 2, 0, 0, 8, 176, 0, 0, - 170, 128, 4, 0, 0, 5, - 2, 0, 7, 128, 41, 32, - 228, 160, 0, 0, 255, 176, - 0, 0, 0, 144, 2, 0, - 228, 128, 46, 0, 0, 2, - 0, 0, 8, 176, 0, 0, - 170, 128, 4, 0, 0, 5, - 2, 0, 7, 128, 43, 32, - 228, 160, 0, 0, 255, 176, - 0, 0, 170, 144, 2, 0, - 228, 128, 46, 0, 0, 2, - 0, 0, 8, 176, 0, 0, - 170, 128, 4, 0, 0, 5, - 0, 0, 7, 128, 44, 32, - 228, 160, 0, 0, 255, 176, - 0, 0, 255, 144, 2, 0, - 228, 128, 4, 0, 0, 4, - 0, 0, 7, 128, 0, 0, - 228, 128, 4, 0, 170, 144, - 1, 0, 228, 128, 46, 0, + 170, 128, 9, 0, 0, 4, + 2, 0, 2, 128, 0, 0, + 228, 144, 42, 32, 228, 160, + 0, 0, 255, 176, 46, 0, 0, 2, 0, 0, 8, 176, - 0, 0, 255, 128, 5, 0, - 0, 4, 1, 0, 7, 128, - 0, 0, 85, 144, 42, 32, + 0, 0, 170, 128, 9, 0, + 0, 4, 2, 0, 4, 128, + 0, 0, 228, 144, 43, 32, + 228, 160, 0, 0, 255, 176, + 4, 0, 0, 4, 0, 0, + 7, 128, 2, 0, 228, 128, + 4, 0, 170, 144, 1, 0, + 228, 128, 46, 0, 0, 2, + 0, 0, 8, 176, 0, 0, + 255, 128, 9, 0, 0, 4, + 1, 0, 1, 128, 0, 0, + 228, 144, 41, 32, 228, 160, + 0, 0, 255, 176, 46, 0, + 0, 2, 0, 0, 8, 176, + 0, 0, 255, 128, 9, 0, + 0, 4, 1, 0, 2, 128, + 0, 0, 228, 144, 42, 32, 228, 160, 0, 0, 255, 176, 46, 0, 0, 2, 0, 0, 8, 176, 0, 0, 255, 128, - 4, 0, 0, 5, 1, 0, - 7, 128, 41, 32, 228, 160, - 0, 0, 255, 176, 0, 0, - 0, 144, 1, 0, 228, 128, - 46, 0, 0, 2, 0, 0, - 8, 176, 0, 0, 255, 128, - 4, 0, 0, 5, 1, 0, - 7, 128, 43, 32, 228, 160, - 0, 0, 255, 176, 0, 0, - 170, 144, 1, 0, 228, 128, - 46, 0, 0, 2, 0, 0, - 8, 176, 0, 0, 255, 128, - 4, 0, 0, 5, 1, 0, - 7, 128, 44, 32, 228, 160, - 0, 0, 255, 176, 0, 0, - 255, 144, 1, 0, 228, 128, - 4, 0, 0, 4, 0, 0, - 7, 128, 1, 0, 228, 128, - 4, 0, 255, 144, 0, 0, - 228, 128, 5, 0, 0, 3, + 9, 0, 0, 4, 1, 0, + 4, 128, 0, 0, 228, 144, + 43, 32, 228, 160, 0, 0, + 255, 176, 4, 0, 0, 4, + 0, 0, 7, 128, 1, 0, + 228, 128, 4, 0, 255, 144, + 0, 0, 228, 128, 5, 0, + 0, 3, 1, 0, 15, 128, + 0, 0, 85, 128, 1, 0, + 228, 160, 4, 0, 0, 4, 1, 0, 15, 128, 0, 0, - 85, 128, 1, 0, 228, 160, - 4, 0, 0, 4, 1, 0, - 15, 128, 0, 0, 228, 160, - 0, 0, 0, 128, 1, 0, - 228, 128, 4, 0, 0, 4, - 0, 0, 15, 128, 2, 0, - 228, 160, 0, 0, 170, 128, - 1, 0, 228, 128, 2, 0, - 0, 3, 0, 0, 15, 128, - 0, 0, 228, 128, 3, 0, - 228, 160, 1, 0, 0, 2, - 0, 0, 15, 192, 0, 0, - 228, 128, 2, 0, 0, 3, - 0, 0, 1, 128, 0, 0, - 255, 128, 14, 0, 85, 161, - 5, 0, 0, 3, 0, 0, - 1, 128, 0, 0, 0, 128, - 14, 0, 170, 160, 11, 0, + 228, 160, 0, 0, 0, 128, + 1, 0, 228, 128, 4, 0, + 0, 4, 0, 0, 15, 128, + 2, 0, 228, 160, 0, 0, + 170, 128, 1, 0, 228, 128, + 2, 0, 0, 3, 0, 0, + 15, 128, 0, 0, 228, 128, + 3, 0, 228, 160, 1, 0, + 0, 2, 0, 0, 15, 192, + 0, 0, 228, 128, 2, 0, 0, 3, 0, 0, 1, 128, - 0, 0, 0, 128, 14, 0, - 255, 160, 10, 0, 0, 3, - 0, 0, 4, 224, 0, 0, - 0, 128, 4, 0, 255, 160, - 1, 0, 0, 2, 0, 0, - 3, 224, 2, 0, 228, 144, - 255, 255, 0, 0 + 0, 0, 255, 128, 14, 0, + 85, 161, 5, 0, 0, 3, + 0, 0, 1, 128, 0, 0, + 0, 128, 14, 0, 170, 160, + 11, 0, 0, 3, 0, 0, + 1, 128, 0, 0, 0, 128, + 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 }; diff --git a/src/gl/gl3render.cpp b/src/gl/gl3render.cpp index 15f0cff..467d8b1 100644 --- a/src/gl/gl3render.cpp +++ b/src/gl/gl3render.cpp @@ -122,8 +122,6 @@ void defaultRenderCB(Atomic *atomic, InstanceDataHeader *header) { Material *m; - RGBAf col; - GLfloat surfProps[4]; setWorldMatrix(atomic->getFrame()->getLTM()); lightingCB(atomic); diff --git a/src/gl/rwgl3plg.h b/src/gl/rwgl3plg.h index 75ace8e..5374b3e 100644 --- a/src/gl/rwgl3plg.h +++ b/src/gl/rwgl3plg.h @@ -1,13 +1,16 @@ namespace rw { namespace gl3 { +void initMatFX(void); +ObjPipeline *makeMatFXPipeline(void); void matfxRenderCB(Atomic *atomic, InstanceDataHeader *header); -ObjPipeline *makeSkinPipeline(void); -ObjPipeline *makeMatFXPipeline(void); - -void initMatFX(void); void initSkin(void); +ObjPipeline *makeSkinPipeline(void); +void skinInstanceCB(Geometry *geo, InstanceDataHeader *header, bool32 reinstance); +void skinRenderCB(Atomic *atomic, InstanceDataHeader *header); +void uploadSkinMatrices(Atomic *atomic); + } } diff --git a/src/gl/shaders/default.vert b/src/gl/shaders/default.vert index 0fde135..edd3ac6 100644 --- a/src/gl/shaders/default.vert +++ b/src/gl/shaders/default.vert @@ -10,15 +10,15 @@ out float v_fog; void main(void) { - vec4 V = u_world * vec4(in_pos, 1.0); - gl_Position = u_proj * u_view * V; - vec3 N = mat3(u_world) * in_normal; + vec4 Vertex = u_world * vec4(in_pos, 1.0); + gl_Position = u_proj * u_view * Vertex; + vec3 Normal = mat3(u_world) * in_normal; v_tex0 = in_tex0; v_color = in_color; v_color.rgb += u_ambLight.rgb*surfAmbient; - v_color.rgb += DoDynamicLight(V.xyz, N)*surfDiffuse; + v_color.rgb += DoDynamicLight(Vertex.xyz, Normal)*surfDiffuse; v_color = clamp(v_color, 0.0, 1.0); v_color *= u_matColor; diff --git a/src/gl/shaders/default_vs_gl3.inc b/src/gl/shaders/default_vs_gl3.inc index e95c5e8..098ec0a 100644 --- a/src/gl/shaders/default_vs_gl3.inc +++ b/src/gl/shaders/default_vs_gl3.inc @@ -11,15 +11,15 @@ const char *default_vert_src = "void\n" "main(void)\n" "{\n" -" vec4 V = u_world * vec4(in_pos, 1.0);\n" -" gl_Position = u_proj * u_view * V;\n" -" vec3 N = mat3(u_world) * in_normal;\n" +" vec4 Vertex = u_world * vec4(in_pos, 1.0);\n" +" gl_Position = u_proj * u_view * Vertex;\n" +" vec3 Normal = mat3(u_world) * in_normal;\n" " v_tex0 = in_tex0;\n" " v_color = in_color;\n" " v_color.rgb += u_ambLight.rgb*surfAmbient;\n" -" v_color.rgb += DoDynamicLight(V.xyz, N)*surfDiffuse;\n" +" v_color.rgb += DoDynamicLight(Vertex.xyz, Normal)*surfDiffuse;\n" " v_color = clamp(v_color, 0.0, 1.0);\n" " v_color *= u_matColor;\n" diff --git a/src/gl/shaders/im3d.vert b/src/gl/shaders/im3d.vert index 0276370..162d4f9 100644 --- a/src/gl/shaders/im3d.vert +++ b/src/gl/shaders/im3d.vert @@ -9,9 +9,9 @@ out float v_fog; void main(void) { - vec4 V = u_world * vec4(in_pos, 1.0); - vec4 cV = u_view * V; - gl_Position = u_proj * cV; + vec4 Vertex = u_world * vec4(in_pos, 1.0); + vec4 CamVertex = u_view * Vertex; + gl_Position = u_proj * CamVertex; v_color = in_color; v_tex0 = in_tex0; v_fog = DoFog(gl_Position.w); diff --git a/src/gl/shaders/im3d_gl3.inc b/src/gl/shaders/im3d_gl3.inc index 7459606..789cb2f 100644 --- a/src/gl/shaders/im3d_gl3.inc +++ b/src/gl/shaders/im3d_gl3.inc @@ -10,9 +10,9 @@ const char *im3d_vert_src = "void\n" "main(void)\n" "{\n" -" vec4 V = u_world * vec4(in_pos, 1.0);\n" -" vec4 cV = u_view * V;\n" -" gl_Position = u_proj * cV;\n" +" vec4 Vertex = u_world * vec4(in_pos, 1.0);\n" +" vec4 CamVertex = u_view * Vertex;\n" +" gl_Position = u_proj * CamVertex;\n" " v_color = in_color;\n" " v_tex0 = in_tex0;\n" " v_fog = DoFog(gl_Position.w);\n" diff --git a/src/gl/shaders/matfx_env.vert b/src/gl/shaders/matfx_env.vert index c6de99a..b19ae0f 100644 --- a/src/gl/shaders/matfx_env.vert +++ b/src/gl/shaders/matfx_env.vert @@ -13,16 +13,16 @@ out float v_fog; void main(void) { - vec4 V = u_world * vec4(in_pos, 1.0); - gl_Position = u_proj * u_view * V; - vec3 N = mat3(u_world) * in_normal; + vec4 Vertex = u_world * vec4(in_pos, 1.0); + gl_Position = u_proj * u_view * Vertex; + vec3 Normal = mat3(u_world) * in_normal; v_tex0 = in_tex0; - v_tex1 = (u_texMatrix * vec4(N, 1.0)).xy; + v_tex1 = (u_texMatrix * vec4(Normal, 1.0)).xy; v_color = in_color; v_color.rgb += u_ambLight.rgb*surfAmbient; - v_color.rgb += DoDynamicLight(V.xyz, N)*surfDiffuse; + v_color.rgb += DoDynamicLight(Vertex.xyz, Normal)*surfDiffuse; v_color = clamp(v_color, 0.0, 1.0); v_color *= u_matColor; diff --git a/src/gl/shaders/matfx_gl3.inc b/src/gl/shaders/matfx_gl3.inc index 873f88e..664db3a 100644 --- a/src/gl/shaders/matfx_gl3.inc +++ b/src/gl/shaders/matfx_gl3.inc @@ -14,16 +14,16 @@ const char *matfx_env_vert_src = "void\n" "main(void)\n" "{\n" -" vec4 V = u_world * vec4(in_pos, 1.0);\n" -" gl_Position = u_proj * u_view * V;\n" -" vec3 N = mat3(u_world) * in_normal;\n" +" vec4 Vertex = u_world * vec4(in_pos, 1.0);\n" +" gl_Position = u_proj * u_view * Vertex;\n" +" vec3 Normal = mat3(u_world) * in_normal;\n" " v_tex0 = in_tex0;\n" -" v_tex1 = (u_texMatrix * vec4(N, 1.0)).xy;\n" +" v_tex1 = (u_texMatrix * vec4(Normal, 1.0)).xy;\n" " v_color = in_color;\n" " v_color.rgb += u_ambLight.rgb*surfAmbient;\n" -" v_color.rgb += DoDynamicLight(V.xyz, N)*surfDiffuse;\n" +" v_color.rgb += DoDynamicLight(Vertex.xyz, Normal)*surfDiffuse;\n" " v_color = clamp(v_color, 0.0, 1.0);\n" " v_color *= u_matColor;\n" diff --git a/src/gl/shaders/skin.vert b/src/gl/shaders/skin.vert index c4be0e3..ff198b1 100644 --- a/src/gl/shaders/skin.vert +++ b/src/gl/shaders/skin.vert @@ -21,15 +21,15 @@ main(void) SkinNormal += (mat3(u_boneMatrices[int(in_indices[i])]) * in_normal) * in_weights[i]; } - vec4 V = u_world * vec4(SkinVertex, 1.0); - gl_Position = u_proj * u_view * V; - vec3 N = mat3(u_world) * SkinNormal; + vec4 Vertex = u_world * vec4(SkinVertex, 1.0); + gl_Position = u_proj * u_view * Vertex; + vec3 Normal = mat3(u_world) * SkinNormal; v_tex0 = in_tex0; v_color = in_color; v_color.rgb += u_ambLight.rgb*surfAmbient; - v_color.rgb += DoDynamicLight(V.xyz, N)*surfDiffuse; + v_color.rgb += DoDynamicLight(Vertex.xyz, Normal)*surfDiffuse; v_color = clamp(v_color, 0.0, 1.0); v_color *= u_matColor; diff --git a/src/gl/shaders/skin_gl3.inc b/src/gl/shaders/skin_gl3.inc index fdcad55..6a6fd44 100644 --- a/src/gl/shaders/skin_gl3.inc +++ b/src/gl/shaders/skin_gl3.inc @@ -22,15 +22,15 @@ const char *skin_vert_src = " SkinNormal += (mat3(u_boneMatrices[int(in_indices[i])]) * in_normal) * in_weights[i];\n" " }\n" -" vec4 V = u_world * vec4(SkinVertex, 1.0);\n" -" gl_Position = u_proj * u_view * V;\n" -" vec3 N = mat3(u_world) * SkinNormal;\n" +" vec4 Vertex = u_world * vec4(SkinVertex, 1.0);\n" +" gl_Position = u_proj * u_view * Vertex;\n" +" vec3 Normal = mat3(u_world) * SkinNormal;\n" " v_tex0 = in_tex0;\n" " v_color = in_color;\n" " v_color.rgb += u_ambLight.rgb*surfAmbient;\n" -" v_color.rgb += DoDynamicLight(V.xyz, N)*surfDiffuse;\n" +" v_color.rgb += DoDynamicLight(Vertex.xyz, Normal)*surfDiffuse;\n" " v_color = clamp(v_color, 0.0, 1.0);\n" " v_color *= u_matColor;\n"