From: <Hex...@us...> - 2008-06-20 03:02:00
|
Revision: 2451 http://ogreaddons.svn.sourceforge.net/ogreaddons/?rev=2451&view=rev Author: HexiDave Date: 2008-06-19 20:02:06 -0700 (Thu, 19 Jun 2008) Log Message: ----------- Moving old SPT to branch/v1 Added Paths: ----------- trunk/simplepagedterrain/branches/ trunk/simplepagedterrain/branches/v1/ trunk/simplepagedterrain/branches/v1/bin/ trunk/simplepagedterrain/branches/v1/docs/ trunk/simplepagedterrain/branches/v1/libnoise/ trunk/simplepagedterrain/branches/v1/media/ trunk/simplepagedterrain/branches/v1/project/ trunk/simplepagedterrain/branches/v1/source/ Removed Paths: ------------- trunk/simplepagedterrain/bin/ trunk/simplepagedterrain/docs/ trunk/simplepagedterrain/libnoise/ trunk/simplepagedterrain/media/ trunk/simplepagedterrain/project/ trunk/simplepagedterrain/source/ Copied: trunk/simplepagedterrain/branches/v1/bin (from rev 2450, trunk/simplepagedterrain/bin) Copied: trunk/simplepagedterrain/branches/v1/docs (from rev 2450, trunk/simplepagedterrain/docs) Copied: trunk/simplepagedterrain/branches/v1/libnoise (from rev 2450, trunk/simplepagedterrain/libnoise) Copied: trunk/simplepagedterrain/branches/v1/media (from rev 2450, trunk/simplepagedterrain/media) Copied: trunk/simplepagedterrain/branches/v1/project (from rev 2450, trunk/simplepagedterrain/project) Copied: trunk/simplepagedterrain/branches/v1/source (from rev 2450, trunk/simplepagedterrain/source) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Hex...@us...> - 2008-06-20 03:19:32
|
Revision: 2452 http://ogreaddons.svn.sourceforge.net/ogreaddons/?rev=2452&view=rev Author: HexiDave Date: 2008-06-19 20:19:41 -0700 (Thu, 19 Jun 2008) Log Message: ----------- SPT v2 first commit. Has demo pre-compiled with Ogre DLLs in bin/Release Enjoy! Added Paths: ----------- trunk/simplepagedterrain/trunk/ trunk/simplepagedterrain/trunk/bin/ trunk/simplepagedterrain/trunk/bin/Release/ trunk/simplepagedterrain/trunk/bin/Release/OIS.dll trunk/simplepagedterrain/trunk/bin/Release/OgreGUIRenderer.dll trunk/simplepagedterrain/trunk/bin/Release/OgreMain.dll trunk/simplepagedterrain/trunk/bin/Release/Plugin_CgProgramManager.dll trunk/simplepagedterrain/trunk/bin/Release/Plugins.cfg trunk/simplepagedterrain/trunk/bin/Release/RenderSystem_Direct3D9.dll trunk/simplepagedterrain/trunk/bin/Release/SPT2_Demo.exe trunk/simplepagedterrain/trunk/bin/Release/cg.dll trunk/simplepagedterrain/trunk/bin/Release/resources.cfg trunk/simplepagedterrain/trunk/demo/ trunk/simplepagedterrain/trunk/demo/include/ trunk/simplepagedterrain/trunk/demo/include/SPT_Demo.h trunk/simplepagedterrain/trunk/demo/scripts/ trunk/simplepagedterrain/trunk/demo/scripts/SPT2_Demo.sln trunk/simplepagedterrain/trunk/demo/scripts/SPT2_Demo.vcproj trunk/simplepagedterrain/trunk/demo/src/ trunk/simplepagedterrain/trunk/demo/src/SPT_Demo.cpp trunk/simplepagedterrain/trunk/lib/ trunk/simplepagedterrain/trunk/library/ trunk/simplepagedterrain/trunk/library/include/ trunk/simplepagedterrain/trunk/library/include/AtmosphericCubeMap.h trunk/simplepagedterrain/trunk/library/include/CircleDisplacement.h trunk/simplepagedterrain/trunk/library/include/GPULightmapper.h trunk/simplepagedterrain/trunk/library/include/Heightmap.h trunk/simplepagedterrain/trunk/library/include/HeightmapReader.h trunk/simplepagedterrain/trunk/library/include/HeightmapRules.h trunk/simplepagedterrain/trunk/library/include/Lightmapper.h trunk/simplepagedterrain/trunk/library/include/MovableText.h trunk/simplepagedterrain/trunk/library/include/PNGHeightmapReader.h trunk/simplepagedterrain/trunk/library/include/Prerequisites.h trunk/simplepagedterrain/trunk/library/include/QNode.h trunk/simplepagedterrain/trunk/library/include/RAWHeightmapReader.h trunk/simplepagedterrain/trunk/library/include/RectFlatten.h trunk/simplepagedterrain/trunk/library/include/Terrain.h trunk/simplepagedterrain/trunk/library/include/TerrainMesh.h trunk/simplepagedterrain/trunk/library/include/TerrainModifier.h trunk/simplepagedterrain/trunk/library/include/Vec2D.h trunk/simplepagedterrain/trunk/library/include/Vec3D.h trunk/simplepagedterrain/trunk/library/scripts/ trunk/simplepagedterrain/trunk/library/scripts/SPTv2.vcproj trunk/simplepagedterrain/trunk/library/scripts/SPTv2_Library.sln trunk/simplepagedterrain/trunk/library/src/ trunk/simplepagedterrain/trunk/library/src/AtmosphericCubeMap.cpp trunk/simplepagedterrain/trunk/library/src/CircleDisplacement.cpp trunk/simplepagedterrain/trunk/library/src/GPULightmapper.cpp trunk/simplepagedterrain/trunk/library/src/Heightmap.cpp trunk/simplepagedterrain/trunk/library/src/HeightmapReader.cpp trunk/simplepagedterrain/trunk/library/src/HeightmapRules.cpp trunk/simplepagedterrain/trunk/library/src/Lightmapper.cpp trunk/simplepagedterrain/trunk/library/src/MovableText.cpp trunk/simplepagedterrain/trunk/library/src/PNGHeightmapReader.cpp trunk/simplepagedterrain/trunk/library/src/QNode.cpp trunk/simplepagedterrain/trunk/library/src/RAWHeightmapReader.cpp trunk/simplepagedterrain/trunk/library/src/RectFlatten.cpp trunk/simplepagedterrain/trunk/library/src/Terrain.cpp trunk/simplepagedterrain/trunk/library/src/TerrainMesh.cpp trunk/simplepagedterrain/trunk/media/ trunk/simplepagedterrain/trunk/media/materials/ trunk/simplepagedterrain/trunk/media/materials/Highlands.material trunk/simplepagedterrain/trunk/media/materials/Lightmap.hlsl trunk/simplepagedterrain/trunk/media/materials/Lightmap.material trunk/simplepagedterrain/trunk/media/materials/Quad.hlsl trunk/simplepagedterrain/trunk/media/materials/Quad.program trunk/simplepagedterrain/trunk/media/materials/SPT2_Low.program trunk/simplepagedterrain/trunk/media/materials/SPT2_Low.source trunk/simplepagedterrain/trunk/media/materials/SPT2_Medium.program trunk/simplepagedterrain/trunk/media/materials/SPT2_Medium.source trunk/simplepagedterrain/trunk/media/materials/SPT2_Shadow.program trunk/simplepagedterrain/trunk/media/materials/SPT2_Shadow.source trunk/simplepagedterrain/trunk/media/materials/SkySphere.material trunk/simplepagedterrain/trunk/media/materials/SkySphere.source trunk/simplepagedterrain/trunk/media/packs/ trunk/simplepagedterrain/trunk/media/packs/OgreCore.zip trunk/simplepagedterrain/trunk/media/textures/ trunk/simplepagedterrain/trunk/media/textures/047roche.jpg trunk/simplepagedterrain/trunk/media/textures/051roche.jpg trunk/simplepagedterrain/trunk/media/textures/Detail3.jpg trunk/simplepagedterrain/trunk/media/textures/Highlands_Coverage.jpg trunk/simplepagedterrain/trunk/media/textures/Highlands_Height.png trunk/simplepagedterrain/trunk/media/textures/Highlands_Splat.dds trunk/simplepagedterrain/trunk/media/textures/Thumbs.db trunk/simplepagedterrain/trunk/media/textures/detail_splat1.png trunk/simplepagedterrain/trunk/media/textures/herbe_3.jpg trunk/simplepagedterrain/trunk/media/textures/herbe_5.jpg trunk/simplepagedterrain/trunk/media/textures/nature093.jpg trunk/simplepagedterrain/trunk/media/textures/sand_025.jpg Added: trunk/simplepagedterrain/trunk/bin/Release/OIS.dll =================================================================== (Binary files differ) Property changes on: trunk/simplepagedterrain/trunk/bin/Release/OIS.dll ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/simplepagedterrain/trunk/bin/Release/OgreGUIRenderer.dll =================================================================== (Binary files differ) Property changes on: trunk/simplepagedterrain/trunk/bin/Release/OgreGUIRenderer.dll ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/simplepagedterrain/trunk/bin/Release/OgreMain.dll =================================================================== (Binary files differ) Property changes on: trunk/simplepagedterrain/trunk/bin/Release/OgreMain.dll ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/simplepagedterrain/trunk/bin/Release/Plugin_CgProgramManager.dll =================================================================== (Binary files differ) Property changes on: trunk/simplepagedterrain/trunk/bin/Release/Plugin_CgProgramManager.dll ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/simplepagedterrain/trunk/bin/Release/Plugins.cfg =================================================================== --- trunk/simplepagedterrain/trunk/bin/Release/Plugins.cfg (rev 0) +++ trunk/simplepagedterrain/trunk/bin/Release/Plugins.cfg 2008-06-20 03:19:41 UTC (rev 2452) @@ -0,0 +1,11 @@ +# Defines plugins to load + +# Define plugin folder +PluginFolder=. + +# Define plugins +Plugin=RenderSystem_Direct3D9 +#Plugin=RenderSystem_GL +Plugin=Plugin_CgProgramManager + + Property changes on: trunk/simplepagedterrain/trunk/bin/Release/Plugins.cfg ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/simplepagedterrain/trunk/bin/Release/RenderSystem_Direct3D9.dll =================================================================== (Binary files differ) Property changes on: trunk/simplepagedterrain/trunk/bin/Release/RenderSystem_Direct3D9.dll ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/simplepagedterrain/trunk/bin/Release/SPT2_Demo.exe =================================================================== (Binary files differ) Property changes on: trunk/simplepagedterrain/trunk/bin/Release/SPT2_Demo.exe ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/simplepagedterrain/trunk/bin/Release/cg.dll =================================================================== (Binary files differ) Property changes on: trunk/simplepagedterrain/trunk/bin/Release/cg.dll ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/simplepagedterrain/trunk/bin/Release/resources.cfg =================================================================== --- trunk/simplepagedterrain/trunk/bin/Release/resources.cfg (rev 0) +++ trunk/simplepagedterrain/trunk/bin/Release/resources.cfg 2008-06-20 03:19:41 UTC (rev 2452) @@ -0,0 +1,13 @@ +# Resource locations to be added to the 'boostrap' path +# This also contains the minimum you need to use the Ogre example framework +[Bootstrap] +Zip=../../media/packs/OgreCore.zip + +# Resource locations to be added to the default path +[General] +FileSystem=../../media +FileSystem=../../media/materials +FileSystem=../../media/textures +FileSystem=../../PagedGeometry/media/grass +FileSystem=../../PagedGeometry/media/trees +FileSystem=../../PagedGeometry/media/trees2 \ No newline at end of file Property changes on: trunk/simplepagedterrain/trunk/bin/Release/resources.cfg ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/simplepagedterrain/trunk/demo/include/SPT_Demo.h =================================================================== --- trunk/simplepagedterrain/trunk/demo/include/SPT_Demo.h (rev 0) +++ trunk/simplepagedterrain/trunk/demo/include/SPT_Demo.h 2008-06-20 03:19:41 UTC (rev 2452) @@ -0,0 +1,221 @@ +#include "ExampleApplication.h" +#include "Terrain.h" +#include "AtmosphericCubeMap.h" +#include "CircleDisplacement.h" +#include "RectFlatten.h" +#include <Ogre.h> + +using namespace SPT; + +Terrain* gTerrain; + +Light* gSunLight; + + + + +class MyFrameListener : public ExampleFrameListener +{ +protected: + Real mBaseSpeed; + Real mCurrentSpeed; + +public: + MyFrameListener(RenderWindow* win, Camera* cam) + : ExampleFrameListener(win,cam) + { + mBaseSpeed = 400.0f; + mCurrentSpeed = 1.0f; + } + bool frameStarted(const FrameEvent& evt) + { + + if (ExampleFrameListener::frameStarted(evt) == false) + return false; + + + for (size_t k = OIS::KC_1; k <= OIS::KC_9;k++) + { + if (mKeyboard->isKeyDown(OIS::KeyCode(k))) + mCurrentSpeed = (Real(k - OIS::KC_1) + 1.0f) * 2.0f; + } + + if (mKeyboard->isKeyDown(OIS::KC_0)) + mCurrentSpeed = 0.5f; + + mMoveSpeed = mCurrentSpeed * mBaseSpeed; + + + // This is set to update every frame for SPT + gTerrain->onFrameStart(evt.timeSinceLastFrame); + + + if (mKeyboard->isKeyDown(OIS::KC_J) && mTimeUntilNextToggle <= 0) + { + Vector3 vLightDir = Vector3(Math::RangeRandom(-10,10),Math::RangeRandom(-10,-0.1),Math::RangeRandom(-10,10)); + vLightDir.normalise(); + + gTerrain->setLightDirection(vLightDir); + + + mTimeUntilNextToggle = 0.2; + } + + if (mKeyboard->isKeyDown(OIS::KC_L) && mTimeUntilNextToggle <= 0) + { + + AtmosphericCubeMap* pAtm = gTerrain->getAtmosphere(); + pAtm->setHG(-0.96); + pAtm->setSunBrightness(4); + //pAtm->setRaleighCoef(0.02); + pAtm->setMieCoef(0.1); + + gTerrain->setLightDirection(Vector3(0,0,1)); + + mTimeUntilNextToggle = 0.2; + } + + if (mKeyboard->isKeyDown(OIS::KC_K) && mTimeUntilNextToggle <= 0) + { + Ray ray = mCamera->getCameraToViewportRay(0.5,0.5); + + Vector3 vRayPos = Vector3::ZERO; + + if (gTerrain->getRayHeight(ray,vRayPos,true,false)) + { + gTerrain->addTerrainModifier(RectFlatten(vRayPos,2000,1000)); + } + + + + mTimeUntilNextToggle = 0.0f; + } + + + if (mKeyboard->isKeyDown(OIS::KC_H) && mTimeUntilNextToggle <= 0) + { + // Randomly displaces the terrain as a big crater + Vector3 pos = Vector3(Math::RangeRandom(-16000,16000),0.0f,Math::RangeRandom(-16000,16000)); + + if (gTerrain->getHeightAt(pos,true,false)) + { + Real radius = Math::RangeRandom(500,16000); + Real power = Math::RangeRandom(-20000,20000); + QNode* pHighest = gTerrain->addTerrainModifier(CircleDisplacement(pos,radius,power)); + + } + + + mTimeUntilNextToggle = 0.2; + } + + + // Displays the current movement speed + mDebugText = "Current speed: " + StringConverter::toString(mMoveSpeed) + " m/s"; + + + + + return true; + } + + bool frameEnded(const FrameEvent& evt) + { + + + // Updates the end-of-frame duties of SPT + gTerrain->onFrameEnd(evt.timeSinceLastFrame); + + return ExampleFrameListener::frameEnded(evt); + } + + +}; + + + + + +class EnvMapApplication : public ExampleApplication +{ +public: + EnvMapApplication() + { + gTerrain = 0; + + + } + ~EnvMapApplication() + { + delete gTerrain; + gTerrain = 0; + + } + +protected: + + + // Just override the mandatory create scene method + void createScene(void) + { + LogManager::getSingleton().getDefaultLog()->setLogDetail(Ogre::LL_BOREME); + // Set ambient light + mSceneMgr->setAmbientLight(ColourValue(0.5,0.5,0.5)); + + + gSunLight = mSceneMgr->createLight("Sun"); + gSunLight->setType(Light::LT_DIRECTIONAL); + gSunLight->setDirection(-0.808863, -0.488935, -0.326625); + + + mCamera->getViewport()->setBackgroundColour(ColourValue(0.75,0.75,0.75)); + mCamera->setNearClipDistance(10); + mCamera->setFarClipDistance(100000); + + mCamera->setPosition(0,2500,3500); + mCamera->lookAt(0,0,0); + + // Create SPT + + gTerrain = new Terrain(mCamera,mSceneMgr); + + gTerrain->setClampState(Terrain::ACS_BELOW,15,false,true); + + // Do a quick setup + + gTerrain->quickSetup("Highlands_Height.png",2049,"SPT_Highlands",64000.0,6000.0); + + // All this handles the atmosphere + + //gTerrain->createAtmosphere("BlueSky.txt","SkySphere"); + + + gTerrain->createAtmosphere( + 637800,638640, + -0.985148, + 95.0213, + 640000.0, + Vector3(2.9427e-006, 9.4954e-006, 1.40597e-005), + Vector3(9.43648e-005, 3.36762e-005, 6.59358e-006), + "SkySphere",512,256); + + gTerrain->createLightmapper("Lightmapper","SPT_Comp",2048,2049); + + gTerrain->setLightDirection(gSunLight->getDirection()); + + + //gTerrain->getAtmosphere()->exportSettings("TestExport.txt"); + //gTerrain->getAtmosphere()->importSettings("TestExport.txt",true); + + // And you're done! + + } + + void createFrameListener() + { + mFrameListener= new MyFrameListener(mWindow, mCamera); + mFrameListener->showDebugOverlay(true); + mRoot->addFrameListener(mFrameListener); + } + +}; Property changes on: trunk/simplepagedterrain/trunk/demo/include/SPT_Demo.h ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/simplepagedterrain/trunk/demo/scripts/SPT2_Demo.sln =================================================================== --- trunk/simplepagedterrain/trunk/demo/scripts/SPT2_Demo.sln (rev 0) +++ trunk/simplepagedterrain/trunk/demo/scripts/SPT2_Demo.sln 2008-06-20 03:19:41 UTC (rev 2452) @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SPT2_Demo", "SPT2_Demo.vcproj", "{0EB479CC-802C-43BF-BAA9-7CF842A12C2C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0EB479CC-802C-43BF-BAA9-7CF842A12C2C}.Debug|Win32.ActiveCfg = Debug|Win32 + {0EB479CC-802C-43BF-BAA9-7CF842A12C2C}.Debug|Win32.Build.0 = Debug|Win32 + {0EB479CC-802C-43BF-BAA9-7CF842A12C2C}.Release|Win32.ActiveCfg = Release|Win32 + {0EB479CC-802C-43BF-BAA9-7CF842A12C2C}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal Property changes on: trunk/simplepagedterrain/trunk/demo/scripts/SPT2_Demo.sln ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/simplepagedterrain/trunk/demo/scripts/SPT2_Demo.vcproj =================================================================== --- trunk/simplepagedterrain/trunk/demo/scripts/SPT2_Demo.vcproj (rev 0) +++ trunk/simplepagedterrain/trunk/demo/scripts/SPT2_Demo.vcproj 2008-06-20 03:19:41 UTC (rev 2452) @@ -0,0 +1,204 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8.00" + Name="SPT2_Demo" + ProjectGUID="{0EB479CC-802C-43BF-BAA9-7CF842A12C2C}" + RootNamespace="SPT2_Demo" + Keyword="Win32Proj" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="..\bin\$(ConfigurationName)" + IntermediateDirectory="..\obj\$(ConfigurationName)" + ConfigurationType="1" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="..\include;"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Samples\Common\include";..\..\library\include;$(NOINHERIT)" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="OgreMain_d.lib OIS_d.lib SPTv2_d.lib user32.lib" + OutputFile="$(OutDir)\$(ProjectName)_d.exe" + LinkIncremental="2" + AdditionalLibraryDirectories=""$(OGRE_HOME)\lib";"$(OGRE_HOME)\Dependencies\lib\$(ConfigurationName)";..\..\lib" + GenerateDebugInformation="true" + SubSystem="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + CommandLine="copy $(OutDir)\$(TargetFileName) ..\..\bin\$(ConfigurationName)" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="..\bin\$(ConfigurationName)" + IntermediateDirectory="..\obj\$(ConfigurationName)" + ConfigurationType="1" + CharacterSet="2" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories="..\include;"$(OGRE_HOME)\OgreMain\include";"$(OGRE_HOME)\Dependencies\include";"$(OGRE_HOME)\Samples\Common\include";..\..\library\include;$(NOINHERIT)" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="OgreMain.lib OIS.lib SPTv2.lib user32.lib" + LinkIncremental="1" + AdditionalLibraryDirectories=""$(OGRE_HOME)\lib";"$(OGRE_HOME)\Dependencies\lib\$(ConfigurationName)";..\..\lib" + GenerateDebugInformation="true" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + CommandLine="copy $(OutDir)\$(TargetFileName) ..\..\bin\$(ConfigurationName)" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath="..\src\SPT_Demo.cpp" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + <File + RelativePath="..\include\SPT_Demo.h" + > + </File> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> Property changes on: trunk/simplepagedterrain/trunk/demo/scripts/SPT2_Demo.vcproj ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/simplepagedterrain/trunk/demo/src/SPT_Demo.cpp =================================================================== --- trunk/simplepagedterrain/trunk/demo/src/SPT_Demo.cpp (rev 0) +++ trunk/simplepagedterrain/trunk/demo/src/SPT_Demo.cpp 2008-06-20 03:19:41 UTC (rev 2452) @@ -0,0 +1,59 @@ +/* +----------------------------------------------------------------------------- +This source file is part of OGRE + (Object-oriented Graphics Rendering Engine) +For the latest info, see http://www.ogre3d.org/ + +Copyright (c) 2000-2006 Torus Knot Software Ltd +Also see acknowledgements in Readme.html + +You may use this sample code for anything you like, it is not covered by the +LGPL like the rest of the engine. +----------------------------------------------------------------------------- +*/ + +/** + \file + EnvMapping.cpp + \brief + Shows OGRE's environment mapping feature as well as the + blending modes available when using multiple texture layers +*/ + +#include "SPT_Demo.h" + +#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 +#define WIN32_LEAN_AND_MEAN +#include "windows.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 +INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT ) +#else +int main(int argc, char **argv) +#endif +{ + // Create application object + EnvMapApplication app; + + try { + app.go(); + } catch( Exception& e ) { +#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 + MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL); +#else + std::cerr << "An exception has occured: " << e.getFullDescription(); +#endif + } + + + return 0; +} + +#ifdef __cplusplus +} +#endif Property changes on: trunk/simplepagedterrain/trunk/demo/src/SPT_Demo.cpp ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/simplepagedterrain/trunk/library/include/AtmosphericCubeMap.h =================================================================== --- trunk/simplepagedterrain/trunk/library/include/AtmosphericCubeMap.h (rev 0) +++ trunk/simplepagedterrain/trunk/library/include/AtmosphericCubeMap.h 2008-06-20 03:19:41 UTC (rev 2452) @@ -0,0 +1,165 @@ +#pragma once + +#include "Prerequisites.h" +#include <OgrePrerequisites.h> +#include <OgreMaterial.h> +#include <OgreTexture.h> +#include <OgreVector3.h> +#include <OgreMesh.h> + +namespace SPT +{ + class AtmosphericCubeMap + { + public: + AtmosphericCubeMap(); + AtmosphericCubeMap( + Ogre::SceneManager* pSceneMgr, + Ogre::Camera* pCamera, + const Ogre::String& strImportSettingsFile, + const Ogre::String& strSkyBoxMatName, + const Ogre::String& strTerrainMatName, + const Ogre::String& strCubeMapTexName = "SPT_SkyBox_Tex", + const Ogre::String& strExtinctionTexName = "SPT_Ext_Tex", + const Ogre::String& strTerrainMaxDistanceParamName = "fMaxDistance", + const Ogre::String& strSkyBoxTexUnitName = "SkyBox", + const Ogre::String& strTerrainSkyTexUnitName = "SkyBox", + const Ogre::String& strTerrainExtinctionTexUnitName = "Extinction"); + + AtmosphericCubeMap( + Ogre::SceneManager* pSceneMgr, + Ogre::Camera* pCamera, + Ogre::Real fPlanetRadius, + Ogre::Real fAtmosphereRadius, + Ogre::Real fHG, + Ogre::Real fSunBrightness, + Ogre::Real fMaxDistance, + const Ogre::Vector3& vLightDir, + const Ogre::Vector3& vMie, + const Ogre::Vector3& vRaleigh, + const Ogre::String& strSkyBoxMatName, + const Ogre::String& strTerrainMatName, + size_t iExtinctionTexSize = 1024, + size_t iSkyBoxTexSize = 512, + Ogre::Real fRaleighCoef = 0.2f, + Ogre::Real fMieCoef = 0.001, + const Ogre::String& strCubeMapTexName = "SPT_SkyBox_Tex", + const Ogre::String& strExtinctionTexName = "SPT_Ext_Tex", + const Ogre::String& strTerrainMaxDistanceParamName = "fMaxDistance", + const Ogre::String& strSkyBoxTexUnitName = "SkyBox", + const Ogre::String& strTerrainSkyTexUnitName = "SkyBox", + const Ogre::String& strTerrainExtinctionTexUnitName = "Extinction"); + + ~AtmosphericCubeMap(); + + + // I didn't create this! + // It's from the Wiki + void createSphere(const Ogre::String& strName, const Ogre::Real r, const size_t nRings = 16, const size_t nSegments = 16); + + + Ogre::Real CalculateSkyLength(const Ogre::Vector3 &inDirection); + + Ogre::Vector3 CalculateExtinctionAmount(Ogre::Real distance); + + + Ogre::Vector3 CalculateLin(const Ogre::Vector3 &viewDirection); + + void createExtinction(); + + void createFaces(); + + void updateExtinction(); + + void updateFaces(); + + void updateCoefficients(); + + void updateMaxDistance(Ogre::Real fMaxDistance); + + void updatePosition(); + + void setLightDirection(const Ogre::Vector3& vLightDir){mLightDir = vLightDir;} + const Ogre::Vector3& getLightDirection(){return mLightDir;} + + Ogre::Real getPlanetRadius() const { return mPlanetRadius; } + void setPlanetRadius(Ogre::Real val) { mPlanetRadius = val; } + + Ogre::Real getAtmosphereRadius() const { return mAtmosphereRadius; } + void setAtmosphereRadius(Ogre::Real val) { mAtmosphereRadius = val; } + + Ogre::Real getHG() const { return mHG; } + void setHG(Ogre::Real val) { mHG = val; } + + Ogre::Real getRaleighCoef() const { return mRaleighCoef; } + void setRaleighCoef(Ogre::Real val) { mRaleighCoef = val; } + + Ogre::Real getMieCoef() const { return mMieCoef; } + void setMieCoef(Ogre::Real val) { mMieCoef = val; } + + Ogre::Vector3 getRaleigh() const { return mRaleigh; } + void setRaleigh(Ogre::Vector3 val) { mRaleigh = val; } + + Ogre::Vector3 getMie() const { return mMie; } + void setMie(Ogre::Vector3 val) { mMie = val; } + + Ogre::Real getSunBrightness() const { return mSunBrightness; } + void setSunBrightness(Ogre::Real val) { mSunBrightness = val; } + + Ogre::Real getMaxDistance() const { return mMaxDistance; } + void setMaxDistance(Ogre::Real val) { mMaxDistance = val; } + + void exportSettings(const Ogre::String& strFileName); + void importSettings(const Ogre::String& strFileName, bool bAutoUpdate = false); + + // Quick cheats to make my life easier + enum CubeFace + { + CF_POS_X = 0, + CF_NEG_X, + CF_POS_Y, + CF_NEG_Y, + CF_POS_Z, + CF_NEG_Z + }; + + private: + Ogre::Real mPlanetRadius; + Ogre::Real mAtmosphereRadius; + Ogre::Real mHG; + Ogre::Real mRaleighCoef; + Ogre::Real mMieCoef; + Ogre::Vector3 mRaleigh; + Ogre::Vector3 mMie; + Ogre::Vector3 mBetaRaleighC; + Ogre::Vector3 mBetaMieC; + Ogre::Vector3 mBetaExtinction; + Ogre::Real mSunBrightness; + Ogre::Real mMaxDistance; + Ogre::MaterialPtr mSkyBoxMaterial; + Ogre::MaterialPtr mTerrainMaterial; + + Ogre::String mSkyBoxTexUnitName; + Ogre::String mTerrainSkyTexUnitName; + Ogre::String mTerrainExtinctionTexUnitName; + Ogre::String mTerrainMaxDistanceParamName; + + Ogre::String mExtinctionTexName; + Ogre::String mCubeMapTexName; + size_t mExtTextureSize; + size_t mLinTextureSize; + Ogre::Vector3 mLightDir; + //Ogre::Real mTheta; + //Ogre::Real mEpsilon; + + Ogre::TexturePtr mCubeMap; + Ogre::TexturePtr mExtinction; + + Ogre::SceneManager* mSceneMgr; + Ogre::Camera* mCamera; + + Ogre::SceneNode* mSkyNode; + Ogre::Entity* mSkySphere; + Ogre::MeshPtr mSkySphereMesh; + }; +} \ No newline at end of file Property changes on: trunk/simplepagedterrain/trunk/library/include/AtmosphericCubeMap.h ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/simplepagedterrain/trunk/library/include/CircleDisplacement.h =================================================================== --- trunk/simplepagedterrain/trunk/library/include/CircleDisplacement.h (rev 0) +++ trunk/simplepagedterrain/trunk/library/include/CircleDisplacement.h 2008-06-20 03:19:41 UTC (rev 2452) @@ -0,0 +1,28 @@ +#pragma once + +#include "Prerequisites.h" +#include "TerrainModifier.h" +#include <OgrePrerequisites.h> +#include <OgreVector3.h> +#include "Vec2D.h" + +namespace SPT +{ + class CircleDisplacement : public TerrainModifier + { + public: + CircleDisplacement(const Ogre::Vector3& center, Ogre::Real radius, Ogre::Real displacement, bool addative = true); + + void displace(Vec2D<double> vTopLeft, double fWidth, Heightmap* pHeightmap, float fScale ); + + //void displace(Ogre::Vector3* pVerts); + + bool isInBounds(const Vec2D<double>& vMin, const Vec2D<double>& vMax); + + private: + Ogre::Real mDisplacement; + Ogre::Real mRadius; + Ogre::Vector3 mCenter; + bool mAddative; + }; +} \ No newline at end of file Property changes on: trunk/simplepagedterrain/trunk/library/include/CircleDisplacement.h ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/simplepagedterrain/trunk/library/include/GPULightmapper.h =================================================================== --- trunk/simplepagedterrain/trunk/library/include/GPULightmapper.h (rev 0) +++ trunk/simplepagedterrain/trunk/library/include/GPULightmapper.h 2008-06-20 03:19:41 UTC (rev 2452) @@ -0,0 +1,60 @@ +#pragma once + +#include "Prerequisites.h" +#include <OgrePrerequisites.h> +#include <OgreMaterial.h> +#include <OgreTexture.h> +#include <OgreVector3.h> + +namespace SPT +{ + class GPULightmapper + { + public: + GPULightmapper( + Ogre::SceneManager* pSceneMgr, + Ogre::Camera* pCamera, + Heightmap* pRootHeightmap, + const Ogre::Vector3& vLightDir, + const Ogre::String& strLightmapMatName, + const Ogre::String& strTerrainMatName, + const Ogre::String& strCompositorName, + const Ogre::Vector3& vTerrainScale, + size_t iMaxLightmapSize = 2048, + size_t iMaxHeightmapTexSize = 2049, + const Ogre::String& strLightmapScaleParamName = "vScale", + const Ogre::String& strLightmapHeightmapSizeParamName = "fSize", + const Ogre::String& strHeightmapTexName = "SPT_Heightmap_Tex", + const Ogre::String& strRenderTextureName = "SPT_Lightmap_RTT", + const Ogre::String& strLightmapTexUnitName = "Heightmap", + const Ogre::String& strTerrainTexUnitName = "Lightmap", + const Ogre::String& strCompositorScaleParamName = "vScale"); + + ~GPULightmapper(); + + void buildHeightmapTexture(const Ogre::String& strHeightmapTexName, size_t iMapWidth); + + void updateHeightmapBuffer(); + + void updateLightmapWindow(const Ogre::Vector3& vScale); + + void updateLightmap(const Ogre::Vector3& vLightDir); + + private: + Ogre::SceneManager* mSceneMgr; + Ogre::CompositorInstance* mCompositorInstance; + Ogre::RenderTarget* mRenderTarget; + Ogre::Viewport* mViewport; + Ogre::String mLightmapTextureUnitName; + Ogre::String mTerrainTextureUnitName; + Ogre::String mCompositorScaleParamName; + Ogre::MaterialPtr mLightmapMaterial; + Ogre::MaterialPtr mTerrainMaterial; + Ogre::TexturePtr mHeightmapTexture; + Ogre::TexturePtr mRenderTexture; + Heightmap* mRootHeightmap; + Ogre::Vector3 mLightDirection; + Ogre::String mLightmapScaleParamName; + Ogre::String mLightmapHeightmapSizeParamName; + }; +} \ No newline at end of file Property changes on: trunk/simplepagedterrain/trunk/library/include/GPULightmapper.h ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/simplepagedterrain/trunk/library/include/Heightmap.h =================================================================== --- trunk/simplepagedterrain/trunk/library/include/Heightmap.h (rev 0) +++ trunk/simplepagedterrain/trunk/library/include/Heightmap.h 2008-06-20 03:19:41 UTC (rev 2452) @@ -0,0 +1,51 @@ +#pragma once + +#include "Prerequisites.h" +#include <OgrePrerequisites.h> + +namespace SPT +{ + template<typename T> + inline T Lerp(T a, T b, T x) { return a + x * (b - a); } + + class Heightmap + { + public: + Heightmap(); + Heightmap(const std::string& strFileName, size_t iWidth = 0, bool bHasBorder = true); + //Heightmap(float* fData, size_t iWidth); + ~Heightmap(); + + void allocateData(); + HEIGHTMAPTYPE* getData(){return mData;} + + size_t getWidth(){return mWidth;} + void setWidth(size_t iWidth); + + size_t getMaxLevels(){return mMaxLevels;} + void setMaxLevels(size_t iMaxLevels){mMaxLevels = iMaxLevels;} + + void setStartDepth(size_t iStartDepth){mStartDepth = iStartDepth;} + size_t getStartDepth(){return mStartDepth;} + + size_t calculateMaxLevels(); + + HEIGHTMAPTYPE getHeightAt(int x, int y); + + float getHeightAt(float fPosX, float fPosZ, size_t iDepth, size_t iOffsetX, size_t iOffsetY); + + float getHeightAndNormalAt(float fPosX, float fPosZ, const Ogre::Vector3& vScale, size_t iDepth, size_t iOffsetX, size_t iOffsetY, Ogre::Vector3& vNormal); + + void getSubdivision(Heightmap* pSubMap, size_t iWidth, size_t iOffsetX, size_t iOffsetY, size_t iSpacing); + + private: + size_t mAllocatedWidth; + size_t mWidth; + HEIGHTMAPTYPE* mData; + + size_t mStartDepth; + size_t mMaxLevels; + + bool mHasBorder; + }; +} \ No newline at end of file Property changes on: trunk/simplepagedterrain/trunk/library/include/Heightmap.h ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/simplepagedterrain/trunk/library/include/HeightmapReader.h =================================================================== --- trunk/simplepagedterrain/trunk/library/include/HeightmapReader.h (rev 0) +++ trunk/simplepagedterrain/trunk/library/include/HeightmapReader.h 2008-06-20 03:19:41 UTC (rev 2452) @@ -0,0 +1,33 @@ +#pragma once + +#include "Prerequisites.h" +#include <OgrePrerequisites.h> +#include <OgreSingleton.h> + +namespace SPT +{ + + class HeightmapReader : public Ogre::Singleton<HeightmapReader> + { + public: + HeightmapReader(){}; + + virtual ~HeightmapReader(){}; + + static HeightmapReader& getSingleton(); + + static HeightmapReader* getSingletonPtr(); + + void readHeightmap( + const std::string& strFileName, + Heightmap* pHeightmap, + size_t iWidth = 0, + size_t iOffsetX = 0, + size_t iOffsetY = 0, + size_t iSpacing = 1, + bool bHasBorder = false); + + + private: + }; +} \ No newline at end of file Property changes on: trunk/simplepagedterrain/trunk/library/include/HeightmapReader.h ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/simplepagedterrain/trunk/library/include/HeightmapRules.h =================================================================== --- trunk/simplepagedterrain/trunk/library/include/HeightmapRules.h (rev 0) +++ trunk/simplepagedterrain/trunk/library/include/HeightmapRules.h 2008-06-20 03:19:41 UTC (rev 2452) @@ -0,0 +1,31 @@ +#pragma once + +#include "Prerequisites.h" +#include <string> + +namespace SPT +{ + class HeightmapRules + { + public: + enum HeightmapFileType + { + HFT_RAW_1_BYTE = 0, + HFT_RAW_2_BYTE, + HFT_PNG/*, + HFT_JPEG, + HFT_DEM*/ + }; + + class Rule + { + public: + std::string mHeightmapName; + std::string mResourceGroupName; + HeightmapFileType mFileType; + size_t mTotalWidth; + size_t mLevelsPerChunk; + }; + private: + }; +} \ No newline at end of file Property changes on: trunk/simplepagedterrain/trunk/library/include/HeightmapRules.h ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/simplepagedterrain/trunk/library/include/Lightmapper.h =================================================================== --- trunk/simplepagedterrain/trunk/library/include/Lightmapper.h (rev 0) +++ trunk/simplepagedterrain/trunk/library/include/Lightmapper.h 2008-06-20 03:19:41 UTC (rev 2452) @@ -0,0 +1,27 @@ +#pragma once + +#include "Prerequisites.h" +#include <OgrePrerequisites.h> +#include <OgreVector3.h> + +namespace SPT +{ + class Lightmapper + { + public: + void createLightmap( + Heightmap* pHeightmap, + Ogre::Image& lightmapImage, + const Ogre::Vector2& vStartPos, + const Ogre::Real rWidth, + const Ogre::Vector3& vLightDir, + const Ogre::ColourValue& cAmbient, + const Ogre::ColourValue& cLightColor ); + + Ogre::Real getHeight(Ogre::Real x, Ogre::Real z); + Ogre::Vector3 getNormalAt(Ogre::Real x, Ogre::Real z); + private: + Heightmap* mHeightmap; + Ogre::Vector3 mScale; + }; +} \ No newline at end of file Property changes on: trunk/simplepagedterrain/trunk/library/include/Lightmapper.h ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/simplepagedterrain/trunk/library/include/MovableText.h =================================================================== --- trunk/simplepagedterrain/trunk/library/include/MovableText.h (rev 0) +++ trunk/simplepagedterrain/trunk/library/include/MovableText.h 2008-06-20 03:19:41 UTC (rev 2452) @@ -0,0 +1,111 @@ +/** +* File: MovableText.h +* +* description: This create create a billboarding object that display a text. +* +* @author 2003 by cTh see gav...@ra... +* @update 2006 by barraq see no...@ba... +*/ + +#ifndef __include_MovableText_H__ +#define __include_MovableText_H__ + +namespace Ogre { + + class MovableText : public MovableObject, public Renderable + { + /******************************** MovableText data ****************************/ + public: + enum HorizontalAlignment {H_LEFT, H_CENTER}; + enum VerticalAlignment {V_BELOW, V_ABOVE, V_CENTER}; + + protected: + String mFontName; + String mType; + String mName; + String mCaption; + HorizontalAlignment mHorizontalAlignment; + VerticalAlignment mVerticalAlignment; + + ColourValue mColor; + RenderOperation mRenderOp; + AxisAlignedBox mAABB; + LightList mLList; + + Real mCharHeight; + Real mSpaceWidth; + + bool mNeedUpdate; + bool mUpdateColors; + bool mOnTop; + + Real mTimeUntilNextToggle; + Real mRadius; + Real mAdditionalHeight; + + Camera *mpCam; + RenderWindow *mpWin; + Font *mpFont; + MaterialPtr mpMaterial; + MaterialPtr mpBackgroundMaterial; + + /******************************** public methods ******************************/ + public: + MovableText(const String &name, const String &caption, const String &fontName = "BlueHighway", Real charHeight = 1.0, const ColourValue &color = ColourValue::White); + virtual ~MovableText(); + + // Add to build on Shoggoth: + /* + virtual void visitRenderables(Ogre::Renderable::Visitor* visitor, bool debugRenderables = false); + */ + + // Set settings + void setFontName(const String &fontName); + void setCaption(const String &caption); + void setColor(const ColourValue &color); + void setCharacterHeight(Real height); + void setSpaceWidth(Real width); + void setTextAlignment(const HorizontalAlignment& horizontalAlignment, const VerticalAlignment& verticalAlignment); + void setAdditionalHeight( Real height ); + void showOnTop(bool show=true); + + // Get settings + const String &getFontName() const {return mFontName;} + const String &getCaption() const {return mCaption;} + const ColourValue &getColor() const {return mColor;} + + Real getCharacterHeight() const {return mCharHeight;} + Real getSpaceWidth() const {return mSpaceWidth;} + Real getAdditionalHeight() const {return mAdditionalHeight;} + bool getShowOnTop() const {return mOnTop;} + AxisAlignedBox GetAABB(void) { return mAABB; } + + /******************************** protected methods and overload **************/ + protected: + + // from MovableText, create the object + void _setupGeometry(); + void _updateColors(); + + // from MovableObject + void getWorldTransforms(Matrix4 *xform) const; + Real getBoundingRadius(void) const {return mRadius;}; + Real getSquaredViewDepth(const Camera *cam) const {return 0;}; + const Quaternion &getWorldOrientation(void) const; + const Vector3 &getWorldPosition(void) const; + const AxisAlignedBox &getBoundingBox(void) const {return mAABB;}; + const String &getName(void) const {return mName;}; + const String &getMovableType(void) const {static Ogre::String movType = "MovableText"; return movType;}; + + void _notifyCurrentCamera(Camera *cam); + void _updateRenderQueue(RenderQueue* queue); + + // from renderable + void getRenderOperation(RenderOperation &op); + const MaterialPtr &getMaterial(void) const {assert(!mpMaterial.isNull());return mpMaterial;}; + const LightList &getLights(void) const {return mLList;}; + }; + +} + +#endif Property changes on: trunk/simplepagedterrain/trunk/library/include/MovableText.h ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/simplepagedterrain/trunk/library/include/PNGHeightmapReader.h =================================================================== --- trunk/simplepagedterrain/trunk/library/include/PNGHeightmapReader.h (rev 0) +++ trunk/simplepagedterrain/trunk/library/include/PNGHeightmapReader.h 2008-06-20 03:19:41 UTC (rev 2452) @@ -0,0 +1,21 @@ +#pragma once + +#include "Prerequisites.h" + +namespace SPT +{ + class PNGHeightmapReader + { + public: + void readHeightmap( + const std::string& strFileName, + Heightmap* pHeightmap, + size_t iWidth = 0, + size_t iOffsetX = 0, + size_t iOffsetY = 0, + size_t iSpacing = 1, + bool bHasBorder = false); + + private: + }; +} \ No newline at end of file Property changes on: trunk/simplepagedterrain/trunk/library/include/PNGHeightmapReader.h ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/simplepagedterrain/trunk/library/include/Prerequisites.h =================================================================== --- trunk/simplepagedterrain/trunk/library/include/Prerequisites.h (rev 0) +++ trunk/simplepagedterrain/trunk/library/include/Prerequisites.h 2008-06-20 03:19:41 UTC (rev 2452) @@ -0,0 +1,50 @@ +#pragma once + +#pragma warning(disable: 4267) +#include <string> + +namespace SPT +{ + template<class TType> + class Vec2D; + + template<class TType> + class Vec3D; + + class Terrain; + class TerrainMesh; + class TerrainModifier; + class QuadTree; + class QNode; + class Heightmap; + class HeightmapRefinement; + class HeightmapGenerator; + class HeightmapReader; + class HeightmapRules; + class AtmosphericCubeMap; + class GPULightmapper; + +#define USE_SINGLETON 1 +#define VERTEX_WIDTH 33 +#define MAP_WIDTH (VERTEX_WIDTH+2) +#define USE_MORPH 1 +#define MORPH_START 0.2f +#define MORPH_CONSTANT_ID 77 +#define PARENT_UV_OFFSET_ID 99 +#define EPS 0.0001 +#define FLOAT_EQ(x,v) (((v - EPS) < x) && (x <( v + EPS))) +//#define MORPH_SPEED 1.0f +#define MAX_LOD 1 +//#define SKIRT_LENGTH 700.0f +#define USE_DEBUG_DISPLAYS 0 +#define USE_FLOAT_DATA 0 +#if (USE_FLOAT_DATA == 1) + typedef float HEIGHTMAPTYPE; +#define UNPACK_HEIGHT(h) (h) +#define PACK_HEIGHT(h) (static_cast<float>(h)) +#else + typedef unsigned short HEIGHTMAPTYPE; +#define UNPACK_HEIGHT(h) (static_cast<float>(h)) +#define PACK_HEIGHT(h) (static_cast<HEIGHTMAPTYPE>(h)) +#endif +} \ No newline at end of file Property changes on: trunk/simplepagedterrain/trunk/library/include/Prerequisites.h ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/simplepagedterrain/trunk/library/include/QNode.h =================================================================== --- trunk/simplepagedterrain/trunk/library/include/QNode.h (rev 0) +++ trunk/simplepagedterrain/trunk/library/include/QNode.h 2008-06-20 03:19:41 UTC (rev 2452) @@ -0,0 +1,117 @@ +#pragma once + +#include "Prerequisites.h" +#include "Vec2D.h" + +namespace SPT +{ + class QNode + { + public: + // Root + QNode(Terrain* pTerrain); + + // Child node + QNode(QNode* pParent, size_t iNodePosition); + + ~QNode(); + + QNode* getParent(){return mParent;} + + QNode* getChild(size_t iChild){return mChildren[iChild];} + + Terrain* getTerrain(){return mTerrain;} + + size_t getNodePosition(){return mNodePosition;} + + bool hasChildren(){return mHasChildren;} + + TerrainMesh* getTerrainMesh(){return mTerrainMesh;} + + Heightmap* getHeightmap(){return mHeightmap;} + + //Heightmap* getParentHeightmap(){return mParentMap;} + //void setParentHeightmap(Heightmap* pParentMap){mParentMap = pParentMap;} + + QNode* getHighestAffected(TerrainModifier* pModifier); + void checkModifier(TerrainModifier* pModifier); + + void _testUpdate(); + + void buildHeightmap(); + void buildTerrain(); + + const Vec2D<size_t>& getMapOffset(){return mMapOffset;} + + const Vec2D<size_t>& getIntegerOffset(){return mIntegerOffset;} + + const Vec2D<double>& getFloatingPointOffset(){return mFloatingPointOffset;} + + size_t getIntegerWidth(){return mIntegerWidth;} + + double getFloatingPointWidth(){return mFloatingPointWidth;} + + size_t getDepth(){return mDepth;} + + void setForceSplit(bool forceSplit = false){mForceSplit = forceSplit;} + + bool isPointInNode(float fPosX, float fPosZ); + + QNode* getNodeAtPoint(float fPosX, float fPosZ); + + // Returns 0.0f if not found + float getHeightAt(float x, float z); + + // Returns false if not found - stores result in "y" + bool getHeightAt(float x, float z, float& y); + + bool isReadyToSplit(); + + bool isReadyToUnSplit(); + + bool splitNode(); + + bool unsplitNode(); + + void runUpdate(float rTime = 0.0f); + + void runLODChecks(); + + void runQuadTreeChecks(); + + enum QPosition + { + NW = 0, + NE, + SW, + SE, + ROOT + }; + + private: + QNode* mParent; + QNode* mChildren[4]; + + Terrain* mTerrain; + + size_t mNodePosition; + + size_t mDepth; + + bool mHasChildren; + + TerrainMesh* mTerrainMesh; + + Heightmap* mHeightmap; + //Heightmap* mParentMap; + Vec2D<size_t> mMapOffset; + + Vec2D<size_t> mIntegerOffset; + size_t mIntegerWidth; + + Vec2D<double> mFloatingPointOffset; + double mFloatingPointWidth; + + bool mForceSplit; + }; +} \ No newline at end of file Property changes on: trunk/simplepagedterrain/trunk/library/include/QNode.h ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/simplepagedterrain/trunk/library/include/RAWHeightmapReader.h =================================================================== --- trunk/simplepagedterrain/trunk/library/include/RAWHeightmapReader.h (rev 0) +++ trunk/simplepagedterrain/trunk/library/include/RAWHeightmapReader.h 2008-06-20 03:19:41 UTC (rev 2452) @@ -0,0 +1,20 @@ +#pragma once + +#include "Prerequisites.h" + +namespace SPT +{ + class RAWHeightmapReader + { + public: + void readHeightmap( + const std::string& strFileName, + Heightmap* pHeightmap, + size_t iWidth = 0, + size_t iOffsetX = 0, + size_t iOffsetY = 0, + size_t iSpacing = 1); + + private: + }; +} \ No newline at end of file Property changes on: trunk/simplepagedterrain/trunk/library/include/RAWHeightmapReader.h ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/simplepagedterrain/trunk/library/include/RectFlatten.h =================================================================== --- trunk/simplepagedterrain/trunk/library/include/RectFlatten.h (rev 0) +++ trunk/simplepagedterrain/trunk/library/include/RectFlatten.h 2008-06-20 03:19:41 UTC (rev 2452) @@ -0,0 +1,28 @@ +#pragma once + +#include "Prerequisites.h" +#include "TerrainModifier.h" +#include <OgrePrerequisites.h> +#include <OgreVector3.h> +#include <OgreVector2.h> +#include "Vec2D.h" + +namespace SPT +{ + class RectFlatten : public TerrainModifier + { + public: + RectFlatten(const Ogre::Vector3& center, Ogre::Real width, Ogre::Real height); + + void displace(Vec2D<double> vTopLeft, double fWidth, Heightmap* pHeightmap, float fScale ); + + bool isInBounds(const Vec2D<double>& vMin, const Vec2D<double>& vMax); + + private: + Ogre::Vector3 mCenter; + Ogre::Real mWidth; + Ogre::Real mHeight; + Ogre::Vector2 mMin; + Ogre::Vector2 mMax; + }; +} \ No newline at end of file Property changes on: trunk/simplepagedterrain/trunk/library/include/RectFlatten.h ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/simplepagedterrain/trunk/library/include/Terrain.h =================================================================== --- trunk/simplepagedterrain/trunk/library/include/Terrain.h (rev 0) +++ trunk/simplepagedterrain/trunk/library/include/Terrain.h 2008-06-20 03:19:41 UTC (rev 2452) @@ -0,0 +1,217 @@ +#pragma once + +#include <OgrePrerequisites.h> +#include <OgreVertexIndexData.h> +#include <OgreMaterial.h> +#include <OgreVector3.h> +#include "Prerequisites.h" +#include "TerrainModifier.h" +#if (USE_SINGLETON == 1) +#include <OgreSingleton.h> +#endif + +namespace SPT +{ +#if (USE_SINGLETON == 1) + class Terrain : public Ogre::Singleton<Terrain> +#else + class Terrain +#endif + { + public: + Terrain(); + Terrain( + Ogre::Camera* pCamera, + Ogre::SceneManager* pSceneMgr); + ~Terrain(); + +#if (USE_SINGLETON == 1) + static Terrain& getSingleton(); + + static Terrain* getSingletonPtr(); +#endif + + void addIndexData(Ogre::IndexData* pData, size_t iLOD); + Ogre::IndexData* getIndexData(size_t iLOD); + + void setCamera(Ogre::Camera* pCamera){mCamera = pCamera;} + Ogre::Camera* getCamera(){return mCamera;} + + enum AutoClampState + { + ACS_OFF = 0, + ACS_BELOW, + ACS_ALWAYS + }; + + AutoClampState getClampState() const { return mClampState; } + + Ogre::Real getClampBonusHeight() const {return mClampBonusHeight; } + + bool getClampUseRoot() {return mClampUseRoot;} + bool getClampUseGeoMorph(){return mClampUseGeoMorph;} + + void setClampState( + AutoClampState val, + Ogre::Real heightBonus = 0.0f, + bool useRoot = false, + bool useMorph = false) + { + mClampState = val; + mClampBonusHeight = heightBonus; + mClampUseRoot = useRoot; + mClampUseGeoMorph = useMorph; + } + + Ogre::Real getSkirtLength() const { return mSkirtLength; } + void setSkirtLength(Ogre::Real val) { mSkirtLength = val; } + void setSkirtLengthPercent(Ogre::Real val = 10.0f){ mSkirtLength = mTerrainHeight * (val / 100.0f);} + + Ogre::Real getMorphSpeed() const { return mMorphSpeed; } + void setMorphSpeed(Ogre::Real val) { mMorphSpeed = val; } + + //void setTerrainNode(Ogre::SceneNode* pTerrainNode){mTerrainNode = pTerrainNode;} + Ogre::SceneNode* getTerrainNode(){return mTerrainNode;} + + void setSceneManager(Ogre::SceneManager* pSceneMgr){mSceneMgr = pSceneMgr;} + Ogre::SceneManager* getSceneManager(){return mSceneMgr;} + + void setMaterial(const Ogre::String& materialName); + Ogre::MaterialPtr getMaterial(){return mTerrainMaterial;} + + //void setZFirstMaterial(const Ogre::String& materialName); + //Ogre::MaterialPtr getZFirstMaterial(){return mTerrainZFirstMaterial;} + + void setTerrainHeight(Ogre::Real height){mTerrainHeight = height;} + Ogre::Real getTerrainHeight(){return mTerrainHeight;} + + //typedef std::vector<TerrainModifier*> TerrainMods; + + //void addTerrainMod(TerrainModifier* modifier); + //TerrainMods::iterator getTerrainModIterator(); + //TerrainMods::iterator getTerrainModIteratorEnd(); + + void setMaxDepth(size_t iMaxDepth){mMaxDepth = iMaxDepth;} + size_t getMaxDepth(){return mMaxDepth;} + + + void setWidth(double dWidth){mWidth = dWidth;} + double getWidth(){return mWidth;} + + void initialize(const Ogre::String& heightmapName, size_t iWidth = 0); + void destroy(); + + + Heightmap* getHeightmap(){return mHeightmap;} + + QNode* getRootNode(){return mRootNode;} + + bool getHeightAt(Ogre::Vector3& vPos, Ogre::Real rBonus = 0.0f, bool bUseRoot = false, bool bUseGeoMorphing = false); + + Ogre::Vector3 getNormalAt(Ogre::Vector3& vPos, bool bUseRoot = false, bool bUseGeoMorphing = false); + + bool getRayHeight(const Ogre::Ray& vRay, Ogre::Vector3& vReturnPos, bool bUseRoot = false, bool bUseGeoMorphing = false); + + void _checkIn(){mTotalNodes++;} + + void onFrameStart(Ogre::Real fTime); + + void onFrameEnd(Ogre::Real fTime); + + QNode* addTerrainModifier(TerrainModifier& pModifier); + + AtmosphericCubeMap* createAtmosphere( + Ogre::Real fPlanetRadius, + Ogre::Real fAtmosphereRadius, + Ogre::Real fHG, + Ogre::Real fSunBrightness, + Ogre::Real fMaxDistance, + const Ogre::Vector3& vMie, + const Ogre::Vector3& vRaleigh, + const Ogre::String& strSkyBoxMatName, + size_t iExtinctionTexSize = 1024, + size_t iSkyBoxTexSize = 512, + Ogre::Real fRaleighCoef = 0.2f, + Ogre::Real fMieCoef = 0.001, + const Ogre::String& strCubeMapTexName = "SPT_SkyBox_Tex", + const Ogre::String& strExtinctionTexName = "SPT_Ext_Tex", + const Ogre::String& strTerrainMaxDistanceParamName = "fMaxDistance", + const Ogre::String& strSkyBoxTexUnitName = "SkyBox", + const Ogre::String& strTerrainSkyTexUnitName = "SkyBox", + const Ogre::String& strTerrainExtinctionTexUnitName = "Extinction"); + + AtmosphericCubeMap* createAtmosphere( + const Ogre::String& strImportSettingsFile, + const Ogre::String& strSkyBoxMatName, + const Ogre::String& strCubeMapTexName = "SPT_SkyBox_Tex", + const Ogre::String& strExtinctionTexName = "SPT_Ext_Tex", + const Ogre::String& strTerrainMaxDistanceParamName = "fMaxDistance", + const Ogre::String& strSkyBoxTexUnitName = "SkyBox", + const Ogre::String& strTerrainSkyTexUnitName = "SkyBox", + const Ogre::String& strTerrainExtinctionTexUnitName = "Extinction"); + + GPULightmapper* createLightmapper( + const Ogre::String& strLightmapMatName, + const Ogre::String& strCompositorName, + size_t iMaxLightmapSize = 2048, + size_t iMaxHeightmapTexSize = 2049, + const Ogre::String& strLightmapScaleParamName = "vScale", + const Ogre::String& strLightmapHeightmapSizeParamName = "fSize", + const Ogre::String& strHeightmapTexName = "SPT_Heightmap_Tex", + const Ogre::String& strRenderTextureName = "SPT_Lightmap_RTT", + const Ogre::String& strLightmapTexUnitName = "Heightmap", + const Ogre::String& strTerrainTexUnitName = "Lightmap", + const Ogre::String& strCompositorScaleParamName = "vScale"); + + AtmosphericCubeMap* getAtmosphere(){return mSkyMap;} + GPULightmapper* getLightmapper(){return mLightmapper;} + + void setLightDirection(const Ogre::Vector3& vLightDir); + + + void quickSetup( + const Ogre::String& strHeightmapName, + size_t iHeightmapWidth, + const Ogre::String& strTerrainMaterialName, + Ogre::Real fTerrainWidth, + Ogre::Real fTerrainHeight ); + + + private: + typedef std::map<size_t, Ogre::IndexData*> IndexStorage; + IndexStorage mIndexStore; + + Ogre::Camera* mCamera; + Ogre::SceneNode* mTerrainNode; + Ogre::SceneManager* mSceneMgr; + Ogre::MaterialPtr mTerrainZFirstMaterial; + Ogre::MaterialPtr mTerrainMaterial; + + Ogre::Real mTerrainHeight; + Ogre::Real mSkirtLength; + Ogre::Real mMorphSpeed; + + AutoClampState mClampState; + Ogre::Real mClampBonusHeight; + bool mClampUseRoot; + bool mClampUseGeoMorph; + //TerrainMods mModifiers; + + GPULightmapper* mLightmapper; + AtmosphericCubeMap* mSkyMap; + + size_t mMaxDepth; + + size_t mTotalNodes; + double mWidth; + + Heightmap* mHeightmap; + + QNode* mRootNode; + + HeightmapReader* mSingleton; + + Ogre::Vector3 mLightDirection; + + }; +} \ No newline at end of file Property changes on: trunk/simplepagedterrain/trunk/library/include/Terrain.h ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/simplepagedterrain/trunk/library/include/TerrainMesh.h =================================================================== --- trunk/simplepagedterrain/trunk/library/include/TerrainMesh.h (rev 0) +++ trunk/simplepagedterrain/trunk/library/include/TerrainMesh.h 2008-06-20 03:19:41 UTC (rev 2452) @@ -0,0 +1,197 @@ +#pragma once + +#include <OgrePrerequisites.h> +#include <OgreMaterial.h> +#include <OgreMovableObject.h> +#include <OgreRenderable.h> +#include <OgreCamera.h> +#include <OgreSceneNode.h> +#include <OgreTexture.h> +#include <OgreSceneManager.h> +#include "Prerequisites.h" +#include "MovableText.h" + +namespace SPT +{ + class TerrainMesh : public Ogre::MovableObject, public Ogre::Renderable + { + public: + + TerrainMesh(Terrain* pTerrain, QNode* pParentNode); + + ~TerrainMesh(); + + /// Overridden from Renderable to allow the morph LOD entry to be set + void _updateCustomGpuParameter( + const Ogre::GpuProgramParameters::AutoConstantEntry& constantEntry, + Ogre::GpuProgramParameters* params) const; + + void setRenderLevel(size_t iLOD = 0); + + size_t getRenderLevel(){return mRenderLevel;} + + Ogre::Real _calculateCFactor(); + void _calculateMinLevelDist2( Ogre::Real C ); + + Ogre::HardwareVertexBufferSharedPtr createDeltaBuffer(void); + + void _notifyCurrentCamera(Ogre::Camera* cam); + + void createGeometryData(); + void build(); + + void getImportantStats(int& renderLevel, int& targetRenderLevel, float& LODMorph); + void setImportantStats(int renderLevel, int targetRenderLevel, float LODMorph); + + void setPreCalculatedLight(Ogre::TexturePtr pRenderedLight){mRenderedLighting = pRenderedLight;} + + void destroyGeometry(); + void destroyGeometryData(); + void destroyRenderedLighting(); + void destroyMaterial(); + + Ogre::IndexData* getIndexData(size_t iLOD = 0); + + const Ogre::Vector3& getVertexPosition(size_t x, size_t z); + + enum TerrainSplitState + { + TSS_NONE = 0, + TSS_SPLIT, + TSS_UNSPLIT + }; + + void update(Ogre::Real rTime = 0.0f); + + void checkLOD(); + + TerrainSplitState getSplitState(){return mSplitState;} + + Ogre::Real getMorph(){return mLODMorphFactor;} + + void justSplit(); + + void justUnSplit(); + + + // REQUIRED VIRTUALS: + const Ogre::String& getMovableType(void) const + { + static Ogre::String movType = "SPT_TerrainMesh"; + return movType; + } + const Ogre::Ax... [truncated message content] |