Moving some file around...
This commit is contained in:
parent
ef1d2a15a9
commit
4bf983dce4
@ -72,4 +72,4 @@ INSTALL(TARGETS PolyVoxSceneManager
|
||||
ARCHIVE DESTINATION lib
|
||||
)
|
||||
|
||||
INSTALL(DIRECTORY materials/ DESTINATION ${CMAKE_INSTALL_PREFIX}/bin/materials PATTERN "*.svn*" EXCLUDE)
|
||||
INSTALL(DIRECTORY media/materials/ DESTINATION ${CMAKE_INSTALL_PREFIX}/bin/media/materials PATTERN "*.svn*" EXCLUDE)
|
28
media/materials/programs/ColourMap3DFragmentProgram.cg
Normal file
28
media/materials/programs/ColourMap3DFragmentProgram.cg
Normal file
@ -0,0 +1,28 @@
|
||||
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);
|
||||
} */
|
94
media/materials/programs/ColourMap3DVertexProgram.cg
Normal file
94
media/materials/programs/ColourMap3DVertexProgram.cg
Normal file
@ -0,0 +1,94 @@
|
||||
//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);
|
||||
}
|
||||
|
@ -0,0 +1,48 @@
|
||||
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);
|
||||
} */
|
@ -0,0 +1,68 @@
|
||||
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;
|
||||
}*/
|
76
media/materials/programs/Thermite.program
Normal file
76
media/materials/programs/Thermite.program
Normal file
@ -0,0 +1,76 @@
|
||||
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
|
||||
}
|
101
media/materials/scripts/ColourMap2D.material
Normal file
101
media/materials/scripts/ColourMap2D.material
Normal file
@ -0,0 +1,101 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
97
media/materials/scripts/ColourMap3D.material
Normal file
97
media/materials/scripts/ColourMap3D.material
Normal file
@ -0,0 +1,97 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
19
media/materials/scripts/ColourMapAndNormalMap3D.material
Normal file
19
media/materials/scripts/ColourMapAndNormalMap3D.material
Normal file
@ -0,0 +1,19 @@
|
||||
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
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user