From a2b79a71aa45e083c18789a21e8c99990b1a5202 Mon Sep 17 00:00:00 2001 From: aap Date: Tue, 21 Apr 2020 01:26:33 +0200 Subject: [PATCH] implemented d3d9 skin pipe --- src/d3d/d3d.cpp | 2 +- src/d3d/d3d9matfx.cpp | 10 + src/d3d/d3d9render.cpp | 1 + src/d3d/d3d9skin.cpp | 339 +++++++++++++- src/d3d/shaders/make_skin.cmd | 4 + src/d3d/shaders/skin_all_VS.h | 702 ++++++++++++++++++++++++++++ src/d3d/shaders/skin_amb_VS.h | 287 ++++++++++++ src/d3d/shaders/skin_amb_dir_VS.h | 559 ++++++++++++++++++++++ src/d3d/shaders/standardConstants.h | 29 ++ src/gl/gl3render.cpp | 2 +- src/hanim.cpp | 4 +- 11 files changed, 1932 insertions(+), 7 deletions(-) create mode 100644 src/d3d/shaders/make_skin.cmd create mode 100644 src/d3d/shaders/skin_all_VS.h create mode 100644 src/d3d/shaders/skin_amb_VS.h create mode 100644 src/d3d/shaders/skin_amb_dir_VS.h create mode 100644 src/d3d/shaders/standardConstants.h diff --git a/src/d3d/d3d.cpp b/src/d3d/d3d.cpp index ad50e23..d666a5c 100644 --- a/src/d3d/d3d.cpp +++ b/src/d3d/d3d.cpp @@ -181,7 +181,7 @@ calculateTextureSize(uint32 width, uint32 height, uint32 depth, uint32 format) } int vertFormatMap[] = { - -1, VERT_FLOAT2, VERT_FLOAT3, -1, VERT_ARGB + -1, VERT_FLOAT2, VERT_FLOAT3, VERT_FLOAT4, VERT_ARGB, VERT_RGBA /* blend indices */ }; void* diff --git a/src/d3d/d3d9matfx.cpp b/src/d3d/d3d9matfx.cpp index 07eb1f9..2c42c17 100644 --- a/src/d3d/d3d9matfx.cpp +++ b/src/d3d/d3d9matfx.cpp @@ -20,6 +20,10 @@ namespace rw { namespace d3d9 { using namespace d3d; +#ifndef RW_D3D9 +void matfxRenderCB_Shader(Atomic *atomic, InstanceDataHeader *header) {} +#else + static void *matfx_env_amb_VS; static void *matfx_env_amb_dir_VS; static void *matfx_env_all_VS; @@ -261,10 +265,14 @@ destroyMatFXShaders(void) matfx_env_tex_PS = nil; } +#endif + static void* matfxOpen(void *o, int32, int32) { +#ifdef RW_D3D9 createMatFXShaders(); +#endif matFXGlobals.pipelines[PLATFORM_D3D9] = makeMatFXPipeline(); return o; @@ -273,7 +281,9 @@ matfxOpen(void *o, int32, int32) static void* matfxClose(void *o, int32, int32) { +#ifdef RW_D3D9 destroyMatFXShaders(); +#endif return o; } diff --git a/src/d3d/d3d9render.cpp b/src/d3d/d3d9render.cpp index 587f112..819607e 100644 --- a/src/d3d/d3d9render.cpp +++ b/src/d3d/d3d9render.cpp @@ -19,6 +19,7 @@ using namespace d3d; #ifndef RW_D3D9 void defaultRenderCB(Atomic*, InstanceDataHeader*) {} +void defaultRenderCB_Shader(Atomic *atomic, InstanceDataHeader *header) {} #else void diff --git a/src/d3d/d3d9skin.cpp b/src/d3d/d3d9skin.cpp index 9eabd2c..00e7324 100644 --- a/src/d3d/d3d9skin.cpp +++ b/src/d3d/d3d9skin.cpp @@ -3,9 +3,11 @@ #include #include +#define WITH_D3D #include "../rwbase.h" #include "../rwerror.h" #include "../rwplg.h" +#include "../rwrender.h" #include "../rwpipeline.h" #include "../rwobjects.h" #include "../rwanim.h" @@ -18,9 +20,336 @@ namespace rw { namespace d3d9 { using namespace d3d; +#ifndef RW_D3D9 +void skinInstanceCB(Geometry *geo, InstanceDataHeader *header, bool32 reinstance) {} +void skinRenderCB(Atomic *atomic, InstanceDataHeader *header) {} +#else + + +static void *skin_amb_VS; +static void *skin_amb_dir_VS; +static void *skin_all_VS; + +#define NUMDECLELT 14 + +void +skinInstanceCB(Geometry *geo, InstanceDataHeader *header, bool32 reinstance) +{ + int i = 0; + VertexElement dcl[NUMDECLELT]; + VertexStream *s = &header->vertexStream[0]; + + bool isPrelit = (geo->flags & Geometry::PRELIT) != 0; + bool hasNormals = (geo->flags & Geometry::NORMALS) != 0; + + // TODO: support both vertex buffers + + if(!reinstance){ + // Create declarations and buffers only the first time + + assert(s->vertexBuffer == nil); + s->offset = 0; + s->managed = 1; + s->geometryFlags = 0; + s->dynamicLock = 0; + + dcl[i].stream = 0; + dcl[i].offset = 0; + dcl[i].type = D3DDECLTYPE_FLOAT3; + dcl[i].method = D3DDECLMETHOD_DEFAULT; + dcl[i].usage = D3DDECLUSAGE_POSITION; + dcl[i].usageIndex = 0; + i++; + uint16 stride = 12; + s->geometryFlags |= 0x2; + + if(isPrelit){ + dcl[i].stream = 0; + dcl[i].offset = stride; + dcl[i].type = D3DDECLTYPE_D3DCOLOR; + dcl[i].method = D3DDECLMETHOD_DEFAULT; + dcl[i].usage = D3DDECLUSAGE_COLOR; + dcl[i].usageIndex = 0; + i++; + s->geometryFlags |= 0x8; + stride += 4; + } + + for(int32 n = 0; n < geo->numTexCoordSets; n++){ + dcl[i].stream = 0; + dcl[i].offset = stride; + dcl[i].type = D3DDECLTYPE_FLOAT2; + dcl[i].method = D3DDECLMETHOD_DEFAULT; + dcl[i].usage = D3DDECLUSAGE_TEXCOORD; + dcl[i].usageIndex = (uint8)n; + i++; + s->geometryFlags |= 0x10 << n; + stride += 8; + } + + if(hasNormals){ + dcl[i].stream = 0; + dcl[i].offset = stride; + dcl[i].type = D3DDECLTYPE_FLOAT3; + dcl[i].method = D3DDECLMETHOD_DEFAULT; + dcl[i].usage = D3DDECLUSAGE_NORMAL; + dcl[i].usageIndex = 0; + i++; + s->geometryFlags |= 0x4; + stride += 12; + } + + dcl[i].stream = 0; + dcl[i].offset = stride; + dcl[i].type = D3DDECLTYPE_FLOAT4; + dcl[i].method = D3DDECLMETHOD_DEFAULT; + dcl[i].usage = D3DDECLUSAGE_BLENDWEIGHT; + dcl[i].usageIndex = 0; + i++; + stride += 16; + + dcl[i].stream = 0; + dcl[i].offset = stride; + dcl[i].type = D3DDECLTYPE_UBYTE4; + dcl[i].method = D3DDECLMETHOD_DEFAULT; + dcl[i].usage = D3DDECLUSAGE_BLENDINDICES; + dcl[i].usageIndex = 0; + i++; + stride += 4; + + + dcl[i] = D3DDECL_END(); + s->stride = stride; + + assert(header->vertexDeclaration == nil); + header->vertexDeclaration = createVertexDeclaration((VertexElement*)dcl); + + s->vertexBuffer = createVertexBuffer(header->totalNumVertex*s->stride, 0, false); + }else + getDeclaration(header->vertexDeclaration, dcl); + + Skin *skin = Skin::get(geo); + uint8 *verts = lockVertices(s->vertexBuffer, 0, 0, D3DLOCK_NOSYSLOCK); + + // Instance vertices + if(!reinstance || geo->lockedSinceInst&Geometry::LOCKVERTICES){ + for(i = 0; dcl[i].usage != D3DDECLUSAGE_POSITION || dcl[i].usageIndex != 0; i++) + ; + instV3d(vertFormatMap[dcl[i].type], verts + dcl[i].offset, + geo->morphTargets[0].vertices, + header->totalNumVertex, + header->vertexStream[dcl[i].stream].stride); + } + + // Instance prelight colors + if(isPrelit && (!reinstance || geo->lockedSinceInst&Geometry::LOCKPRELIGHT)){ + for(i = 0; dcl[i].usage != D3DDECLUSAGE_COLOR || dcl[i].usageIndex != 0; i++) + ; + InstanceData *inst = header->inst; + uint32 n = header->numMeshes; + while(n--){ + uint32 stride = header->vertexStream[dcl[i].stream].stride; + inst->vertexAlpha = instColor(vertFormatMap[dcl[i].type], + verts + dcl[i].offset + stride*inst->minVert, + geo->colors + inst->minVert, + inst->numVertices, + stride); + inst++; + } + } + + // Instance tex coords + for(int32 n = 0; n < geo->numTexCoordSets; n++){ + if(!reinstance || geo->lockedSinceInst&(Geometry::LOCKTEXCOORDS<texCoords[n], + header->totalNumVertex, + header->vertexStream[dcl[i].stream].stride); + } + } + + // Instance normals + if(hasNormals && (!reinstance || geo->lockedSinceInst&Geometry::LOCKNORMALS)){ + for(i = 0; dcl[i].usage != D3DDECLUSAGE_NORMAL || dcl[i].usageIndex != 0; i++) + ; + instV3d(vertFormatMap[dcl[i].type], verts + dcl[i].offset, + geo->morphTargets[0].normals, + header->totalNumVertex, + header->vertexStream[dcl[i].stream].stride); + } + + // Instance skin weights + if(!reinstance){ + for(i = 0; dcl[i].usage != D3DDECLUSAGE_BLENDWEIGHT || dcl[i].usageIndex != 0; i++) + ; + instV4d(vertFormatMap[dcl[i].type], verts + dcl[i].offset, + (V4d*)skin->weights, + header->totalNumVertex, + header->vertexStream[dcl[i].stream].stride); + } + + // Instance skin indices + if(!reinstance){ + for(i = 0; dcl[i].usage != D3DDECLUSAGE_BLENDINDICES || dcl[i].usageIndex != 0; i++) + ; + // not really colors of course but what the heck + instColor(vertFormatMap[dcl[i].type], verts + dcl[i].offset, + (RGBA*)skin->indices, + header->totalNumVertex, + header->vertexStream[dcl[i].stream].stride); + } + + unlockVertices(s->vertexBuffer); +} + +enum +{ + VSLOC_boneMatrices = VSLOC_afterLights +}; + +static float skinMatrices[64*16]; + +void +uploadSkinMatrices(Atomic *a) +{ + int i; + Skin *skin = Skin::get(a->geometry); + HAnimHierarchy *hier = Skin::getHierarchy(a); + Matrix *invMats = (Matrix*)skin->inverseMatrices; + Matrix tmp; + + Matrix *m = (Matrix*)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++; + } + }else{ + Matrix invAtmMat; + Matrix::invert(&invAtmMat, a->getFrame()->getLTM()); + 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++; + } + } + d3ddevice->SetVertexShaderConstantF(VSLOC_boneMatrices, skinMatrices, hier->numNodes*4); +} + +void +skinRenderCB(Atomic *atomic, InstanceDataHeader *header) +{ + int vsBits; + + d3ddevice->SetStreamSource(0, (IDirect3DVertexBuffer9*)header->vertexStream[0].vertexBuffer, + 0, header->vertexStream[0].stride); + d3ddevice->SetIndices((IDirect3DIndexBuffer9*)header->indexBuffer); + d3ddevice->SetVertexDeclaration((IDirect3DVertexDeclaration9*)header->vertexDeclaration); + + vsBits = lightingCB_Shader(atomic); + uploadMatrices(atomic->getFrame()->getLTM()); + + uploadSkinMatrices(atomic); + + d3ddevice->SetVertexShaderConstantF(VSLOC_fogData, (float*)&d3dShaderState.fogData, 1); + d3ddevice->SetPixelShaderConstantF(PSLOC_fogColor, (float*)&d3dShaderState.fogColor, 1); + + // Pick a shader + if((vsBits & VSLIGHT_MASK) == 0) + setVertexShader(skin_amb_VS); + else if((vsBits & VSLIGHT_MASK) == VSLIGHT_DIRECT) + setVertexShader(skin_amb_dir_VS); + else + setVertexShader(skin_all_VS); + + float surfProps[4]; + surfProps[3] = atomic->geometry->flags&Geometry::PRELIT ? 1.0f : 0.0f; + + InstanceData *inst = header->inst; + for(uint32 i = 0; i < header->numMeshes; i++){ + Material *m = inst->material; + + SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 255); + + rw::RGBAf col; + convColor(&col, &inst->material->color); + d3ddevice->SetVertexShaderConstantF(VSLOC_matColor, (float*)&col, 1); + + surfProps[0] = m->surfaceProps.ambient; + surfProps[1] = m->surfaceProps.specular; + surfProps[2] = m->surfaceProps.diffuse; + d3ddevice->SetVertexShaderConstantF(VSLOC_surfProps, surfProps, 1); + + if(inst->material->texture){ + d3d::setTexture(0, m->texture); + setPixelShader(default_tex_PS); + }else + setPixelShader(default_PS); + + drawInst(header, inst); + inst++; + } + setVertexShader(nil); + setPixelShader(nil); +} + +#define VS_NAME g_vs20_main +#define PS_NAME g_ps20_main + +void +createSkinShaders(void) +{ + { + static +#include "shaders/skin_amb_VS.h" + skin_amb_VS = createVertexShader((void*)VS_NAME); + assert(skin_amb_VS); + } + { + static +#include "shaders/skin_amb_dir_VS.h" + skin_amb_dir_VS = createVertexShader((void*)VS_NAME); + assert(skin_amb_dir_VS); + } + // Skinning takes a lot of instructions....lighting may be not possible + // TODO: should do something about this + { + static +#include "shaders/skin_all_VS.h" + skin_all_VS = createVertexShader((void*)VS_NAME); +// assert(skin_all_VS); + } +} + +void +destroySkinShaders(void) +{ + destroyVertexShader(skin_amb_VS); + skin_amb_VS = nil; + + destroyVertexShader(skin_amb_dir_VS); + skin_amb_dir_VS = nil; + + if(skin_all_VS){ + destroyVertexShader(skin_all_VS); + skin_all_VS = nil; + } +} + +#endif + static void* skinOpen(void *o, int32, int32) { +#ifdef RW_D3D9 + createSkinShaders(); +#endif + skinGlobals.pipelines[PLATFORM_D3D9] = makeSkinPipeline(); return o; } @@ -28,6 +357,10 @@ skinOpen(void *o, int32, int32) static void* skinClose(void *o, int32, int32) { +#ifdef RW_D3D9 + destroySkinShaders(); +#endif + return o; } @@ -42,9 +375,9 @@ ObjPipeline* makeSkinPipeline(void) { ObjPipeline *pipe = new ObjPipeline(PLATFORM_D3D9); - pipe->instanceCB = defaultInstanceCB; - pipe->uninstanceCB = defaultUninstanceCB; - pipe->renderCB = defaultRenderCB_Shader; + pipe->instanceCB = skinInstanceCB; + pipe->uninstanceCB = nil; + pipe->renderCB = skinRenderCB; pipe->pluginID = ID_SKIN; pipe->pluginData = 1; return pipe; diff --git a/src/d3d/shaders/make_skin.cmd b/src/d3d/shaders/make_skin.cmd new file mode 100644 index 0000000..19fb35a --- /dev/null +++ b/src/d3d/shaders/make_skin.cmd @@ -0,0 +1,4 @@ +@echo off +"%DXSDK_DIR%\utilities\bin\x86\fxc.exe" /T vs_2_0 /Fh skin_amb_VS.h skin_VS.hlsl +"%DXSDK_DIR%\utilities\bin\x86\fxc.exe" /T vs_2_0 /DDIRECTIONALS /Fh skin_amb_dir_VS.h skin_VS.hlsl +"%DXSDK_DIR%\utilities\bin\x86\fxc.exe" /T vs_2_0 /DDIRECTIONALS /DPOINTLIGHTS /DSPOTLIGHTS /Fh skin_all_VS.h skin_VS.hlsl diff --git a/src/d3d/shaders/skin_all_VS.h b/src/d3d/shaders/skin_all_VS.h new file mode 100644 index 0000000..9e20072 --- /dev/null +++ b/src/d3d/shaders/skin_all_VS.h @@ -0,0 +1,702 @@ +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +// fxc /T vs_2_0 /DDIRECTIONALS /DPOINTLIGHTS /DSPOTLIGHTS /Fh skin_all_VS.h +// skin_VS.hlsl +// +// +// Parameters: +// +// float4 ambientLight; +// float4x4 boneMatrices[64]; +// float4x4 combinedMat; +// int4 firstLight; +// float4 fogData; +// +// struct +// { +// float4 color; +// float4 position; +// float4 direction; +// +// } lights[8]; +// +// float4 matCol; +// float3x3 normalMat; +// int numDirLights; +// int numPointLights; +// int numSpotLights; +// float4 surfProps; +// float4x4 worldMat; +// +// +// Registers: +// +// Name Reg Size +// -------------- ----- ---- +// numDirLights i0 1 +// numPointLights i1 1 +// numSpotLights i2 1 +// combinedMat c0 4 +// worldMat c4 4 +// normalMat c8 3 +// matCol c12 1 +// surfProps c13 1 +// fogData c14 1 +// ambientLight c15 1 +// firstLight c16 1 +// lights c17 24 +// boneMatrices c41 256 +// + + vs_2_0 + def c11, 4, 0, -0, -1 + def c297, 3, 0, 0, 0 + dcl_position v0 + dcl_normal v1 + dcl_texcoord v2 + dcl_color v3 + 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.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 + 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 + mul r3.xyz, r0.y, c9 + mad r0.xyw, c8.xyzz, r0.x, r3.xyzz + mad r0.xyz, c10, r0.z, r0.xyww + mov r3.yw, c11 + slt r0.w, r3.y, c13.w + lrp r4, r0.w, v3, -c11.zzzw + mov r3.x, c13.x + mad r3.xyz, c15, r3.x, r4 + mov r5.xyz, r3 + mov r0.w, c11.y + rep i0 + add r1.w, r0.w, c16.x + mul r1.w, r1.w, c297.x + mova a0.x, r1.w + dp3 r1.w, r0, -c19[a0.x] + max r1.w, r1.w, c11.y + mul r6.xyz, r1.w, c17[a0.x] + mad r5.xyz, r6, c13.z, r5 + add r0.w, r0.w, -c11.w + endrep + mov r3.xyz, r5 + mov r0.w, c11.y + rep i1 + add r1.w, r0.w, c16.y + mul r1.w, r1.w, c297.x + mova a0.x, r1.w + add r6.xyz, r2, -c18[a0.x] + dp3 r1.w, r6, r6 + rsq r1.w, r1.w + mul r6.xyz, r1.w, r6 + dp3 r2.w, r0, -r6 + max r2.w, r2.w, c11.y + mul r6.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 + max r1.w, r1.w, c11.y + mul r6.xyz, r1.w, r6 + mad r3.xyz, r6, c13.z, r3 + add r0.w, r0.w, -c11.w + endrep + mov r4.xyz, r3 + mov r0.w, c11.y + rep i2 + add r1.w, r0.w, c16.z + mul r1.w, r1.w, c297.x + mova a0.x, r1.w + add r5.xyz, r2, -c18[a0.x] + dp3 r1.w, r5, r5 + rsq r1.w, r1.w + mul r5.xyz, r1.w, r5 + dp3 r2.w, r0, -r5 + dp3 r5.x, r5, c19[a0.x] + max r2.w, r2.w, c11.y + add r5.x, r5.x, c18[a0.x].w + add r5.y, -r3.w, c18[a0.x].w + rcp r5.y, r5.y + mul r5.x, r5.y, r5.x + slt r5.y, r5.x, c11.y + mad r2.w, r5.y, -r2.w, r2.w + max r5.x, r5.x, c19[a0.x].w + mul r2.w, r2.w, r5.x + 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 + 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 + endrep + max r0, r4, c11.y + min r0, r0, -c11.w + mul oD0, r0, c12 + mul r0, r1.y, c1 + mad r0, c0, r1.x, r0 + mad r0, c2, r1.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 + mov oT0.xy, v2 + +// approximately 137 instruction slots used +#endif + +const BYTE g_vs20_main[] = +{ + 0, 2, 254, 255, 254, 255, + 171, 0, 67, 84, 65, 66, + 28, 0, 0, 0, 119, 2, + 0, 0, 0, 2, 254, 255, + 13, 0, 0, 0, 28, 0, + 0, 0, 0, 1, 0, 0, + 112, 2, 0, 0, 32, 1, + 0, 0, 2, 0, 15, 0, + 1, 0, 62, 0, 48, 1, + 0, 0, 0, 0, 0, 0, + 64, 1, 0, 0, 2, 0, + 41, 0, 0, 1, 166, 0, + 80, 1, 0, 0, 0, 0, + 0, 0, 96, 1, 0, 0, + 2, 0, 0, 0, 4, 0, + 2, 0, 108, 1, 0, 0, + 0, 0, 0, 0, 124, 1, + 0, 0, 2, 0, 16, 0, + 1, 0, 66, 0, 136, 1, + 0, 0, 0, 0, 0, 0, + 152, 1, 0, 0, 2, 0, + 14, 0, 1, 0, 58, 0, + 48, 1, 0, 0, 0, 0, + 0, 0, 160, 1, 0, 0, + 2, 0, 17, 0, 24, 0, + 70, 0, 236, 1, 0, 0, + 0, 0, 0, 0, 252, 1, + 0, 0, 2, 0, 12, 0, + 1, 0, 50, 0, 48, 1, + 0, 0, 0, 0, 0, 0, + 3, 2, 0, 0, 2, 0, + 8, 0, 3, 0, 34, 0, + 16, 2, 0, 0, 0, 0, + 0, 0, 32, 2, 0, 0, + 1, 0, 0, 0, 1, 0, + 2, 0, 48, 2, 0, 0, + 0, 0, 0, 0, 64, 2, + 0, 0, 1, 0, 1, 0, + 1, 0, 6, 0, 48, 2, + 0, 0, 0, 0, 0, 0, + 79, 2, 0, 0, 1, 0, + 2, 0, 1, 0, 10, 0, + 48, 2, 0, 0, 0, 0, + 0, 0, 93, 2, 0, 0, + 2, 0, 13, 0, 1, 0, + 54, 0, 48, 1, 0, 0, + 0, 0, 0, 0, 103, 2, + 0, 0, 2, 0, 4, 0, + 4, 0, 18, 0, 108, 1, + 0, 0, 0, 0, 0, 0, + 97, 109, 98, 105, 101, 110, + 116, 76, 105, 103, 104, 116, + 0, 171, 171, 171, 1, 0, + 3, 0, 1, 0, 4, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 98, 111, 110, 101, + 77, 97, 116, 114, 105, 99, + 101, 115, 0, 171, 171, 171, + 3, 0, 3, 0, 4, 0, + 4, 0, 64, 0, 0, 0, + 0, 0, 0, 0, 99, 111, + 109, 98, 105, 110, 101, 100, + 77, 97, 116, 0, 3, 0, + 3, 0, 4, 0, 4, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 102, 105, 114, 115, + 116, 76, 105, 103, 104, 116, + 0, 171, 1, 0, 2, 0, + 1, 0, 4, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 102, 111, 103, 68, 97, 116, + 97, 0, 108, 105, 103, 104, + 116, 115, 0, 99, 111, 108, + 111, 114, 0, 171, 171, 171, + 1, 0, 3, 0, 1, 0, + 4, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 112, 111, + 115, 105, 116, 105, 111, 110, + 0, 100, 105, 114, 101, 99, + 116, 105, 111, 110, 0, 171, + 167, 1, 0, 0, 176, 1, + 0, 0, 192, 1, 0, 0, + 176, 1, 0, 0, 201, 1, + 0, 0, 176, 1, 0, 0, + 5, 0, 0, 0, 1, 0, + 12, 0, 8, 0, 3, 0, + 212, 1, 0, 0, 109, 97, + 116, 67, 111, 108, 0, 110, + 111, 114, 109, 97, 108, 77, + 97, 116, 0, 171, 171, 171, + 3, 0, 3, 0, 3, 0, + 3, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 110, 117, + 109, 68, 105, 114, 76, 105, + 103, 104, 116, 115, 0, 171, + 171, 171, 0, 0, 2, 0, + 1, 0, 1, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 110, 117, 109, 80, 111, 105, + 110, 116, 76, 105, 103, 104, + 116, 115, 0, 110, 117, 109, + 83, 112, 111, 116, 76, 105, + 103, 104, 116, 115, 0, 115, + 117, 114, 102, 80, 114, 111, + 112, 115, 0, 119, 111, 114, + 108, 100, 77, 97, 116, 0, + 118, 115, 95, 50, 95, 48, + 0, 77, 105, 99, 114, 111, + 115, 111, 102, 116, 32, 40, + 82, 41, 32, 72, 76, 83, + 76, 32, 83, 104, 97, 100, + 101, 114, 32, 67, 111, 109, + 112, 105, 108, 101, 114, 32, + 57, 46, 50, 57, 46, 57, + 53, 50, 46, 51, 49, 49, + 49, 0, 81, 0, 0, 5, + 11, 0, 15, 160, 0, 0, + 128, 64, 0, 0, 0, 0, + 0, 0, 0, 128, 0, 0, + 128, 191, 81, 0, 0, 5, + 41, 1, 15, 160, 0, 0, + 64, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 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, + 15, 144, 31, 0, 0, 2, + 5, 0, 0, 128, 2, 0, + 15, 144, 31, 0, 0, 2, + 10, 0, 0, 128, 3, 0, + 15, 144, 31, 0, 0, 2, + 1, 0, 0, 128, 4, 0, + 15, 144, 31, 0, 0, 2, + 2, 0, 0, 128, 5, 0, + 15, 144, 5, 0, 0, 3, + 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, + 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, + 228, 160, 0, 0, 0, 176, + 4, 0, 0, 5, 3, 0, + 7, 128, 41, 32, 228, 160, + 0, 0, 0, 176, 0, 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, + 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, + 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, + 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, + 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, 10, 128, 11, 0, + 228, 160, 12, 0, 0, 3, + 0, 0, 8, 128, 3, 0, + 85, 128, 13, 0, 255, 160, + 18, 0, 0, 4, 4, 0, + 15, 128, 0, 0, 255, 128, + 3, 0, 228, 144, 11, 0, + 234, 161, 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, + 4, 0, 228, 128, 1, 0, + 0, 2, 5, 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, 41, 1, + 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, + 6, 0, 7, 128, 1, 0, + 255, 128, 17, 32, 228, 160, + 0, 0, 0, 176, 4, 0, + 0, 4, 5, 0, 7, 128, + 6, 0, 228, 128, 13, 0, + 170, 160, 5, 0, 228, 128, + 2, 0, 0, 3, 0, 0, + 8, 128, 0, 0, 255, 128, + 11, 0, 255, 161, 39, 0, + 0, 0, 1, 0, 0, 2, + 3, 0, 7, 128, 5, 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, 41, 1, 0, 160, + 46, 0, 0, 2, 0, 0, + 1, 176, 1, 0, 255, 128, + 2, 0, 0, 4, 6, 0, + 7, 128, 2, 0, 228, 128, + 18, 32, 228, 161, 0, 0, + 0, 176, 8, 0, 0, 3, + 1, 0, 8, 128, 6, 0, + 228, 128, 6, 0, 228, 128, + 7, 0, 0, 2, 1, 0, + 8, 128, 1, 0, 255, 128, + 5, 0, 0, 3, 6, 0, + 7, 128, 1, 0, 255, 128, + 6, 0, 228, 128, 8, 0, + 0, 3, 2, 0, 8, 128, + 0, 0, 228, 128, 6, 0, + 228, 129, 11, 0, 0, 3, + 2, 0, 8, 128, 2, 0, + 255, 128, 11, 0, 85, 160, + 5, 0, 0, 4, 6, 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, 161, 11, 0, 0, 3, + 1, 0, 8, 128, 1, 0, + 255, 128, 11, 0, 85, 160, + 5, 0, 0, 3, 6, 0, + 7, 128, 1, 0, 255, 128, + 6, 0, 228, 128, 4, 0, + 0, 4, 3, 0, 7, 128, + 6, 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, 255, 161, 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, 41, 1, 0, 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, + 5, 0, 1, 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, + 5, 0, 1, 128, 5, 0, + 0, 128, 18, 32, 255, 160, + 0, 0, 0, 176, 2, 0, + 0, 4, 5, 0, 2, 128, + 3, 0, 255, 129, 18, 32, + 255, 160, 0, 0, 0, 176, + 6, 0, 0, 2, 5, 0, + 2, 128, 5, 0, 85, 128, + 5, 0, 0, 3, 5, 0, + 1, 128, 5, 0, 85, 128, + 5, 0, 0, 128, 12, 0, + 0, 3, 5, 0, 2, 128, + 5, 0, 0, 128, 11, 0, + 85, 160, 4, 0, 0, 4, + 2, 0, 8, 128, 5, 0, + 85, 128, 2, 0, 255, 129, + 2, 0, 255, 128, 11, 0, + 0, 4, 5, 0, 1, 128, + 5, 0, 0, 128, 19, 32, + 255, 160, 0, 0, 0, 176, + 5, 0, 0, 3, 2, 0, + 8, 128, 2, 0, 255, 128, + 5, 0, 0, 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, 161, + 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, 161, 39, 0, 0, 0, + 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, 161, 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, 0, 4, 0, 0, + 15, 128, 2, 0, 228, 160, + 1, 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, + 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, 255, 160, + 10, 0, 0, 3, 0, 0, + 4, 224, 0, 0, 0, 128, + 11, 0, 255, 161, 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 new file mode 100644 index 0000000..b030200 --- /dev/null +++ b/src/d3d/shaders/skin_amb_VS.h @@ -0,0 +1,287 @@ +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +// fxc /T vs_2_0 /Fh skin_amb_VS.h skin_VS.hlsl +// +// +// Parameters: +// +// float4 ambientLight; +// float4x4 boneMatrices[64]; +// float4x4 combinedMat; +// float4 fogData; +// float4 matCol; +// float4 surfProps; +// +// +// Registers: +// +// Name Reg Size +// ------------ ----- ---- +// combinedMat c0 4 +// matCol c12 1 +// surfProps c13 1 +// fogData c14 1 +// ambientLight c15 1 +// boneMatrices c41 256 +// + + vs_2_0 + def c4, 4, 0, -0, -1 + dcl_position v0 + dcl_texcoord v1 + dcl_color v2 + dcl_blendweight v3 + dcl_blendindices v4 + mov r0.y, c4.y + slt r0.x, r0.y, c13.w + lrp r1, r0.x, v2, -c4.zzzw + mov r0.x, c13.x + mad r1.xyz, c15, r0.x, r1 + max r0, r1, c4.y + min r0, r0, -c4.w + 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 + 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 + 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 + 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 + mad r0.xyz, r1, v3.w, r0 + mul r1, r0.y, c1 + mad r1, c0, r0.x, r1 + mad r0, c2, r0.z, r1 + add r0, r0, c3 + add r1.x, r0.w, -c14.y + mov oPos, r0 + mul r0.x, r1.x, c14.z + max r0.x, r0.x, c14.w + min oT0.z, r0.x, -c4.w + mov oT0.xy, v1 + +// approximately 42 instruction slots used +#endif + +const BYTE g_vs20_main[] = +{ + 0, 2, 254, 255, 254, 255, + 82, 0, 67, 84, 65, 66, + 28, 0, 0, 0, 16, 1, + 0, 0, 0, 2, 254, 255, + 6, 0, 0, 0, 28, 0, + 0, 0, 0, 1, 0, 0, + 9, 1, 0, 0, 148, 0, + 0, 0, 2, 0, 15, 0, + 1, 0, 62, 0, 164, 0, + 0, 0, 0, 0, 0, 0, + 180, 0, 0, 0, 2, 0, + 41, 0, 0, 1, 166, 0, + 196, 0, 0, 0, 0, 0, + 0, 0, 212, 0, 0, 0, + 2, 0, 0, 0, 4, 0, + 2, 0, 224, 0, 0, 0, + 0, 0, 0, 0, 240, 0, + 0, 0, 2, 0, 14, 0, + 1, 0, 58, 0, 164, 0, + 0, 0, 0, 0, 0, 0, + 248, 0, 0, 0, 2, 0, + 12, 0, 1, 0, 50, 0, + 164, 0, 0, 0, 0, 0, + 0, 0, 255, 0, 0, 0, + 2, 0, 13, 0, 1, 0, + 54, 0, 164, 0, 0, 0, + 0, 0, 0, 0, 97, 109, + 98, 105, 101, 110, 116, 76, + 105, 103, 104, 116, 0, 171, + 171, 171, 1, 0, 3, 0, + 1, 0, 4, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 98, 111, 110, 101, 77, 97, + 116, 114, 105, 99, 101, 115, + 0, 171, 171, 171, 3, 0, + 3, 0, 4, 0, 4, 0, + 64, 0, 0, 0, 0, 0, + 0, 0, 99, 111, 109, 98, + 105, 110, 101, 100, 77, 97, + 116, 0, 3, 0, 3, 0, + 4, 0, 4, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 102, 111, 103, 68, 97, 116, + 97, 0, 109, 97, 116, 67, + 111, 108, 0, 115, 117, 114, + 102, 80, 114, 111, 112, 115, + 0, 118, 115, 95, 50, 95, + 48, 0, 77, 105, 99, 114, + 111, 115, 111, 102, 116, 32, + 40, 82, 41, 32, 72, 76, + 83, 76, 32, 83, 104, 97, + 100, 101, 114, 32, 67, 111, + 109, 112, 105, 108, 101, 114, + 32, 57, 46, 50, 57, 46, + 57, 53, 50, 46, 51, 49, + 49, 49, 0, 171, 171, 171, + 81, 0, 0, 5, 4, 0, + 15, 160, 0, 0, 128, 64, + 0, 0, 0, 0, 0, 0, + 0, 128, 0, 0, 128, 191, + 31, 0, 0, 2, 0, 0, + 0, 128, 0, 0, 15, 144, + 31, 0, 0, 2, 5, 0, + 0, 128, 1, 0, 15, 144, + 31, 0, 0, 2, 10, 0, + 0, 128, 2, 0, 15, 144, + 31, 0, 0, 2, 1, 0, + 0, 128, 3, 0, 15, 144, + 31, 0, 0, 2, 2, 0, + 0, 128, 4, 0, 15, 144, + 1, 0, 0, 2, 0, 0, + 2, 128, 4, 0, 85, 160, + 12, 0, 0, 3, 0, 0, + 1, 128, 0, 0, 85, 128, + 13, 0, 255, 160, 18, 0, + 0, 4, 1, 0, 15, 128, + 0, 0, 0, 128, 2, 0, + 228, 144, 4, 0, 234, 161, + 1, 0, 0, 2, 0, 0, + 1, 128, 13, 0, 0, 160, + 4, 0, 0, 4, 1, 0, + 7, 128, 15, 0, 228, 160, + 0, 0, 0, 128, 1, 0, + 228, 128, 11, 0, 0, 3, + 0, 0, 15, 128, 1, 0, + 228, 128, 4, 0, 85, 160, + 10, 0, 0, 3, 0, 0, + 15, 128, 0, 0, 228, 128, + 4, 0, 255, 161, 5, 0, + 0, 3, 0, 0, 15, 208, + 0, 0, 228, 128, 12, 0, + 228, 160, 5, 0, 0, 3, + 0, 0, 15, 128, 4, 0, + 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, + 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, + 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, + 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, + 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, + 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, 255, 161, 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 new file mode 100644 index 0000000..c2786fd --- /dev/null +++ b/src/d3d/shaders/skin_amb_dir_VS.h @@ -0,0 +1,559 @@ +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 +// +// fxc /T vs_2_0 /DDIRECTIONALS /Fh skin_amb_dir_VS.h skin_VS.hlsl +// +// +// Parameters: +// +// float4 ambientLight; +// float4x4 boneMatrices[64]; +// float4x4 combinedMat; +// int4 firstLight; +// float4 fogData; +// +// struct +// { +// float4 color; +// float4 position; +// float4 direction; +// +// } lights[8]; +// +// float4 matCol; +// float3x3 normalMat; +// int numDirLights; +// float4 surfProps; +// +// +// Registers: +// +// Name Reg Size +// ------------ ----- ---- +// numDirLights i0 1 +// combinedMat c0 4 +// normalMat c8 3 +// matCol c12 1 +// surfProps c13 1 +// fogData c14 1 +// ambientLight c15 1 +// firstLight c16 1 +// lights c17 24 +// boneMatrices c41 256 +// + + vs_2_0 + def c4, 4, 0, -0, -1 + def c5, 3, 0, 0, 0 + dcl_position v0 + dcl_normal v1 + dcl_texcoord v2 + dcl_color v3 + dcl_blendweight v4 + dcl_blendindices v5 + mul r0, v5, c4.x + mova a0.w, r0.x + mul r1.xyz, v1.y, c42[a0.w] + mova a0.w, r0.x + mad r1.xyz, c41[a0.w], v1.x, r1 + mova a0.w, r0.x + mad r1.xyz, c43[a0.w], v1.z, r1 + mova a0.w, r0.y + mul r2.xyz, v1.y, c42[a0.w] + mova a0.w, r0.y + mad r2.xyz, c41[a0.w], v1.x, r2 + mova a0.w, r0.y + mad r2.xyz, c43[a0.w], v1.z, r2 + 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] + mova a0.w, r0.z + mad r2.xyz, c41[a0.w], v1.x, r2 + mova a0.w, r0.z + mad r2.xyz, c43[a0.w], v1.z, r2 + mad r1.xyz, r2, v4.z, r1 + mova a0.w, r0.w + mul r2.xyz, v1.y, c42[a0.w] + mova a0.w, r0.w + mad r2.xyz, c41[a0.w], v1.x, r2 + mova a0.w, r0.w + mad r2.xyz, c43[a0.w], v1.z, r2 + mad r1.xyz, r2, v4.w, r1 + mul r2.xyz, r1.y, c9 + mad r1.xyw, c8.xyzz, r1.x, r2.xyzz + mad r1.xyz, c10, r1.z, r1.xyww + mov r2.y, c4.y + slt r1.w, r2.y, c13.w + lrp r2, r1.w, v3, -c4.zzzw + mov r3.x, c13.x + mad r3.xyz, c15, r3.x, r2 + mov r2.xyz, r3 + mov r1.w, c4.y + rep i0 + add r3.w, r1.w, c16.x + mul r3.w, r3.w, c5.x + mova a0.w, r3.w + dp3 r4.x, r1, -c19[a0.w] + max r4.x, r4.x, c4.y + mova a0.w, r3.w + mul r4.xyz, r4.x, c17[a0.w] + mad r2.xyz, r4, c13.z, r2 + add r1.w, r1.w, -c4.w + endrep + max r1, r2, c4.y + min r1, r1, -c4.w + mul oD0, r1, c12 + mova a0.w, r0.y + mul r1.xyz, v0.y, c42[a0.w] + mova a0.w, r0.y + mad r1.xyz, c41[a0.w], v0.x, r1 + 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 + mul r1.xyz, r1, v4.y + mova a0.w, r0.x + mul r2.xyz, v0.y, c42[a0.w] + mova a0.w, r0.x + mad r2.xyz, c41[a0.w], v0.x, r2 + 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 + mad r1.xyz, r2, v4.x, r1 + mova a0.w, r0.z + mul r2.xyz, v0.y, c42[a0.w] + mova a0.w, r0.z + mad r2.xyz, c41[a0.w], v0.x, r2 + 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 + mova a0.w, r0.w + mul r1.xyz, v0.y, c42[a0.w] + mova a0.w, r0.w + mad r1.xyz, c41[a0.w], v0.x, r1 + 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 + mad r0.xyz, r1, v4.w, r0 + mul r1, r0.y, c1 + mad r1, c0, r0.x, r1 + mad r0, c2, r0.z, r1 + 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, -c4.w + mov oT0.xy, v2 + +// approximately 102 instruction slots used +#endif + +const BYTE g_vs20_main[] = +{ + 0, 2, 254, 255, 254, 255, + 147, 0, 67, 84, 65, 66, + 28, 0, 0, 0, 21, 2, + 0, 0, 0, 2, 254, 255, + 10, 0, 0, 0, 28, 0, + 0, 0, 0, 1, 0, 0, + 14, 2, 0, 0, 228, 0, + 0, 0, 2, 0, 15, 0, + 1, 0, 62, 0, 244, 0, + 0, 0, 0, 0, 0, 0, + 4, 1, 0, 0, 2, 0, + 41, 0, 0, 1, 166, 0, + 20, 1, 0, 0, 0, 0, + 0, 0, 36, 1, 0, 0, + 2, 0, 0, 0, 4, 0, + 2, 0, 48, 1, 0, 0, + 0, 0, 0, 0, 64, 1, + 0, 0, 2, 0, 16, 0, + 1, 0, 66, 0, 76, 1, + 0, 0, 0, 0, 0, 0, + 92, 1, 0, 0, 2, 0, + 14, 0, 1, 0, 58, 0, + 244, 0, 0, 0, 0, 0, + 0, 0, 100, 1, 0, 0, + 2, 0, 17, 0, 24, 0, + 70, 0, 176, 1, 0, 0, + 0, 0, 0, 0, 192, 1, + 0, 0, 2, 0, 12, 0, + 1, 0, 50, 0, 244, 0, + 0, 0, 0, 0, 0, 0, + 199, 1, 0, 0, 2, 0, + 8, 0, 3, 0, 34, 0, + 212, 1, 0, 0, 0, 0, + 0, 0, 228, 1, 0, 0, + 1, 0, 0, 0, 1, 0, + 2, 0, 244, 1, 0, 0, + 0, 0, 0, 0, 4, 2, + 0, 0, 2, 0, 13, 0, + 1, 0, 54, 0, 244, 0, + 0, 0, 0, 0, 0, 0, + 97, 109, 98, 105, 101, 110, + 116, 76, 105, 103, 104, 116, + 0, 171, 171, 171, 1, 0, + 3, 0, 1, 0, 4, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 98, 111, 110, 101, + 77, 97, 116, 114, 105, 99, + 101, 115, 0, 171, 171, 171, + 3, 0, 3, 0, 4, 0, + 4, 0, 64, 0, 0, 0, + 0, 0, 0, 0, 99, 111, + 109, 98, 105, 110, 101, 100, + 77, 97, 116, 0, 3, 0, + 3, 0, 4, 0, 4, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 102, 105, 114, 115, + 116, 76, 105, 103, 104, 116, + 0, 171, 1, 0, 2, 0, + 1, 0, 4, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 102, 111, 103, 68, 97, 116, + 97, 0, 108, 105, 103, 104, + 116, 115, 0, 99, 111, 108, + 111, 114, 0, 171, 171, 171, + 1, 0, 3, 0, 1, 0, + 4, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 112, 111, + 115, 105, 116, 105, 111, 110, + 0, 100, 105, 114, 101, 99, + 116, 105, 111, 110, 0, 171, + 107, 1, 0, 0, 116, 1, + 0, 0, 132, 1, 0, 0, + 116, 1, 0, 0, 141, 1, + 0, 0, 116, 1, 0, 0, + 5, 0, 0, 0, 1, 0, + 12, 0, 8, 0, 3, 0, + 152, 1, 0, 0, 109, 97, + 116, 67, 111, 108, 0, 110, + 111, 114, 109, 97, 108, 77, + 97, 116, 0, 171, 171, 171, + 3, 0, 3, 0, 3, 0, + 3, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 110, 117, + 109, 68, 105, 114, 76, 105, + 103, 104, 116, 115, 0, 171, + 171, 171, 0, 0, 2, 0, + 1, 0, 1, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 115, 117, 114, 102, 80, 114, + 111, 112, 115, 0, 118, 115, + 95, 50, 95, 48, 0, 77, + 105, 99, 114, 111, 115, 111, + 102, 116, 32, 40, 82, 41, + 32, 72, 76, 83, 76, 32, + 83, 104, 97, 100, 101, 114, + 32, 67, 111, 109, 112, 105, + 108, 101, 114, 32, 57, 46, + 50, 57, 46, 57, 53, 50, + 46, 51, 49, 49, 49, 0, + 171, 171, 81, 0, 0, 5, + 4, 0, 15, 160, 0, 0, + 128, 64, 0, 0, 0, 0, + 0, 0, 0, 128, 0, 0, + 128, 191, 81, 0, 0, 5, + 5, 0, 15, 160, 0, 0, + 64, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 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, + 15, 144, 31, 0, 0, 2, + 5, 0, 0, 128, 2, 0, + 15, 144, 31, 0, 0, 2, + 10, 0, 0, 128, 3, 0, + 15, 144, 31, 0, 0, 2, + 1, 0, 0, 128, 4, 0, + 15, 144, 31, 0, 0, 2, + 2, 0, 0, 128, 5, 0, + 15, 144, 5, 0, 0, 3, + 0, 0, 15, 128, 5, 0, + 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, + 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, 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, + 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, + 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, + 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, 2, 128, 4, 0, + 85, 160, 12, 0, 0, 3, + 1, 0, 8, 128, 2, 0, + 85, 128, 13, 0, 255, 160, + 18, 0, 0, 4, 2, 0, + 15, 128, 1, 0, 255, 128, + 3, 0, 228, 144, 4, 0, + 234, 161, 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, + 2, 0, 228, 128, 1, 0, + 0, 2, 2, 0, 7, 128, + 3, 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, 3, 0, + 8, 128, 1, 0, 255, 128, + 16, 0, 0, 160, 5, 0, + 0, 3, 3, 0, 8, 128, + 3, 0, 255, 128, 5, 0, + 0, 160, 46, 0, 0, 2, + 0, 0, 8, 176, 3, 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, 3, 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, 2, 0, 7, 128, + 4, 0, 228, 128, 13, 0, + 170, 160, 2, 0, 228, 128, + 2, 0, 0, 3, 1, 0, + 8, 128, 1, 0, 255, 128, + 4, 0, 255, 161, 39, 0, + 0, 0, 11, 0, 0, 3, + 1, 0, 15, 128, 2, 0, + 228, 128, 4, 0, 85, 160, + 10, 0, 0, 3, 1, 0, + 15, 128, 1, 0, 228, 128, + 4, 0, 255, 161, 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, + 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, + 1, 0, 228, 128, 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, 5, 0, 0, 4, + 2, 0, 7, 128, 0, 0, + 85, 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, 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, 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, + 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, + 0, 2, 0, 0, 8, 176, + 0, 0, 255, 128, 5, 0, + 0, 4, 1, 0, 7, 128, + 0, 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, 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, + 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, + 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, 161, + 1, 0, 0, 2, 0, 0, + 3, 224, 2, 0, 228, 144, + 255, 255, 0, 0 +}; diff --git a/src/d3d/shaders/standardConstants.h b/src/d3d/shaders/standardConstants.h new file mode 100644 index 0000000..96895b0 --- /dev/null +++ b/src/d3d/shaders/standardConstants.h @@ -0,0 +1,29 @@ +float4x4 combinedMat : register(c0); +float4x4 worldMat : register(c4); +float3x3 normalMat : register(c8); +float4 matCol : register(c12); +float4 surfProps : register(c13); +float4 fogData : register(c14); +float4 ambientLight : register(c15); + +#define surfAmbient (surfProps.x) +#define surfSpecular (surfProps.y) +#define surfDiffuse (surfProps.z) +#define surfPrelight (surfProps.w) + +#define fogStart (fogData.x) +#define fogEnd (fogData.y) +#define fogRange (fogData.z) +#define fogDisable (fogData.w) + +#include "lighting.h" + +int numDirLights : register(i0); +int numPointLights : register(i1); +int numSpotLights : register(i2); +int4 firstLight : register(c16); +Light lights[8] : register(c17); + +#define firstDirLight (firstLight.x) +#define firstPointLight (firstLight.y) +#define firstSpotLight (firstLight.z) diff --git a/src/gl/gl3render.cpp b/src/gl/gl3render.cpp index ad819df..e5b2f1a 100644 --- a/src/gl/gl3render.cpp +++ b/src/gl/gl3render.cpp @@ -49,7 +49,7 @@ lightingCB(bool32 normals) world = (World*)engine->currentWorld; // only unpositioned lights right now - FORLIST(lnk, world->directionalLights){ + FORLIST(lnk, world->globalLights){ Light *l = Light::fromWorld(lnk); if(normals && l->getType() == Light::DIRECTIONAL && diff --git a/src/hanim.cpp b/src/hanim.cpp index 5a0b46e..b9efafd 100644 --- a/src/hanim.cpp +++ b/src/hanim.cpp @@ -162,7 +162,7 @@ HAnimHierarchy::updateMatrices(void) curMat = this->matrices; frm = this->parentFrame; - if(frm && (parfrm = frm->getParent())) + if(frm && (parfrm = frm->getParent()) && !(this->flags&LOCALSPACEMATRICES)) rootMat = *parfrm->getLTM(); else rootMat.setIdentity(); @@ -171,7 +171,7 @@ HAnimHierarchy::updateMatrices(void) HAnimNodeInfo *node = this->nodeInfo; for(i = 0; i < this->numNodes; i++){ anim->applyCB(&animMat, anim->getInterpFrame(i)); - Matrix::mult(curMat, parentMat, &animMat); + Matrix::mult(curMat, &animMat, parentMat); if(node->flags & PUSH) *sp++ = parentMat;