Revision: 778
http://python-ogre.svn.sourceforge.net/python-ogre/?rev=778&view=rev
Author: andy_miller
Date: 2008-10-28 08:28:29 +0000 (Tue, 28 Oct 2008)
Log Message:
-----------
Updated Hydrax demo to version 0.4 (and media)
Modified Paths:
--------------
trunk/python-ogre/demos/hydrax/Demo_Hydrax01.py
trunk/python-ogre/demos/hydrax/media/materials/scripts/SkyBox.material
trunk/python-ogre/demos/hydrax/media/packs/SkyBoxes.zip
Added Paths:
-----------
trunk/python-ogre/demos/hydrax/media/Hydrax/GodRaysSun.png
trunk/python-ogre/demos/hydrax/media/Hydrax/HydraxDemo.hdx
trunk/python-ogre/demos/hydrax/media/Hydrax/UnderwaterDistortion.jpg
trunk/python-ogre/demos/hydrax/media/materials/programs/Island.cg
trunk/python-ogre/demos/hydrax/media/materials/programs/Palm.cg
trunk/python-ogre/demos/hydrax/media/materials/scripts/Island.cfg
trunk/python-ogre/demos/hydrax/media/materials/scripts/Island.material
trunk/python-ogre/demos/hydrax/media/materials/scripts/Palm.material
trunk/python-ogre/demos/hydrax/media/materials/textures/Island.png
trunk/python-ogre/demos/hydrax/media/materials/textures/Palm.tga
trunk/python-ogre/demos/hydrax/media/materials/textures/Sand.png
trunk/python-ogre/demos/hydrax/media/materials/textures/Sand.tga
trunk/python-ogre/demos/hydrax/media/materials/textures/SandGrass.png
trunk/python-ogre/demos/hydrax/media/materials/textures/SandGrass.tga
trunk/python-ogre/demos/hydrax/media/models/Palm.mesh
Modified: trunk/python-ogre/demos/hydrax/Demo_Hydrax01.py
===================================================================
--- trunk/python-ogre/demos/hydrax/Demo_Hydrax01.py 2008-10-27 12:54:39 UTC (rev 777)
+++ trunk/python-ogre/demos/hydrax/Demo_Hydrax01.py 2008-10-28 08:28:29 UTC (rev 778)
@@ -16,43 +16,24 @@
import SampleFramework as sf
import ogre.addons.hydrax as Hydrax
+import ogre.io.OIS as OIS
-_def_SkyBoxNum = 5
+_def_SkyBoxNum = 3
_def_PGComplexity = 256
mSkyBoxes = [ "Sky/ClubTropicana",
- "Sky/Stormy",
"Sky/EarlyMorning",
- "Sky/Evening",
"Sky/Clouds"]
-mSunPosition = [ogre.Vector3(0,10000,-90000),
- ogre.Vector3(0,10000,-90000)/2.5,
- ogre.Vector3(13000,0,120000)/3,
- ogre.Vector3(-50000,-5000,50000),
- ogre.Vector3(0,0,0)]
+mSunPosition = [ ogre.Vector3(0,10000,0),
+ ogre.Vector3(0,10000,90000),
+ ogre.Vector3(0,10000,0)
+ ]
-mSunColor = [ogre.Vector3(1, 0.9, 0.6)/5,
- ogre.Vector3(0.75, 0.65, 0.45)/2,
+mSunColor = [ogre.Vector3(1, 0.9, 0.6),
ogre.Vector3(1,0.6,0.4),
- ogre.Vector3(1,0.4,0.1),
- ogre.Vector3(0,0,0)]
+ ogre.Vector3(0.45,0.45,0.45)]
-# print dir (Hydrax)
-# print dir( Hydrax.Module)
-# print dir ( Hydrax.Noise)
-mPGOptions = [Hydrax.ProjectedGrid.Options(_def_PGComplexity),
- Hydrax.ProjectedGrid.Options(_def_PGComplexity, 45.5, 7.0, False),
- Hydrax.ProjectedGrid.Options(_def_PGComplexity, 32.5, 7.0, False),
- Hydrax.ProjectedGrid.Options(_def_PGComplexity, 32.5, 7.0, False),
- Hydrax.ProjectedGrid.Options(_def_PGComplexity, 20.0, 7.0, False)]
-
-mPerlinOptions = [ Hydrax.Perlin.Options(8, 0.085, 0.49, 1.4, 1.27),
- Hydrax.Perlin.Options(8, 0.085, 0.49, 1.4, 1.27),
- Hydrax.Perlin.Options(8, 0.085, 0.49, 1.4, 1.27),
- Hydrax.Perlin.Options(8, 0.075, 0.49, 1.4, 1.27),
- Hydrax.Perlin.Options(8, 0.085, 0.49, 1.4, 1.27)]
-
mCurrentSkyBox = 0
## Event handler to add ability to alter subdivision
@@ -66,85 +47,124 @@
self.mKeyBuffer=-1
def frameStarted(self, e):
+ global mCurrentSkyBox
if sf.FrameListener.frameStarted(self, e) == False:
return False
- self.app.hydrax.update(e.timeSinceLastFrame)
-#
-# mKeyboard->capture()
-#
-# if (mKeyboard->isKeyDown(OIS::KC_M) && mKeyBuffer < 0)
+# # Check camera height
+# ogre.RaySceneQuery *raySceneQuery =
+# mSceneMgr.
+# createRayQuery(ogre.Ray(mCamera.getPosition() + ogre.Vector3(0,1000000,0),
+# Vector3.NEGATIVE_UNIT_Y));
+# ogre.RaySceneQueryResult& qryResult = raySceneQuery.execute();
+# ogre.RaySceneQueryResult.iterator i = qryResult.begin();
+# if (i != qryResult.end() && i.worldFragment)
# {
-# mCurrentSkyBox++
-#
-# if(mCurrentSkyBox > (_def_SkyBoxNum-1))
+# if (mCamera.getPosition().y < i.worldFragment.singleIntersection.y + 30)
# {
-# mCurrentSkyBox = 0
+# mCamera.
+# setPosition(mCamera.getPosition().x,
+# i.worldFragment.singleIntersection.y + 30,
+# mCamera.getPosition().z);
# }
+# }
#
-# changeSkyBox()
-#
-# mKeyBuffer = 0.5f
-# }
-#
-# mKeyBuffer -= e.timeSinceLastFrame
-#
+# delete raySceneQuery;
+
+ self.app.hydrax.update(e.timeSinceLastFrame)
+ if self._isToggleKeyDown(OIS.KC_M, 0.5):
+ mCurrentSkyBox+=1
+
+ if mCurrentSkyBox > (_def_SkyBoxNum-1):
+ mCurrentSkyBox = 0
+
+ self.changeSkyBox()
+
return True
def changeSkyBox( self ):
# Change skybox
- self.sceneManager.setSkyBox(true, mSkyBoxes[mCurrentSkyBox], 99999*3, true)
+ self.sceneManager.setSkyBox(True, mSkyBoxes[mCurrentSkyBox], 99999*3, True)
# Update Hydrax sun position and colour
- app.hydrax.setSunPosition(mSunPosition[mCurrentSkyBox])
- app.hydrax.setSunColor(mSunColor[mCurrentSkyBox])
+ self.app.hydrax.setSunPosition(mSunPosition[mCurrentSkyBox])
+ self.app.hydrax.setSunColor(mSunColor[mCurrentSkyBox])
# Update light 0 light position and colour
self.sceneManager.getLight("Light0").setPosition(mSunPosition[mCurrentSkyBox])
self.sceneManager.getLight("Light0").setSpecularColour(mSunColor[mCurrentSkyBox].x,mSunColor[mCurrentSkyBox].y,mSunColor[mCurrentSkyBox].z)
- # Update perlin noise options
- app.hydrax.getModule().getNoise().setOptions(mPerlinOptions[mCurrentSkyBox])
- # Update projected grid options
- app.hydrax.getModule().setOptions(mPGOptions[mCurrentSkyBox])
+
+### Just to locate palmiers with a pseudo-random algoritm
-# ogre.LogManager.getSingleton().logMessage("Skybox " + mSkyBoxes[mCurrentSkyBox] + " selected. ("+Ogre::StringConverter::toString(mCurrentSkyBox+1)+"/"+Ogre::StringConverter::toString(_def_SkyBoxNum)+")")
-
+seed_ = 801;
+def rnd_(min, max):
+ global seed_
+ seed_ += ogre.Math.PI*2.8574 + seed_*(0.3424 - 0.12434 + 0.452345)
+ if (seed_ > 10000000000): seed_ -= 10000000000
+ i= float(ogre.Math.Sin(ogre.Radian(seed_)))
+ k = ((max-min)*abs(i) + min) # this is a float !!!
+ return (k)
+def createPalms(mSceneMgr):
+ NumberOfPalms = 14;
+ mPalmsSceneNode = mSceneMgr.getRootSceneNode().createChildSceneNode();
+ for k in range (NumberOfPalms):
+ RandomPos = ogre.Vector3(rnd_(500,2500),0, rnd_(500,2500))
+ raySceneQuery = mSceneMgr.createRayQuery(ogre.Ray(RandomPos + ogre.Vector3(0,1000000,0), ogre.Vector3().NEGATIVE_UNIT_Y));
+ qryResult = raySceneQuery.execute()
+ for i in qryResult:
+ if (i.worldFragment):
+ if (i.worldFragment.singleIntersection.y>105 or i.worldFragment.singleIntersection.y<20):
+ k-=1
+ continue
+ RandomPos.y = i.worldFragment.singleIntersection.y
+ else:
+ k-=1
+ continue
+
+ mPalmEnt = mSceneMgr.createEntity("Palm"+str(k), "Palm.mesh")
+ mPalmSN = mPalmsSceneNode.createChildSceneNode()
+
+ mPalmSN.rotate(ogre.Vector3(-1,0,rnd_(-0.3,0.3)), ogre.Degree(90));
+ mPalmSN.attachObject(mPalmEnt)
+ Scale = rnd_(50,75)
+ mPalmSN.scale(Scale,Scale,Scale)
+ mPalmSN.setPosition(RandomPos)
+
+
class HydraxApplication(sf.Application):
-
+ def _chooseSceneManager(self):
+ # Create the SceneManager
+ self.sceneManager = self.root.createSceneManager("TerrainSceneManager")
+
def _createScene(self):
sceneManager = self.sceneManager
camera = self.camera
+ sceneManager.setAmbientLight ( ogre.ColourValue(1.0,1.0,1.0 ))
+
# Create the SkyBox
sceneManager.setSkyBox(True, mSkyBoxes[mCurrentSkyBox], 99999*3, True)
# Set some camera params
camera.setFarClipDistance(99999*6)
- camera.setPosition(4897.61,76.8614,4709.9)
- camera.setOrientation(ogre.Quaternion(0.487431, -0.0391184, 0.869485, 0.0697797))
+ camera.setPosition(312.902,206.419,1524.02)
+ camera.setOrientation(ogre.Quaternion(0.998, -0.0121, -0.0608, -0.00074))
+ # Light
+ mLight = sceneManager.createLight("Light0")
+ mLight.setPosition(mSunPosition[mCurrentSkyBox])
+ mLight.setDiffuseColour(1, 1, 1)
+ mLight.setSpecularColour(mSunColor[mCurrentSkyBox].x,
+ mSunColor[mCurrentSkyBox].y,
+ mSunColor[mCurrentSkyBox].z)
+
+
# Create Hydrax object
- self.hydrax = Hydrax.Hydrax(sceneManager, camera)
+ self.hydrax = Hydrax.Hydrax(sceneManager, camera, self.renderWindow.getViewport(0))
- # Set RTT textures quality
- self.hydrax.setRttOptions(
- Hydrax.RttOptions(# Reflection tex quality
- Hydrax.TEX_QUA_1024,
- # Refraction tex quality
- Hydrax.TEX_QUA_1024,
- # Depth tex quality
- Hydrax.TEX_QUA_1024))
-
- # Set components
- self.hydrax.setComponents( Hydrax.HydraxComponent( Hydrax.HYDRAX_COMPONENT_SUN |
- Hydrax.HYDRAX_COMPONENT_FOAM |
- Hydrax.HYDRAX_COMPONENT_DEPTH |
- Hydrax.HYDRAX_COMPONENT_SMOOTH |
- Hydrax.HYDRAX_COMPONENT_CAUSTICS ))
-
# Create our projected grid module
self.noise= Hydrax.Perlin() ## Default options (8, 0.085, 0.49, 1.4, 1.27f)
self.Module = Hydrax.ProjectedGrid(# Hydrax parent pointer
@@ -153,47 +173,34 @@
self.noise,
# Base plane
ogre.Plane(ogre.Vector3(0,1,0), ogre.Vector3(0,0,0)),
+ Hydrax.MaterialManager.NM_VERTEX,
# Projected grid options (Can be updated each frame . setOptions(...))
- Hydrax.ProjectedGrid.Options(_def_PGComplexity ))
+ Hydrax.ProjectedGrid.Options(264 ))
# Set our module
self.hydrax.setModule(self.Module)
- # Set our shader mode
- self.hydrax.setShaderMode(Hydrax.MaterialManager.SM_HLSL)
+ # Load all parameters from config file
+ # Remarks: The config file must be in Hydrax resource group.
+ # All parameters can be set/updated directly by code(Like previous versions),
+ # but due to the high number of customizable parameters, Hydrax 0.4 allows save/load config files.
+ self.hydrax.loadCfg("HydraxDemo.hdx");
# Create water
self.hydrax.create()
+
+ # Load island
+ sceneManager.setWorldGeometry("Island.cfg")
+
+ # Add our hydrax depth technique to island material
+ # (Because the terrain mesh is not an ogre.Entity)
+ self.hydrax.getMaterialManager().addDepthTechnique(
+ ogre.MaterialManager.getSingleton().getByName("Island").createTechnique())
- # Adjust some options
- self.hydrax.setPosition(ogre.Vector3(0,0,0))
- self.hydrax.setPlanesError(37.5)
- self.hydrax.setDepthLimit(110)
- self.hydrax.setSunPosition(mSunPosition[mCurrentSkyBox])
- self.hydrax.setSunColor(mSunColor[mCurrentSkyBox])
- self.hydrax.setNormalDistortion(0.025)
- self.hydrax.setDepthColor(ogre.Vector3(0.04,0.135,0.185))
- self.hydrax.setSmoothPower(5)
- self.hydrax.setCausticsScale(12)
- self.hydrax.setGlobalTransparency(0.1)
- self.hydrax.setFullReflectionDistance(99999997952.0)
- self.hydrax.setGlobalTransparency(0)
- self.hydrax.setPolygonMode(0)
+ # Create palmiers
+ createPalms(sceneManager );
- # Lights
- sceneManager.setAmbientLight(ogre.ColourValue(1, 1, 1))
- Light = sceneManager.createLight("Light0")
- Light.setPosition(mSunPosition[mCurrentSkyBox])
- Light.setDiffuseColour(1, 1, 1)
- Light.setSpecularColour(mSunColor[mCurrentSkyBox].x,mSunColor[mCurrentSkyBox].y,mSunColor[mCurrentSkyBox].z)
- # Island
- IslandEntity = sceneManager.createEntity("Island", "Island.mesh")
- IslandEntity.setMaterialName("Examples/OffsetMapping/Specular")
- IslandSceneNode = sceneManager.getRootSceneNode().createChildSceneNode(ogre.Vector3(5000, -175, 5000))
- IslandSceneNode.setScale(23, 13.5, 23)
- IslandSceneNode.attachObject(IslandEntity)
-
def _createFrameListener(self):
self.frameListener = HydraxListener(self.renderWindow, self.camera, self.sceneManager, self)
self.root.addFrameListener(self.frameListener)
Added: trunk/python-ogre/demos/hydrax/media/Hydrax/GodRaysSun.png
===================================================================
(Binary files differ)
Property changes on: trunk/python-ogre/demos/hydrax/media/Hydrax/GodRaysSun.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/python-ogre/demos/hydrax/media/Hydrax/HydraxDemo.hdx
===================================================================
--- trunk/python-ogre/demos/hydrax/media/Hydrax/HydraxDemo.hdx (rev 0)
+++ trunk/python-ogre/demos/hydrax/media/Hydrax/HydraxDemo.hdx 2008-10-28 08:28:29 UTC (rev 778)
@@ -0,0 +1,78 @@
+#Hydrax cfg file.
+
+#Hydrax version field
+HydraxVersion=0.4.0
+
+#Main options field
+<vector3>Position=-5000x100x-5000
+<float>PlanesError=10.5
+#Shader mode: 0=HLSL, 1=CG, 2=GLSL
+<int>ShaderMode=1
+<float>FullReflectionDistance=1e+011
+<float>GlobalTransparency=0
+<float>NormalDistortion=0.075
+<vector3>WaterColor=0.139765x0.359464x0.425373
+
+#Components field
+Components=Sun|Foam|Depth|Smooth|Caustics|Underwater|UnderwaterReflections|UnderwaterGodRays
+
+#Sun parameters
+<vector3>SunPosition=0x10000x0
+<float>SunStrength=1.75
+<float>SunArea=150
+<vector3>SunColor=1x0.9x0.6
+
+#Foam parameters
+<float>FoamMaxDistance=7.5e+007
+<float>FoamScale=0.0075
+<float>FoamStart=0
+<float>FoamTransparency=1
+
+#Depth parameters
+<float>DepthLimit=90
+
+#Smooth transitions parameters
+<float>SmoothPower=5
+
+#Caustics parameters
+<float>CausticsScale=135
+<float>CausticsPower=10.5
+<float>CausticsEnd=0.8
+
+#God rays parameters
+<vector3>GodRaysExposure=0.76x2.46x2.29
+<float>GodRaysIntensity=0.015
+<float>GodRaysSpeed=5
+<int>GodRaysNumberOfRays=100
+<float>GodRaysRaysSize=0.03
+<bool>GodRaysIntersections=false
+
+#Rtt quality field(0x0 = Auto)
+<size>Rtt_Quality_Reflection=0x0
+<size>Rtt_Quality_Refraction=0x0
+<size>Rtt_Quality_Depth=0x0
+<size>Rtt_Quality_URDepth=0x0
+<size>Rtt_Quality_GPUNormalMap=0x0
+
+#Module options
+Module=ProjectedGrid
+
+<float>PG_ChoopyStrength=3.75
+<bool>PG_ChoppyWaves=true
+<int>PG_Complexity=264
+<float>PG_Elevation=50
+<bool>PG_ForceRecalculateGeometry=false
+<bool>PG_Smooth=false
+<float>PG_Strength=35
+
+#Noise options
+Noise=Perlin
+
+<int>Perlin_Octaves=8
+<float>Perlin_Scale=0.085
+<float>Perlin_Falloff=0.49
+<float>Perlin_Animspeed=1.4
+<float>Perlin_Timemulti=1.27
+<float>Perlin_GPU_Strength=2
+<vector3>Perlin_GPU_LODParameters=0.5x50x150000
+
Added: trunk/python-ogre/demos/hydrax/media/Hydrax/UnderwaterDistortion.jpg
===================================================================
(Binary files differ)
Property changes on: trunk/python-ogre/demos/hydrax/media/Hydrax/UnderwaterDistortion.jpg
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/python-ogre/demos/hydrax/media/materials/programs/Island.cg
===================================================================
--- trunk/python-ogre/demos/hydrax/media/materials/programs/Island.cg (rev 0)
+++ trunk/python-ogre/demos/hydrax/media/materials/programs/Island.cg 2008-10-28 08:28:29 UTC (rev 778)
@@ -0,0 +1,129 @@
+// Island CG vertex and fragment program - For Hydrax demo application
+// Xavier Vergu\xEDn Gonz\xE1lez
+
+void main_vp( // In
+ float4 iPosition : POSITION,
+ float3 iNormal : NORMAL,
+ float2 iUv : TEXCOORD0,
+ float3 iTangent : TANGENT0,
+ // Out
+ out float4 oPosition : POSITION,
+ out float2 oUv : TEXCOORD0,
+ out float3 oLightDir : TEXCOORD1,
+ out float3 oEyeDir : TEXCOORD2,
+ out float3 oHalfAngle : TEXCOORD3,
+ out float oYPos : TEXCOORD4,
+ // Uniform
+ uniform float4 uLightPosition,
+ uniform float3 uEyePosition,
+ uniform float4x4 uWorldViewProj,
+ uniform float uTexturesScale)
+{
+ oPosition = mul(uWorldViewProj, iPosition);
+ oUv = iUv*uTexturesScale;
+
+ float3 lightDir = normalize(uLightPosition.xyz - (iPosition.xyz * uLightPosition.w));
+ float3 eyeDir = uEyePosition - iPosition.xyz;
+
+ float3 binormal = cross(iTangent, iNormal);
+ float3x3 rotation = float3x3(iTangent, binormal, iNormal);
+
+ lightDir = normalize(mul(rotation, lightDir));
+ eyeDir = normalize(mul(rotation, eyeDir));
+
+ oLightDir = lightDir;
+ oEyeDir = eyeDir;
+ oHalfAngle = normalize(eyeDir + lightDir);
+
+ oYPos = iPosition.y/200; //[0,1] range
+}
+
+float3 expand(float3 v)
+{
+ return (v - 0.5) * 2;
+}
+
+float3 calculate_colour(sampler2D uNormalHeightMap,
+ sampler2D uDiffuseMap,
+ float2 iUv,
+ float3 iEyeDir,
+ float3 iLightDir,
+ float3 iHalfAngle,
+ float3 uLightDiffuse,
+ float3 uLightSpecular,
+ float4 uScaleBias,
+ float _GreenFade)
+{
+ // get the height using the tex coords
+ float height = tex2D(uNormalHeightMap, iUv).a;
+
+ // calculate displacement
+ float displacement = (height * uScaleBias.x) + uScaleBias.y;
+
+ // calculate the new tex coord to use for normal and diffuse
+ float2 newTexCoord = ((iEyeDir.xy * displacement) + iUv).xy;
+
+ // get the new normal and diffuse values
+ float3 normal = expand(tex2D(uNormalHeightMap, newTexCoord).xyz);
+ float3 diffuse = tex2D(uDiffuseMap, newTexCoord).xyz;
+
+ if (_GreenFade>0.6)
+ {
+ float d = (_GreenFade-0.6)/3;
+ diffuse += float3(-d,d,-d);
+ }
+
+ float3 specular = pow(saturate(dot(normal, iHalfAngle)), 10) * uLightSpecular;
+ float diff = saturate(dot(normal, iLightDir));
+
+ if (diff<0.5)
+ {
+ diff = 0.5;
+ }
+
+ return diffuse * diff * uLightDiffuse + specular;
+}
+
+void main_fp( // In
+ float2 iUv : TEXCOORD0,
+ float3 iLightDir : TEXCOORD1,
+ float3 iEyeDir : TEXCOORD2,
+ float3 iHalfAngle : TEXCOORD3,
+ float iYPos : TEXCOORD4,
+ // Out
+ out float4 oColor : COLOR,
+ // Uniform
+ uniform float3 uLightDiffuse,
+ uniform float3 uLightSpecular,
+ uniform float4 uScaleBias,
+ uniform sampler2D uNormalHeightMap1,
+ uniform sampler2D uDiffuseMap1,
+ uniform sampler2D uNormalHeightMap2,
+ uniform sampler2D uDiffuseMap2)
+{
+ float3 col1 = calculate_colour(uNormalHeightMap1,
+ uDiffuseMap1,
+ iUv,
+ iEyeDir,
+ iLightDir,
+ iHalfAngle,
+ uLightDiffuse,
+ uLightSpecular,
+ uScaleBias,
+ 0);
+
+ float3 col2 = calculate_colour(uNormalHeightMap2,
+ uDiffuseMap2,
+ iUv,
+ iEyeDir,
+ iLightDir,
+ iHalfAngle,
+ uLightDiffuse,
+ uLightSpecular,
+ uScaleBias,
+ iYPos);
+
+ oColor = float4(lerp(col1,col2,iYPos), 1);
+}
+
+
Added: trunk/python-ogre/demos/hydrax/media/materials/programs/Palm.cg
===================================================================
--- trunk/python-ogre/demos/hydrax/media/materials/programs/Palm.cg (rev 0)
+++ trunk/python-ogre/demos/hydrax/media/materials/programs/Palm.cg 2008-10-28 08:28:29 UTC (rev 778)
@@ -0,0 +1,54 @@
+// Palm CG vertex and fragment program - For Hydrax demo application
+// Xavier Vergu\xEDn Gonz\xE1lez
+
+void main_vp( // In
+ float4 iPosition : POSITION,
+ float3 iNormal : NORMAL,
+ float2 iUv : TEXCOORD0,
+ // Out
+ out float4 oPosition : POSITION,
+ out float3 oPosition_ : TEXCOORD0,
+ out float3 oNormal : TEXCOORD1,
+ out float2 oUv : TEXCOORD2,
+ // Uniform
+ uniform float uTime,
+ uniform float4x4 uWorld,
+ uniform float4x4 uWorldViewProj)
+{
+ if(iPosition.z>2)
+ {
+ uTime += mul(uWorld, iPosition-float4(0,0,2,0)).x/100;
+ iPosition.xz += float2(sin(uTime), cos(uTime))*iPosition.z/100;
+ }
+
+ oPosition = mul(uWorldViewProj, iPosition);
+ oPosition_ = iPosition.xyz;
+ oNormal = iNormal;
+ oUv = iUv;
+}
+
+void main_fp( // In
+ float3 iPosition : TEXCOORD0,
+ float3 iNormal : TEXCOORD1,
+ float2 iUv : TEXCOORD2,
+ // Out
+ out float4 oColor : COLOR,
+ // Uniform
+ uniform float3 uEyePosition,
+ uniform float3 uLightPosition,
+ uniform float3 uLightDiffuse,
+ uniform float3 uLightSpecular,
+ uniform sampler2D uTexture)
+{
+ float3 ViewVector = normalize(iPosition-uEyePosition);
+ float3 LightDir = normalize(uLightPosition-iPosition);
+
+ float Specular = dot(iNormal, normalize(ViewVector + LightDir));
+ float4 DiffTexture = tex2D(uTexture, iUv);
+
+ float3 Final = DiffTexture*uLightDiffuse + uLightSpecular*Specular/2*saturate(2/iPosition.z);
+
+ oColor = float4(saturate(Final),DiffTexture.w);
+}
+
+
Added: trunk/python-ogre/demos/hydrax/media/materials/scripts/Island.cfg
===================================================================
--- trunk/python-ogre/demos/hydrax/media/materials/scripts/Island.cfg (rev 0)
+++ trunk/python-ogre/demos/hydrax/media/materials/scripts/Island.cfg 2008-10-28 08:28:29 UTC (rev 778)
@@ -0,0 +1,59 @@
+#number of times the detail texture will tile in a terrain tile
+DetailTile=3
+
+# Heightmap source
+PageSource=Heightmap
+
+# Heightmap-source specific settings
+Heightmap.image=Island.png
+
+# How large is a page of tiles (in vertices)? Must be (2^n)+1
+PageSize=129
+
+# How large is each tile? Must be (2^n)+1 and be smaller than PageSize
+TileSize=17
+
+# The maximum error allowed when determining which LOD to use
+MaxPixelError=3
+
+# The size of a terrain page, in world units
+PageWorldX=3000
+PageWorldZ=3000
+# Maximum height of the terrain
+MaxHeight=200
+
+# Upper LOD limit
+MaxMipMapLevel=1
+
+VertexNormals=yes
+#VertexColors=yes
+#UseTriStrips=yes
+
+# Use vertex program to morph LODs, if available
+#VertexProgramMorph=yes
+
+# The proportional distance range at which the LOD morph starts to take effect
+# This is as a proportion of the distance between the current LODs effective range,
+# and the effective range of the next lower LOD
+#LODMorphStart=0.2
+
+# This following section is for if you want to provide your own terrain shading routine
+# Note that since you define your textures within the material this makes the
+# WorldTexture and DetailTexture settings redundant
+
+# The name of the vertex program parameter you wish to bind the morph LOD factor to
+# this is 0 when there is no adjustment (highest) to 1 when the morph takes it completely
+# to the same position as the next lower LOD
+# USE THIS IF YOU USE HIGH-LEVEL VERTEX PROGRAMS WITH LOD MORPHING
+#MorphLODFactorParamName=morphFactor
+
+# The index of the vertex program parameter you wish to bind the morph LOD factor to
+# this is 0 when there is no adjustment (highest) to 1 when the morph takes it completely
+# to the same position as the next lower LOD
+# USE THIS IF YOU USE ASSEMBLER VERTEX PROGRAMS WITH LOD MORPHING
+#MorphLODFactorParamIndex=4
+
+# The name of the material you will define to shade the terrain
+CustomMaterialName=Island
+
+
Added: trunk/python-ogre/demos/hydrax/media/materials/scripts/Island.material
===================================================================
--- trunk/python-ogre/demos/hydrax/media/materials/scripts/Island.material (rev 0)
+++ trunk/python-ogre/demos/hydrax/media/materials/scripts/Island.material 2008-10-28 08:28:29 UTC (rev 778)
@@ -0,0 +1,66 @@
+// Island CG Material - For Hydrax demo application
+// Xavier Vergu\xEDn Gonz\xE1lez
+
+vertex_program Island/VP cg
+{
+ source Island.cg
+ entry_point main_vp
+ profiles vs_1_1 arbvp1
+}
+
+fragment_program Island/FP cg
+{
+ source Island.cg
+ entry_point main_fp
+ profiles ps_2_0 arbfp1
+}
+
+material Island
+{
+ technique
+ {
+ pass
+ {
+ // Vertex program reference
+ vertex_program_ref Island/VP
+ {
+ param_named_auto uLightPosition light_position_object_space 0
+ param_named_auto uEyePosition camera_position_object_space
+ param_named_auto uWorldViewProj worldviewproj_matrix
+
+ param_named uTexturesScale float 16
+ }
+
+ // Fragment program
+ fragment_program_ref Island/FP
+ {
+ param_named_auto uLightDiffuse light_diffuse_colour 0
+ param_named_auto uLightSpecular light_specular_colour 0
+ // Parallax Height scale and bias
+ param_named uScaleBias float4 0.04 -0.02 1 0
+ }
+
+ texture_unit
+ {
+ texture Sand.tga
+ tex_coord_set 0
+ }
+ texture_unit
+ {
+ texture Sand.png
+ tex_coord_set 1
+ }
+
+ texture_unit
+ {
+ texture SandGrass.tga
+ tex_coord_set 2
+ }
+ texture_unit
+ {
+ texture SandGrass.png
+ tex_coord_set 3
+ }
+ }
+ }
+}
Added: trunk/python-ogre/demos/hydrax/media/materials/scripts/Palm.material
===================================================================
--- trunk/python-ogre/demos/hydrax/media/materials/scripts/Palm.material (rev 0)
+++ trunk/python-ogre/demos/hydrax/media/materials/scripts/Palm.material 2008-10-28 08:28:29 UTC (rev 778)
@@ -0,0 +1,59 @@
+// Palm CG Material - For Hydrax demo application
+// Xavier Vergu\xEDn Gonz\xE1lez
+
+vertex_program Palm/VP cg
+{
+ source Palm.cg
+ entry_point main_vp
+ profiles vs_1_1 arbvp1
+}
+
+fragment_program Palm/FP cg
+{
+ source Palm.cg
+ entry_point main_fp
+ profiles ps_2_0 arbfp1
+}
+
+material Palm
+{
+ technique
+ {
+ pass
+ {
+ lighting off
+
+ cull_software none
+ cull_hardware none
+
+ alpha_rejection greater 79
+
+ depth_check on
+ depth_write on
+
+ // Vertex program reference
+ vertex_program_ref Palm/VP
+ {
+ param_named_auto uTime time 1.05
+ param_named_auto uWorldViewProj worldviewproj_matrix
+ param_named_auto uWorld world_matrix
+ }
+
+ // Fragment program
+ fragment_program_ref Palm/FP
+ {
+ param_named_auto uLightPosition light_position_object_space 0
+ param_named_auto uEyePosition camera_position_object_space
+ param_named_auto uLightDiffuse light_diffuse_colour 0
+ param_named_auto uLightSpecular light_specular_colour 0
+ }
+
+ texture_unit
+ {
+ texture Palm.tga
+ tex_address_mode clamp
+ tex_coord_set 0
+ }
+ }
+ }
+}
Modified: trunk/python-ogre/demos/hydrax/media/materials/scripts/SkyBox.material
===================================================================
--- trunk/python-ogre/demos/hydrax/media/materials/scripts/SkyBox.material 2008-10-27 12:54:39 UTC (rev 777)
+++ trunk/python-ogre/demos/hydrax/media/materials/scripts/SkyBox.material 2008-10-28 08:28:29 UTC (rev 778)
@@ -1,21 +1,3 @@
-material Sky/Evening
-{
- technique
- {
- pass
- {
- lighting off
- depth_write off
-
- texture_unit
- {
- cubic_texture evening.jpg separateUV
- tex_address_mode clamp
- }
- }
- }
-}
-
material Sky/EarlyMorning
{
technique
@@ -34,42 +16,6 @@
}
}
-material Sky/Morning
-{
- technique
- {
- pass
- {
- lighting off
- depth_write off
-
- texture_unit
- {
- cubic_texture morning.jpg separateUV
- tex_address_mode clamp
- }
- }
- }
-}
-
-material Sky/Stormy
-{
- technique
- {
- pass
- {
- lighting off
- depth_write off
-
- texture_unit
- {
- cubic_texture stormy.jpg separateUV
- tex_address_mode clamp
- }
- }
- }
-}
-
material Sky/ClubTropicana
{
technique
Added: trunk/python-ogre/demos/hydrax/media/materials/textures/Island.png
===================================================================
(Binary files differ)
Property changes on: trunk/python-ogre/demos/hydrax/media/materials/textures/Island.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/python-ogre/demos/hydrax/media/materials/textures/Palm.tga
===================================================================
(Binary files differ)
Property changes on: trunk/python-ogre/demos/hydrax/media/materials/textures/Palm.tga
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/python-ogre/demos/hydrax/media/materials/textures/Sand.png
===================================================================
(Binary files differ)
Property changes on: trunk/python-ogre/demos/hydrax/media/materials/textures/Sand.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/python-ogre/demos/hydrax/media/materials/textures/Sand.tga
===================================================================
(Binary files differ)
Property changes on: trunk/python-ogre/demos/hydrax/media/materials/textures/Sand.tga
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/python-ogre/demos/hydrax/media/materials/textures/SandGrass.png
===================================================================
(Binary files differ)
Property changes on: trunk/python-ogre/demos/hydrax/media/materials/textures/SandGrass.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/python-ogre/demos/hydrax/media/materials/textures/SandGrass.tga
===================================================================
(Binary files differ)
Property changes on: trunk/python-ogre/demos/hydrax/media/materials/textures/SandGrass.tga
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/python-ogre/demos/hydrax/media/models/Palm.mesh
===================================================================
(Binary files differ)
Property changes on: trunk/python-ogre/demos/hydrax/media/models/Palm.mesh
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/python-ogre/demos/hydrax/media/packs/SkyBoxes.zip
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|