[Python-ogre-commit] SF.net SVN: python-ogre: [417] trunk/python-ogre
Brought to you by:
andy_miller,
roman_yakovenko
From: <and...@us...> - 2007-10-13 13:35:56
|
Revision: 417 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=417&view=rev Author: andy_miller Date: 2007-10-13 06:35:58 -0700 (Sat, 13 Oct 2007) Log Message: ----------- General bug fixes - more common functions moved into common_utils Updates for editable terrain, and ogre bullet Moved ogrebullet and forests into ThirdParty Updated QuickGUI Updated forests Modified Paths: -------------- trunk/python-ogre/PythonOgreConfig_nt.py trunk/python-ogre/ThirdParty/dxwebsetup.exe trunk/python-ogre/ThirdParty/opcode/Ice/IceTypes.h trunk/python-ogre/ThirdParty/opcode/OPC_IceHook.h trunk/python-ogre/ThirdParty/quickgui/QuickGUIBorder.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIBorder.h trunk/python-ogre/ThirdParty/quickgui/QuickGUIButton.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIButton.h trunk/python-ogre/ThirdParty/quickgui/QuickGUIComboBox.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIComboBox.h trunk/python-ogre/ThirdParty/quickgui/QuickGUIHorizontalScrollBar.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIHorizontalScrollBar.h trunk/python-ogre/ThirdParty/quickgui/QuickGUIHorizontalTrackBar.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIHorizontalTrackBar.h trunk/python-ogre/ThirdParty/quickgui/QuickGUIImage.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIImage.h trunk/python-ogre/ThirdParty/quickgui/QuickGUILabel.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUILabel.h trunk/python-ogre/ThirdParty/quickgui/QuickGUIList.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIList.h trunk/python-ogre/ThirdParty/quickgui/QuickGUIManager.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIManager.h trunk/python-ogre/ThirdParty/quickgui/QuickGUIMouseCursor.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIMouseCursor.h trunk/python-ogre/ThirdParty/quickgui/QuickGUINStateButton.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUINStateButton.h trunk/python-ogre/ThirdParty/quickgui/QuickGUIPanel.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIPanel.h trunk/python-ogre/ThirdParty/quickgui/QuickGUIProgressBar.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIProgressBar.h trunk/python-ogre/ThirdParty/quickgui/QuickGUIQuad.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIQuad.h trunk/python-ogre/ThirdParty/quickgui/QuickGUIQuadContainer.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIQuadContainer.h trunk/python-ogre/ThirdParty/quickgui/QuickGUIScrollPane.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIScrollPane.h trunk/python-ogre/ThirdParty/quickgui/QuickGUISheet.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUISheet.h trunk/python-ogre/ThirdParty/quickgui/QuickGUISkinSet.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUISkinSet.h trunk/python-ogre/ThirdParty/quickgui/QuickGUIText.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUITextBox.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUITextBox.h trunk/python-ogre/ThirdParty/quickgui/QuickGUITitleBar.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUITitleBar.h trunk/python-ogre/ThirdParty/quickgui/QuickGUIUtility.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIUtility.h trunk/python-ogre/ThirdParty/quickgui/QuickGUIVertexBuffer.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIVertexBuffer.h trunk/python-ogre/ThirdParty/quickgui/QuickGUIVerticalScrollBar.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIVerticalScrollBar.h trunk/python-ogre/ThirdParty/quickgui/QuickGUIVerticalTrackBar.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIVerticalTrackBar.h trunk/python-ogre/ThirdParty/quickgui/QuickGUIWidget.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIWidget.h trunk/python-ogre/ThirdParty/quickgui/QuickGUIWindow.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIWindow.h trunk/python-ogre/code_generators/common_utils/__init__.py trunk/python-ogre/code_generators/common_utils/extract_documentation.py trunk/python-ogre/code_generators/common_utils/var_checker.py trunk/python-ogre/code_generators/et/customization_data.py trunk/python-ogre/code_generators/et/generate_code.py trunk/python-ogre/code_generators/et/python_et.h trunk/python-ogre/code_generators/ogre/generate_code.py trunk/python-ogre/code_generators/ogre/hand_made_wrappers.py trunk/python-ogre/code_generators/ogrebulletc/generate_code.py trunk/python-ogre/code_generators/ogrebulletd/generate_code.py trunk/python-ogre/code_generators/ogreforests/generate_code.py trunk/python-ogre/code_generators/quickgui/generate_code.py trunk/python-ogre/code_generators/template/generate_code.py trunk/python-ogre/environment.py Added Paths: ----------- trunk/python-ogre/ThirdParty/CaelumPrerequisites.h trunk/python-ogre/ThirdParty/forests/ trunk/python-ogre/ThirdParty/forests/BatchPage.cpp trunk/python-ogre/ThirdParty/forests/BatchPage.h trunk/python-ogre/ThirdParty/forests/BatchedGeometry.cpp trunk/python-ogre/ThirdParty/forests/BatchedGeometry.h trunk/python-ogre/ThirdParty/forests/GrassLoader.cpp trunk/python-ogre/ThirdParty/forests/GrassLoader.h trunk/python-ogre/ThirdParty/forests/ImpostorPage.cpp trunk/python-ogre/ThirdParty/forests/ImpostorPage.h trunk/python-ogre/ThirdParty/forests/PagedGeometry.cpp trunk/python-ogre/ThirdParty/forests/PagedGeometry.h trunk/python-ogre/ThirdParty/forests/PropertyMaps.cpp trunk/python-ogre/ThirdParty/forests/PropertyMaps.h trunk/python-ogre/ThirdParty/forests/StaticBillboardSet.cpp trunk/python-ogre/ThirdParty/forests/StaticBillboardSet.h trunk/python-ogre/ThirdParty/forests/TreeLoader2D.cpp trunk/python-ogre/ThirdParty/forests/TreeLoader2D.h trunk/python-ogre/ThirdParty/forests/TreeLoader3D.cpp trunk/python-ogre/ThirdParty/forests/TreeLoader3D.h trunk/python-ogre/ThirdParty/forests/orig/ trunk/python-ogre/ThirdParty/forests/orig/PagedGeometry.h trunk/python-ogre/ThirdParty/ogrebullet/ trunk/python-ogre/ThirdParty/ogrebullet/Collisions/ trunk/python-ogre/ThirdParty/ogrebullet/Collisions/Debug/ trunk/python-ogre/ThirdParty/ogrebullet/Collisions/Debug/OgreBulletCollisionsDebugContact.h trunk/python-ogre/ThirdParty/ogrebullet/Collisions/Debug/OgreBulletCollisionsDebugDrawer.h trunk/python-ogre/ThirdParty/ogrebullet/Collisions/Debug/OgreBulletCollisionsDebugLines.h trunk/python-ogre/ThirdParty/ogrebullet/Collisions/Debug/OgreBulletCollisionsDebugShape.h trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisions.h trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsBoxShape.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsCompoundShape.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsConeShape.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsConvexCast.h trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsConvexHullShape.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsCylinderShape.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsDebugContact.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsDebugDrawer.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsDebugLines.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsDebugShape.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsMeshToShapeConverter.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsMinkowskiSumShape.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsMultiSphereShape.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsObject.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsObject.h trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsObjectState.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsObjectState.h trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsPreRequisites.h trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsPrecompiled.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsRay.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsRay.h trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsShape.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsShape.h trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsSphereShape.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsStaticPlaneShape.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsTriangleShape.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsTrimeshShape.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsWorld.cpp trunk/python-ogre/ThirdParty/ogrebullet/Collisions/OgreBulletCollisionsWorld.h trunk/python-ogre/ThirdParty/ogrebullet/Collisions/Shapes/ trunk/python-ogre/ThirdParty/ogrebullet/Collisions/Shapes/OgreBulletCollisionsBoxShape.h trunk/python-ogre/ThirdParty/ogrebullet/Collisions/Shapes/OgreBulletCollisionsCompoundShape.h trunk/python-ogre/ThirdParty/ogrebullet/Collisions/Shapes/OgreBulletCollisionsConeShape.h trunk/python-ogre/ThirdParty/ogrebullet/Collisions/Shapes/OgreBulletCollisionsConvexHullShape.h trunk/python-ogre/ThirdParty/ogrebullet/Collisions/Shapes/OgreBulletCollisionsCylinderShape.h trunk/python-ogre/ThirdParty/ogrebullet/Collisions/Shapes/OgreBulletCollisionsMinkowskiSumShape.h trunk/python-ogre/ThirdParty/ogrebullet/Collisions/Shapes/OgreBulletCollisionsMultiSphereShape.h trunk/python-ogre/ThirdParty/ogrebullet/Collisions/Shapes/OgreBulletCollisionsSphereShape.h trunk/python-ogre/ThirdParty/ogrebullet/Collisions/Shapes/OgreBulletCollisionsStaticPlaneShape.h trunk/python-ogre/ThirdParty/ogrebullet/Collisions/Shapes/OgreBulletCollisionsTriangleShape.h trunk/python-ogre/ThirdParty/ogrebullet/Collisions/Shapes/OgreBulletCollisionsTrimeshShape.h trunk/python-ogre/ThirdParty/ogrebullet/Collisions/Utils/ trunk/python-ogre/ThirdParty/ogrebullet/Collisions/Utils/OgreBulletCollisionsMeshToShapeConverter.h trunk/python-ogre/ThirdParty/ogrebullet/Collisions/Utils/OgreBulletConverter.h trunk/python-ogre/ThirdParty/ogrebullet/Dynamics/ trunk/python-ogre/ThirdParty/ogrebullet/Dynamics/Constraints/ trunk/python-ogre/ThirdParty/ogrebullet/Dynamics/Constraints/OgreBulletDynamics6DofConstraint.h trunk/python-ogre/ThirdParty/ogrebullet/Dynamics/Constraints/OgreBulletDynamicsConeTwistConstraint.h trunk/python-ogre/ThirdParty/ogrebullet/Dynamics/Constraints/OgreBulletDynamicsHingeConstraint.h trunk/python-ogre/ThirdParty/ogrebullet/Dynamics/Constraints/OgreBulletDynamicsPoint2pointConstraint.h trunk/python-ogre/ThirdParty/ogrebullet/Dynamics/Constraints/OgreBulletDynamicsRaycastVehicle.h trunk/python-ogre/ThirdParty/ogrebullet/Dynamics/OgreBulletDynamics.h trunk/python-ogre/ThirdParty/ogrebullet/Dynamics/OgreBulletDynamics6DofConstraint.cpp trunk/python-ogre/ThirdParty/ogrebullet/Dynamics/OgreBulletDynamicsConeTwistConstraint.cpp trunk/python-ogre/ThirdParty/ogrebullet/Dynamics/OgreBulletDynamicsConstraint.cpp trunk/python-ogre/ThirdParty/ogrebullet/Dynamics/OgreBulletDynamicsConstraint.h trunk/python-ogre/ThirdParty/ogrebullet/Dynamics/OgreBulletDynamicsHingeConstraint.cpp trunk/python-ogre/ThirdParty/ogrebullet/Dynamics/OgreBulletDynamicsObjectState.cpp trunk/python-ogre/ThirdParty/ogrebullet/Dynamics/OgreBulletDynamicsObjectState.h trunk/python-ogre/ThirdParty/ogrebullet/Dynamics/OgreBulletDynamicsPoint2pointConstraint.cpp trunk/python-ogre/ThirdParty/ogrebullet/Dynamics/OgreBulletDynamicsPreRequisites.h trunk/python-ogre/ThirdParty/ogrebullet/Dynamics/OgreBulletDynamicsPrecompiled.cpp trunk/python-ogre/ThirdParty/ogrebullet/Dynamics/OgreBulletDynamicsRaycastVehicle.cpp trunk/python-ogre/ThirdParty/ogrebullet/Dynamics/OgreBulletDynamicsRigidBody.cpp trunk/python-ogre/ThirdParty/ogrebullet/Dynamics/OgreBulletDynamicsRigidBody.h trunk/python-ogre/ThirdParty/ogrebullet/Dynamics/OgreBulletDynamicsWorld.cpp trunk/python-ogre/ThirdParty/ogrebullet/Dynamics/OgreBulletDynamicsWorld.h trunk/python-ogre/ThirdParty/opcode/IceAABB.cpp trunk/python-ogre/ThirdParty/opcode/IceAABB.h trunk/python-ogre/ThirdParty/opcode/IceAxes.h trunk/python-ogre/ThirdParty/opcode/IceBoundingSphere.h trunk/python-ogre/ThirdParty/opcode/IceContainer.cpp trunk/python-ogre/ThirdParty/opcode/IceContainer.h trunk/python-ogre/ThirdParty/opcode/IceFPU.h trunk/python-ogre/ThirdParty/opcode/IceHPoint.cpp trunk/python-ogre/ThirdParty/opcode/IceHPoint.h trunk/python-ogre/ThirdParty/opcode/IceIndexedTriangle.cpp trunk/python-ogre/ThirdParty/opcode/IceIndexedTriangle.h trunk/python-ogre/ThirdParty/opcode/IceLSS.h trunk/python-ogre/ThirdParty/opcode/IceMatrix3x3.cpp trunk/python-ogre/ThirdParty/opcode/IceMatrix3x3.h trunk/python-ogre/ThirdParty/opcode/IceMatrix4x4.cpp trunk/python-ogre/ThirdParty/opcode/IceMatrix4x4.h trunk/python-ogre/ThirdParty/opcode/IceMemoryMacros.h trunk/python-ogre/ThirdParty/opcode/IceOBB.cpp trunk/python-ogre/ThirdParty/opcode/IceOBB.h trunk/python-ogre/ThirdParty/opcode/IcePairs.h trunk/python-ogre/ThirdParty/opcode/IcePlane.cpp trunk/python-ogre/ThirdParty/opcode/IcePlane.h trunk/python-ogre/ThirdParty/opcode/IcePoint.cpp trunk/python-ogre/ThirdParty/opcode/IcePoint.h trunk/python-ogre/ThirdParty/opcode/IcePreprocessor.h trunk/python-ogre/ThirdParty/opcode/IceRandom.cpp trunk/python-ogre/ThirdParty/opcode/IceRandom.h trunk/python-ogre/ThirdParty/opcode/IceRay.cpp trunk/python-ogre/ThirdParty/opcode/IceRay.h trunk/python-ogre/ThirdParty/opcode/IceRevisitedRadix.cpp trunk/python-ogre/ThirdParty/opcode/IceRevisitedRadix.h trunk/python-ogre/ThirdParty/opcode/IceSegment.cpp trunk/python-ogre/ThirdParty/opcode/IceSegment.h trunk/python-ogre/ThirdParty/opcode/IceTriangle.cpp trunk/python-ogre/ThirdParty/opcode/IceTriangle.h trunk/python-ogre/ThirdParty/opcode/IceTrilist.h trunk/python-ogre/ThirdParty/opcode/IceTypes.h trunk/python-ogre/ThirdParty/opcode/IceUtils.cpp trunk/python-ogre/ThirdParty/opcode/IceUtils.h trunk/python-ogre/ThirdParty/opcode/Opcode.dsp trunk/python-ogre/ThirdParty/opcode/Opcode.dsw trunk/python-ogre/ThirdParty/opcode/Opcode.ncb trunk/python-ogre/ThirdParty/quickgui/QuickGUIMenuLabel.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIMenuLabel.h trunk/python-ogre/demos/ogrebullet/ trunk/python-ogre/demos/ogrebullet/Demo_OgreCollision01.py trunk/python-ogre/demos/ogrebullet/SampleFramework.py trunk/python-ogre/demos/ogrebullet/plugins.cfg trunk/python-ogre/demos/ogrebullet/resources.cfg Removed Paths: ------------- trunk/python-ogre/ThirdParty/quickgui/QuickGUIListItem.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIListItem.h trunk/python-ogre/ThirdParty/quickgui/QuickGUIMenu.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIMenu.h trunk/python-ogre/ThirdParty/quickgui/QuickGUIMenuList.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIMenuList.h Modified: trunk/python-ogre/PythonOgreConfig_nt.py =================================================================== --- trunk/python-ogre/PythonOgreConfig_nt.py 2007-10-11 13:50:16 UTC (rev 416) +++ trunk/python-ogre/PythonOgreConfig_nt.py 2007-10-13 13:35:58 UTC (rev 417) @@ -32,9 +32,11 @@ PATH_OPENAL= os.path.join(BASE_DIR, 'openal') PATH_ALUT= os.path.join(BASE_DIR, 'freealut') PATH_OgreOde= os.path.join(BASE_DIR, PATH_OgreAddons,'ogreode') -PATH_OgreBullet= os.path.join(PATH_OgreAddons,'ogrebullet') -PATH_ogreforests= os.path.join(PATH_OgreAddons,'forests') +# # PATH_OgreBullet= os.path.join(PATH_OgreAddons,'ogrebullet') +# # PATH_ogreforests= os.path.join(PATH_OgreAddons,'forests') +PATH_OgreBullet= os.path.join(PATH_THIRDPARTY,'ogrebullet') +PATH_ogreforests= os.path.join(PATH_THIRDPARTY,'forests') PATH_OGREAL= os.path.join(PATH_THIRDPARTY,'ogreal') PATH_OPCODE= os.path.join(PATH_THIRDPARTY,'opcode') PATH_quickgui= os.path.join(PATH_THIRDPARTY,'quickgui') @@ -74,7 +76,7 @@ PATH_LIB_ODE = os.path.join( PATH_ODE, 'lib/releaselib')## probable releaselib for posix PATH_LIB_OPCODE = os.path.join( PATH_OPCODE ) PATH_LIB_OgreOde = os.path.join( PATH_OgreOde, 'lib/Release') -PATH_LIB_OgreBullet = os.path.join( PATH_OgreBullet, 'lib/Release') +# # PATH_LIB_OgreBullet = os.path.join( PATH_OgreBullet, 'lib/Release') PATH_LIB_OgreOdePrefab = os.path.join( PATH_OgreOde, 'prefab/lib/Release' ) PATH_LIB_OgreOdeLoader = os.path.join( PATH_OgreOde, 'loader/lib/Release' ) PATH_LIB_OgreAL = os.path.join( PATH_OGREAL)#, 'lib/Release' ) @@ -111,10 +113,13 @@ PATH_INCLUDE_OGG= os.path.join( PATH_OGG, 'include' ) PATH_INCLUDE_VORBIS= os.path.join( PATH_VORBIS, 'include' ) PATH_INCLUDE_ALUT= os.path.join( PATH_ALUT, 'include' ) -PATH_INCLUDE_OgreBullet = [ - os.path.join( PATH_OgreBullet,'Collisions','include') - ,os.path.join( PATH_OgreBullet,'Dynamics','include') - ] + +# # PATH_INCLUDE_OgreBullet = [ +# # os.path.join( PATH_OgreBullet,'Collisions','include') +# # ,os.path.join( PATH_OgreBullet,'Dynamics','include') +# # ] +##PATH_INCLUDE_OgreBullet = PATH_OgreBullet + PATH_INCLUDE_OgreOde = os.path.join( PATH_OgreOde,'include') PATH_INCLUDE_OgreOdePrefab= os.path.join( PATH_OgreOde,'prefab/include') PATH_INCLUDE_OgreOdeLoader= os.path.join( PATH_OgreOde,'loader/include') @@ -131,7 +136,8 @@ PATH_INCLUDE_ogredshow = PATH_ogredshow PATH_INCLUDE_plib = PATH_plib PATH_INCLUDE_navi = os.path.join (PATH_navi,'include') -PATH_INCLUDE_ogreforests = os.path.join (PATH_ogreforests,'include') +##PATH_INCLUDE_ogreforests = os.path.join (PATH_ogreforests,'include') +PATH_INCLUDE_ogreforests = PATH_ogreforests PATH_INCLUDE_OggVorbisTheora = [ os.path.join(BASE_DIR,'ogg','include') ,os.path.join(BASE_DIR, 'vorbis', 'include') Added: trunk/python-ogre/ThirdParty/CaelumPrerequisites.h =================================================================== --- trunk/python-ogre/ThirdParty/CaelumPrerequisites.h (rev 0) +++ trunk/python-ogre/ThirdParty/CaelumPrerequisites.h 2007-10-13 13:35:58 UTC (rev 417) @@ -0,0 +1,39 @@ +#ifndef CAELUMPREREQUISITES_H +#define CAELUMPREREQUISITES_H + +// Include external headers +#include "Ogre.h" + +#define DllExport + +// Define the version code +#define CAELUM_VERSION_MAIN 0 +#define CAELUM_VERSION_SEC 2 +#define CAELUM_VERSION_TER 1 +#define CAELUM_VERSION = (CAELUM_VERSION_MAIN << 16) | (CAELUM_VERSION_SEC << 8) | CAELUM_VERSION_TER + +namespace caelum { + /// Resource group name for caelum resources. + extern DllExport Ogre::String RESOURCE_GROUP_NAME; + + /* Set a global camera distances modifier for the clipping distance. + This threshold will be substracted from the far clipping distance if applicable, else it will be + added to the near clipping distance (ie, if infinite far clipping distance is used). + */ + const float CAMERA_DISTANCE_MODIFIER = 0; + + // Render grounp for caelum stuff + // It's best to have them all together + enum CaelumRenderQueueGroupId + { + CAELUM_RENDER_QUEUE_STARFIELD = Ogre::RENDER_QUEUE_SKIES_EARLY + 0, + CAELUM_RENDER_QUEUE_SKYDOME = Ogre::RENDER_QUEUE_SKIES_EARLY + 1, + CAELUM_RENDER_QUEUE_SUN = Ogre::RENDER_QUEUE_SKIES_EARLY + 2, + CAELUM_RENDER_QUEUE_CLOUDS = Ogre::RENDER_QUEUE_SKIES_EARLY + 3, + }; +} + +// Log macro +#define LOG(msg) Ogre::LogManager::getSingleton().logMessage(msg); + +#endif //CAELUMPREREQUISITES_H Modified: trunk/python-ogre/ThirdParty/dxwebsetup.exe =================================================================== (Binary files differ) Added: trunk/python-ogre/ThirdParty/forests/BatchPage.cpp =================================================================== --- trunk/python-ogre/ThirdParty/forests/BatchPage.cpp (rev 0) +++ trunk/python-ogre/ThirdParty/forests/BatchPage.cpp 2007-10-13 13:35:58 UTC (rev 417) @@ -0,0 +1,265 @@ +/*------------------------------------------------------------------------------------- +Copyright (c) 2006 John Judnich + +This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. +Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------------*/ + +//BatchPage.cpp +//BatchPage is an extension to PagedGeometry which displays entities as static geometry. +//------------------------------------------------------------------------------------- + +#include "BatchPage.h" +#include "BatchedGeometry.h" + +#include "OgreRoot.h" +#include "OgreCamera.h" +#include "OgreVector3.h" +#include "OgreQuaternion.h" +#include "OgreEntity.h" +#include "OgreRenderSystem.h" +#include "OgreRenderSystemCapabilities.h" +#include "OgreHighLevelGpuProgram.h" +#include "OgreHighLevelGpuProgramManager.h" +using namespace Ogre; + + +//------------------------------------------------------------------------------------- + + +unsigned long BatchPage::refCount = 0; +unsigned long BatchPage::GUID = 0; + +void BatchPage::init(PagedGeometry *geom) +{ + sceneMgr = geom->getSceneManager(); + batch = new BatchedGeometry(sceneMgr); + + fadeEnabled = false; + + const RenderSystemCapabilities *caps = Root::getSingleton().getRenderSystem()->getCapabilities(); + if (caps->hasCapability(RSC_VERTEX_PROGRAM)) + shadersSupported = true; + else + shadersSupported = false; + + ++refCount; +} + +BatchPage::~BatchPage() +{ + delete batch; + + //Delete unfaded material references + unfadedMaterials.clear(); +} + + +void BatchPage::addEntity(Entity *ent, const Vector3 &position, const Quaternion &rotation, const Vector3 &scale, const Ogre::ColourValue &color) +{ + batch->addEntity(ent, position, rotation, scale, color); +} + +void BatchPage::build() +{ + batch->build(); + + BatchedGeometry::SubBatchIterator it = batch->getSubBatchIterator(); + while (it.hasMoreElements()){ + BatchedGeometry::SubBatch *subBatch = it.getNext(); + MaterialPtr mat = subBatch->getMaterial(); + + //Disable specular unless a custom shader is being used. + //This is done because the default shader applied by BatchPage + //doesn't support specular, and fixed-function needs to look + //the same as the shader (for computers with no shader support) + for (int t = 0; t < mat->getNumTechniques(); ++t){ + Technique *tech = mat->getTechnique(t); + for (int p = 0; p < tech->getNumPasses(); ++p){ + Pass *pass = tech->getPass(p); + if (pass->getVertexProgramName() == "") + pass->setSpecular(0, 0, 0, 1); + } + } + + //Store the original materials + unfadedMaterials.push_back(subBatch->getMaterial()); + } + + _updateShaders(); +} + +void BatchPage::removeEntities() +{ + batch->clear(); + + unfadedMaterials.clear(); + fadeEnabled = false; +} + + +void BatchPage::setVisible(bool visible) +{ + batch->setVisible(visible); +} + +void BatchPage::setFade(bool enabled, Real visibleDist, Real invisibleDist) +{ + if (!shadersSupported) + return; + + //If fade status has changed... + if (fadeEnabled != enabled){ + fadeEnabled = enabled; + + if (enabled) { + //Transparent batches should render after impostors + batch->setRenderQueueGroup(RENDER_QUEUE_6); + } else { + //Opaque batches should render in the normal render queue + batch->setRenderQueueGroup(RENDER_QUEUE_MAIN); + } + + this->visibleDist = visibleDist; + this->invisibleDist = invisibleDist; + _updateShaders(); + } +} + +void BatchPage::_updateShaders() +{ + if (!shadersSupported) + return; + + unsigned int i = 0; + BatchedGeometry::SubBatchIterator it = batch->getSubBatchIterator(); + while (it.hasMoreElements()){ + BatchedGeometry::SubBatch *subBatch = it.getNext(); + MaterialPtr mat = unfadedMaterials[i++]; + + //Compile the CG shader script based on various material / fade options + StringUtil::StrStreamType tmpName; + tmpName << "BatchPage_"; + if (fadeEnabled) + tmpName << "fade_"; + tmpName << "vp"; + + const String vertexProgName = tmpName.str(); + + //If the shader hasn't been created yet, create it + if (HighLevelGpuProgramManager::getSingleton().getByName(vertexProgName).isNull()){ + String vertexProgSource = + "void main( \n" + " float3 normal : NORMAL, \n" + " float4 iPosition : POSITION, \n" + " float4 iColor : COLOR, \n" + " float2 iUV : TEXCOORD0, \n" + + " out float4 oPosition : POSITION, \n" + " out float4 oColor : COLOR, \n" + " out float2 oUV : TEXCOORD0, \n" + " out float4 oFog : FOG, \n" + + " uniform float4 objSpaceLight, \n" + " uniform float4 lightDiffuse, \n" + " uniform float4 lightAmbient, \n" + " uniform float4 matAmbient, \n"; + + if (fadeEnabled) vertexProgSource += + " uniform float3 camPos, \n"; + + vertexProgSource += + " uniform float4x4 worldViewProj, \n" + " uniform float fadeGap, \n" + " uniform float invisibleDist )\n" + "{ \n"; + + vertexProgSource += + //Perform lighting calculations (no specular) + " float3 light = normalize(objSpaceLight.xyz - (iPosition.xyz * objSpaceLight.w)); \n" + " float diffuseFactor = max(dot(normal, light), 0); \n" + " oColor = lightAmbient + diffuseFactor * lightDiffuse; \n"; + + vertexProgSource += + " oColor *= (iColor / matAmbient); \n"; + + if (fadeEnabled) vertexProgSource += + //Fade out in the distance + " float dist = distance(camPos.xz, iPosition.xz); \n" + " oColor.a *= (invisibleDist - dist) / fadeGap; \n"; + + vertexProgSource += + " oUV = iUV; \n" + " oPosition = mul(worldViewProj, iPosition); \n" + " oFog.x = oPosition.z; \n" + "}"; + + HighLevelGpuProgramPtr vertexShader = HighLevelGpuProgramManager::getSingleton().createProgram( + vertexProgName, + ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, + "cg", GPT_VERTEX_PROGRAM); + + vertexShader->setSource(vertexProgSource); + vertexShader->setParameter("profiles", "vs_1_1 arbvp1"); + vertexShader->setParameter("entry_point", "main"); + vertexShader->load(); + } + + //Now that the shader is ready to be applied, apply it + StringUtil::StrStreamType materialSignature; + materialSignature << "BatchMat|"; + materialSignature << mat->getName() << "|"; + if (fadeEnabled){ + materialSignature << visibleDist << "|"; + materialSignature << invisibleDist << "|"; + } + + //Search for the desired material + MaterialPtr generatedMaterial = MaterialManager::getSingleton().getByName(materialSignature.str()); + if (generatedMaterial.isNull()){ + //Clone the material + generatedMaterial = mat->clone(materialSignature.str()); + + //And apply the fade shader + for (unsigned short t = 0; t < generatedMaterial->getNumTechniques(); ++t){ + Technique *tech = generatedMaterial->getTechnique(t); + for (unsigned short p = 0; p < tech->getNumPasses(); ++p){ + Pass *pass = tech->getPass(p); + + //Setup vertex program + pass->setVertexProgram(vertexProgName); + GpuProgramParametersSharedPtr params = pass->getVertexProgramParameters(); + + params->setNamedAutoConstant("objSpaceLight", GpuProgramParameters::ACT_LIGHT_POSITION_OBJECT_SPACE); + params->setNamedAutoConstant("lightDiffuse", GpuProgramParameters::ACT_DERIVED_LIGHT_DIFFUSE_COLOUR); + params->setNamedAutoConstant("lightAmbient", GpuProgramParameters::ACT_DERIVED_AMBIENT_LIGHT_COLOUR); + + params->setNamedAutoConstant("matAmbient", GpuProgramParameters::ACT_SURFACE_AMBIENT_COLOUR); + params->setNamedAutoConstant("worldViewProj", GpuProgramParameters::ACT_WORLDVIEWPROJ_MATRIX); + + if (fadeEnabled){ + params->setNamedAutoConstant("camPos", GpuProgramParameters::ACT_CAMERA_POSITION_OBJECT_SPACE); + + //Set fade ranges + params->setNamedAutoConstant("invisibleDist", GpuProgramParameters::ACT_CUSTOM); + params->setNamedConstant("invisibleDist", invisibleDist); + + params->setNamedAutoConstant("fadeGap", GpuProgramParameters::ACT_CUSTOM); + params->setNamedConstant("fadeGap", invisibleDist - visibleDist); + + if (pass->getAlphaRejectFunction() == CMPF_ALWAYS_PASS) + pass->setSceneBlending(SBT_TRANSPARENT_ALPHA); + } + } + } + + } + + //Apply the material + subBatch->setMaterial(generatedMaterial); + } + +} Added: trunk/python-ogre/ThirdParty/forests/BatchPage.h =================================================================== --- trunk/python-ogre/ThirdParty/forests/BatchPage.h (rev 0) +++ trunk/python-ogre/ThirdParty/forests/BatchPage.h 2007-10-13 13:35:58 UTC (rev 417) @@ -0,0 +1,78 @@ +/*------------------------------------------------------------------------------------- +Copyright (c) 2006 John Judnich + +This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. +Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------------*/ + +//BatchPage.h +//BatchPage is an extension to PagedGeometry which displays entities as static geometry. +//------------------------------------------------------------------------------------- + +#ifndef __BatchPage_H__ +#define __BatchPage_H__ + +#include "PagedGeometry.h" +#include "BatchedGeometry.h" + +#include "OgrePrerequisites.h" +#include "OgreStringConverter.h" + + +/** +\brief The BatchPage class renders entities as StaticGeometry. + +This is one of the geometry page types included in the StaticGeometry engine. These +page types should be added to a PagedGeometry object with PagedGeometry::addDetailLevel() +so the PagedGeometry will know how you want your geometry displayed. + +To use this page type, use: +\code +PagedGeometry::addDetailLevel<BatchPage>(farRange); +\endcode + +This page type uses batched geometry (Ogre::StaticGeometry) to represent the entities. +Batched geometry is generally much faster than plain entities, since video card state +changes and transform calculations can be minimized. Batched geometry can be anywhere +from 2 to 20 times faster than plain entities. +*/ +class BatchPage: public GeometryPage +{ +public: + void init(PagedGeometry *geom); + ~BatchPage(); + + void addEntity(Ogre::Entity *ent, const Ogre::Vector3 &position, const Ogre::Quaternion &rotation, const Ogre::Vector3 &scale, const Ogre::ColourValue &color); + void build(); + void removeEntities(); + + void setVisible(bool visible); + void setFade(bool enabled, Ogre::Real visibleDist, Ogre::Real invisibleDist); + + void addEntityToBoundingBox() {} + void clearBoundingBox() {} + const Ogre::AxisAlignedBox &getBoundingBox() { return batch->getBoundingBox(); } + +private: + void _updateShaders(); + + bool fadeEnabled, shadersSupported; + Ogre::Real visibleDist, invisibleDist; + std::vector<Ogre::MaterialPtr> unfadedMaterials; + + Ogre::SceneManager *sceneMgr; + BatchedGeometry *batch; + + static unsigned long refCount; + static unsigned long GUID; + static inline Ogre::String getUniqueID(const Ogre::String &prefix) + { + return prefix + Ogre::StringConverter::toString(++GUID); + } +}; + + +#endif Added: trunk/python-ogre/ThirdParty/forests/BatchedGeometry.cpp =================================================================== --- trunk/python-ogre/ThirdParty/forests/BatchedGeometry.cpp (rev 0) +++ trunk/python-ogre/ThirdParty/forests/BatchedGeometry.cpp 2007-10-13 13:35:58 UTC (rev 417) @@ -0,0 +1,607 @@ +/*------------------------------------------------------------------------------------- +Copyright (c) 2006 John Judnich + +This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. +Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: +1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------------*/ + +//BatchedGeometry.h +//A "lightweight" version of Ogre::StaticGeometry, which gives you a little more control +//over the batch materials, etc. +//------------------------------------------------------------------------------------- + +#include "BatchedGeometry.h" + +#include "OgreRoot.h" +#include "OgreRenderSystem.h" +#include "OgreCamera.h" +#include "OgreVector3.h" +#include "OgreQuaternion.h" +#include "OgreSceneNode.h" +#include "OgreString.h" +#include "OgreStringConverter.h" +#include "OgreEntity.h" +#include "OgreSubMesh.h" +#include "OgreMesh.h" +#include "OgreMeshManager.h" +#include "OgreHardwareBufferManager.h" +#include "OgreHardwareBuffer.h" +#include "OgreMaterialManager.h" +#include "OgreMaterial.h" +using namespace Ogre; + + +//------------------------------------------------------------------------------------- + +BatchedGeometry::BatchedGeometry(SceneManager *mgr) + : withinFarDistance(0), + minDistanceSquared(0), + sceneNode(NULL), + sceneMgr(mgr), + built(false), + boundsUndefined(true) + +{ + clear(); +} + +BatchedGeometry::~BatchedGeometry() +{ + clear(); +} + +void BatchedGeometry::addEntity(Entity *ent, const Vector3 &position, const Quaternion &orientation, const Vector3 &scale, const Ogre::ColourValue &color) +{ + //For each submesh + Mesh::SubMeshIterator i = ent->getMesh()->getSubMeshIterator(); + while (i.hasMoreElements()){ + //Get the submesh + SubMesh *mesh = i.peekNext(); + + //Generate a format string that uniquely identifies this material & vertex/index format + String formatStr = getFormatString(mesh); + + //If a batch using an identical format exists... + SubBatch *batch; + SubBatchMap::iterator batchIter = subBatchMap.find(formatStr); + if (batchIter != subBatchMap.end()){ + //Use the batch + batch = batchIter->second; + } else { + //Otherwise create a new batch + batch = new SubBatch(this, mesh); + subBatchMap.insert(std::pair<String, SubBatch*>(formatStr, batch)); + } + + //Now add the submesh to the compatible batch + batch->addSubMesh(mesh, position, orientation, scale, color); + + //Next item + i.getNext(); + } + + //Update bounding box + Matrix4 mat(orientation); + mat.setScale(scale); + AxisAlignedBox entBounds = ent->getBoundingBox(); + entBounds.transform(mat); + + if (boundsUndefined){ + bounds.setMinimum(entBounds.getMinimum() + position); + bounds.setMaximum(entBounds.getMaximum() + position); + boundsUndefined = false; + } else { + Vector3 min = bounds.getMinimum(); + Vector3 max = bounds.getMaximum(); + min.makeFloor(entBounds.getMinimum() + position); + max.makeCeil(entBounds.getMaximum() + position); + bounds.setMinimum(min); + bounds.setMaximum(max); + } +} + +BatchedGeometry::SubBatchIterator BatchedGeometry::getSubBatchIterator() const +{ + return BatchedGeometry::SubBatchIterator((SubBatchMap&)subBatchMap); +} + +String BatchedGeometry::getFormatString(SubMesh *mesh) +{ + StringUtil::StrStreamType str; + + str << mesh->getMaterialName() << "|"; + str << mesh->indexData->indexBuffer->getType() << "|"; + + const VertexDeclaration::VertexElementList &elemList = mesh->vertexData->vertexDeclaration->getElements(); + VertexDeclaration::VertexElementList::const_iterator i; + for (i = elemList.begin(); i != elemList.end(); ++i) + { + const VertexElement &element = *i; + str << element.getSource() << "|"; + str << element.getSemantic() << "|"; + str << element.getType() << "|"; + } + + return str.str(); +} + +void BatchedGeometry::build() +{ + ///Make sure the batch hasn't already been built + if (built) + OGRE_EXCEPT(Exception::ERR_DUPLICATE_ITEM, "Invalid call to build() - geometry is already batched (call clear() first)", "BatchedGeometry::GeomBatch::build()"); + + if (subBatchMap.size() != 0) { + //Finish bounds information + center = bounds.getCenter(); //Calculate bounds center + bounds.setMinimum(bounds.getMinimum() - center); //Center the bounding box + bounds.setMaximum(bounds.getMaximum() - center); //Center the bounding box + radius = bounds.getMaximum().length(); //Calculate BB radius + + //Create scene node + sceneNode = sceneMgr->getRootSceneNode()->createChildSceneNode(center); + + //Build each batch + for (SubBatchMap::iterator i = subBatchMap.begin(); i != subBatchMap.end(); ++i){ + i->second->build(); + } + + //Attach the batch to the scene node + sceneNode->attachObject(this); + + //Debug + //sceneNode->showBoundingBox(true); + + built = true; + } + +} + +void BatchedGeometry::clear() +{ + //Remove the batch from the scene + if (sceneNode){ + sceneNode->removeAllChildren(); + sceneMgr->destroySceneNode(sceneNode->getName()); + sceneNode = NULL; + } + + //Reset bounds information + boundsUndefined = true; + center = Vector3::ZERO; + radius = 0; + + //Delete each batch + for (SubBatchMap::iterator i = subBatchMap.begin(); i != subBatchMap.end(); ++i){ + delete i->second; + } + subBatchMap.clear(); + + built = false; +} + +void BatchedGeometry::_updateRenderQueue(RenderQueue *queue) +{ + //If visible... + if (isVisible()){ + //Ask each batch to add itself to the render queue if appropriate + for (SubBatchMap::iterator i = subBatchMap.begin(); i != subBatchMap.end(); ++i){ + i->second->addSelfToRenderQueue(queue, getRenderQueueGroup()); + } + } +} + +bool BatchedGeometry::isVisible() +{ + return mVisible && withinFarDistance; +} + +void BatchedGeometry::_notifyCurrentCamera(Camera *cam) +{ + if (getRenderingDistance() == 0) { + withinFarDistance = true; + } else { + //Calculate camera distance + Vector3 camVec = cam->getDerivedPosition() - center; + Real centerDistanceSquared = camVec.squaredLength(); + minDistanceSquared = std::max(0.0f, centerDistanceSquared - (radius * radius)); + //Note: centerDistanceSquared measures the distance between the camera and the center of the GeomBatch, + //while minDistanceSquared measures the closest distance between the camera and the closest edge of the + //geometry's bounding sphere. + + //Determine whether the BatchedGeometry is within the far rendering distance + withinFarDistance = minDistanceSquared <= Math::Sqr(getRenderingDistance()); + } +} + + + + +BatchedGeometry::SubBatch::SubBatch(BatchedGeometry *parent, SubMesh *mesh) +{ + meshType = mesh; + material = MaterialManager::getSingleton().getByName(mesh->getMaterialName()); + this->parent = parent; + built = false; + + //Setup vertex/index data structure + vertexData = mesh->vertexData->clone(false); + indexData = mesh->indexData->clone(false); + + //Remove blend weights from vertex format + const VertexElement* blendIndices = vertexData->vertexDeclaration->findElementBySemantic(VES_BLEND_INDICES); + const VertexElement* blendWeights = vertexData->vertexDeclaration->findElementBySemantic(VES_BLEND_WEIGHTS); + if (blendIndices && blendWeights) + { + //Check for format errors + assert(blendIndices->getSource() == blendWeights->getSource() + && "Blend indices and weights should be in the same buffer"); + assert(blendIndices->getSize() + blendWeights->getSize() == vertexData->vertexBufferBinding->getBuffer(blendIndices->getSource())->getVertexSize() + && "Blend indices and blend buffers should have buffer to themselves!"); + + //Remove the blend weights + vertexData->vertexBufferBinding->unsetBinding(blendIndices->getSource()); + vertexData->vertexDeclaration->removeElement(VES_BLEND_INDICES); + vertexData->vertexDeclaration->removeElement(VES_BLEND_WEIGHTS); + #if OGRE_VERSION_MAJOR == 1 && OGRE_VERSION_MINOR > 2 + vertexData->closeGapsInBindings(); + #endif + } + + //Reset vertex/index count + vertexData->vertexStart = 0; + vertexData->vertexCount = 0; + indexData->indexStart = 0; + indexData->indexCount = 0; +} + +BatchedGeometry::SubBatch::~SubBatch() +{ + clear(); + + delete vertexData; + delete indexData; +} + +void BatchedGeometry::SubBatch::addSubMesh(SubMesh *mesh, const Vector3 &position, const Quaternion &orientation, const Vector3 &scale, const Ogre::ColourValue &color) +{ + assert(!built); + + //Add this submesh to the queue + QueuedMesh newMesh; + newMesh.mesh = mesh; + newMesh.position = position; + newMesh.orientation = orientation; + newMesh.scale = scale; + + newMesh.color = color; + VertexElementType format = Root::getSingleton().getRenderSystem()->getColourVertexElementType(); + switch (format){ + case VET_COLOUR_ARGB: + std::swap(newMesh.color.r, newMesh.color.b); + break; + case VET_COLOUR_ABGR: + break; + default: + OGRE_EXCEPT(0, "Unknown RenderSystem color format", "BatchedGeometry::SubBatch::addSubMesh()"); + break; + } + + meshQueue.push_back(newMesh); + + //Increment the vertex/index count so the buffers will have room for this mesh + vertexData->vertexCount += mesh->vertexData->vertexCount; + indexData->indexCount += mesh->indexData->indexCount; +} + +void BatchedGeometry::SubBatch::build() +{ + assert(!built); + + //Misc. setup + Vector3 batchCenter = parent->center; + + //Allocate the index buffer + HardwareIndexBuffer::IndexType indexType = meshType->indexData->indexBuffer->getType(); + indexData->indexBuffer = HardwareBufferManager::getSingleton() + .createIndexBuffer(indexType, indexData->indexCount, HardwareBuffer::HBU_STATIC_WRITE_ONLY); + + //Lock the index buffer + uint32 *indexBuffer32; + uint16 *indexBuffer16; + if (indexType == HardwareIndexBuffer::IT_32BIT) + indexBuffer32 = static_cast<uint32*>(indexData->indexBuffer->lock(HardwareBuffer::HBL_DISCARD)); + else + indexBuffer16 = static_cast<uint16*>(indexData->indexBuffer->lock(HardwareBuffer::HBL_DISCARD)); + + //Allocate & lock the vertex buffers + std::vector<uchar*> vertexBuffers; + std::vector<VertexDeclaration::VertexElementList> vertexBufferElements; + + VertexBufferBinding *vertBinding = vertexData->vertexBufferBinding; + VertexDeclaration *vertDecl = vertexData->vertexDeclaration; + + for (Ogre::ushort i = 0; i < vertBinding->getBufferCount(); ++i) + { + HardwareVertexBufferSharedPtr buffer = HardwareBufferManager::getSingleton() + .createVertexBuffer(vertDecl->getVertexSize(i), vertexData->vertexCount, HardwareBuffer::HBU_STATIC_WRITE_ONLY); + vertBinding->setBinding(i, buffer); + + vertexBuffers.push_back(static_cast<uchar*>(buffer->lock(HardwareBuffer::HBL_DISCARD))); + vertexBufferElements.push_back(vertDecl->findElementsBySource(i)); + } + + //If no vertex colors are used, make sure the final batch includes them (so the shade values work) + if (!vertexData->vertexDeclaration->findElementBySemantic(VES_DIFFUSE)) { + Ogre::ushort i = (ushort)vertBinding->getBufferCount(); + + vertDecl->addElement(i, 0, VET_COLOUR, VES_DIFFUSE); + + HardwareVertexBufferSharedPtr buffer = HardwareBufferManager::getSingleton() + .createVertexBuffer(vertDecl->getVertexSize(i), vertexData->vertexCount, HardwareBuffer::HBU_STATIC_WRITE_ONLY); + vertBinding->setBinding(i, buffer); + + vertexBuffers.push_back(static_cast<uchar*>(buffer->lock(HardwareBuffer::HBL_DISCARD))); + vertexBufferElements.push_back(vertDecl->findElementsBySource(i)); + + } + + //Prepare vertex colors + Pass *p = material->getTechnique(0)->getPass(0); + p->setVertexColourTracking(TVC_AMBIENT); + + ColourValue ambient = p->getAmbient(); + VertexElementType format = Root::getSingleton().getRenderSystem()->getColourVertexElementType(); + switch (format){ + case VET_COLOUR_ARGB: + std::swap(ambient.r, ambient.b); + break; + case VET_COLOUR_ABGR: + break; + default: + OGRE_EXCEPT(0, "Unknown RenderSystem color format", "BatchedGeometry::SubBatch::build()"); + break; + } + + + //For each queued mesh... + MeshQueueIterator it; + size_t indexOffset = 0; + for (it = meshQueue.begin(); it != meshQueue.end(); ++it) { + const QueuedMesh queuedMesh = (*it); + const IndexData *sourceIndexData = queuedMesh.mesh->indexData; + const VertexData *sourceVertexData = queuedMesh.mesh->vertexData; + + //Copy mesh vertex data into the vertex buffer + VertexBufferBinding *sourceBinds = sourceVertexData->vertexBufferBinding; + VertexBufferBinding *destBinds = vertexData->vertexBufferBinding; + for (Ogre::ushort i = 0; i < destBinds->getBufferCount(); ++i) + { + if (i < sourceBinds->getBufferCount()){ + //Lock the input buffer + HardwareVertexBufferSharedPtr sourceBuffer = sourceBinds->getBuffer(i); + uchar *sourceBase = static_cast<uchar*>(sourceBuffer->lock(HardwareBuffer::HBL_READ_ONLY)); + + //Get the locked output buffer + uchar *destBase = vertexBuffers[i]; + + //Copy vertices + float *sourcePtr, *destPtr; + for (size_t v = 0; v < sourceVertexData->vertexCount; ++v) + { + // Iterate over vertex elements + VertexDeclaration::VertexElementList &elems = vertexBufferElements[i]; + VertexDeclaration::VertexElementList::iterator ei; + for (ei = elems.begin(); ei != elems.end(); ++ei) + { + VertexElement &elem = *ei; + elem.baseVertexPointerToElement(sourceBase, &sourcePtr); + elem.baseVertexPointerToElement(destBase, &destPtr); + + Vector3 tmp; + uint32 tmpColor; + uint8 tmpR, tmpG, tmpB, tmpA; + + switch (elem.getSemantic()) + { + case VES_POSITION: + tmp.x = *sourcePtr++; + tmp.y = *sourcePtr++; + tmp.z = *sourcePtr++; + + //Transform + tmp = (queuedMesh.orientation * (tmp * queuedMesh.scale)) + queuedMesh.position; + tmp -= batchCenter; //Adjust for batch center + + *destPtr++ = tmp.x; + *destPtr++ = tmp.y; + *destPtr++ = tmp.z; + break; + + case VES_NORMAL: + tmp.x = *sourcePtr++; + tmp.y = *sourcePtr++; + tmp.z = *sourcePtr++; + + //Rotate + tmp = queuedMesh.orientation * tmp; + + *destPtr++ = tmp.x; + *destPtr++ = tmp.y; + *destPtr++ = tmp.z; + break; + + case VES_DIFFUSE: + tmpColor = *((uint32*)sourcePtr++); + tmpR = ((tmpColor) & 0xFF) * queuedMesh.color.r * ambient.r; + tmpG = ((tmpColor >> 8) & 0xFF) * queuedMesh.color.g * ambient.g; + tmpB = ((tmpColor >> 16) & 0xFF) * queuedMesh.color.b * ambient.b; + tmpA = (tmpColor >> 24) & 0xFF; + + tmpColor = tmpR | (tmpG << 8) | (tmpB << 16) | (tmpA << 24); + *((uint32*)destPtr++) = tmpColor; + break; + + case VES_TANGENT: + case VES_BINORMAL: + tmp.x = *sourcePtr++; + tmp.y = *sourcePtr++; + tmp.z = *sourcePtr++; + + //Rotate + tmp = queuedMesh.orientation * tmp; + + *destPtr++ = tmp.x; + *destPtr++ = tmp.y; + *destPtr++ = tmp.z; + break; + + default: + //Raw copy + memcpy(destPtr, sourcePtr, VertexElement::getTypeSize(elem.getType())); + break; + }; + } + + // Increment both pointers + destBase += sourceBuffer->getVertexSize(); + sourceBase += sourceBuffer->getVertexSize(); + } + + //Unlock the input buffer + vertexBuffers[i] = destBase; + sourceBuffer->unlock(); + } else { + //Get the locked output buffer + uint32 *startPtr = (uint32*)vertexBuffers[vertBinding->getBufferCount()-1]; + uint32 *endPtr = startPtr + sourceVertexData->vertexCount; + + //Generate color + uint8 tmpR = ambient.r * queuedMesh.color.r * 255; + uint8 tmpG = ambient.g * queuedMesh.color.g * 255; + uint8 tmpB = ambient.b * queuedMesh.color.b * 255; + uint32 tmpColor = tmpR | (tmpG << 8) | (tmpB << 16) | (0xFF << 24); + + //Copy colors + while (startPtr < endPtr) { + *startPtr++ = tmpColor; + } + + vertexBuffers[vertBinding->getBufferCount()-1] += (sizeof(uint32) * sourceVertexData->vertexCount); + } + } + + + //Copy mesh index data into the index buffer + if (indexType == HardwareIndexBuffer::IT_32BIT) { + //Lock the input buffer + uint32 *source = static_cast<uint32*>(sourceIndexData->indexBuffer->lock( + sourceIndexData->indexStart, sourceIndexData->indexCount, HardwareBuffer::HBL_READ_ONLY + )); + uint32 *sourceEnd = source + sourceIndexData->indexCount; + + //And copy it to the output buffer + while (source != sourceEnd) { + *indexBuffer32++ = static_cast<uint32>(*source++ + indexOffset); + } + + //Unlock the input buffer + sourceIndexData->indexBuffer->unlock(); + + //Increment the index offset + indexOffset += sourceVertexData->vertexCount; + } else { + //Lock the input buffer + uint16 *source = static_cast<uint16*>(sourceIndexData->indexBuffer->lock( + sourceIndexData->indexStart, sourceIndexData->indexCount, HardwareBuffer::HBL_READ_ONLY + )); + uint16 *sourceEnd = source + sourceIndexData->indexCount; + + //And copy it to the output buffer + while (source != sourceEnd) { + *indexBuffer16++ = static_cast<uint16>(*source++ + indexOffset); + } + + //Unlock the input buffer + sourceIndexData->indexBuffer->unlock(); + + //Increment the index offset + indexOffset += sourceVertexData->vertexCount; + } + } + + //Unlock buffers + indexData->indexBuffer->unlock(); + for (Ogre::ushort i = 0; i < vertBinding->getBufferCount(); ++i) + vertBinding->getBuffer(i)->unlock(); + + //Clear mesh queue + meshQueue.clear(); + + built = true; +} + +void BatchedGeometry::SubBatch::clear() +{ + //If built, delete the batch + if (built){ + //Delete buffers + indexData->indexBuffer.setNull(); + vertexData->vertexBufferBinding->unsetAllBindings(); + + //Reset vertex/index count + vertexData->vertexStart = 0; + vertexData->vertexCount = 0; + indexData->indexStart = 0; + indexData->indexCount = 0; + } + + //Clear mesh queue + meshQueue.clear(); + + built = false; +} + +void BatchedGeometry::SubBatch::addSelfToRenderQueue(RenderQueue *queue, uint8 group) +{ + if (built){ + //Update material technique based on camera distance + assert(!material.isNull()); + bestTechnqiue = material->getBestTechnique(material->getLodIndexSquaredDepth(parent->minDistanceSquared)); + + //Add to render queue + queue->addRenderable(this, group); + } +} + +void BatchedGeometry::SubBatch::getRenderOperation(RenderOperation& op) +{ + op.operationType = RenderOperation::OT_TRIANGLE_LIST; + op.srcRenderable = this; + op.useIndexes = true; + op.vertexData = vertexData; + op.indexData = indexData; +} + +Real BatchedGeometry::SubBatch::getSquaredViewDepth(const Camera* cam) const +{ + Vector3 camVec = cam->getDerivedPosition() - parent->center; + return camVec.squaredLength(); +} + +#if OGRE_VERSION_MAJOR == 1 && OGRE_VERSION_MINOR <= 2 +//Dagon-compatible getLights() +const Ogre::LightList& BatchedGeometry::SubBatch::getLights(void) const +{ + return parent->sceneNode->findLights(parent->radius); +} +#else +//Eihort-compatible getLights() +const Ogre::LightList& BatchedGeometry::SubBatch::getLights(void) const +{ + return parent->queryLights(); +} +#endif Added: trunk/python-ogre/ThirdParty/forests/BatchedGeometry.h =================================================================== --- trunk/python-ogre/ThirdParty/forests/BatchedGeometry.h (rev 0) +++ trunk/python-ogre/ThirdParty/forests/BatchedGeometry.h 2007-10-13 13:35:58 UTC (rev 417) @@ -0,0 +1,122 @@ +/*------------------------------------------------------------------------------------- +Copyright (c) 2006 John Judnich + +This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. +Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: +1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------------*/ + +//BatchedGeometry.h +//A "lightweight" version of Ogre::StaticGeometry, which gives you a little more control +//over the batch materials, etc. +//------------------------------------------------------------------------------------- + +#ifndef __BatchedGeometry_H__ +#define __BatchedGeometry_H__ + +#include "OgrePrerequisites.h" +#include "OgreMovableObject.h" +#include "OgreSceneNode.h" +#include "OgreMaterialManager.h" + + +class BatchedGeometry: public Ogre::MovableObject +{ +public: + BatchedGeometry(Ogre::SceneManager *mgr); + ~BatchedGeometry(); + + void addEntity(Ogre::Entity *ent, const Ogre::Vector3 &position, const Ogre::Quaternion &orientation = Ogre::Quaternion::IDENTITY, const Ogre::Vector3 &scale = Ogre::Vector3::UNIT_SCALE, const Ogre::ColourValue &color = Ogre::ColourValue::White); + void build(); + void clear(); + + void _notifyCurrentCamera(Ogre::Camera *cam); + void _updateRenderQueue(Ogre::RenderQueue *queue); + bool isVisible(); + const Ogre::AxisAlignedBox &getBoundingBox(void) const { return bounds; } + Ogre::Real getBoundingRadius(void) const { return radius; } + const Ogre::String &getMovableType(void) const { static Ogre::String t = "BatchedGeometry"; return t; } + + class SubBatch: public Ogre::Renderable + { + public: + SubBatch(BatchedGeometry *parent, Ogre::SubMesh *mesh); + ~SubBatch(); + + void addSubMesh(Ogre::SubMesh *mesh, const Ogre::Vector3 &position, const Ogre::Quaternion &orientation, const Ogre::Vector3 &scale, const Ogre::ColourValue &color = Ogre::ColourValue::White); + void build(); + void clear(); + + void setMaterial(Ogre::MaterialPtr &mat) { material = mat; } + void setMaterialName(const Ogre::String &mat) { material = Ogre::MaterialManager::getSingleton().getByName(mat); } + inline Ogre::String getMaterialName() const { return material->getName(); } + + void addSelfToRenderQueue(Ogre::RenderQueue *queue, Ogre::uint8 group); + void getRenderOperation(Ogre::RenderOperation& op); + Ogre::Real getSquaredViewDepth(const Ogre::Camera* cam) const; + const Ogre::LightList& getLights(void) const; + + Ogre::Technique *getTechnique() const { return bestTechnqiue; } + const Ogre::MaterialPtr &getMaterial(void) const { return material; } + void getWorldTransforms(Ogre::Matrix4* xform) const { *xform = parent->_getParentNodeFullTransform(); } + const Ogre::Quaternion& getWorldOrientation(void) const { return parent->sceneNode->_getDerivedOrientation(); } + const Ogre::Vector3& getWorldPosition(void) const { return parent->sceneNode->_getDerivedPosition(); } + bool castsShadows(void) const { return parent->getCastShadows(); } + + private: + //A structure defining the desired position/orientation/scale of a batched mesh. The + //SubMesh is not specified since that can be determined by which MeshQueue this belongs to. + struct QueuedMesh + { + Ogre::SubMesh *mesh; + Ogre::Vector3 position; + Ogre::Quaternion orientation; + Ogre::Vector3 scale; + Ogre::ColourValue color; + }; + + bool built; + + Ogre::VertexData *vertexData; + Ogre::IndexData *indexData; + + Ogre::SubMesh *meshType; + BatchedGeometry *parent; + Ogre::MaterialPtr material; + Ogre::Technique *bestTechnqiue; //This is recalculated every frame + + typedef std::vector<QueuedMesh>::iterator MeshQueueIterator; + typedef std::vector<QueuedMesh> MeshQueue; + MeshQueue meshQueue; //The list of meshes to be added to this batch + }; + +private: + Ogre::String getFormatString(Ogre::SubMesh *mesh); + + typedef std::map<Ogre::String, SubBatch*> SubBatchMap; //Stores a list of GeomBatch'es, using a format string (generated with getGeometryFormatString()) as the key value + SubBatchMap subBatchMap; + + Ogre::Vector3 center; + Ogre::AxisAlignedBox bounds; + bool boundsUndefined; + Ogre::Real radius; + + Ogre::SceneManager *sceneMgr; + Ogre::SceneNode *sceneNode; + + Ogre::Real minDistanceSquared; + bool withinFarDistance; + + bool built; + +public: + typedef Ogre::MapIterator<SubBatchMap> SubBatchIterator; + SubBatchIterator getSubBatchIterator() const; +}; + + + + +#endif \ No newline at end of file Added: trunk/python-ogre/ThirdParty/forests/GrassLoader.cpp =================================================================== --- trunk/python-ogre/ThirdParty/forests/GrassLoader.cpp (rev 0) +++ trunk/python-ogre/ThirdParty/forests/GrassLoader.cpp 2007-10-13 13:35:58 UTC (rev 417) @@ -0,0 +1,807 @@ +/*------------------------------------------------------------------------------------- +Copyright (c) 2006 John Judnich + +This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. +Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------------*/ + +#include "GrassLoader.h" +#include "PagedGeometry.h" +#include "PropertyMaps.h" + +#include "OgreRoot.h" +#include "OgreTimer.h" +#include "OgreCamera.h" +#include "OgreVector3.h" +#inclu... [truncated message content] |