#include "stdafx.h" #include "D3DShader.h" #include "VertexShader.h" #include "BPStructs.h" //I hope we don't get too many hash collisions :p //all these magic numbers are primes, it should help a bit xformhash GetCurrentXForm() { //return 0; xformhash hash = bpmem.genMode.numtexgens*8*17; /* for (int i=0; i%i texgens, %i colors\n",numUV,numTexgen,numColors); WRITE(p,"\n"); WRITE(p,"struct VS_INPUT {\n"); WRITE(p," float4 pos : POSITION;\n"); WRITE(p," float3 normal : NORMAL;\n"); if (numColors) WRITE(p," float4 colors[%i] : COLOR0;\n",numColors); if (numUV) WRITE(p," float3 uv[%i] : TEXCOORD0;\n",numUV); WRITE(p,"};\n"); WRITE(p,"\n"); WRITE(p,"struct VS_OUTPUT {\n"); WRITE(p," float4 pos : POSITION;\n"); WRITE(p," float4 colors[%i] : COLOR0;\n",numColors); if (numTexgen) WRITE(p," float4 uv[%i] : TEXCOORD0;\n",numTexgen); if (fogEnable) WRITE(p," float fog : FOG;\n",numTexgen); WRITE(p,"};\n"); WRITE(p,"\n"); WRITE(p,"uniform matrix matWorldViewProj : register(c0);\n"); WRITE(p,"\n"); WRITE(p,"VS_OUTPUT main(const VS_INPUT input)\n"); WRITE(p,"{\n"); WRITE(p," VS_OUTPUT output;"); WRITE(p,"\n"); WRITE(p," output.pos = mul(matWorldViewProj, input.pos);\n"); for (int i = 0; i < (int)bpmem.genMode.numtexgens; i++) { //build the equation for this stage WriteTexgen(p,i); } WRITE(p," for (int i=0; i<2; i++)\n output.colors[i] = input.colors[i];\n"); // WRITE(p," output.fog = 0.0f;"); WRITE(p,"return output;\n"); WRITE(p,"}\n"); WRITE(p,"\0"); // MessageBox(0,text2,0,0); return D3D::CompileVShader(text2,(int)(p-text2)); } /* * xform->vertexshader ideas */ void WriteTexgen(char *&p, int n) { WRITE(p," output.uv[%i] = float4(input.uv[%i].xy,0,input.uv[%i].z);\n",n,n,n); } void WriteLight(int color, int component) { }