const char g_default[] = "// Default Shader\n" "// Restores all default DirectX 9 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" "#if 0 // Skip Below Parameters During Compilation of Default Shader\n" "\n" "//--- Automatic Parameters\n" "\n" "float4x4 world : World; // Object World Matrix\n" "float4x4 view : View; // View Matrix\n" "float4x4 projection : Projection; // Projection Matrix\n" "float4x4 worldView : WorldView; // World x View Matrix\n" "float4x4 viewProj : ViewProjection; // View x Proj. Matrix\n" "float4x4 wvp : WorldViewProjection; // World x View x Proj. Matrix\n" "\n" "float3 objPos : ObjectPos; // Object Position\n" "float3 oBjPos : Position; // Synonym\n" "float3 eyePos : EyePos; // Camera World Position\n" "float3 camPos : CamPos; // Synonym\n" "float3 wcp : WorldCameraPosition; // Synonym\n" "float3 wCP : World_Camera_Position; // Synonym\n" "\n" "float3 bbMax : BoundingBoxMax; // Bounding Box Maximum\n" "float3 bBMax : Local_BBox_Max; // Synonym\n" "float3 bBMAx : LocalBBoxMax; // Synonym\n" "float3 bbMin : BoundingBoxMin; // Bounding Box Minimum\n" "float3 bBMin : Local_BBox_Min; // Synonym\n" "float3 bBMIn : LocalBBoxMin; // Synonym\n" "float3 bbSize : BoundingBoxSize; // Bounding Box Size\n" "float3 bBSize : Local_BBox_Size; // Synonym\n" "float3 bbSIze : LocalBBoxSize; // Synonym\n" "float3 bbCenter : BoundingCenter; // Bounding Box Center\n" "float bsSize : BoundingSphereSize;// Bounding Sphere Size\n" "float bsMinR : BoundingSphereMin; // Bounding Sphere Minimum Radius\n" "float bsMaxR : BoundingSphereMax; // Bounding Sphere Maximum Radius\n" "\n" "int passCount : PassCount; // Shader's pass count\n" "int passIndex : PassIndex; // Current rendering pass index\n" "\n" "float4 diff : Diffuse; // Material's Diffuse Color\n" "float4 emis : Emissive; // Material's Emissive Color\n" "float4 spec : Specular; // Material's Specular Color\n" "float4 ambi : Ambient; // Material's Ambient Color\n" "float power : SpecularPower; // Material's Specular Power Value\n" "float pOwer : Power; // Synonym\n" "\n" "texture tex_ : Texture; // Material's Texture\n" "\n" "texture tex0 : Texture0; // Texture of Channel 0\n" "texture tex1 : Texture1; // Texture of Channel 1\n" "texture tex2 : Texture2; // Texture of Channel 2\n" "texture tex3 : Texture3; // Texture of Channel 3\n" "texture tex4 : Texture4; // Texture of Channel 4\n" "texture tex5 : Texture5; // Texture of Channel 5\n" "texture tex6 : Texture6; // Texture of Channel 6\n" "texture tex7 : Texture7; // Texture of Channel 7\n" "\n" "float2 texSize : TexelSize; // Texel Size of the last texture parsed in the shader\n" "\n" "float time : Time; // Time elapsed since play event (in sec)\n" "float lastTime : LastTime; // Last simulation time in seconds (in sec)\n" "float elapsedTime : ElapsedTime; // Last delta time (in sec)\n" "\n" "float3 posLight : NearestLight; // Nearest Light's Position\n" "float4x4 matLight : NearestLight; // Nearest Light's World Matrix\n" "float4 colLight : NearestLight; // Nearest Light's Color\n" "float rangeLight : NearestLight; // Nearest Light's Range\n" "int lightCount : NearestLight; // Number of active lights in the scene\n" "\n" "float randValue : Random; // Random number in range [0.0 - 1.0]\n" "float4 glbAmbient : GlobalAmbient;// Global ambient color\n" "\n" "float4x3 bones[1] : Bones; // Bones Matrices Array\n" "float4x3 boNes[1] : Joint; // Synonym\n" "\n" "float3x4 tBones[1] : TBones; // Transposed Bones Matrices Array\n" "float3x4 tBoNes[1] : TJoint; // Synonym\n" "\n" "float4x3 rBones[1] : RBones; // Index of the register where bones matrices will be copied\n" "float4x3 rBoNes[1] : RJoint; // Synonym\n" "\n" "float3x4 rTBones[1] : RTBones; // Index of the register where transposed bones matrices of the skinned character will be copied\n" "float3x4 rTBoNes[1] : RTJoint; // Synonym\n" "\n" "int boneCountPV : BonesPerVertex; // Maximum number of bones per vertex\n" "int boneCOuntPV : JointPerVertex; // Synonym\n" "\n" "\n" "//--- Inversed and Transposed Matrices\n" "\n" "float4x4 tWorld : TWorld; // Transposed Object World Matrix\n" "float4x4 tView : TView; // Transposed View Matrix\n" "float4x4 tProjection : TProjection; // Transposed Projection Matrix\n" "float4x4 tWorldView : TWorldView; // Transposed World x View Matrix\n" "float4x4 tViewProj : TViewProjection; // Transposed View x Proj. Matrix\n" "float4x4 tWvp : TWorldViewProjection;// Transposed World x View x Proj. Matrix\n" "\n" "float4x4 invWorld : Inv_World; // Inversed Object World Matrix\n" "float4x4 invWOrLd : IWorld; // Synonym\n" "float4x4 invWOrld : WorldI; // Synonym\n" "float4x4 invWORld : WorldInverse; // Synonym\n" "\n" "float4x4 invView : Inv_View; // Inversed View Matrix\n" "float4x4 invVIew : IView; // Synonym\n" "float4x4 invVIEw : ViewI; // Synonym\n" "float4x4 invVIEW : ViewInverse; // Synonym\n" "\n" "float4x4 invProjection : Inv_Projection; // Inversed Projection Matrix\n" "float4x4 invPrOjection : IProjection; // Synonym\n" "float4x4 invProJection : ProjectionI; // Synonym\n" "float4x4 invProjEction : ProjectionInverse; // Synonym\n" "\n" "float4x4 invWorldView : Inv_WorldView; // Inversed World x View Matrix\n" "float4x4 invWOrldView : IWorldView; // Synonym\n" "float4x4 invWoRldView : WorldViewI; // Synonym\n" "float4x4 invWorLdView : WorldViewInverse; // Synonym\n" "\n" "float4x4 invVIewProj : Inv_ViewProjection; // Inversed View x Proj. Matrix\n" "float4x4 invViEwProj : IViewProjection; // Synonym\n" "float4x4 invVieWProj : ViewProjectionI; // Synonym\n" "float4x4 invViewProj : ViewProjectionInverse; // Synonym\n" "\n" "float4x4 invWvp : Inv_WorldViewProjection; // Inversed World x View x Proj. Matrix\n" "float4x4 invWVp : IWorldViewProjection; // Synonym\n" "float4x4 invWvP : WorldViewProjectionI; // Synonym\n" "float4x4 invWVP : WorldViewProjectionInverse; // Synonym\n" "\n" "float4x4 invTWorld : Inv_TWorld; // Transposed Inversed Object World Matrix\n" "float4x4 invTWOrLd : ITWorld; // Synonym\n" "float4x4 invTWOrld : WorldIT; // Synonym\n" "float4x4 invTWORld : WorldInverseTranspose; // Synonym\n" "\n" "float4x4 invTView : Inv_TView; // Transposed Inversed View Matrix\n" "float4x4 invTVIew : ITView; // Synonym\n" "float4x4 invTViEw : ViewIT; // Synonym\n" "float4x4 invTVieW : ViewInverseTranspose; // Synonym\n" "\n" "float4x4 invTPrOjection: Inv_TProjection; // Transposed Inversed Projection Matrix\n" "float4x4 invTProJection: ITProjection; // Synonym\n" "float4x4 invTProjEction: ProjectionIT; // Synonym\n" "float4x4 invTProjeCtion: ProjectionInverseTranspose;// Synonym\n" "\n" "float4x4 invTWorldView : Inv_TWorldView; // Transposed Inversed World x View Matrix\n" "float4x4 invTWOrLdView : ITWorldView; // Synonym\n" "float4x4 invTWOrldView : WorldViewIT; // Synonym\n" "float4x4 invTWORldView : WorldViewInverseTranspose;// Synonym\n" "\n" "float4x4 invTViewProj : Inv_TViewProjection; // Transposed Inversed View x Proj. Matrix\n" "float4x4 invTVieWProj : ITViewProjection; // Synonym\n" "float4x4 invTViEwProj : ViewProjectionIT; // Synonym\n" "float4x4 invTViewPrOj : ViewProjectionInverseTranspose;// Synonym\n" "\n" "float4x4 invTWvp : Inv_TWorldViewProjection; // Transposed Inversed World x View x Proj. Matrix\n" "float4x4 invTWVp : ITWorldViewProjection; // Synonym\n" "float4x4 invTWvP : WorldViewProjectionIT; // Synonym\n" "float4x4 invTWVP : WorldViewProjectionInverseTranspose;// Synonym\n" "\n" "\n" "//--- Available Annotations\n" "\n" "float3 entPos ; // Exposed as a 3D Entity\n" "float3 entPOs ; // Synonym\n" "float3 entPoS ; // Synonym\n" "\n" "float3 litPos ; // Exposed as a Light\n" "float3 camPOs ; // Exposed as a Camera\n" "\n" "float4 pos4 ; // Exposed as a 4D vector\n" "\n" "float2 texSIze ; // Previous texture's texel size\n" "\n" "float3 localCamPos : CamPos ; // Camera's Position in Local Space\n" "\n" "float lightRange : NearestLight ;// Range of the 3th nearest light\n" "float3 lightPos : NearestLight ; // Position of the first light given by the 3D engine\n" "float4 lightCol : NearestLight ; // Color of the nearest light, of green if no light exist\n" "\n" "texture myTexture ; // Get texture named \"brick\"\n" "texture myTExture ; // Load texture \"images/brick.jpg\"\n" "\n" "texture myTeXture <\n" " string Function=\"WoodFct\"; // Call function WoodFct() to build the texture\n" " string ResourceType=\"3D\"; // Procedural texture type\n" " string Target=\"tx_1_0\"; // Procedural texture profile\n" " int Width=64; // Procedural texture width\n" " int Height=64; // Procedural texture height\n" " int Depth=64; // Procedural texture depth\n" " float4 Dimensions={64,64,64,0};// Procedural texture dimensions\n" " string Format=\"A8R8G8B8\"; // Procedural texture format\n" " int MipLevels=0; // Procedural texture mipmap levels\n" ">;\n" "\n" "float myValue < float UIMin=5; float UIMax=10;>; // Exposed as a float slider\n" "\n" "technique t <\n" " bool NeedTangentSpace = true; // Force tangent space to be built\n" " bool NeedColorAndNormal= true; // Send Color and Normals to the stream\n" ">\n" "{\n" " pass p\n" " {\n" " }\n" "}\n" "\n" "#endif\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" "static const float4x4 id4x4 = {\n" " {1, 0, 0, 0},\n" " {0, 1, 0, 0},\n" " {0, 0, 1, 0},\n" " {0, 0, 0, 1}\n" "};\n" "\n" "technique Default\n" "{\n" " pass Restore\n" " {\n" " //---------------------------------------------------------------------\n" " // Transform states\n" " // WorldTransform, ViewTransform, ProjectionTransform are automatically\n" " // set from within Virtools 3d engine.\n" " //---------------------------------------------------------------------\n" "\n" #ifndef _XBOX " //---------------------------------------------------------------------\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] = {0, 0, 0, 0};\n" " LightAttenuation0[0] = 0;\n" " LightAttenuation1[0] = 0;\n" " LightAttenuation2[0] = 0;\n" " LightDiffuse[0] = {0, 0, 0, 0};\n" " LightDirection[0] = {0, 0, 1};\n" " LightFalloff[0] = 1.0;\n" " LightPhi[0] = 0;\n" " LightPosition[0] = {0, 0, 0};\n" " LightRange[0] = 0;\n" " LightSpecular[0] = {0, 0, 0};\n" " LightTheta[0] = 0;\n" " LightType[0] = DIRECTIONAL;\n" "\n" " //---------------------------------------------------------------------\n" " // Material states\n" " //---------------------------------------------------------------------\n" " MaterialAmbient = {0, 0, 0, 0};\n" " MaterialDiffuse = {0, 0, 0, 0};\n" " MaterialEmissive = {0, 0, 0, 0};\n" " MaterialPower = 0;\n" " MaterialSpecular = {0, 0, 0, 0};\n" "\n" " //---------------------------------------------------------------------\n" " // Renderstates/Vertex Pipeline\n" " //---------------------------------------------------------------------\n" " Ambient = {0, 0, 0, 0};\n" " AmbientMaterialSource = MATERIAL;\n" " Clipping = false;\n" #endif " ClipPlaneEnable = 0;\n" #ifndef _XBOX " ColorVertex = false;\n" #endif " CullMode = CCW;\n" #ifndef _XBOX " DiffuseMaterialSource = COLOR1;\n" " EmissiveMaterialSource = MATERIAL;\n" " FogColor = {0, 0, 0 ,0};\n" " FogDensity = 1.0;\n" " FogEnable = false;\n" " FogEnd = 1.0;\n" " FogStart = 0;\n" " FogTableMode = NONE;\n" " FogVertexMode = NONE;\n" " IndexedVertexBlendEnable = false;\n" " Lighting = true;\n" " LocalViewer = true;\n" #endif " MultiSampleAntialias = true;\n" " MultiSampleMask = 0xFFFFFFFF;\n" #ifndef _XBOX " NormalizeNormals = false;\n" " PatchSegments = 0;\n" " PointScale_A = 1.0;\n" " PointScale_B = 0;\n" " PointScale_C = 0;\n" " PointScaleEnable = false;\n" #endif " PointSize = 1.0;\n" " PointSize_Min = 1.0;\n" " PointSize_Max = 64.0;\n" " PointSpriteEnable = false;\n" #ifndef _XBOX " RangeFogEnable = 0;\n" " SpecularEnable = false;\n" " SpecularMaterialSource = COLOR2;\n" " TweenFactor = 0;\n" " VertexBlend = DISABLE;\n" #endif "\n" " //---------------------------------------------------------------------\n" " // Renderstates/Pixel Pipeline\n" " //---------------------------------------------------------------------\n" " AlphaBlendEnable = false;\n" " AlphaFunc = ALWAYS;\n" " AlphaRef = 0;\n" " AlphaTestEnable = false;\n" " BlendOp = ADD;\n" " ColorWriteEnable = RED | GREEN | BLUE | ALPHA;\n" " DepthBias = 0;\n" " DestBlend = ZERO;\n" #ifndef _XBOX " DitherEnable = false;\n" #endif " FillMode = SOLID;\n" #ifndef _XBOX " LastPixel = true;\n" " ShadeMode = GOURAUD;\n" #endif " 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" #ifndef _XBOX " TextureFactor = 0xFFFFFFFF;\n" #endif " Wrap0 = 0;\n" " Wrap1 = 0;\n" " Wrap2 = 0;\n" " Wrap3 = 0;\n" " Wrap4 = 0;\n" " Wrap5 = 0;\n" " Wrap6 = 0;\n" " Wrap7 = 0;\n" " Wrap8 = 0;\n" " Wrap9 = 0;\n" " Wrap10 = 0;\n" " Wrap11 = 0;\n" " Wrap12 = 0;\n" " Wrap13 = 0;\n" " Wrap14 = 0;\n" " Wrap15 = 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] = {0, 0, 0, 0};\n" " MagFilter[0] = LINEAR;\n" " MaxAnisotropy[0] = 1;\n" " MaxMipLevel[0] = 0;\n" " MinFilter[0] = LINEAR;\n" " MipFilter[0] = POINT;\n" " MipMapLodBias[0] = 0;\n" #ifndef _XBOX " SRGBTexture[0] = 0;\n" #endif "\n" " //---------------------------------------------------------------------\n" " // Shaders\n" " // PixelShaderConstants and VertexShaderConstants are unchanged\n" " //---------------------------------------------------------------------\n" " VertexShader = NULL;\n" " PixelShader = NULL;\n" "\n" " //---------------------------------------------------------------------\n" " // Texture states/Textures\n" " //---------------------------------------------------------------------\n" " Texture[0] = NULL;\n" " Texture[1] = NULL;\n" " Texture[2] = NULL;\n" " Texture[3] = NULL;\n" " Texture[4] = NULL;\n" " Texture[5] = NULL;\n" " Texture[6] = NULL;\n" " Texture[7] = NULL;\n" "\n" #ifndef _XBOX " //---------------------------------------------------------------------\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;\n" " BumpEnvLOffset[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" " AlphaOp[4] = DISABLE;\n" " ColorOp[4] = DISABLE;\n" "\n" " //---------------------------------------------------------------------\n" " // Texture states/Texture coordinates\n" " //---------------------------------------------------------------------\n" " TexCoordIndex[0] = 0;\n" " TextureTransformFlags[0] = DISABLE;\n" " TextureTransform[0] = ;\n" " TexCoordIndex[1] = 1;\n" " TextureTransformFlags[1] = DISABLE;\n" " TextureTransform[1] = ;\n" " TexCoordIndex[2] = 2;\n" " TextureTransformFlags[2] = DISABLE;\n" " TextureTransform[2] = ;\n" " TexCoordIndex[3] = 3;\n" " TextureTransformFlags[3] = DISABLE;\n" " TextureTransform[3] = ;\n" " TexCoordIndex[4] = 4;\n" " TextureTransformFlags[4] = DISABLE;\n" " TextureTransform[4] = ;\n" " TexCoordIndex[5] = 5;\n" " TextureTransformFlags[5] = DISABLE;\n" " TextureTransform[5] = ;\n" " TexCoordIndex[6] = 6;\n" " TextureTransformFlags[6] = DISABLE;\n" " TextureTransform[6] = ;\n" " TexCoordIndex[7] = 7;\n" " TextureTransformFlags[7] = DISABLE;\n" " TextureTransform[7] = ;\n" #endif " }\n" "}\n" ;