Renamed PolyVoxSceneManager to PolyVox

This commit is contained in:
David Williams 2008-04-15 21:36:37 +00:00
parent fd804f51b4
commit 1d8fc1c544
26 changed files with 9 additions and 745 deletions

View File

@ -34,6 +34,13 @@ SET(INC_FILES
include/VolumeIterator.h include/VolumeIterator.h
) )
FIND_PACKAGE(Boost REQUIRED)
#under windows boost linking is automatic. Under Linux it is specified here. Might need changing for MinGW
#IF(NOT WIN32)
# SET(BOOST_LIBRARIES boost_program_options boost_filesystem)
#ENDIF(NOT WIN32)
ADD_DEFINITIONS(-DPOLYVOX_EXPORT) #Export symbols in the .dll ADD_DEFINITIONS(-DPOLYVOX_EXPORT) #Export symbols in the .dll
#Appends "_d" to the generated library when in debug mode #Appends "_d" to the generated library when in debug mode
@ -45,7 +52,7 @@ SOURCE_GROUP("Sources" FILES ${SRC_FILES})
SOURCE_GROUP("Headers" FILES ${INC_FILES}) SOURCE_GROUP("Headers" FILES ${INC_FILES})
#Tell CMake the paths #Tell CMake the paths
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/include)
#Build #Build
ADD_LIBRARY(PolyVoxSceneManager SHARED ${SRC_FILES} ${INC_FILES}) ADD_LIBRARY(PolyVoxSceneManager SHARED ${SRC_FILES} ${INC_FILES})
@ -57,6 +64,4 @@ INSTALL(TARGETS PolyVoxSceneManager
RUNTIME DESTINATION bin RUNTIME DESTINATION bin
LIBRARY DESTINATION lib LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib ARCHIVE DESTINATION lib
) )
INSTALL(DIRECTORY media/ DESTINATION ${CMAKE_INSTALL_PREFIX}/bin/media PATTERN "*.svn*" EXCLUDE)

View File

@ -1,101 +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 colourMap0 : TEXUNIT0,
uniform sampler2D colourMap1 : TEXUNIT1,
uniform sampler2D colourMap2 : TEXUNIT2,
uniform sampler2D colourMap3 : TEXUNIT3,
uniform sampler2D colourMap4 : TEXUNIT4,
uniform sampler2D colourMap5 : TEXUNIT5,
uniform sampler2D colourMap6 : TEXUNIT6,
uniform sampler2D colourMap7 : TEXUNIT7) : 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;
//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;
float3 colourMapValueXY;
float3 colourMapValueYZ;
float3 colourMapValueXZ;
if(IN.Alpha.x < 1.5)
{
//Retrieve the 3 samples
colourMapValueXY = tex2D(colourMap0, IN.TexCoords.xy).rgb * abs(IN.Normal.z);
colourMapValueYZ = tex2D(colourMap0, IN.TexCoords.yz).rgb * abs(IN.Normal.x);
colourMapValueXZ = tex2D(colourMap0, IN.TexCoords.xz).rgb * abs(IN.Normal.y);
}
else if(IN.Alpha.x < 2.5)
{
//Retrieve the 3 samples
colourMapValueXY = tex2D(colourMap1, IN.TexCoords.xy).rgb * abs(IN.Normal.z);
colourMapValueYZ = tex2D(colourMap1, IN.TexCoords.yz).rgb * abs(IN.Normal.x);
colourMapValueXZ = tex2D(colourMap1, IN.TexCoords.xz).rgb * abs(IN.Normal.y);
}
else if(IN.Alpha.x < 3.5)
{
//Retrieve the 3 samples
colourMapValueXY = tex2D(colourMap2, IN.TexCoords.xy).rgb * abs(IN.Normal.z);
colourMapValueYZ = tex2D(colourMap2, IN.TexCoords.yz).rgb * abs(IN.Normal.x);
colourMapValueXZ = tex2D(colourMap2, IN.TexCoords.xz).rgb * abs(IN.Normal.y);
}
else if(IN.Alpha.x < 4.5)
{
//Retrieve the 3 samples
colourMapValueXY = tex2D(colourMap3, IN.TexCoords.xy).rgb * abs(IN.Normal.z);
colourMapValueYZ = tex2D(colourMap3, IN.TexCoords.yz).rgb * abs(IN.Normal.x);
colourMapValueXZ = tex2D(colourMap3, IN.TexCoords.xz).rgb * abs(IN.Normal.y);
}
else if(IN.Alpha.x < 5.5)
{
//Retrieve the 3 samples
colourMapValueXY = tex2D(colourMap4, IN.TexCoords.xy).rgb * abs(IN.Normal.z);
colourMapValueYZ = tex2D(colourMap4, IN.TexCoords.yz).rgb * abs(IN.Normal.x);
colourMapValueXZ = tex2D(colourMap4, IN.TexCoords.xz).rgb * abs(IN.Normal.y);
}
else if(IN.Alpha.x < 6.5)
{
//Retrieve the 3 samples
colourMapValueXY = tex2D(colourMap5, IN.TexCoords.xy).rgb * abs(IN.Normal.z);
colourMapValueYZ = tex2D(colourMap5, IN.TexCoords.yz).rgb * abs(IN.Normal.x);
colourMapValueXZ = tex2D(colourMap5, IN.TexCoords.xz).rgb * abs(IN.Normal.y);
}
else if(IN.Alpha.x < 7.5)
{
//Retrieve the 3 samples
colourMapValueXY = tex2D(colourMap6, IN.TexCoords.xy).rgb * abs(IN.Normal.z);
colourMapValueYZ = tex2D(colourMap6, IN.TexCoords.yz).rgb * abs(IN.Normal.x);
colourMapValueXZ = tex2D(colourMap6, IN.TexCoords.xz).rgb * abs(IN.Normal.y);
}
else
{
//Retrieve the 3 samples
colourMapValueXY = tex2D(colourMap7, IN.TexCoords.xy).rgb * abs(IN.Normal.z);
colourMapValueYZ = tex2D(colourMap7, IN.TexCoords.yz).rgb * abs(IN.Normal.x);
colourMapValueXZ = tex2D(colourMap7, IN.TexCoords.xz).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);
}

View File

@ -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);
}

View File

@ -1,13 +0,0 @@
vertex_program SingleOneLightVertexProgram cg
{
source SingleVertexProgram.cg
entry_point OneLight
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_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
}

View File

@ -1,72 +0,0 @@
material MultiMaterial
{
technique
{
pass
{
ambient 0.0 0.0 0.0
diffuse 0.0 0.0 0.0
depth_bias -5 -5
}
pass
{
vertex_program_ref SingleOneLightVertexProgram
{
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 SingleFragmentProgram
{
}
texture_unit
{
texture bricks.jpg
}
texture_unit
{
texture castle_wall.png
}
texture_unit
{
texture roof_tiles.png
}
texture_unit
{
texture grass.png
}
texture_unit
{
texture water.png
}
texture_unit
{
texture ground.png
}
texture_unit
{
texture stained_glass.png
}
texture_unit
{
texture wall.png
}
scene_blend add
}
}
}

View File

@ -1,69 +0,0 @@
material SingleMaterial
{
technique
{
pass
{
ambient 0.0 0.0 0.0
diffuse 0.0 0.0 0.0
depth_bias -1 -1
}
pass
{
vertex_program_ref SingleOneLightVertexProgram
{
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 SingleFragmentProgram
{
}
texture_unit
{
texture bricks.jpg
}
texture_unit
{
texture castle_wall.png
}
texture_unit
{
texture roof_tiles.png
}
texture_unit
{
texture grass.png
}
texture_unit
{
texture water.png
}
texture_unit
{
texture ground.png
}
texture_unit
{
texture stained_glass.png
}
texture_unit
{
texture wall.png
}
}
}
}

View File

@ -1,11 +0,0 @@
material BlackMaterial
{
technique
{
pass
{
ambient 0.0 0.0 0.0
diffuse 0.0 0.0 0.0
}
}
}

View File

@ -1,11 +0,0 @@
material BlueMaterial
{
technique
{
pass
{
ambient 0.0 0.0 0.5
diffuse 0.0 0.0 1.0
}
}
}

View File

@ -1,11 +0,0 @@
material CyanMaterial
{
technique
{
pass
{
ambient 0.0 0.5 0.5
diffuse 0.0 1.0 1.0
}
}
}

View File

@ -1,11 +0,0 @@
material GreenMaterial
{
technique
{
pass
{
ambient 0.0 0.5 0.0
diffuse 0.0 1.0 0.0
}
}
}

View File

@ -1,11 +0,0 @@
material PurpleMaterial
{
technique
{
pass
{
ambient 0.5 0.0 0.5
diffuse 1.0 0.0 1.0
}
}
}

View File

@ -1,11 +0,0 @@
material RedMaterial
{
technique
{
pass
{
ambient 0.5 0.0 0.0
diffuse 1.0 0.0 0.0
}
}
}

View File

@ -1,11 +0,0 @@
material WhiteMaterial
{
technique
{
pass
{
ambient 0.5 0.5 0.5
diffuse 1.0 1.0 1.0
}
}
}

View File

@ -1,11 +0,0 @@
material YellowMaterial
{
technique
{
pass
{
ambient 0.5 0.5 0.0
diffuse 1.0 1.0 0.0
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,60 +0,0 @@
material Bullet/Cone
{
// receive_shadows off
technique
{
pass
{
ambient 1 1 1 1
diffuse 1 1 1 1
specular 1 1 1 1 10
texture_unit
{
texture cone.png
tex_address_mode clamp
}
}
}
}
material Bullet/Capsule
{
receive_shadows off
technique
{
pass
{
ambient 1 1 1 1
diffuse 1 1 1 1
specular 1 1 1 1 10
texture_unit
{
texture capsule.png
tex_address_mode clamp
}
}
}
}
material Bullet/Ball
{
receive_shadows off
technique
{
pass
{
ambient 1 1 1 1
diffuse 1 1 1 1
specular 1 1 1 1 10
texture_unit
{
texture ball.png
}
}
}
}

View File

@ -1,42 +0,0 @@
material DT__default__
{
technique
{
pass
{
lighting off
diffuse vertexcolour
}
}
}
material Material/SOLID/TEX/box.jpg/VertCol
{
technique
{
pass
{
diffuse vertexcolour
specular 0.500000 0.500000 0.500000 12.500000
texture_unit
{
texture box.jpg
}
}
}
}
material 1 - Default
{
technique
{
pass
{
diffuse vertexcolour
specular 0.500000 0.500000 0.500000 12.500000
texture_unit
{
texture box.jpg
}
}
}
}

View File

@ -1,120 +0,0 @@
material 23 - Default
{
receive_shadows off
technique
{
pass
{
ambient 0.500000 0.500000 0.500000 1.000000
diffuse 0.470588 0.608627 0.737255 1.000000
specular 0.449020 0.449020 0.449020 1.000000 12.500000
emissive 0.000000 0.000000 0.000000 1.000000
texture_unit
{
texture glass.png
tex_address_mode wrap
filtering trilinear
}
}
}
}
material 19 - Default
{
receive_shadows off
technique
{
pass
{
ambient 0.500000 0.500000 0.500000 1.000000
diffuse 0.470588 0.470588 0.470588 1.000000
specular 0.449020 0.449020 0.449020 1.000000 12.500000
emissive 0.000000 0.000000 0.000000 1.000000
texture_unit
{
texture CB_Skin.png
tex_address_mode wrap
filtering trilinear
}
}
}
}
material 21 - Default
{
receive_shadows off
technique
{
pass
{
ambient 0.500000 0.500000 0.500000 1.000000
diffuse 0.470588 0.470588 0.470588 1.000000
specular 0.449020 0.449020 0.449020 1.000000 12.500000
emissive 0.000000 0.000000 0.000000 1.000000
texture_unit
{
texture Pulley.png
tex_address_mode wrap
filtering trilinear
}
}
}
}
material 14 - Default
{
receive_shadows off
technique
{
pass
{
ambient 0.500000 0.500000 0.500000 1.000000
diffuse 0.470588 0.470588 0.800000 1.000000
specular 0.449020 0.449020 0.449020 1.000000 12.500000
emissive 0.000000 0.000000 0.000000 1.000000
texture_unit
{
texture BugSPIN.png
tex_address_mode wrap
filtering trilinear
}
}
}
}
material 22 - Default
{
receive_shadows off
technique
{
pass
{
ambient 0.500000 0.500000 0.500000 1.000000
diffuse 0.470588 0.470588 0.470588 1.000000
specular 0.449020 0.449020 0.449020 1.000000 12.500000
emissive 0.000000 0.000000 0.000000 1.000000
texture_unit
{
texture Bug_Eng.png
tex_address_mode wrap
filtering trilinear
}
}
}
}
material PAN
{
receive_shadows off
technique
{
pass
{
ambient 0.500000 0.500000 0.500000 1.000000
diffuse 0.800000 0.470588 0.470588 1.000000
specular 0.449020 0.449020 0.449020 1.000000 12.500000
emissive 0.000000 0.000000 0.000000 1.000000
texture_unit
{
texture BUGSPIN.png
tex_address_mode wrap
filtering trilinear
}
}
}
}

View File

@ -1,16 +0,0 @@
material OgreBulletDemos/TargetSights
{
// receive_shadows off
technique
{
pass
{
lighting off
scene_blend alpha_blend
texture_unit
{
texture target.png
}
}
}
}

View File

@ -1,20 +0,0 @@
material Wheel
{
receive_shadows off
technique
{
pass
{
ambient 0.500000 0.500000 0.500000 1.000000
diffuse 0.470588 0.470588 0.470588 1.000000
specular 0.449020 0.449020 0.449020 1.000000 12.500000
emissive 0.000000 0.000000 0.000000 1.000000
texture_unit
{
texture Tire_tex.png
tex_address_mode wrap
filtering trilinear
}
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 478 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB