deargui-vpl/ref/virtools/Samples/Behaviors/Shader/Sources/default_fxDX8.cpp

255 lines
8.4 KiB
C++

const char g_default[] =
"// Default Shader\n"
"// Restores all default Direct X 8 renderstates\n"
"// (c)2003 Virtools\n"
"\n"
"// The Default Shader is not saved and thus cannot be modified.\n"
"// This is for coherence reason (from one .cmo to another the default\n"
"// rendering will always be the same).\n"
"\n"
"// Beneath you'll find the list of all Automatics parameters known by Virtools.\n"
"// Even though they aren't used by the Default Shader, they appear here \n"
"// to help you remember the Semantics syntax.\n"
"\n"
"//--- Standard Automatic Parameters\n"
"matrix mWOR; // Object World Matrix\n"
"matrix mVIE; // Camera View Matrix\n"
"matrix mPRO; // Projection Matrix\n"
"matrix mWVI; // World x View Matrix\n"
"matrix mWVP; // World x View x Projection Matrix\n"
"vector mEPO; // Eye Position Vector\n"
"//---------------------------------------------------------------------\n"
"\n"
"//--- Additional Automatic Parameters\n"
"vector vPOS; // Object Position\n"
"\n"
"//--- Texures\n"
"\n"
"texture tTEX; // Material's Texture\n"
"texture tNUL; // Null Texture\n"
"\n"
"vector vDIF; // Material's Diffuse Color\n"
"vector vEMI; // Material's Emissive Color\n"
"vector vSPE; // Material's Specular Color\n"
"vector vAMB; // Material's Ambient Color\n"
"\n"
"float fPOW; // Material's Power Value\n"
"\n"
"vector fTIM; // Time elapsed since play event (in seconds),sinf(time),cosf(time),1.\n"
"\n"
"\n"
"// Identity Matrix\n"
"matrix matI = \n"
"[\n"
" 1.0,0.0,0.0,0.0,\n"
" 0.0,1.0,0.0,0.0,\n"
" 0.0,0.0,1.0,0.0,\n"
" 0.0,0.0,0.0,1.0\n"
"];\n"
"\n"
"//---------------------------------------------------------------------\n"
"// Shaders\n"
"// PixelShaderConstants and VertexShaderConstants are unchanged\n"
"//---------------------------------------------------------------------\n"
"\n"
"// Use the code below as a reference to common states.\n"
"// If a shader does not modify a state then the state\n"
"// will remain to its initial value defined below.\n"
"\n"
"technique Def\n"
"{\n"
" pass Rest\n"
" {\n"
" //---------------------------------------------------------------------\n"
" // Transform states\n"
" // WorldTransform, ViewTransform, ProjectionTransform are automatically\n"
" // set from within Virtools 3d engine.\n"
" //---------------------------------------------------------------------\n"
"\n"
" //---------------------------------------------------------------------\n"
" // Light states\n"
" //\n"
" // Warning: With LightEnable[n] = false, the compiler skips all other\n"
" // light states. So even if the default light state LightRange is set to\n"
" // 1000, it will be 0 !\n"
" // That is why you must explicitly set light state in order to see light\n"
" // shine. Do not forget to set:\n"
" // - LightEnable[0] = true;\n"
" // - LightAttenuation0[0] = greater than 0 (like 1);\n"
" // - LightDiffuse[0] = non-black color;\n"
" // - LightRange[0] = greater than 0 (like 1000);\n"
" //---------------------------------------------------------------------\n"
" LightEnable[0] = false;\n"
" \n"
" LightAmbient[0] = 0x00000000;\n"
" LightAttenuation0[0] = 0.0;\n"
" LightAttenuation1[0] = 1.0;\n"
" LightAttenuation2[0] = 2.0;\n"
" LightDiffuse[0] = 0x00000000;\n"
"// LightDirection[0] = (0.0, 0.0, 1.0);\n"
" LightFalloff[0] = 1.0;\n"
" LightPhi[0] = 0.0;\n"
" LightPosition[0] = (0.0, 0.0, 0.0);\n"
" LightRange[0] = 0.0;\n"
" LightSpecular[0] = 0x00000000;\n"
" LightTheta[0] = 0.0;\n"
" LightType[0] = DIRECTIONAL;\n"
"\n"
" //---------------------------------------------------------------------\n"
" // Material states\n"
" //---------------------------------------------------------------------\n"
" MaterialAmbient = 0x00000000;\n"
" MaterialDiffuse = 0x00000000;\n"
" MaterialEmissive = 0x00000000;\n"
" MaterialPower = 0.0;\n"
" MaterialSpecular = 0x00000000;\n"
"\n"
" //---------------------------------------------------------------------\n"
" // Renderstates/Vertex Pipeline\n"
" //---------------------------------------------------------------------\n"
" Ambient = 0x00000000;\n"
" AmbientMaterialSource = MATERIAL;\n"
"// Clipping = 0;\n"
"// ClipPlaneEnable = false;\n"
" ColorVertex = false;\n"
" CullMode = CCW;\n"
" DiffuseMaterialSource = COLOR1;\n"
" EmissiveMaterialSource = MATERIAL;\n"
" FogColor = 0x00000000;\n"
" FogDensity = 1.0;\n"
" FogEnable = false;\n"
" FogEnd = 1.0;\n"
" FogStart = 0.0;\n"
" FogTableMode = NONE;\n"
"// FogVertexMode = NONE;\n"
"// IndexedVertexBlendEnable = false;\n"
" Lighting = true;\n"
" LocalViewer = true;\n"
" MultiSampleAntialias = true;\n"
" MultiSampleMask = 0xFFFFFFFF;\n"
" NormalizeNormals = false;\n"
" PatchSegments = 0;\n"
" PointScale_A = 1.0;\n"
" PointScale_B = 0.0;\n"
" PointScale_C = 0.0;\n"
" PointScaleEnable = false;\n"
" PointSize = 1.0;\n"
" PointSize_Min = 1.0;\n"
" PointSize_Max = 64.0;\n"
" PointSpriteEnable = false;\n"
" RangeFogEnable = false;\n"
" SpecularEnable = false;\n"
" SpecularMaterialSource = COLOR2;\n"
"// TweenFactor = 0;\n"
" VertexBlend = DISABLE;\n"
"\n"
" //---------------------------------------------------------------------\n"
" // Renderstates/Pixel Pipeline\n"
" //---------------------------------------------------------------------\n"
" AlphaBlendEnable = false;\n"
" AlphaFunc = ALWAYS;\n"
" AlphaRef = 0;\n"
" AlphaTestEnable = false;\n"
" BlendOp = ADD;\n"
"// ColorWriteEnable = TRUE;\n // DWORD on DX8.1, BOOL on XBOX, problem"
"// DepthBias = 0.0;\n"
" DestBlend = ZERO;\n"
" DitherEnable = false;\n"
" FillMode = SOLID;\n"
"// LastPixel = true;\n"
" ShadeMode = GOURAUD;\n"
" SrcBlend = ONE;\n"
" StencilEnable = false;\n"
" StencilFail = KEEP;\n"
" StencilFunc = ALWAYS;\n"
" StencilMask = 0xFFFFFFFF;\n"
" StencilPass = KEEP;\n"
" StencilRef = 0;\n"
" StencilWriteMask = 0xFFFFFFFF;\n"
" StencilZFail = KEEP;\n"
" TextureFactor = 0xFFFFFFFF;\n"
" Wrap0 = 0;\n"
" Wrap1 = 0;\n"
" Wrap2 = 0;\n"
" Wrap3 = 0;\n"
" ZEnable = true;\n"
" ZFunc = LESSEQUAL;\n"
" ZWriteEnable = true;\n"
"\n"
" //---------------------------------------------------------------------\n"
" // Sample states\n"
" //---------------------------------------------------------------------\n"
" AddressU[0] = WRAP;\n"
" AddressV[0] = WRAP;\n"
" AddressW[0] = WRAP;\n"
" BorderColor[0] = 0x00000000;\n"
" MagFilter[0] = LINEAR;\n"
" MaxAnisotropy[0] = 1;\n"
" MaxMipLevel[0] = 0;\n"
" MinFilter[0] = LINEAR;\n"
" MipFilter[0] = LINEAR;\n"
" MipMapLodBias[0] = 0;\n"
"// SRGBTexture[0] = 0;\n"
" \n"
" //---------------------------------------------------------------------\n"
" // Texture states/Textures\n"
" //---------------------------------------------------------------------\n"
" Texture[0] = <tNUL>;\n"
" Texture[1] = <tNUL>;\n"
" Texture[2] = <tNUL>;\n"
" Texture[3] = <tNUL>;\n"
" \n"
" //---------------------------------------------------------------------\n"
" // Texture states/Texture stages\n"
" //---------------------------------------------------------------------\n"
" AlphaOp[0] = SELECTARG1;\n"
" AlphaArg0[0] = CURRENT;\n"
" AlphaArg1[0] = TEXTURE;\n"
" AlphaArg2[0] = CURRENT;\n"
" ColorOp[0] = MODULATE;\n"
" ColorArg0[0] = CURRENT;\n"
" ColorArg1[0] = TEXTURE;\n"
" ColorArg2[0] = CURRENT;\n"
" BumpEnvLScale[0] = 0.0;\n"
" BumpEnvLOffset[0] = 0.0;\n"
" BumpEnvMat00[0] = 0;\n"
" BumpEnvMat01[0] = 0;\n"
" BumpEnvMat10[0] = 0;\n"
" BumpEnvMat11[0] = 0;\n"
" ResultArg[0] = CURRENT;\n"
"\n"
" AlphaOp[1] = DISABLE;\n"
" ColorOp[1] = DISABLE;\n"
" AlphaOp[2] = DISABLE;\n"
" ColorOp[2] = DISABLE;\n"
" AlphaOp[3] = DISABLE;\n"
" ColorOp[3] = DISABLE;\n"
"\n"
" //---------------------------------------------------------------------\n"
" // Texture states/Texture coordinates\n"
" //---------------------------------------------------------------------\n"
" TexCoordIndex[0] = 0;\n"
" TextureTransformFlags[0] = DISABLE;\n"
" TextureTransform[0] = <matI>;\n"
" TexCoordIndex[1] = 1;\n"
" TextureTransformFlags[1] = DISABLE;\n"
" TextureTransform[1] = <matI>;\n"
" TexCoordIndex[2] = 2;\n"
" TextureTransformFlags[2] = DISABLE;\n"
" TextureTransform[2] = <matI>;\n"
" TexCoordIndex[3] = 3;\n"
" TextureTransformFlags[3] = DISABLE;\n"
" TextureTransform[3] = <matI>;\n"
"\n"
" VertexShader =\n"
" decl\n"
" {\n"
" stream 0;\n"
" float v0[3]; // Position\n"
" float v3[3]; // Normal\n"
" float v7[2]; // Texture Coord1\n"
" };\n"
" }\n"
"}\n"
;