diff --git a/media/materials/programs/ColourMap2DFragmentProgram.cg b/media/materials/programs/ColourMap2DFragmentProgram.cg deleted file mode 100644 index e28a6011..00000000 --- a/media/materials/programs/ColourMap2DFragmentProgram.cg +++ /dev/null @@ -1,23 +0,0 @@ -struct v2f -{ - float4 Position : POSITION; //in projection space - float4 Color : COLOR; - float4 TexCoordsXY : TEXCOORD0; - float4 TexCoordsYZ : TEXCOORD1; - float4 TexCoordsXZ : TEXCOORD2; - float4 Normal : TEXCOORD3; - float Alpha : TEXCOORD4; -}; - -float4 main(v2f IN, uniform sampler2D colourMap : TEXUNIT0) : COLOR -{ - float3 colourMapValueXY = tex2D(colourMap, IN.TexCoordsXY.xy).rgb * abs(IN.Normal.z); - float3 colourMapValueYZ = tex2D(colourMap, IN.TexCoordsYZ.xy).rgb * abs(IN.Normal.x); - float3 colourMapValueXZ = tex2D(colourMap, IN.TexCoordsXZ.xy).rgb * abs(IN.Normal.y); - - float3 colourMapValue = colourMapValueXY + colourMapValueYZ + colourMapValueXZ; - - //colourMapValue /= 3.0; - - return float4(colourMapValue*IN.Color.rgb,pow(IN.Alpha,0.75)); -} \ No newline at end of file diff --git a/media/materials/programs/ColourMap2DVertexProgram.cg b/media/materials/programs/ColourMap2DVertexProgram.cg deleted file mode 100644 index dae27b48..00000000 --- a/media/materials/programs/ColourMap2DVertexProgram.cg +++ /dev/null @@ -1,145 +0,0 @@ -//NOTE - The code in this file might seem slightly strange. Intuitivy it would -//seem better to get Ogre to pass in an array of lights, rather than passing -//them individually and then building arrays. However, I have had problms with -//this approach (possibly a bug?) - -//See http://www.ogre3d.org/phpBB2/viewtopic.php?t=32391 - -struct a2v -{ - float4 Position : POSITION; //in object space - float3 Normal : NORMAL; - float Alpha : TEXCOORD0; -}; - -struct v2f -{ - float4 Position : POSITION; //in projection space - float4 Color : COLOR; - float4 TexCoordsXY : TEXCOORD0; - float4 TexCoordsYZ : TEXCOORD1; - float4 TexCoordsXZ : TEXCOORD2; - float4 Normal : TEXCOORD3; - float Alpha : TEXCOORD4; -}; - -struct light -{ - float4 position; - float4 diffuseColour; - float4 attenuation; -}; - -v2f doWork(a2v IN, float4x4 world, float4x4 viewProj, float textureScale, float4 ambient, int iNoOfLights, light lights[4]) -{ - v2f OUT; - - OUT.Position = mul(world, IN.Position); - - float3 uVec; - float3 vVec; - - IN.Normal = normalize(IN.Normal); - - /*float absX = abs(IN.Normal.x); - float absY = abs(IN.Normal.y); - float absZ = abs(IN.Normal.z); - if((absZ <= absX) && (absZ <= absY)) - { - //OUT.TexCoords.xy = OUT.Position.xy /textureScale; - uVec = float3(-IN.Normal.y, IN.Normal.x,0); - } - else if((absY <= absX) && (absY <= absZ)) - { - //OUT.TexCoords.xy = OUT.Position.xz /textureScale; - uVec = float3(-IN.Normal.z, 0, IN.Normal.x); - } - else if((absX <= absZ) && (absX <= absY)) - { - // OUT.TexCoords.xy = OUT.Position.yz /textureScale; - uVec = float3(0, -IN.Normal.z, IN.Normal.y); - } - vVec = cross(IN.Normal, uVec); - OUT.TexCoords.x = dot(OUT.Position.xyz, uVec); - OUT.TexCoords.y = dot(OUT.Position.xyz, vVec); */ - - //OUT.TexCoords.xy = OUT.Position.xy * IN.Normal.z * IN.Normal.z + OUT.Position.xz * IN.Normal.y * IN.Normal.y + OUT.Position.yz * IN.Normal.x * IN.Normal.x; - - //OUT.TexCoords.xy /= textureScale; - - OUT.TexCoordsXY.xy = OUT.Position.xy; - OUT.TexCoordsYZ.xy = OUT.Position.yz; - OUT.TexCoordsXZ.xy = OUT.Position.xz; - - OUT.TexCoordsXY.xy /= textureScale; - OUT.TexCoordsYZ.xy /= textureScale; - OUT.TexCoordsXZ.xy /= textureScale; - - OUT.Normal = float4(IN.Normal,0.0); - - - //OUT.TexCoords.xy = OUT.Position.yz /textureScale; - OUT.TexCoordsXY.w = 1; - OUT.TexCoordsYZ.w = 1; - OUT.TexCoordsXZ.w = 1; - - OUT.Color.rgba = float4(0.0,0.0,0.0,1.0); - - for(int lightCt = 0; lightCt < iNoOfLights; lightCt++) - { - float3 L = normalize(lights[lightCt].position.xyz - OUT.Position.xyz); - //Calculate attenuation factor. - float d = distance(lights[lightCt].position.xyz, OUT.Position.xyz); - float attenuationFactor = 1.0 / (lights[lightCt].attenuation.y + lights[lightCt].attenuation.z * d + lights[lightCt].attenuation.w * d * d); - // Calculate diffuse component - float LdotN = max(dot(L, IN.Normal) , 0); - OUT.Color.rgb += lights[lightCt].diffuseColour.rgb * LdotN * attenuationFactor; - } - - OUT.Color.rgb += ambient.rgb; - - OUT.Position = mul(viewProj, OUT.Position); - - OUT.Alpha = IN.Alpha; - - return OUT; -} - -v2f OneLight(a2v IN,uniform float4x4 world, uniform float4x4 viewProj, uniform float textureScale, uniform float4 ambient, uniform light light0) -{ - light lights[4]; - lights[0] = light0; - - return doWork(IN, world, viewProj, textureScale, ambient, 1, lights); -} - -v2f TwoLights(a2v IN,uniform float4x4 world, uniform float4x4 viewProj, uniform float textureScale, uniform float4 ambient, uniform light light0, uniform light light1) -{ - light lights[4]; - lights[0] = light0; - lights[1] = light1; - - return doWork(IN, world, viewProj, textureScale, ambient, 2, lights); -} - -v2f ThreeLights(a2v IN,uniform float4x4 world, uniform float4x4 viewProj, uniform float textureScale, uniform float4 ambient, uniform light light0, uniform light light1, uniform light light2) -{ - light lights[4]; - lights[0] = light0; - lights[1] = light1; - lights[2] = light2; - - return doWork(IN, world, viewProj, textureScale, ambient, 3, lights); -} - -v2f FourLights(a2v IN,uniform float4x4 world, uniform float4x4 viewProj, uniform float textureScale, uniform float4 ambient, uniform light light0, uniform light light1, uniform light light2, uniform light light3) -{ - light lights[4]; - lights[0] = light0; - lights[1] = light1; - lights[2] = light2; - lights[3] = light3; - - return doWork(IN, world, viewProj, textureScale, ambient, 4, lights); -} - diff --git a/media/materials/programs/ColourMap3DFragmentProgram.cg b/media/materials/programs/ColourMap3DFragmentProgram.cg deleted file mode 100644 index 0e89e3b2..00000000 --- a/media/materials/programs/ColourMap3DFragmentProgram.cg +++ /dev/null @@ -1,28 +0,0 @@ -struct a2v -{ - float4 Position : POSITION; //in object space - float3 Normal : NORMAL; -}; - -struct v2f -{ - float4 Position : POSITION; //in projection space - float4 Color : COLOR; - float4 TexCoords : TEXCOORD0; -}; - -float4 main(v2f IN, uniform sampler3D colourMap : TEXUNIT0) : COLOR -{ - - float3 colourMapValue = tex3D(colourMap, IN.TexCoords.xyz).rgb; - - - - return float4(colourMapValue*IN.Color.rgb, 1.0); -} - -/*float4 main(v2f IN, uniform sampler3D detailTexture : TEXUNIT0) : COLOR -{ - float3 detailColor = tex3D(detailTexture, IN.TexCoords.xyz).rgb; - return float4(detailColor * IN.Color.rgb, 1.0); -} */ \ No newline at end of file diff --git a/media/materials/programs/ColourMap3DVertexProgram.cg b/media/materials/programs/ColourMap3DVertexProgram.cg deleted file mode 100644 index fec6a7cd..00000000 --- a/media/materials/programs/ColourMap3DVertexProgram.cg +++ /dev/null @@ -1,94 +0,0 @@ -//NOTE - The code in this file might seem slightly strange. Intuitivy it would -//seem better to get Ogre to pass in an array of lights, rather than passing -//them individually and then building arrays. However, I have had problms with -//this approach (possibly a bug?) - -//See http://www.ogre3d.org/phpBB2/viewtopic.php?t=32391 - -struct a2v -{ - float4 Position : POSITION; //in object space - float3 Normal : NORMAL; -}; - -struct v2f -{ - float4 Position : POSITION; //in projection space - float4 Color : COLOR; - float4 TexCoords : TEXCOORD0; -}; - -struct light -{ - float4 position; - float4 diffuseColour; - float4 attenuation; -}; - -v2f doWork(a2v IN, float4x4 world, float4x4 viewProj, float textureScale, uniform float4 ambient, int iNoOfLights, light lights[4]) -{ - v2f OUT; - - OUT.Position = mul(world, IN.Position); - - OUT.TexCoords.xyz = OUT.Position.xyz /textureScale; - OUT.TexCoords.w = 1; - - OUT.Color.rgba = float4(0.0,0.0,0.0,1.0); - - for(int lightCt = 0; lightCt < iNoOfLights; lightCt++) - { - float3 L = normalize(lights[lightCt].position.xyz - OUT.Position.xyz); - //Calculate attenuation factor. - float d = distance(lights[lightCt].position.xyz, OUT.Position.xyz); - float attenuationFactor = 1.0 / (lights[lightCt].attenuation.y + lights[lightCt].attenuation.z * d + lights[lightCt].attenuation.w * d * d); - // Calculate diffuse component - float LdotN = max(dot(L, IN.Normal) , 0); - OUT.Color.rgb += lights[lightCt].diffuseColour.rgb * LdotN * attenuationFactor; - } - - OUT.Color.rgb += ambient.rgb; - - OUT.Position = mul(viewProj, OUT.Position); - - return OUT; -} - -v2f OneLight(a2v IN,uniform float4x4 world, uniform float4x4 viewProj, uniform float textureScale, uniform float4 ambient, uniform light light0) -{ - light lights[4]; - lights[0] = light0; - - return doWork(IN, world, viewProj, textureScale, ambient, 1, lights); -} - -v2f TwoLights(a2v IN,uniform float4x4 world, uniform float4x4 viewProj, uniform float textureScale, uniform float4 ambient, uniform light light0, uniform light light1) -{ - light lights[4]; - lights[0] = light0; - lights[1] = light1; - - return doWork(IN, world, viewProj, textureScale, ambient, 2, lights); -} - -v2f ThreeLights(a2v IN,uniform float4x4 world, uniform float4x4 viewProj, uniform float textureScale, uniform float4 ambient, uniform light light0, uniform light light1, uniform light light2) -{ - light lights[4]; - lights[0] = light0; - lights[1] = light1; - lights[2] = light2; - - return doWork(IN, world, viewProj, textureScale, ambient, 3, lights); -} - -v2f FourLights(a2v IN,uniform float4x4 world, uniform float4x4 viewProj, uniform float textureScale, uniform float4 ambient, uniform light light0, uniform light light1, uniform light light2, uniform light light3) -{ - light lights[4]; - lights[0] = light0; - lights[1] = light1; - lights[2] = light2; - lights[3] = light3; - - return doWork(IN, world, viewProj, textureScale, ambient, 4, lights); -} - diff --git a/media/materials/programs/ColourMapAndNormalMap3DFragmentProgram.cg b/media/materials/programs/ColourMapAndNormalMap3DFragmentProgram.cg deleted file mode 100644 index ddac3908..00000000 --- a/media/materials/programs/ColourMapAndNormalMap3DFragmentProgram.cg +++ /dev/null @@ -1,48 +0,0 @@ -struct a2v -{ - float4 Position : POSITION; //in object space - float3 Normal : NORMAL; -}; - -struct v2f -{ - float4 Position : POSITION; //in projection space - float4 TexCoords : TEXCOORD0; - float3 LightDirection : TEXCOORD1; - float3 Normal : TEXCOORD2; -}; - -float4 main(v2f IN, uniform sampler3D colourMap : TEXUNIT0, uniform sampler3D normalMap : TEXUNIT1) : COLOR -{ - float3 normalMapValue = tex3D(normalMap, IN.TexCoords.xyz).rgb; - normalMapValue = (normalMapValue - 0.5) * 2; - - float3 finalNormal = normalize(IN.Normal + normalMapValue); - - float3 colourMapValue = tex3D(colourMap, IN.TexCoords.xyz).rgb; - - - // calculate light vector - //float3 Normal = normalize(IN.Color.xyz); - /* float3 Normal = (IN.Color.xyz * 2) - float3(1.0,1.0,1.0); - Normal = normalize(Normal+ normalAdjustment); - float3 lightDirection = normalize(float3(1,1,1)); */ - - // Calculate diffuse component - float diffuse = max(dot(finalNormal, IN.LightDirection) , 0); - - diffuse += 0.3; - - //OUT.Color = ambient + float4(diffuse,diffuse,diffuse,1.0); - - - //return float4(detailColor * IN.Color.rgb, 1.0); - - return float4(colourMapValue*diffuse, 1.0); -} - -/*float4 main(v2f IN, uniform sampler3D detailTexture : TEXUNIT0) : COLOR -{ - float3 detailColor = tex3D(detailTexture, IN.TexCoords.xyz).rgb; - return float4(detailColor * IN.Color.rgb, 1.0); -} */ \ No newline at end of file diff --git a/media/materials/programs/ColourMapAndNormalMap3DVertexProgram.cg b/media/materials/programs/ColourMapAndNormalMap3DVertexProgram.cg deleted file mode 100644 index aaf35764..00000000 --- a/media/materials/programs/ColourMapAndNormalMap3DVertexProgram.cg +++ /dev/null @@ -1,68 +0,0 @@ -struct a2v -{ - float4 Position : POSITION; //in object space - float3 Normal : NORMAL; -}; - -struct v2f -{ - float4 Position : POSITION; //in projection space - float4 TexCoords : TEXCOORD0; - float3 LightDirection : TEXCOORD1; - float3 Normal : TEXCOORD2; -}; - -v2f main(a2v IN,uniform float4x4 world, uniform float4x4 viewProj/*,uniform float4 ambient*/) -{ - v2f OUT; - - OUT.Position = mul(world, IN.Position); - - OUT.TexCoords.xyz = OUT.Position.xyz /8; - OUT.TexCoords.w = 1; - - OUT.Position = mul(viewProj, OUT.Position); - - - - // calculate light vector - /*float3 N = normalize(IN.Normal); - float3 lightPosition = float3(0,0,0); - float3 L = normalize(lightPosition - IN.Position.xyz); */ - - // Calculate diffuse component - //float diffuse = max(dot(N, L) , 0); - - //OUT.Color = ambient + float4(diffuse,diffuse,diffuse,1.0); - - //OUT.Color = float4((IN.Normal + float3(1.0,1.0,1.0)) / 2.0, 0.0); - - OUT.LightDirection = normalize(float3(1.0,1.0,1.0)); - OUT.Normal = IN.Normal; - - return OUT; -} - -/*v2f main(a2v IN,uniform float4x4 worldViewProj,uniform float4 ambient) -{ - v2f OUT; - - OUT.Position = mul(worldViewProj, IN.Position); - - OUT.TexCoords.xyz = IN.Position.xyz / 4; - OUT.TexCoords.w = 1; - - //OUT.Color = float4(1.0,0.0,0.0,1.0); - - // calculate light vector - float3 N = normalize(IN.Normal); - float3 lightPosition = float3(0,0,0); - float3 L = normalize(lightPosition - IN.Position.xyz); - - // Calculate diffuse component - float diffuse = max(dot(N, L) , 0); - - OUT.Color = ambient + float4(diffuse,diffuse,diffuse,1.0); - - return OUT; -}*/ \ No newline at end of file diff --git a/media/materials/programs/NormalFragmentProgram.cg b/media/materials/programs/NormalFragmentProgram.cg deleted file mode 100644 index fe5c6bf7..00000000 --- a/media/materials/programs/NormalFragmentProgram.cg +++ /dev/null @@ -1,10 +0,0 @@ -struct v2f -{ - float4 Position : POSITION; //in projection space - float4 Normal : TEXCOORD0; -}; - -float4 main(v2f IN) : COLOR -{ - return abs(IN.Normal); -} \ No newline at end of file diff --git a/media/materials/programs/NormalVertexProgram.cg b/media/materials/programs/NormalVertexProgram.cg deleted file mode 100644 index 4302e33b..00000000 --- a/media/materials/programs/NormalVertexProgram.cg +++ /dev/null @@ -1,27 +0,0 @@ -struct a2v -{ - float4 Position : POSITION; //in object space - float3 Normal : NORMAL; - float2 Alpha : TEXCOORD0; -}; - -struct v2f -{ - float4 Position : POSITION; //in projection space - float4 Normal : TEXCOORD0; -}; - -v2f main(a2v IN, uniform float4x4 world, uniform float4x4 viewProj) -{ - v2f OUT; - - OUT.Position = mul(world, IN.Position); - - IN.Normal = normalize(IN.Normal); - - OUT.Normal = float4(IN.Normal,0.0); - - OUT.Position = mul(viewProj, OUT.Position); - - return OUT; -} \ No newline at end of file diff --git a/media/materials/programs/TextureAtlasExperimentalFragmentProgram.cg b/media/materials/programs/TextureAtlasExperimentalFragmentProgram.cg deleted file mode 100644 index 75da1077..00000000 --- a/media/materials/programs/TextureAtlasExperimentalFragmentProgram.cg +++ /dev/null @@ -1,82 +0,0 @@ -struct v2f -{ - float4 Position : POSITION; //in projection space - float4 Color : COLOR; - float4 TexCoords : TEXCOORD0; - float4 Normal : TEXCOORD1; - float Alpha : TEXCOORD2; -}; - -float4 main(v2f IN, uniform sampler2D colourMap : TEXUNIT0) : COLOR -{ - float textureScalingFactor = 20.0f; - float textureSize = 512.0f; - float noOfTexturesPerDimension = 4.0; - - //Scale the texture. - IN.TexCoords /= textureScalingFactor; - - //Make sure texture coordinates are in the range 0.0 - 1.0 (or 0.9999? Is this necessary?) - IN.TexCoords.x = frac(IN.TexCoords.x); - IN.TexCoords.y = frac(IN.TexCoords.y); - IN.TexCoords.z = frac(IN.TexCoords.z); - - //Avoid sampling the texels at the edge of each texture. To do this, compress the range of texture coordinates. - //To work with mipmaping we can't use a constant addition of 0.5 - it needs to be dependant of mipmap level? - IN.TexCoords *= (textureSize - 1.0); - IN.TexCoords += 0.5f; - IN.TexCoords /= textureSize; - - //Now scale the texture coordinates to the right range for the texture atlas. - IN.TexCoords /= noOfTexturesPerDimension; - - - //Next we compute the offset of the texture in the texture atlas - float material = floor(IN.Alpha); - float y = floor(material / noOfTexturesPerDimension); - float x = fmod(material,noOfTexturesPerDimension); - float2 offset = float2(x,y); - offset /= noOfTexturesPerDimension; - - - - float3 colourMapValueXY = tex2D(colourMap, IN.TexCoords.xy + offset).rgb * abs(IN.Normal.z); - float3 colourMapValueYZ = tex2D(colourMap, IN.TexCoords.yz + offset).rgb * abs(IN.Normal.x); - float3 colourMapValueXZ = tex2D(colourMap, IN.TexCoords.xz + offset).rgb * abs(IN.Normal.y); - - float3 colourMapValue = colourMapValueXY + colourMapValueYZ + colourMapValueXZ; - - return float4(colourMapValue*IN.Color.rgb,1.0); -} - - -//Curently unused. This function mimics linear texture interpolation by taking several samples when in nearest neighbour sampling mode. -float4 performInterpolatedTextureLookup(sampler2D texture, float2 pos) -{ - float xPos = pos.x * 2048.0; - float xFrac = frac(xPos); - float xMin = xPos - xFrac; - float xMax = xPos + 1.0; - xMin /= 2048.0; - xMax /= 2048.0; - - float yPos = pos.y* 2048.0; - float yFrac = frac(yPos); - float yMin = yPos - yFrac; - float yMax = yPos + 1.0; - yMin /= 2048.0; - yMax /= 2048.0; - - - float4 resultMinXMinY = tex2D(texture, float2(xMin, yMin)); - float4 resultMaxXMinY = tex2D(texture, float2(xMax, yMin)); - - float4 resultMinXMaxY = tex2D(texture, float2(xMin, yMax)); - float4 resultMaxXMaxY = tex2D(texture, float2(xMax, yMax)); - - float4 resultMinY = (resultMinXMinY * (1-xFrac) + resultMaxXMinY * xFrac); - float4 resultMaxY = (resultMinXMaxY * (1-xFrac) + resultMaxXMaxY * xFrac); - - float4 result = (resultMinY * (1-yFrac) + resultMaxY * yFrac); - return result; -} \ No newline at end of file diff --git a/media/materials/programs/TextureAtlasFragmentProgram.cg b/media/materials/programs/TextureAtlasFragmentProgram.cg deleted file mode 100644 index 96949344..00000000 --- a/media/materials/programs/TextureAtlasFragmentProgram.cg +++ /dev/null @@ -1,46 +0,0 @@ -struct v2f -{ - float4 Position : POSITION; //in projection space - float4 Color : COLOR; - float4 TexCoords : TEXCOORD0; - float4 Normal : TEXCOORD1; - float2 Alpha : TEXCOORD2; -}; - -float4 main(v2f IN, uniform sampler2D colourMap : TEXUNIT0) : COLOR -{ - //return float4(IN.Alpha.y, 1.0f-IN.Alpha.y, 0.0f,1.0f); - - float textureScalingFactor = 20.0f; - float textureSize = 512.0f; - float noOfTexturesPerDimension = 4.0; - - //Scale the texture. - IN.TexCoords /= textureScalingFactor; - - //Make sure texture coordinates are in the range 0.0 - 1.0 (or 0.9999? Is this necessary?) - IN.TexCoords.x = frac(IN.TexCoords.x); - IN.TexCoords.y = frac(IN.TexCoords.y); - IN.TexCoords.z = frac(IN.TexCoords.z); - - //Now scale the texture coordinates to the right range for the texture atlas. - IN.TexCoords /= noOfTexturesPerDimension; - - //Next we compute the offset of the texture in the texture atlas - float material = floor(IN.Alpha.x); - float y = floor(material / noOfTexturesPerDimension); - float x = fmod(material,noOfTexturesPerDimension); - float2 offset = float2(x,y); - offset /= noOfTexturesPerDimension; - - //Retrieve the 3 samples - float3 colourMapValueXY = tex2D(colourMap, IN.TexCoords.xy + offset).rgb * abs(IN.Normal.z); - float3 colourMapValueYZ = tex2D(colourMap, IN.TexCoords.yz + offset).rgb * abs(IN.Normal.x); - float3 colourMapValueXZ = tex2D(colourMap, IN.TexCoords.xz + offset).rgb * abs(IN.Normal.y); - - //Blend according to triplanar texturing - float3 colourMapValue = colourMapValueXY + colourMapValueYZ + colourMapValueXZ; - - //Return the result - return float4(colourMapValue*IN.Color.rgb*IN.Alpha.y,IN.Alpha.y); -} \ No newline at end of file diff --git a/media/materials/programs/TextureAtlasVertexProgram.cg b/media/materials/programs/TextureAtlasVertexProgram.cg deleted file mode 100644 index d12fb706..00000000 --- a/media/materials/programs/TextureAtlasVertexProgram.cg +++ /dev/null @@ -1,140 +0,0 @@ -struct a2v -{ - float4 Position : POSITION; //in object space - float3 Normal : NORMAL; - float2 Alpha : TEXCOORD0; -}; - -struct v2f -{ - float4 Position : POSITION; //in projection space - float4 Color : COLOR; - float4 TexCoords : TEXCOORD0; - float4 Normal : TEXCOORD1; - float2 Alpha : TEXCOORD2; -}; - -struct light -{ - float4 position; - float4 diffuseColour; - float4 attenuation; -}; - -v2f doWork(a2v IN, float4x4 world, float4x4 viewProj, float4 ambient, int iNoOfLights, light lights[4]) -{ - v2f OUT; - - OUT.Position = mul(world, IN.Position); - - float3 uVec; - float3 vVec; - - IN.Normal = normalize(IN.Normal); - - /*float absX = abs(IN.Normal.x); - float absY = abs(IN.Normal.y); - float absZ = abs(IN.Normal.z); - if((absZ <= absX) && (absZ <= absY)) - { - //OUT.TexCoords.xy = OUT.Position.xy /textureScale; - uVec = float3(-IN.Normal.y, IN.Normal.x,0); - } - else if((absY <= absX) && (absY <= absZ)) - { - //OUT.TexCoords.xy = OUT.Position.xz /textureScale; - uVec = float3(-IN.Normal.z, 0, IN.Normal.x); - } - else if((absX <= absZ) && (absX <= absY)) - { - // OUT.TexCoords.xy = OUT.Position.yz /textureScale; - uVec = float3(0, -IN.Normal.z, IN.Normal.y); - } - vVec = cross(IN.Normal, uVec); - OUT.TexCoords.x = dot(OUT.Position.xyz, uVec); - OUT.TexCoords.y = dot(OUT.Position.xyz, vVec); */ - - //OUT.TexCoords.xy = OUT.Position.xy * IN.Normal.z * IN.Normal.z + OUT.Position.xz * IN.Normal.y * IN.Normal.y + OUT.Position.yz * IN.Normal.x * IN.Normal.x; - - //OUT.TexCoords.xy /= textureScale; - - /*OUT.TexCoordsXY.xy = OUT.Position.xy; - OUT.TexCoordsYZ.xy = OUT.Position.yz; - OUT.TexCoordsXZ.xy = OUT.Position.xz; - - OUT.TexCoordsXY.xy /= textureScale; - OUT.TexCoordsYZ.xy /= textureScale; - OUT.TexCoordsXZ.xy /= textureScale;*/ - - OUT.Normal = float4(IN.Normal,0.0); - - OUT.TexCoords = OUT.Position; - - - //OUT.TexCoords.xy = OUT.Position.yz /textureScale; - /*OUT.TexCoordsXY.w = 1; - OUT.TexCoordsYZ.w = 1; - OUT.TexCoordsXZ.w = 1;*/ - - OUT.Color.rgba = float4(0.0,0.0,0.0,1.0); - - for(int lightCt = 0; lightCt < iNoOfLights; lightCt++) - { - float3 L = normalize(lights[lightCt].position.xyz - OUT.Position.xyz); - //Calculate attenuation factor. - float d = distance(lights[lightCt].position.xyz, OUT.Position.xyz); - float attenuationFactor = 1.0 / (lights[lightCt].attenuation.y + lights[lightCt].attenuation.z * d + lights[lightCt].attenuation.w * d * d); - // Calculate diffuse component - float LdotN = max(dot(L, IN.Normal) , 0); - OUT.Color.rgb += lights[lightCt].diffuseColour.rgb * LdotN * attenuationFactor; - } - - OUT.Color.rgb += ambient.rgb; - - OUT.Position = mul(viewProj, OUT.Position); - - OUT.Alpha = IN.Alpha; - - //OUT.Material = IN.Material; - - return OUT; -} - -v2f OneLight(a2v IN,uniform float4x4 world, uniform float4x4 viewProj, uniform float4 ambient, uniform light light0) -{ - light lights[4]; - lights[0] = light0; - - return doWork(IN, world, viewProj, ambient, 1, lights); -} - -v2f TwoLights(a2v IN,uniform float4x4 world, uniform float4x4 viewProj, uniform float4 ambient, uniform light light0, uniform light light1) -{ - light lights[4]; - lights[0] = light0; - lights[1] = light1; - - return doWork(IN, world, viewProj, ambient, 2, lights); -} - -v2f ThreeLights(a2v IN,uniform float4x4 world, uniform float4x4 viewProj, uniform float4 ambient, uniform light light0, uniform light light1, uniform light light2) -{ - light lights[4]; - lights[0] = light0; - lights[1] = light1; - lights[2] = light2; - - return doWork(IN, world, viewProj, ambient, 3, lights); -} - -v2f FourLights(a2v IN,uniform float4x4 world, uniform float4x4 viewProj, uniform float4 ambient, uniform light light0, uniform light light1, uniform light light2, uniform light light3) -{ - light lights[4]; - lights[0] = light0; - lights[1] = light1; - lights[2] = light2; - lights[3] = light3; - - return doWork(IN, world, viewProj, ambient, 4, lights); -} - diff --git a/media/materials/programs/Thermite.program b/media/materials/programs/Thermite.program index 865e63c2..0debd71f 100644 --- a/media/materials/programs/Thermite.program +++ b/media/materials/programs/Thermite.program @@ -1,125 +1,13 @@ -vertex_program ColourMap2DOneLightVertexProgram cg -{ - source ColourMap2DVertexProgram.cg - entry_point OneLight - profiles vs_1_1 arbvp1 -} - -vertex_program ColourMap2DTwoLightsVertexProgram cg -{ - source ColourMap2DVertexProgram.cg - entry_point TwoLights - profiles vs_1_1 arbvp1 -} - -vertex_program ColourMap2DThreeLightsVertexProgram cg -{ - source ColourMap2DVertexProgram.cg - entry_point ThreeLights - profiles vs_1_1 arbvp1 -} - -vertex_program ColourMap2DFourLightsVertexProgram cg -{ - source ColourMap2DVertexProgram.cg - entry_point FourLights - profiles vs_1_1 arbvp1 -} - -vertex_program ColourMap3DOneLightVertexProgram cg -{ - source ColourMap3DVertexProgram.cg - entry_point OneLight - profiles vs_1_1 arbvp1 -} - -vertex_program ColourMap3DTwoLightsVertexProgram cg -{ - source ColourMap3DVertexProgram.cg - entry_point TwoLights - profiles vs_1_1 arbvp1 -} - -vertex_program ColourMap3DThreeLightsVertexProgram cg -{ - source ColourMap3DVertexProgram.cg - entry_point ThreeLights - profiles vs_1_1 arbvp1 -} - -vertex_program ColourMap3DFourLightsVertexProgram cg -{ - source ColourMap3DVertexProgram.cg - entry_point FourLights - profiles vs_1_1 arbvp1 -} - -vertex_program ColourMapAndNormalMap3DVertexProgram cg -{ - source ColourMapAndNormalMap3DVertexProgram.cg - entry_point main - profiles vs_1_1 arbvp1 -} - -fragment_program ColourMapAndNormalMap3DFragmentProgram cg -{ - source ColourMapAndNormalMap3DFragmentProgram.cg - entry_point main - profiles ps_1_1 arbfp1 -} - -fragment_program ColourMap2DFragmentProgram cg -{ - source ColourMap2DFragmentProgram.cg - entry_point main - profiles ps_1_1 arbfp1 -} - -vertex_program TextureAtlasOneLightVertexProgram cg -{ - source TextureAtlasVertexProgram.cg - entry_point OneLight - profiles vs_1_1 arbvp1 -} - -fragment_program TextureAtlasFragmentProgram cg -{ - source TextureAtlasFragmentProgram.cg - entry_point main - profiles ps_1_1 arbfp1 -} - -fragment_program TextureAtlasExperimentalFragmentProgram cg -{ - source TextureAtlasExperimentalFragmentProgram.cg - entry_point main - profiles ps_1_1 arbfp1 -} - -vertex_program NormalVertexProgram cg -{ - source NormalVertexProgram.cg - entry_point main - profiles vs_1_1 arbvp1 -} - -fragment_program NormalFragmentProgram cg -{ - source NormalFragmentProgram.cg - entry_point main - profiles ps_1_1 arbfp1 -} - vertex_program SingleOneLightVertexProgram cg { source SingleVertexProgram.cg entry_point OneLight - profiles vs_1_1 arbvp1 + profiles vs_3_0 vs_2_x vs_2_0 vs_1_1 vp40 vp30 vp20 arbvp1 } fragment_program SingleFragmentProgram cg { source SingleFragmentProgram.cg entry_point main - profiles ps_1_1 arbfp1 + profiles ps_3_x ps_3_0 ps_2_x ps_2_0 ps_1_4 ps_1_3 ps_1_2 ps_1_1 fp40 fp30 fp20 arbfp1 } \ No newline at end of file diff --git a/media/materials/scripts/ColourMap2D.material b/media/materials/scripts/ColourMap2D.material deleted file mode 100644 index eb60370c..00000000 --- a/media/materials/scripts/ColourMap2D.material +++ /dev/null @@ -1,101 +0,0 @@ -material ColourMap2DOneLight -{ - technique - { - pass - { - vertex_program_ref ColourMap2DOneLightVertexProgram - { - param_named_auto world world_matrix - param_named_auto viewProj viewproj_matrix - param_named textureScale float 16 - param_named_auto ambient ambient_light_colour - param_named_auto light0.position light_position 0 - param_named_auto light0.diffuseColour light_diffuse_colour 0 - param_named_auto light0.attenuation light_attenuation 0 - } - - fragment_program_ref ColourMap2DFragmentProgram - { - } - } - } -} - -material ColourMap2DTwoLights -{ - technique - { - pass - { - vertex_program_ref ColourMap2DTwoLightsVertexProgram - { - param_named_auto world world_matrix - param_named_auto viewProj viewproj_matrix - param_named textureScale float 16 - param_named_auto ambient ambient_light_colour - param_named_auto light0.position light_position 0 - param_named_auto light0.diffuseColour light_diffuse_colour 0 - param_named_auto light0.attenuation light_attenuation 0 - param_named_auto light1.position light_position 1 - param_named_auto light1.diffuseColour light_diffuse_colour 1 - param_named_auto light1.attenuation light_attenuation 1 - } - } - } -} - -material ColourMap2DThreeLights -{ - technique - { - pass - { - vertex_program_ref ColourMap2DThreeLightsVertexProgram - { - param_named_auto world world_matrix - param_named_auto viewProj viewproj_matrix - param_named textureScale float 16 - param_named_auto ambient ambient_light_colour - param_named_auto light0.position light_position 0 - param_named_auto light0.diffuseColour light_diffuse_colour 0 - param_named_auto light0.attenuation light_attenuation 0 - param_named_auto light1.position light_position 1 - param_named_auto light1.diffuseColour light_diffuse_colour 1 - param_named_auto light1.attenuation light_attenuation 1 - param_named_auto light2.position light_position 2 - param_named_auto light2.diffuseColour light_diffuse_colour 2 - param_named_auto light2.attenuation light_attenuation 2 - } - } - } -} - -material ColourMap2DFourLights -{ - technique - { - pass - { - vertex_program_ref ColourMap2DFourLightsVertexProgram - { - param_named_auto world world_matrix - param_named_auto viewProj viewproj_matrix - param_named textureScale float 16 - param_named_auto ambient ambient_light_colour - param_named_auto light0.position light_position 0 - param_named_auto light0.diffuseColour light_diffuse_colour 0 - param_named_auto light0.attenuation light_attenuation 0 - param_named_auto light1.position light_position 1 - param_named_auto light1.diffuseColour light_diffuse_colour 1 - param_named_auto light1.attenuation light_attenuation 1 - param_named_auto light2.position light_position 2 - param_named_auto light2.diffuseColour light_diffuse_colour 2 - param_named_auto light2.attenuation light_attenuation 2 - param_named_auto light3.position light_position 3 - param_named_auto light3.diffuseColour light_diffuse_colour 3 - param_named_auto light3.attenuation light_attenuation 3 - } - } - } -} \ No newline at end of file diff --git a/media/materials/scripts/ColourMap3D.material b/media/materials/scripts/ColourMap3D.material deleted file mode 100644 index b1583483..00000000 --- a/media/materials/scripts/ColourMap3D.material +++ /dev/null @@ -1,97 +0,0 @@ -material ColourMap3DOneLight -{ - technique - { - pass - { - vertex_program_ref ColourMap3DOneLightVertexProgram - { - param_named_auto world world_matrix - param_named_auto viewProj viewproj_matrix - param_named textureScale float 16 - param_named_auto ambient ambient_light_colour - param_named_auto light0.position light_position 0 - param_named_auto light0.diffuseColour light_diffuse_colour 0 - param_named_auto light0.attenuation light_attenuation 0 - } - } - } -} - -material ColourMap3DTwoLights -{ - technique - { - pass - { - vertex_program_ref ColourMap3DTwoLightsVertexProgram - { - param_named_auto world world_matrix - param_named_auto viewProj viewproj_matrix - param_named textureScale float 16 - param_named_auto ambient ambient_light_colour - param_named_auto light0.position light_position 0 - param_named_auto light0.diffuseColour light_diffuse_colour 0 - param_named_auto light0.attenuation light_attenuation 0 - param_named_auto light1.position light_position 1 - param_named_auto light1.diffuseColour light_diffuse_colour 1 - param_named_auto light1.attenuation light_attenuation 1 - } - } - } -} - -material ColourMap3DThreeLights -{ - technique - { - pass - { - vertex_program_ref ColourMap3DThreeLightsVertexProgram - { - param_named_auto world world_matrix - param_named_auto viewProj viewproj_matrix - param_named textureScale float 16 - param_named_auto ambient ambient_light_colour - param_named_auto light0.position light_position 0 - param_named_auto light0.diffuseColour light_diffuse_colour 0 - param_named_auto light0.attenuation light_attenuation 0 - param_named_auto light1.position light_position 1 - param_named_auto light1.diffuseColour light_diffuse_colour 1 - param_named_auto light1.attenuation light_attenuation 1 - param_named_auto light2.position light_position 2 - param_named_auto light2.diffuseColour light_diffuse_colour 2 - param_named_auto light2.attenuation light_attenuation 2 - } - } - } -} - -material ColourMap3DFourLights -{ - technique - { - pass - { - vertex_program_ref ColourMap3DFourLightsVertexProgram - { - param_named_auto world world_matrix - param_named_auto viewProj viewproj_matrix - param_named textureScale float 16 - param_named_auto ambient ambient_light_colour - param_named_auto light0.position light_position 0 - param_named_auto light0.diffuseColour light_diffuse_colour 0 - param_named_auto light0.attenuation light_attenuation 0 - param_named_auto light1.position light_position 1 - param_named_auto light1.diffuseColour light_diffuse_colour 1 - param_named_auto light1.attenuation light_attenuation 1 - param_named_auto light2.position light_position 2 - param_named_auto light2.diffuseColour light_diffuse_colour 2 - param_named_auto light2.attenuation light_attenuation 2 - param_named_auto light3.position light_position 3 - param_named_auto light3.diffuseColour light_diffuse_colour 3 - param_named_auto light3.attenuation light_attenuation 3 - } - } - } -} \ No newline at end of file diff --git a/media/materials/scripts/ColourMapAndNormalMap3D.material b/media/materials/scripts/ColourMapAndNormalMap3D.material deleted file mode 100644 index cfb194e5..00000000 --- a/media/materials/scripts/ColourMapAndNormalMap3D.material +++ /dev/null @@ -1,19 +0,0 @@ -material ColourMapAndNormalMap3D -{ - technique - { - pass - { - vertex_program_ref ColourMapAndNormalMap3DVertexProgram - { - param_named_auto world world_matrix - param_named_auto viewProj viewproj_matrix - //param_named ambient float4 0.5 0.5 0.5 1 - } - - fragment_program_ref ColourMapAndNormalMap3DFragmentProgram - { - } - } - } -} \ No newline at end of file diff --git a/media/materials/scripts/Normal.material b/media/materials/scripts/Normal.material deleted file mode 100644 index db4e0ab9..00000000 --- a/media/materials/scripts/Normal.material +++ /dev/null @@ -1,18 +0,0 @@ -material NormalMaterial -{ - technique - { - pass - { - vertex_program_ref NormalVertexProgram - { - param_named_auto world world_matrix - param_named_auto viewProj viewproj_matrix - } - - fragment_program_ref NormalFragmentProgram - { - } - } - } -} diff --git a/media/materials/scripts/TextureAtlasExperimental.material b/media/materials/scripts/TextureAtlasExperimental.material deleted file mode 100644 index 9360286f..00000000 --- a/media/materials/scripts/TextureAtlasExperimental.material +++ /dev/null @@ -1,28 +0,0 @@ -material TextureAtlasExperimentalMaterial -{ - technique - { - pass - { - vertex_program_ref TextureAtlasOneLightVertexProgram - { - param_named_auto world world_matrix - param_named_auto viewProj viewproj_matrix - param_named_auto ambient ambient_light_colour - param_named_auto light0.position light_position 0 - param_named_auto light0.diffuseColour light_diffuse_colour 0 - param_named_auto light0.attenuation light_attenuation 0 - } - - fragment_program_ref TextureAtlasExperimentalFragmentProgram - { - } - - texture_unit - { - texture texture_atlas.png 2d 0 - //filtering none - } - } - } -} diff --git a/media/materials/scripts/TextureAtlasMulti.material b/media/materials/scripts/TextureAtlasMulti.material deleted file mode 100644 index 59c63ae2..00000000 --- a/media/materials/scripts/TextureAtlasMulti.material +++ /dev/null @@ -1,38 +0,0 @@ -material TextureAtlasMultiMaterial -{ - technique - { - pass - { - ambient 0.0 0.0 0.0 - diffuse 0.0 0.0 0.0 - - depth_bias -5 -5 - } - - pass - { - vertex_program_ref TextureAtlasOneLightVertexProgram - { - param_named_auto world world_matrix - param_named_auto viewProj viewproj_matrix - param_named_auto ambient ambient_light_colour - param_named_auto light0.position light_position 0 - param_named_auto light0.diffuseColour light_diffuse_colour 0 - param_named_auto light0.attenuation light_attenuation 0 - } - - fragment_program_ref TextureAtlasFragmentProgram - { - } - - texture_unit - { - texture texture_atlas.png - filtering none - } - - scene_blend add - } - } -} diff --git a/media/materials/scripts/TextureAtlasSingle.material b/media/materials/scripts/TextureAtlasSingle.material deleted file mode 100644 index 164a6bc3..00000000 --- a/media/materials/scripts/TextureAtlasSingle.material +++ /dev/null @@ -1,28 +0,0 @@ -material TextureAtlasSingleMaterial -{ - technique - { - pass - { - vertex_program_ref TextureAtlasOneLightVertexProgram - { - param_named_auto world world_matrix - param_named_auto viewProj viewproj_matrix - param_named_auto ambient ambient_light_colour - param_named_auto light0.position light_position 0 - param_named_auto light0.diffuseColour light_diffuse_colour 0 - param_named_auto light0.attenuation light_attenuation 0 - } - - fragment_program_ref TextureAtlasFragmentProgram - { - } - - texture_unit - { - texture texture_atlas.png - filtering none - } - } - } -}