172 lines
6.2 KiB
C++
172 lines
6.2 KiB
C++
const char g_default[] =
|
|
"// Default CgFX Shader\n"
|
|
"// Restores all default OpenGL renderstates\n"
|
|
"// (c)2004 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"
|
|
"float4x4 World : WORLD; // Object World Matrix\n"
|
|
"float4x4 View : VIEW; // Camera View Matrix\n"
|
|
"float4x4 Projection : PROJECTION; // Projection Matrix\n"
|
|
"float4x4 WorldView : WORLDVIEW; // World x View Matrix\n"
|
|
"float4x4 Wvp : WORLDVIEWPROJECTION; // World x View x Projection Matrix\n"
|
|
"float3 EyePos : EYEPOS; // Position Vector\n"
|
|
"\n"
|
|
"\n"
|
|
"//--- Additional Automatic Parameters\n"
|
|
"float3 Pos : OBJECTPOS; // Object Position\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"
|
|
"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"
|
|
"\n"
|
|
"float Power : POWER; // Material's Power Value\n"
|
|
"\n"
|
|
"float Time : TIME; // Time elapsed since play event (in sec)\n"
|
|
"\n"
|
|
"int PassCount : PASSCOUNT; // Shader's Pass Count\n"
|
|
"int PassIndex : PASSINDEX; // Current Rendering Pass Index\n"
|
|
"\n"
|
|
"//--- Annotations\n"
|
|
"\n"
|
|
"// Texel size of the previously declared texture\n"
|
|
"float2 texSize <bool istexelsize=true;>;\n"
|
|
"\n"
|
|
" const float2 dummy = {1,1} ;\n"
|
|
"\n"
|
|
"\n"
|
|
"// Exposed parameter is not a color but a 4D Vector\n"
|
|
"float4 vect <string type=\"vector\";>;\n"
|
|
"\n"
|
|
"// Exposed parameter is a 3d entity, and variable is the entity's position\n"
|
|
"float3 posEnt <string type=\"entity3d\";>;\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"
|
|
"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"
|
|
"\n"
|
|
"\n"
|
|
"technique Default\n"
|
|
"{\n"
|
|
" pass Restore\n"
|
|
" {\n"
|
|
"\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"
|
|
"\n"
|
|
" LightEnable[0] = false;\n"
|
|
" \n"
|
|
" LightAmbient[0] = float4(0, 0, 0, 0);\n"
|
|
" LightConstantAttenuation[0] = 0.f;\n"
|
|
" LightLinearAttenuation[0] = 0.f;\n"
|
|
" LightQuadraticAttenuation[0] = 0.f;\n"
|
|
" LightDiffuse[0] = float4(0, 0, 0, 0);\n"
|
|
" LightSpecular[0] = float4(0, 0, 0, 0);\n"
|
|
" LightPosition[0] = float4(0, 0, 0, 0);\n"
|
|
" LightSpotDirection[0] = float4(0, 0, 1, 0);\n"
|
|
"\n"
|
|
" //---------------------------------------------------------------------\n"
|
|
" // Material states\n"
|
|
" //---------------------------------------------------------------------\n"
|
|
" MaterialAmbient = float4(0, 0, 0, 0);\n"
|
|
" MaterialDiffuse = float4(0, 0, 0, 0);\n"
|
|
" MaterialEmission = float4(0, 0, 0, 0);\n"
|
|
" MaterialShininess = 0;\n"
|
|
" MaterialSpecular = float4(0, 0, 0, 0);\n"
|
|
"\n"
|
|
" //---------------------------------------------------------------------\n"
|
|
" // Renderstates/Vertex Pipeline\n"
|
|
" //---------------------------------------------------------------------\n"
|
|
" LightingEnable = true;\n"
|
|
" LightModelAmbient = float4(0, 0, 0, 0);\n"
|
|
" ClipPlaneEnable[0] = false;\n"
|
|
" CullFaceEnable = true;\n"
|
|
" FrontFace = CW;\n"
|
|
" FogEnable = false;\n"
|
|
" FogMode = LINEAR;\n"
|
|
" FogDensity = 1.0f;\n"
|
|
" FogStart = 0;\n"
|
|
" FogEnd = 1.0;\n"
|
|
" FogColor = float4(0, 0, 0 ,0);\n"
|
|
" MultisampleEnable = true;\n"
|
|
" NormalizeEnable = false;\n"
|
|
" PointDistanceAttenuation = float3(1.0, 0, 0);\n"
|
|
" PointSize = 1.0;\n"
|
|
" PointSizeMin = 1.0;\n"
|
|
" PointSizeMax = 64.0;\n"
|
|
" PointSpriteEnable = false;\n"
|
|
"\n"
|
|
" //---------------------------------------------------------------------\n"
|
|
" // Renderstates/Pixel Pipeline\n"
|
|
" //---------------------------------------------------------------------\n"
|
|
" BlendEnable = false;\n"
|
|
" BlendFunc = int2(ONE, ZERO);\n"
|
|
" BlendEquation = FUNCADD;\n"
|
|
" AlphaTestEnable = false;\n"
|
|
" AlphaFunc = float2(ALWAYS, 0);\n"
|
|
" DitherEnable = false;\n"
|
|
" PolygonMode = int2(FRONTANDBACK, FILL);\n"
|
|
" PolygonOffset = float2(0.0, 0);\n"
|
|
" ShadeModel = SMOOTH;\n"
|
|
" StencilTestEnable = false;\n"
|
|
" StencilFunc = int3(ALWAYS, 0, 0xFFFFFFFF);\n"
|
|
" StencilOp = int3(KEEP, KEEP, KEEP);\n"
|
|
" StencilMask = 0xFFFFFFFF;\n"
|
|
" DepthMask = true;\n"
|
|
"\n"
|
|
" //---------------------------------------------------------------------\n"
|
|
" // Shaders\n"
|
|
" // PixelShaderConstants and VertexShaderConstants are unchanged\n"
|
|
" //---------------------------------------------------------------------\n"
|
|
" VertexProgram = NULL;\n"
|
|
" FragmentProgram = NULL;\n"
|
|
"\n"
|
|
" }\n"
|
|
"}\n";
|