[Python-ogre-commit] SF.net SVN: python-ogre: [583] trunk/python-ogre
Brought to you by:
andy_miller,
roman_yakovenko
From: <and...@us...> - 2008-04-05 07:54:49
|
Revision: 583 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=583&view=rev Author: andy_miller Date: 2008-04-05 00:54:56 -0700 (Sat, 05 Apr 2008) Log Message: ----------- Various thirdparty updates, PU 0.7 support etc Modified Paths: -------------- trunk/python-ogre/PythonOgreConfig_nt.py trunk/python-ogre/ThirdParty/caelum/CaelumPrecompiled.h trunk/python-ogre/ThirdParty/caelum/CaelumPrerequisites.h trunk/python-ogre/ThirdParty/caelum/CaelumSystem.cpp trunk/python-ogre/ThirdParty/caelum/CaelumSystem.h trunk/python-ogre/ThirdParty/caelum/GroundFog.cpp trunk/python-ogre/ThirdParty/caelum/GroundFog.h trunk/python-ogre/ThirdParty/caelum/LayeredClouds.cpp trunk/python-ogre/ThirdParty/caelum/LayeredClouds.h trunk/python-ogre/ThirdParty/caelum/SkyColourModel.cpp trunk/python-ogre/ThirdParty/caelum/SkyDome.cpp trunk/python-ogre/ThirdParty/caelum/SkyDome.h trunk/python-ogre/ThirdParty/caelum/SolarSystemModel.cpp trunk/python-ogre/ThirdParty/caelum/Starfield.cpp trunk/python-ogre/ThirdParty/caelum/Starfield.h trunk/python-ogre/ThirdParty/caelum/Sun.cpp trunk/python-ogre/ThirdParty/caelum/Sun.h trunk/python-ogre/ThirdParty/forests/BatchedGeometry.cpp trunk/python-ogre/ThirdParty/forests/BatchedGeometry.h trunk/python-ogre/ThirdParty/forests/ImpostorPage.cpp trunk/python-ogre/ThirdParty/forests/PagedGeometry.h trunk/python-ogre/ThirdParty/forests/TreeLoader2D.cpp trunk/python-ogre/ThirdParty/forests/TreeLoader3D.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIPanel.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIPanel.h trunk/python-ogre/ThirdParty/quickgui/QuickGUIScrollPane.cpp trunk/python-ogre/ThirdParty/quickgui/QuickGUIScrollPane.h trunk/python-ogre/ThirdParty/quickgui/QuickGUIWidget.cpp trunk/python-ogre/code_generators/nxogre/python_nxogre_aliases.h trunk/python-ogre/code_generators/nxogre/python_nxogre_sizeof.h trunk/python-ogre/code_generators/particleuniverse/generate_code.py trunk/python-ogre/environment.py Modified: trunk/python-ogre/PythonOgreConfig_nt.py =================================================================== --- trunk/python-ogre/PythonOgreConfig_nt.py 2008-04-01 04:05:25 UTC (rev 582) +++ trunk/python-ogre/PythonOgreConfig_nt.py 2008-04-05 07:54:56 UTC (rev 583) @@ -53,7 +53,7 @@ PATH_plib = os.path.join(PATH_THIRDPARTY, 'plib') PATH_et = os.path.join(PATH_THIRDPARTY, 'et') PATH_caelum = os.path.join(PATH_THIRDPARTY, 'caelum') -PATH_NxOgre= os.path.join(PATH_THIRDPARTY, 'nxogre') +PATH_NxOgre= os.path.join(BASE_DIR, 'nxogre') PATH_NxOgre_09= os.path.join(PATH_THIRDPARTY, 'nxogre_0.9') PATH_watermesh= os.path.join(PATH_THIRDPARTY, 'watermesh') PATH_noise= os.path.join(PATH_THIRDPARTY, 'noise') @@ -96,7 +96,7 @@ PATH_LIB_OgreAL = os.path.join( PATH_OGREAL)#, 'lib/Release' ) PATH_LIB_betagui = PATH_betagui PATH_LIB_quickgui = PATH_quickgui -# PATH_LIB_NxOgre= os.path.join(PATH_NxOgre, 'lib') +PATH_LIB_NxOgre= os.path.join(PATH_NxOgre, 'lib') PATH_LIB_PhysX = os.path.join(PATH_PhysX,'lib/win32') PATH_LIB_Bullet = os.path.join(PATH_Bullet, 'out/release8/libs' ) PATH_LIB_Theora= os.path.join(PATH_Theora, 'bin', 'Release') @@ -140,9 +140,8 @@ PATH_INCLUDE_FMOD = os.path.join(PATH_FMOD, 'api/inc') PATH_INCLUDE_Ogre_CEGUIRenderer = os.path.join( PATH_Ogre, 'samples/Common/CEGUIRenderer/include') PATH_INCLUDE_quickgui = PATH_quickgui -PATH_INCLUDE_NxOgre= PATH_NxOgre PATH_INCLUDE_NxOgre_09= PATH_NxOgre_09 -# PATH_INCLUDE_NxOgre= os.path.join(PATH_NxOgre, 'include') +PATH_INCLUDE_NxOgre= os.path.join(PATH_NxOgre, 'include') PATH_INCLUDE_Bullet= os.path.join(PATH_Bullet, 'src') PATH_INCLUDE_freetype= os.path.join(PATH_INCLUDE_quickgui,'FreeType2.3.5') PATH_INCLUDE_betagui = PATH_betagui Modified: trunk/python-ogre/ThirdParty/caelum/CaelumPrecompiled.h =================================================================== --- trunk/python-ogre/ThirdParty/caelum/CaelumPrecompiled.h 2008-04-01 04:05:25 UTC (rev 582) +++ trunk/python-ogre/ThirdParty/caelum/CaelumPrecompiled.h 2008-04-05 07:54:56 UTC (rev 583) @@ -18,4 +18,8 @@ along with Caelum. If not, see <http://www.gnu.org/licenses/>. */ +#ifdef __APPLE__ +#include "Ogre/Ogre.h" +#else #include "Ogre.h" +#endif Modified: trunk/python-ogre/ThirdParty/caelum/CaelumPrerequisites.h =================================================================== --- trunk/python-ogre/ThirdParty/caelum/CaelumPrerequisites.h 2008-04-01 04:05:25 UTC (rev 582) +++ trunk/python-ogre/ThirdParty/caelum/CaelumPrerequisites.h 2008-04-05 07:54:56 UTC (rev 583) @@ -22,22 +22,28 @@ #define CAELUMPREREQUISITES_H // Include external headers +#ifdef __APPLE__ +#include "Ogre/Ogre.h" +#else #include "Ogre.h" +#endif -// Define the dll export qualifier if compiling for Windows -// // #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 -// // #ifdef CAELUM_LIB -// // #define DllExport __declspec (dllexport) -// // #else -// // #ifdef __MINGW32__ -// // #define DllExport -// // #else -// // #define DllExport __declspec (dllimport) -// // #endif -// // #endif -// // #else +// // Define the dll export qualifier if compiling for Windows +// #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 +// #ifdef CAELUM_LIB +// #define DllExport __declspec (dllexport) +// #else +// #ifdef __MINGW32__ +// #define DllExport +// #else +// #define DllExport __declspec (dllimport) +// #endif +// #endif +// #elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE +// #define DllExport __attribute__ ((visibility("default"))) +// #else #define DllExport -// // #endif +// #endif // Define the version code #define CAELUM_VERSION_MAIN 0 Modified: trunk/python-ogre/ThirdParty/caelum/CaelumSystem.cpp =================================================================== --- trunk/python-ogre/ThirdParty/caelum/CaelumSystem.cpp 2008-04-01 04:05:25 UTC (rev 582) +++ trunk/python-ogre/ThirdParty/caelum/CaelumSystem.cpp 2008-04-05 07:54:56 UTC (rev 583) @@ -39,6 +39,7 @@ LOG ("Initialising Caelum system..."); mOgreRoot = root; mSceneMgr = sceneMgr; + mCaelumRootNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("CaelumRoot"); mCleanup = false; RESOURCE_GROUP_NAME = resGroupName; @@ -79,22 +80,22 @@ this->setSkyColourModel (new SkyColourModel ()); } if (componentsToCreate & CAELUM_COMPONENT_SKY_DOME) { - this->setSkyDome (new SkyDome (mSceneMgr)); + this->setSkyDome (new SkyDome (mSceneMgr, mCaelumRootNode)); } if (componentsToCreate & CAELUM_COMPONENT_SOLAR_SYSTEM_MODEL) { this->setSolarSystemModel (new SolarSystemModel ()); } if (componentsToCreate & CAELUM_COMPONENT_SUN) { - this->setSun (new Sun (mSceneMgr)); + this->setSun (new SpriteSun (mSceneMgr, mCaelumRootNode)); } if (componentsToCreate & CAELUM_COMPONENT_STARFIELD) { - this->setStarfield (new Starfield (mSceneMgr)); + this->setStarfield (new Starfield (mSceneMgr, mCaelumRootNode)); } if (componentsToCreate & CAELUM_COMPONENT_CLOUDS) { - this->setClouds (new LayeredClouds (mSceneMgr)); + this->setClouds (new LayeredClouds (mSceneMgr, mCaelumRootNode)); } if (componentsToCreate & CAELUM_COMPONENT_GROUND_FOG) { - this->setGroundFog (new GroundFog (mSceneMgr)); + this->setGroundFog (new GroundFog (mSceneMgr, mCaelumRootNode)); } // Auto-register itself as a frame listener @@ -135,6 +136,10 @@ LOG ("Destroyed Caelum resource group"); } + static_cast<Ogre::SceneNode*>(mCaelumRootNode->getParent())-> + removeAndDestroyChild(mCaelumRootNode->getName()); + mCaelumRootNode = 0; + if (cleanup) { delete this; } else { @@ -153,6 +158,9 @@ void CaelumSystem::preViewportUpdate (const Ogre::RenderTargetViewportEvent &e) { Ogre::Camera *cam = e.source->getCamera (); + // Move root node. + mCaelumRootNode->setPosition(cam->getRealPosition()); + if (getSkyDome ()) { getSkyDome ()->notifyCameraChanged (cam); } Modified: trunk/python-ogre/ThirdParty/caelum/CaelumSystem.h =================================================================== --- trunk/python-ogre/ThirdParty/caelum/CaelumSystem.h 2008-04-01 04:05:25 UTC (rev 582) +++ trunk/python-ogre/ThirdParty/caelum/CaelumSystem.h 2008-04-05 07:54:56 UTC (rev 583) @@ -57,7 +57,7 @@ from Caelum could be refactor to only transfer a number of "common sky parameter" around; but that is a lot harder and ultimately less flexible. - @author Jes\xFAs Alonso Abad + @author Jes˙s Alonso Abad */ class DllExport CaelumSystem : public Ogre::FrameListener, public Ogre::RenderTargetListener { // Attributes ----------------------------------------------------------------- @@ -70,6 +70,10 @@ */ Ogre::SceneManager *mSceneMgr; + /** Caelum root scene node. + */ + Ogre::SceneNode *mCaelumRootNode; + /** Cleanup requested flag. */ bool mCleanup; @@ -107,7 +111,7 @@ std::auto_ptr<SolarSystemModel> mSolarSystemModel; /// Reference to the sun, if enabled. - std::auto_ptr<Sun> mSun; + std::auto_ptr<BaseSun> mSun; /// Reference to the starfield, if enabled. std::auto_ptr<Starfield> mStarfield; @@ -207,6 +211,10 @@ */ UniversalClock *getUniversalClock () const; + /** Gets caelum root scene node. + */ + Ogre::SceneNode* getRootNode(void) const { return mCaelumRootNode; } + /** Updates the system. @param e The frame event (contains the elapsed time since the last update). */ @@ -228,14 +236,14 @@ /** Set the sun. * @param sun A new sun or null to disable. */ - inline void setSun (Sun* sun) { + inline void setSun (BaseSun* sun) { mSun.reset(sun); } /** Gets the current sun. @return The sun in use. */ - Sun* getSun () const { + BaseSun* getSun () const { return mSun.get(); } Modified: trunk/python-ogre/ThirdParty/caelum/GroundFog.cpp =================================================================== --- trunk/python-ogre/ThirdParty/caelum/GroundFog.cpp 2008-04-01 04:05:25 UTC (rev 582) +++ trunk/python-ogre/ThirdParty/caelum/GroundFog.cpp 2008-04-05 07:54:56 UTC (rev 583) @@ -27,10 +27,13 @@ GroundFog::GroundFog( Ogre::SceneManager *scene, + Ogre::SceneNode *caelumRootNode, const Ogre::String &domeMaterialName, const Ogre::String &domeEntityName): mScene(scene) { + scene->getRenderQueue()->getQueueGroup(CAELUM_RENDER_QUEUE_GROUND_FOG)->setShadowsEnabled(false); + // Create dome entity, using a prefab sphere. // The prefab sphere has a radius of 50 units. // If this changes in future version of ogre this might break. @@ -39,7 +42,7 @@ mDomeEntity->setCastShadows(false); mDomeEntity->setRenderQueueGroup (CAELUM_RENDER_QUEUE_GROUND_FOG); - mDomeNode = mScene->getRootSceneNode ()->createChildSceneNode (); + mDomeNode = caelumRootNode->createChildSceneNode (); mDomeNode->attachObject (mDomeEntity); // Maybe it would be better to create the material at runtime instead. @@ -176,13 +179,10 @@ { CameraBoundElement::notifyCameraChanged (cam); - // Move dome node. - mDomeNode->setPosition (cam->getRealPosition ()); - // Send camera height to shader. Ogre::GpuProgramParametersSharedPtr params = mDomeMaterial->getBestTechnique()->getPass(0)->getFragmentProgramParameters(); - params->setNamedConstant("cameraHeight", cam->getDerivedPosition().y); + params->setNamedConstant("cameraHeight", cam->getDerivedPosition().dotProduct(mDomeNode->_getDerivedOrientation() * Ogre::Vector3::UNIT_Y)); } void GroundFog::setFarRadius (Ogre::Real radius) Modified: trunk/python-ogre/ThirdParty/caelum/GroundFog.h =================================================================== --- trunk/python-ogre/ThirdParty/caelum/GroundFog.h 2008-04-01 04:05:25 UTC (rev 582) +++ trunk/python-ogre/ThirdParty/caelum/GroundFog.h 2008-04-05 07:54:56 UTC (rev 583) @@ -46,6 +46,7 @@ /** Constructor. */ GroundFog (Ogre::SceneManager *scene, + Ogre::SceneNode *caelumRootNode, const Ogre::String &domeMaterialName = "CaelumGroundFogDome", const Ogre::String &domeEntityName = "CaelumGroundFogDome"); Modified: trunk/python-ogre/ThirdParty/caelum/LayeredClouds.cpp =================================================================== --- trunk/python-ogre/ThirdParty/caelum/LayeredClouds.cpp 2008-04-01 04:05:25 UTC (rev 582) +++ trunk/python-ogre/ThirdParty/caelum/LayeredClouds.cpp 2008-04-05 07:54:56 UTC (rev 583) @@ -23,7 +23,7 @@ #include "CaelumExceptions.h" #include "ImageHelper.h" -namespace +namespace caelum { /** Extend a Vector2 to a Vector3 by appending a 0 */ @@ -38,13 +38,14 @@ LayeredClouds::LayeredClouds ( Ogre::SceneManager* scene, + Ogre::SceneNode *caelumRootNode, const Ogre::String &resourceGroupName, const Ogre::String &materialName, const Ogre::String &meshName, const Ogre::String &entityName ): - mSceneMgr(scene), - mCloudCoverLookup(0) + mCloudCoverLookup(0), + mSceneMgr(scene) { // Create cloud plane mesh if it doesn't exist. if (Ogre::MeshManager::getSingleton ().getByName (meshName).isNull ()) { @@ -54,13 +55,15 @@ false, 1, 1, 1, Ogre::Vector3::UNIT_Z); } + mSceneMgr->getRenderQueue()->getQueueGroup(CAELUM_RENDER_QUEUE_CLOUDS)->setShadowsEnabled(false); + // Create cloud plane entity. mEntity = mSceneMgr->createEntity(entityName, meshName); mEntity->setMaterialName(materialName); mEntity->setCastShadows(false); mEntity->setRenderQueueGroup (CAELUM_RENDER_QUEUE_CLOUDS); - mNode = mSceneMgr->getRootSceneNode ()->createChildSceneNode (); + mNode = caelumRootNode->createChildSceneNode (); mNode->attachObject (mEntity); // It would be better to create the material at runtime instead. @@ -100,7 +103,6 @@ void LayeredClouds::notifyCameraChanged (Ogre::Camera *cam) { CameraBoundElement::notifyCameraChanged (cam); - mNode->setPosition (cam->getRealPosition ()); } void LayeredClouds::setFarRadius (Ogre::Real radius) { Modified: trunk/python-ogre/ThirdParty/caelum/LayeredClouds.h =================================================================== --- trunk/python-ogre/ThirdParty/caelum/LayeredClouds.h 2008-04-01 04:05:25 UTC (rev 582) +++ trunk/python-ogre/ThirdParty/caelum/LayeredClouds.h 2008-04-05 07:54:56 UTC (rev 583) @@ -45,6 +45,7 @@ */ LayeredClouds ( Ogre::SceneManager* scene, + Ogre::SceneNode *caelumRootNode, const Ogre::String &resourceGroupName="Caelum", const Ogre::String &materialName="CaelumLayeredClouds", const Ogre::String &meshName="CaelumLayeredClouds", Modified: trunk/python-ogre/ThirdParty/caelum/SkyColourModel.cpp =================================================================== --- trunk/python-ogre/ThirdParty/caelum/SkyColourModel.cpp 2008-04-01 04:05:25 UTC (rev 582) +++ trunk/python-ogre/ThirdParty/caelum/SkyColourModel.cpp 2008-04-05 07:54:56 UTC (rev 583) @@ -29,8 +29,8 @@ const Ogre::String &gradients, const Ogre::String &sunColours ): - mSunColoursImage(0), - mSkyGradientsImage(0) + mSkyGradientsImage(0), + mSunColoursImage(0) { mSkyGradientsImage = 0; mFogDensityMultiplier = 1; Modified: trunk/python-ogre/ThirdParty/caelum/SkyDome.cpp =================================================================== --- trunk/python-ogre/ThirdParty/caelum/SkyDome.cpp 2008-04-01 04:05:25 UTC (rev 582) +++ trunk/python-ogre/ThirdParty/caelum/SkyDome.cpp 2008-04-05 07:54:56 UTC (rev 583) @@ -28,16 +28,18 @@ const Ogre::String SkyDome::SPHERIC_DOME_NAME = "CaelumSphericDome"; const Ogre::String SkyDome::SKY_DOME_MATERIAL_NAME = "CaelumSkyDomeMaterial"; -SkyDome::SkyDome (Ogre::SceneManager *sceneMgr) { +SkyDome::SkyDome (Ogre::SceneManager *sceneMgr, Ogre::SceneNode *caelumRootNode) { createSkyDomeMaterial (); + sceneMgr->getRenderQueue()->getQueueGroup(CAELUM_RENDER_QUEUE_SKYDOME)->setShadowsEnabled(false); + GeometryFactory::generateSphericDome (SPHERIC_DOME_NAME, 32); Ogre::Entity *ent = sceneMgr->createEntity ("Dome", SPHERIC_DOME_NAME); ent->setMaterialName (SKY_DOME_MATERIAL_NAME); ent->setRenderQueueGroup (CAELUM_RENDER_QUEUE_SKYDOME); ent->setCastShadows (false); - mNode = sceneMgr->getRootSceneNode ()->createChildSceneNode (); + mNode = caelumRootNode->createChildSceneNode (); mNode->attachObject (ent); } @@ -57,7 +59,6 @@ void SkyDome::notifyCameraChanged (Ogre::Camera *cam) { CameraBoundElement::notifyCameraChanged (cam); - mNode->setPosition (cam->getRealPosition ()); } void SkyDome::setFarRadius (Ogre::Real radius) { @@ -222,20 +223,23 @@ LOG ("\tDONE"); } else { mMaterial = static_cast<Ogre::MaterialPtr>(Ogre::MaterialManager::getSingleton ().getByName (SKY_DOME_MATERIAL_NAME)); + mMaterial->load (); } LOG ("DONE"); } void SkyDome::destroySkyDomeMaterial () { - LOG ("Removing sky dome material..."); - if ((Ogre::HighLevelGpuProgramManager::getSingletonPtr()->resourceExists("SkyDomeFP"))) { - LOG ("Removing sky dome SkyDomeFP..."); + LOG ("Removing sky dome materials..."); + if (!Ogre::HighLevelGpuProgramManager::getSingletonPtr()->resourceExists("SkyDomeFP")) { Ogre::HighLevelGpuProgramManager::getSingletonPtr()->remove("SkyDomeFP"); } - if ((Ogre::HighLevelGpuProgramManager::getSingletonPtr()->resourceExists("SkyDomeVP"))) { - LOG ("Removing sky dome SkyDomeVP..."); + if (!Ogre::HighLevelGpuProgramManager::getSingletonPtr()->resourceExists("SkyDomeFP_NoHaze")) { + Ogre::HighLevelGpuProgramManager::getSingletonPtr()->remove("SkyDomeFP_NoHaze"); + } + + if (!Ogre::HighLevelGpuProgramManager::getSingletonPtr()->resourceExists("SkyDomeVP")) { Ogre::HighLevelGpuProgramManager::getSingletonPtr()->remove("SkyDomeVP"); } Modified: trunk/python-ogre/ThirdParty/caelum/SkyDome.h =================================================================== --- trunk/python-ogre/ThirdParty/caelum/SkyDome.h 2008-04-01 04:05:25 UTC (rev 582) +++ trunk/python-ogre/ThirdParty/caelum/SkyDome.h 2008-04-05 07:54:56 UTC (rev 583) @@ -57,7 +57,7 @@ * This will setup some nice defaults. * @param sceneMgr The scene manager where this sky dome will be created. */ - SkyDome (Ogre::SceneManager *sceneMgr); + SkyDome (Ogre::SceneManager *sceneMgr, Ogre::SceneNode *caelumRootNode); /** Destructor */ Modified: trunk/python-ogre/ThirdParty/caelum/SolarSystemModel.cpp =================================================================== --- trunk/python-ogre/ThirdParty/caelum/SolarSystemModel.cpp 2008-04-01 04:05:25 UTC (rev 582) +++ trunk/python-ogre/ThirdParty/caelum/SolarSystemModel.cpp 2008-04-05 07:54:56 UTC (rev 583) @@ -49,9 +49,9 @@ // Ogre direction. Ogre::Vector3 res; - res.x = Math::Sin (azimuth); // East + res.x = Math::Sin (azimuth) * Math::Cos (altitude); // East res.y = -Math::Sin (altitude); // Zenith - res.z = -Math::Cos (azimuth); // North + res.z = -Math::Cos (azimuth) * Math::Cos (altitude); // North Astronomy::restoreFloatingPointMode(fpmode); Modified: trunk/python-ogre/ThirdParty/caelum/Starfield.cpp =================================================================== --- trunk/python-ogre/ThirdParty/caelum/Starfield.cpp 2008-04-01 04:05:25 UTC (rev 582) +++ trunk/python-ogre/ThirdParty/caelum/Starfield.cpp 2008-04-05 07:54:56 UTC (rev 583) @@ -28,19 +28,21 @@ const Ogre::String Starfield::STARFIELD_MATERIAL_NAME = "CaelumStarfieldMaterial"; -Starfield::Starfield (Ogre::SceneManager *sceneMgr, const Ogre::String &textureName) { +Starfield::Starfield (Ogre::SceneManager *sceneMgr, Ogre::SceneNode *caelumRootNode, const Ogre::String &textureName) { mInclination = Ogre::Degree (0); createStarfieldMaterial (); setTexture (textureName); + sceneMgr->getRenderQueue()->getQueueGroup(CAELUM_RENDER_QUEUE_STARFIELD)->setShadowsEnabled(false); + GeometryFactory::generateSphericDome (STARFIELD_DOME_NAME, 32, GeometryFactory::DT_STARFIELD); Ogre::Entity *ent = sceneMgr->createEntity ("StarfieldDome", STARFIELD_DOME_NAME); ent->setMaterialName (STARFIELD_MATERIAL_NAME); ent->setRenderQueueGroup (CAELUM_RENDER_QUEUE_STARFIELD); ent->setCastShadows (false); - mNode = sceneMgr->getRootSceneNode ()->createChildSceneNode (); + mNode = caelumRootNode->createChildSceneNode (); mNode->attachObject (ent); } @@ -60,7 +62,6 @@ void Starfield::notifyCameraChanged (Ogre::Camera *cam) { CameraBoundElement::notifyCameraChanged (cam); - mNode->setPosition (cam->getRealPosition ()); } void Starfield::setFarRadius (Ogre::Real radius) { @@ -108,6 +109,7 @@ } else { mat = static_cast<Ogre::MaterialPtr>(Ogre::MaterialManager::getSingleton ().getByName (STARFIELD_MATERIAL_NAME)); + mat->load(); } LOG ("DONE"); Modified: trunk/python-ogre/ThirdParty/caelum/Starfield.h =================================================================== --- trunk/python-ogre/ThirdParty/caelum/Starfield.h 2008-04-01 04:05:25 UTC (rev 582) +++ trunk/python-ogre/ThirdParty/caelum/Starfield.h 2008-04-05 07:54:56 UTC (rev 583) @@ -59,6 +59,7 @@ */ Starfield ( Ogre::SceneManager *sceneMgr, + Ogre::SceneNode *caelumRootNode, const Ogre::String &textureName = "Starfield.jpg"); /** Destructor. @@ -66,7 +67,7 @@ virtual ~Starfield (); /** Sets the starfield inclination. This inclination is the angle between the starfield rotation axis and the horizon plane. - @param inc The starfield inclination in degrees. + @param inc The starfield inclination in degrees. It`s equal to observer latitude taken with opposite sign. */ void setInclination (Ogre::Degree inc); Modified: trunk/python-ogre/ThirdParty/caelum/Sun.cpp =================================================================== --- trunk/python-ogre/ThirdParty/caelum/Sun.cpp 2008-04-01 04:05:25 UTC (rev 582) +++ trunk/python-ogre/ThirdParty/caelum/Sun.cpp 2008-04-05 07:54:56 UTC (rev 583) @@ -23,9 +23,11 @@ namespace caelum { -const Ogre::String Sun::SUN_MATERIAL_NAME = "CaelumSunMaterial"; +//======================================================================================================================== +// Base Sun +//======================================================================================================================== -Sun::Sun (Ogre::SceneManager *sceneMgr): mScene(sceneMgr) { +BaseSun::BaseSun (Ogre::SceneManager *sceneMgr, Ogre::SceneNode *caelumRootNode): mScene(sceneMgr) { mSunSphereColour = Ogre::ColourValue::White; mSunLightColour = Ogre::ColourValue::White; @@ -39,55 +41,29 @@ // HDR power scale, REALLY bright: mMainLight->setPowerScale (10); - createSunMaterial (); + sceneMgr->getRenderQueue()->getQueueGroup(CAELUM_RENDER_QUEUE_SUN)->setShadowsEnabled(false); - mSunEntity = sceneMgr->createEntity ("CaelumSun", "sphere.mesh"); - mSunEntity->setMaterialName (SUN_MATERIAL_NAME); - mSunEntity->setCastShadows (false); - mSunEntity->setRenderQueueGroup (CAELUM_RENDER_QUEUE_SUN); - mSunNode = sceneMgr->getRootSceneNode ()->createChildSceneNode (); - mSunNode->attachObject (mSunEntity); + mSunNode = caelumRootNode->createChildSceneNode (); } -Sun::~Sun () { +BaseSun::~BaseSun () { if (mSunNode) { - mSunNode->detachObject (mSunEntity); static_cast<Ogre::SceneNode *>(mSunNode->getParent ())->removeAndDestroyChild (mSunNode->getName ()); mSunNode = 0; } - if (mSunEntity) { - mSunEntity->_getManager ()->destroyEntity (mSunEntity); - mSunEntity = 0; - } - destroySunMaterial (); - if (mMainLight) { mMainLight->_getManager ()->destroyLight (mMainLight); mMainLight = 0; } } -void Sun::notifyCameraChanged (Ogre::Camera *cam) { - // This calls setFarRadius - CameraBoundElement::notifyCameraChanged(cam); - - // Set sun position. - Ogre::Real sunRadius = -mRadius * Ogre::Math::Tan (Ogre::Degree (0.01)); - mSunNode->setPosition (cam->getRealPosition () - mSunDirection * (mRadius + sunRadius)); - - // Set sun scaling. - float factor = 2 - mSunSphereColour.b / 3; - float scale = factor * (mRadius + sunRadius) * Ogre::Math::Tan (Ogre::Degree (0.01)); - mSunNode->setScale (Ogre::Vector3::UNIT_SCALE * scale); -} - -void Sun::setFarRadius (Ogre::Real radius) { +void BaseSun::setFarRadius (Ogre::Real radius) { CameraBoundElement::setFarRadius(radius); mRadius = radius; } -void Sun::update ( +void BaseSun::update ( const Ogre::Vector3& sunDirection, const Ogre::ColourValue &sunLightColour, const Ogre::ColourValue &sunSphereColour) @@ -97,33 +73,34 @@ setSunSphereColour(sunSphereColour); } -Ogre::Vector3 Sun::getSunDirection () const { +const Ogre::Vector3& BaseSun::getSunDirection () const { return mSunDirection; } -void Sun::setSunDirection (const Ogre::Vector3 &dir) { +void BaseSun::setSunDirection (const Ogre::Vector3 &dir) { mSunDirection = dir; if (mMainLight != 0) { - mMainLight->setDirection (dir); + mMainLight->setDirection (mSunNode->_getDerivedOrientation() * dir); } } -void Sun::setSunSphereColour (const Ogre::ColourValue &colour) { +void BaseSun::setSunSphereColour (const Ogre::ColourValue &colour) { // Store this last colour mSunSphereColour = colour; - - // Set sun material colour. - mSunMaterial->setSelfIllumination (colour); } -Ogre::ColourValue Sun::getSunSphereColour () { +Ogre::ColourValue BaseSun::getSunSphereColour () const { return mSunSphereColour; } -void Sun::setSunLightColour (const Ogre::ColourValue &colour) { +void BaseSun::setSunLightColour (const Ogre::ColourValue &colour) { // Store this last colour mSunLightColour = colour; + // Apply change + setMainLightColour(colour); +} +void BaseSun::setMainLightColour (const Ogre::ColourValue &colour) { // Set light colours. mMainLight->setDiffuseColour (colour * mDiffuseMultiplier); mMainLight->setSpecularColour (colour * mSpecularMultiplier); @@ -132,43 +109,96 @@ } } -Ogre::ColourValue Sun::getSunLightColour () { +Ogre::ColourValue BaseSun::getSunLightColour () const { return mSunLightColour; } -void Sun::setDiffuseMultiplier (const Ogre::ColourValue &diffuse) { +void BaseSun::setDiffuseMultiplier (const Ogre::ColourValue &diffuse) { mDiffuseMultiplier = diffuse; } -Ogre::ColourValue Sun::getDiffuseMultiplier () { +Ogre::ColourValue BaseSun::getDiffuseMultiplier () const { return mDiffuseMultiplier; } -void Sun::setSpecularMultiplier (const Ogre::ColourValue &specular) { +void BaseSun::setSpecularMultiplier (const Ogre::ColourValue &specular) { mSpecularMultiplier = specular; } -Ogre::ColourValue Sun::getSpecularMultiplier () { +Ogre::ColourValue BaseSun::getSpecularMultiplier () const { return mSpecularMultiplier; } -void Sun::setAmbientMultiplier (const Ogre::ColourValue &ambient) { +void BaseSun::setAmbientMultiplier (const Ogre::ColourValue &ambient) { mAmbientMultiplier = ambient; } -Ogre::ColourValue Sun::getAmbientMultiplier () { +Ogre::ColourValue BaseSun::getAmbientMultiplier () const { return mAmbientMultiplier; } -void Sun::setManageAmbientLight (bool manage) { +void BaseSun::setManageAmbientLight (bool manage) { mManageAmbientLight = manage; } -bool Sun::isManagingAmbientLight () { +bool BaseSun::isManagingAmbientLight () const { return mManageAmbientLight; } -void Sun::createSunMaterial () { +Ogre::Light* BaseSun::getMainLight() const { + return mMainLight; +} + +//======================================================================================================================== +// Sphere Sun - deprecated, use Sprite Sun instead +//======================================================================================================================== + +const Ogre::String SphereSun::SUN_MATERIAL_NAME = "CaelumSunMaterial"; + +SphereSun::SphereSun (Ogre::SceneManager *sceneMgr, Ogre::SceneNode *caelumRootNode, const Ogre::String &meshName) : BaseSun(sceneMgr, caelumRootNode) { + createSunMaterial (); + + mSunEntity = sceneMgr->createEntity ("CaelumSun", meshName); + mSunEntity->setMaterialName (SUN_MATERIAL_NAME); + mSunEntity->setCastShadows (false); + mSunEntity->setRenderQueueGroup (CAELUM_RENDER_QUEUE_SUN); + mSunNode->attachObject (mSunEntity); +} + +SphereSun::~SphereSun () { + if (mSunNode) { + mSunNode->detachObject (mSunEntity); + } + if (mSunEntity) { + mSunEntity->_getManager ()->destroyEntity (mSunEntity); + mSunEntity = 0; + } + + destroySunMaterial (); +} + +void SphereSun::setSunSphereColour (const Ogre::ColourValue &colour) { + BaseSun::setSunSphereColour(colour); + + // Set sun material colour. + mSunMaterial->setSelfIllumination (colour); +} + +void SphereSun::notifyCameraChanged (Ogre::Camera *cam) { + // This calls setFarRadius + CameraBoundElement::notifyCameraChanged(cam); + + // Set sun position. + Ogre::Real sunDistance = mRadius - mRadius * Ogre::Math::Tan (Ogre::Degree (0.01)); + mSunNode->setPosition(-mSunDirection * sunDistance); + + // Set sun scaling in [1.6(6) ~ 2.0] range. + float factor = 2 - mSunSphereColour.b / 3; + float scale = factor * sunDistance * Ogre::Math::Tan (Ogre::Degree (0.01)); + mSunNode->setScale (Ogre::Vector3::UNIT_SCALE * scale); +} + +void SphereSun::createSunMaterial () { Ogre::MaterialPtr mat; LOG ("Generating sun material..."); @@ -192,19 +222,133 @@ } else { mat = static_cast<Ogre::MaterialPtr>(Ogre::MaterialManager::getSingleton ().getByName (SUN_MATERIAL_NAME)); + mat->load (); } LOG ("DONE"); mSunMaterial = mat; } -void Sun::destroySunMaterial () { +void SphereSun::destroySunMaterial () { LOG ("Removing sun material..."); - if (Ogre::MaterialManager::getSingleton ().resourceExists (SUN_MATERIAL_NAME)) { + if (!Ogre::MaterialManager::getSingleton ().resourceExists (SUN_MATERIAL_NAME)) { Ogre::MaterialManager::getSingleton ().remove (SUN_MATERIAL_NAME); } mSunMaterial.setNull (); LOG ("DONE"); } +//======================================================================================================================== +// Sprite Sun +//======================================================================================================================== + +const Ogre::String SpriteSun::SUN_MATERIAL_NAME = "CaelumSpriteSunMaterial"; + +SpriteSun::SpriteSun ( Ogre::SceneManager *sceneMgr, + Ogre::SceneNode *caelumRootNode, + const Ogre::String &sunTextureName, + const Ogre::Degree& sunTextureAngularSize) + : BaseSun(sceneMgr, caelumRootNode) + , mSunTextureAngularSize(sunTextureAngularSize) +{ + createSunMaterial(); + setSunTexture(sunTextureName); + + mSunBillboardSet = sceneMgr->createBillboardSet("CaelumSpriteSun", 2); + mSunBillboardSet->setMaterialName (SUN_MATERIAL_NAME); + mSunBillboardSet->setCastShadows (false); + mSunBillboardSet->setRenderQueueGroup (CAELUM_RENDER_QUEUE_SUN); + mSunBillboardSet->setDefaultDimensions(1.0f, 1.0f); + mSunBillboardSet->createBillboard(Ogre::Vector3::ZERO); + + mSunNode->attachObject (mSunBillboardSet); +} + +SpriteSun::~SpriteSun () { + if (mSunNode) { + mSunNode->detachObject (mSunBillboardSet); + } + if (mSunBillboardSet) { + mSunBillboardSet->_getManager ()->destroyBillboardSet (mSunBillboardSet); + mSunBillboardSet = 0; + } + + destroySunMaterial (); +} + +void SpriteSun::setSunSphereColour (const Ogre::ColourValue &colour) { + BaseSun::setSunSphereColour(colour); + + // Set sun material colour. + mSunBillboardSet->getBillboard(0)->setColour(colour); +} + +void SpriteSun::setSunTexture (const Ogre::String &textureName) { + // Update the sun material + mSunMaterial->getBestTechnique ()->getPass (0)->getTextureUnitState (0)->setTextureName (textureName); +} + +void SpriteSun::setSunTextureAngularSize(const Ogre::Degree& sunTextureAngularSize){ + mSunTextureAngularSize = sunTextureAngularSize; +} + +void SpriteSun::notifyCameraChanged (Ogre::Camera *cam) { + // This calls setFarRadius + BaseSun::notifyCameraChanged(cam); + + // Set sun position. + Ogre::Real sunDistance = mRadius - mRadius * Ogre::Math::Tan(mSunTextureAngularSize); + mSunNode->setPosition(-mSunDirection * sunDistance); + + // Set sun scaling in [1.0 ~ 1.2] range + float factor = 1.2f - mSunSphereColour.b * 0.2f; + float scale = factor * sunDistance * Ogre::Math::Tan(mSunTextureAngularSize); + mSunNode->setScale (Ogre::Vector3::UNIT_SCALE * scale); +} + +void SpriteSun::createSunMaterial () { + Ogre::MaterialPtr mat; + + LOG ("Generating sun material..."); + if (!Ogre::MaterialManager::getSingleton ().resourceExists (SUN_MATERIAL_NAME)) { + LOG ("\tMaterial not found; creating..."); + mat = static_cast<Ogre::MaterialPtr>(Ogre::MaterialManager::getSingleton ().create (SUN_MATERIAL_NAME, RESOURCE_GROUP_NAME)); + mat->setReceiveShadows (false); + LOG ("\t\tMaterial [OK]"); + Ogre::Pass *pass = mat->getTechnique (0)->getPass (0); + pass->setLightingEnabled (false); + pass->setDepthCheckEnabled (false); + pass->setDepthWriteEnabled (false); + pass->setSceneBlending (Ogre::SBT_TRANSPARENT_COLOUR); + pass->setAlphaRejectSettings(Ogre::CMPF_GREATER_EQUAL, 128); + pass->setFog (true); + pass->setAmbient (Ogre::ColourValue::Black); + pass->setDiffuse (Ogre::ColourValue::Black); + pass->setSpecular (Ogre::ColourValue::Black); + pass->setVertexColourTracking(Ogre::TVC_EMISSIVE); + LOG ("\t\tPass [OK]"); + Ogre::TextureUnitState *tus = pass->createTextureUnitState (); + tus->setNumMipmaps(0); + LOG ("\t\tTextureUnit [OK]"); + mat->load (); + LOG ("\tDONE"); + } + else { + mat = static_cast<Ogre::MaterialPtr>(Ogre::MaterialManager::getSingleton ().getByName (SUN_MATERIAL_NAME)); + mat->load (); + } + LOG ("DONE"); + + mSunMaterial = mat; +} + +void SpriteSun::destroySunMaterial () { + LOG ("Removing sun material..."); + if (!Ogre::MaterialManager::getSingleton ().resourceExists (SUN_MATERIAL_NAME)) { + Ogre::MaterialManager::getSingleton ().remove (SUN_MATERIAL_NAME); + } + mSunMaterial.setNull (); + LOG ("DONE"); +} + } // namespace caelum Modified: trunk/python-ogre/ThirdParty/caelum/Sun.h =================================================================== --- trunk/python-ogre/ThirdParty/caelum/Sun.h 2008-04-01 04:05:25 UTC (rev 582) +++ trunk/python-ogre/ThirdParty/caelum/Sun.h 2008-04-05 07:54:56 UTC (rev 583) @@ -26,17 +26,21 @@ namespace caelum { -/** Class representing the sun. - It calculates the sun light direction, position, colour... - @author Jes\xFAs Alonso Abad +class BaseSun; // abstract +class SphereSun; // deprecated +class SpriteSun; + +typedef SpriteSun Sun; + +/** Abstract class representing sun. + Can be registered in CaelumSystem and receive update notifications. + Contains scene node and main light, that are properly placed on the sky by update method. + @author Jes˙s Alonso Abad */ -class DllExport Sun : public CameraBoundElement { +class DllExport BaseSun : public CameraBoundElement { // Attributes ----------------------------------------------------------------- public: - /// Name of the sun material. - static const Ogre::String SUN_MATERIAL_NAME; - - private: + protected: /// Pointer to scene. Ogre::SceneManager *mScene; @@ -46,12 +50,6 @@ /// The sun scene node. Ogre::SceneNode *mSunNode; - /// The sun entity. - Ogre::Entity *mSunEntity; - - /// Reference to the sun material. - Ogre::MaterialPtr mSunMaterial; - /// Base distance of the sun. float mRadius; @@ -83,19 +81,20 @@ /** Constructor. @param sceneMgr The scene manager where the lights will be created. */ - Sun (Ogre::SceneManager *sceneMgr); + BaseSun (Ogre::SceneManager *sceneMgr, + Ogre::SceneNode *caelumRootNode); /** Destructor. - @note If a sun position model is in use, it will be deleted. + @note You must use one of descendant, since base sun is invisible. */ - virtual ~Sun (); + virtual ~BaseSun () = 0; /** Updates sun parameters. @param sunDirection Sun direction. @param sunLightColour Color for the sun's light source @param sunSphereColour Color to draw the sun sphere itself. */ - void update ( + virtual void update ( const Ogre::Vector3& sunDirection, const Ogre::ColourValue &sunLightColour, const Ogre::ColourValue &sunSphereColour); @@ -103,68 +102,175 @@ /** Retrieves the latest sun direction. @return The sun direction. */ - Ogre::Vector3 getSunDirection () const; + const Ogre::Vector3& getSunDirection () const; /** Set the sun direction. @param dir The sun direction. */ - void setSunDirection (const Ogre::Vector3 &dir); + virtual void setSunDirection (const Ogre::Vector3 &dir); + /// Get current sun sphere colour, as set in setSunSphereColour. + Ogre::ColourValue getSunSphereColour () const; + /** Sets the sun sphere colour. @param colour The colour used to draw the sun */ - void setSunSphereColour (const Ogre::ColourValue &colour); + virtual void setSunSphereColour (const Ogre::ColourValue &colour); - /// Get current sun sphere colour, as set in setSunSphereColour. - Ogre::ColourValue getSunSphereColour (); + /// Get current sunlight colour, as set in setSunLightColour. + Ogre::ColourValue getSunLightColour () const; /** Sets the sunlight colour. @param colour The colour used to illuminate the scene. */ - void setSunLightColour (const Ogre::ColourValue &colour); + virtual void setSunLightColour (const Ogre::ColourValue &colour); - /// Get current sun sphere colour, as set in setSunLightColour. - Ogre::ColourValue getSunLightColour (); - /// Set diffuse multiplier for light colour void setDiffuseMultiplier (const Ogre::ColourValue &diffuse); /// Set diffuse multiplier for light colour - Ogre::ColourValue getDiffuseMultiplier (); + Ogre::ColourValue getDiffuseMultiplier () const; /// Set specular multiplier for light colour void setSpecularMultiplier (const Ogre::ColourValue &specular); /// Set specular multiplier for light colour - Ogre::ColourValue getSpecularMultiplier (); + Ogre::ColourValue getSpecularMultiplier () const; /// Set ambient multiplier for light colour /// This only works if isManaging void setAmbientMultiplier (const Ogre::ColourValue &ambient); /// Set ambient multiplier for light colour - Ogre::ColourValue getAmbientMultiplier (); + Ogre::ColourValue getAmbientMultiplier () const; /// This can make this class manage the ambient light of the scene. void setManageAmbientLight (bool manage); /// If the class is managing the scene's ambient light. - bool isManagingAmbientLight (); + bool isManagingAmbientLight () const; + /// Allow access to main light, to disable it duaring eclipse, for example. + Ogre::Light* getMainLight() const; + + protected: + /// Handle far radius. + virtual void setFarRadius (Ogre::Real radius); + + /// Temporary change main light color + void setMainLightColour(const Ogre::ColourValue &colour); +}; + +//======================================================================================================================== + +/** Class representing the sun as sphere with emissive color on it. + @author Jes˙s Alonso Abad + */ +class DllExport SphereSun : public BaseSun { +// Attributes ----------------------------------------------------------------- + public: + /// Name of the sun material. + static const Ogre::String SUN_MATERIAL_NAME; + private: + /// The sun entity. + Ogre::Entity *mSunEntity; + + /// Reference to the sun material. + Ogre::MaterialPtr mSunMaterial; + +// Methods -------------------------------------------------------------------- + public: + /** Constructor. + @param sceneMgr The scene manager where the lights will be created. + */ + SphereSun (Ogre::SceneManager *sceneMgr, + Ogre::SceneNode *caelumRootNode, + const Ogre::String &meshName = "sphere.mesh"); + + /** Destructor. + @note If a sun position model is in use, it will be deleted. + */ + virtual ~SphereSun (); + + /** Sets the sun sphere colour. + @param colour The colour used to draw the sun + */ + void setSunSphereColour (const Ogre::ColourValue &colour); + + public: + /// Handle camera change. + virtual void notifyCameraChanged (Ogre::Camera *cam); + + private: /// Creates the sun material. void createSunMaterial (); /// Destroys the sun material. void destroySunMaterial (); +}; +//======================================================================================================================== + +/** Class representing the sun as billboard with texture on it. + @author Eugene Golushkov + */ +class DllExport SpriteSun : public BaseSun { +// Attributes ----------------------------------------------------------------- + public: + /// Name of the sun material. + static const Ogre::String SUN_MATERIAL_NAME; + + protected: + /// The sun sprite. + Ogre::BillboardSet* mSunBillboardSet; + + /// Reference to the sun material. + Ogre::MaterialPtr mSunMaterial; + + /// The sun sprite visible angle + Ogre::Degree mSunTextureAngularSize; + +// Methods -------------------------------------------------------------------- + public: + /** Constructor. + @param sceneMgr The scene manager where the lights will be created. + */ + SpriteSun (Ogre::SceneManager *sceneMgr, + Ogre::SceneNode *caelumRootNode, + const Ogre::String& sunTextureName = "sun_disc.png", + const Ogre::Degree& sunTextureAngularSize = Ogre::Degree(3.77f)); // 0.53f is real angular size of Sun and Moon, 3.77f is compatible with SphereSun + + /** Destructor. + @note If a sun position model is in use, it will be deleted. + */ + virtual ~SpriteSun (); + + /** Updates the sun material. + @param textureName The new sun texture name. + */ + void setSunTexture (const Ogre::String &textureName); + + /** Updates the sun size. + @param sunTextureAngularSize The new sun texture angular size. + */ + void setSunTextureAngularSize(const Ogre::Degree& sunTextureAngularSize); + + /** Sets the sun sphere colour. + @param colour The colour used to draw the sun + */ + void setSunSphereColour (const Ogre::ColourValue &colour); + public: /// Handle camera change. virtual void notifyCameraChanged (Ogre::Camera *cam); - protected: - /// Handle far radius. - virtual void setFarRadius (Ogre::Real radius); + private: + /// Creates the sun material. + void createSunMaterial (); + + /// Destroys the sun material. + void destroySunMaterial (); }; } // namespace caelum Modified: trunk/python-ogre/ThirdParty/forests/BatchedGeometry.cpp =================================================================== --- trunk/python-ogre/ThirdParty/forests/BatchedGeometry.cpp 2008-04-01 04:05:25 UTC (rev 582) +++ trunk/python-ogre/ThirdParty/forests/BatchedGeometry.cpp 2008-04-05 07:54:56 UTC (rev 583) @@ -237,10 +237,10 @@ meshType = ent->getSubMesh(); this->parent = parent; built = false; - + // Material must always exist Material *origMat = ((MaterialPtr)MaterialManager::getSingleton().getByName(ent->getMaterialName())).getPointer(); if (origMat) { - material = MaterialManager::getSingleton().getByName(getMaterialClone(origMat)->getName()); + material = MaterialManager::getSingleton().getByName(getMaterialClone(*origMat)->getName()); } else { MaterialManager::ResourceCreateOrRetrieveResult result = MaterialManager::getSingleton().createOrRetrieve("PagedGeometry_Batched_Material", "General"); if (result.first.isNull()) { @@ -288,12 +288,12 @@ delete indexData; } -Material *BatchedGeometry::SubBatch::getMaterialClone(Material *mat) +Material *BatchedGeometry::SubBatch::getMaterialClone(Material &mat) { - String clonedName = mat->getName() + "_Batched"; + String clonedName = mat.getName() + "_Batched"; MaterialPtr clonedMat = MaterialManager::getSingleton().getByName(clonedName); if (clonedMat.isNull()) - clonedMat = mat->clone(clonedName); + clonedMat = mat.clone(clonedName); return clonedMat.getPointer(); } Modified: trunk/python-ogre/ThirdParty/forests/BatchedGeometry.h =================================================================== --- trunk/python-ogre/ThirdParty/forests/BatchedGeometry.h 2008-04-01 04:05:25 UTC (rev 582) +++ trunk/python-ogre/ThirdParty/forests/BatchedGeometry.h 2008-04-05 07:54:56 UTC (rev 583) @@ -74,13 +74,13 @@ bool castsShadows(void) const { return parent->getCastShadows(); } private: - //This function is used to make a single clone of materials used, since the materials - //will be modified by the batch system (and it wouldn't be good to modify the original materials - //that the user may be using somewhere else). - Ogre::Material *getMaterialClone(Ogre::Material *mat); + // This function is used to make a single clone of materials used, since the materials + // will be modified by the batch system (and it wouldn't be good to modify the original materials + // that the user may be using somewhere else). + Ogre::Material *getMaterialClone(Ogre::Material &mat); - //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. + // 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; Modified: trunk/python-ogre/ThirdParty/forests/ImpostorPage.cpp =================================================================== --- trunk/python-ogre/ThirdParty/forests/ImpostorPage.cpp 2008-04-01 04:05:25 UTC (rev 582) +++ trunk/python-ogre/ThirdParty/forests/ImpostorPage.cpp 2008-04-05 07:54:56 UTC (rev 583) @@ -502,6 +502,8 @@ Real oldFogEnd = sceneMgr->getFogEnd(); sceneMgr->setFog(FOG_NONE); + // Get current status of the queue mode + Ogre::SceneManager::SpecialCaseRenderQueueMode OldSpecialCaseRenderQueueMode = sceneMgr->getSpecialCaseRenderQueueMode(); //Only render the entity sceneMgr->setSpecialCaseRenderQueueMode(Ogre::SceneManager::SCRQM_INCLUDE); sceneMgr->addSpecialCaseRenderQueue(RENDER_QUEUE_6 + 1); @@ -581,7 +583,8 @@ entity->setRenderQueueGroup(oldRenderQueueGroup); entity->setRenderingDistance(oldMaxDistance); sceneMgr->removeSpecialCaseRenderQueue(RENDER_QUEUE_6 + 1); - sceneMgr->setSpecialCaseRenderQueueMode(Ogre::SceneManager::SCRQM_EXCLUDE); + // Restore original state + sceneMgr->setSpecialCaseRenderQueueMode(OldSpecialCaseRenderQueueMode); //Re-enable mipmapping mm->setDefaultTextureFiltering(oldMinFilter, oldMagFilter, oldMipFilter); Modified: trunk/python-ogre/ThirdParty/forests/PagedGeometry.h =================================================================== --- trunk/python-ogre/ThirdParty/forests/PagedGeometry.h 2008-04-01 04:05:25 UTC (rev 582) +++ trunk/python-ogre/ThirdParty/forests/PagedGeometry.h 2008-04-05 07:54:56 UTC (rev 583) @@ -1348,7 +1348,8 @@ { //Bounded mode gridBounds = bounds; - geomGridX = (gridBounds.width() / mainGeom->getPageSize()); + // In case the devision does not give the round number use the next largest integer + geomGridX = std::ceil(gridBounds.width() / mainGeom->getPageSize()); } geomGridZ = geomGridX; //Note: geomGridX == geomGridZ; Need to merge. @@ -1356,10 +1357,6 @@ //Allocate grid array geomGrid = new GeometryPage *[geomGridX * geomGridZ]; - - //Create GeometryPage's - int offsetx = Ogre::Math::Floor(gridBounds.left / mainGeom->getPageSize()); - int offsetz = Ogre::Math::Floor(gridBounds.top / mainGeom->getPageSize()); for (int x = 0; x < geomGridX; ++x) { for (int z = 0; z < geomGridZ; ++z) @@ -1370,8 +1367,8 @@ page->_centerPoint.x = ((x + 0.5f) * mainGeom->getPageSize()) + gridBounds.left; page->_centerPoint.z = ((z + 0.5f) * mainGeom->getPageSize()) + gridBounds.top; page->_centerPoint.y = 0.0f; - page->_xIndex = x + offsetx; - page->_zIndex = z + offsetz; + page->_xIndex = x; + page->_zIndex = z; page->_inactiveTime = 0; page->_loaded = false; page->_needsUnload = false; Modified: trunk/python-ogre/ThirdParty/forests/TreeLoader2D.cpp =================================================================== --- trunk/python-ogre/ThirdParty/forests/TreeLoader2D.cpp 2008-04-01 04:05:25 UTC (rev 582) +++ trunk/python-ogre/ThirdParty/forests/TreeLoader2D.cpp 2008-04-05 07:54:56 UTC (rev 583) @@ -213,11 +213,11 @@ float distSq = distX * distX + distZ * distZ; if (distSq <= radiusSq){ +#ifdef PAGEDGEOMETRY_USER_DATA + deletedUserData.push_back(treeList[i].userData); +#endif //If it's within the radius, delete it treeList[i] = treeList.back(); -#ifdef PAGEDGEOMETRY_USER_DATA - deletedUserData.push_back(treeList.back().userData); -#endif treeList.pop_back(); modified = true; } Modified: trunk/python-ogre/ThirdParty/forests/TreeLoader3D.cpp =================================================================== --- trunk/python-ogre/ThirdParty/forests/TreeLoader3D.cpp 2008-04-01 04:05:25 UTC (rev 582) +++ trunk/python-ogre/ThirdParty/forests/TreeLoader3D.cpp 2008-04-05 07:54:56 UTC (rev 583) @@ -202,11 +202,11 @@ float distSq = distX * distX + distZ * distZ; if (distSq <= radiusSq){ +#ifdef PAGEDGEOMETRY_USER_DATA + deletedUserData.push_back(treeList[i].userData); +#endif //If it's within the radius, delete it treeList[i] = treeList.back(); -#ifdef PAGEDGEOMETRY_USER_DATA - deletedUserData.push_back(treeList.back().userData); -#endif treeList.pop_back(); modified = true; } Modified: trunk/python-ogre/ThirdParty/quickgui/QuickGUIPanel.cpp =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUIPanel.cpp 2008-04-01 04:05:25 UTC (rev 582) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUIPanel.cpp 2008-04-05 07:54:56 UTC (rev 583) @@ -420,6 +420,16 @@ } } + void Panel::enableScrollPane() + { + mScrollPane->enable(); + } + + void Panel::disableScrollPane() + { + mScrollPane->disable(); + } + QuadContainer* Panel::getQuadContainer() { return this; Modified: trunk/python-ogre/ThirdParty/quickgui/QuickGUIPanel.h =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUIPanel.h 2008-04-01 04:05:25 UTC (rev 582) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUIPanel.h 2008-04-05 07:54:56 UTC (rev 583) @@ -112,6 +112,10 @@ VerticalTrackBar* createVerticalTrackBar(); VerticalTrackBar* createVerticalTrackBar(const std::string& name); + void enableScrollPane(); + + void disableScrollPane(); + virtual QuadContainer* getQuadContainer(); ScrollPane* getScrollPane(); virtual Widget* getTargetWidget(const Point& pixelPosition); Modified: trunk/python-ogre/ThirdParty/quickgui/QuickGUIScrollPane.cpp =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUIScrollPane.cpp 2008-04-01 04:05:25 UTC (rev 582) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUIScrollPane.cpp 2008-04-05 07:54:56 UTC (rev 583) @@ -108,6 +108,21 @@ mRightBar->setSliderHeight(parentSize.height / mSize.height); } + void ScrollPane::enable() + { + Widget::enable(); + + unmanageWidgets(); + manageWidgets(); + } + + void ScrollPane::disable() + { + mBottomBar->hide(); + mRightBar->hide(); + Widget::disable(); + } + HorizontalScrollBar::ButtonLayout ScrollPane::getHorizontalButtonLayout() { return mHorizontalButtonLayout; @@ -130,6 +145,9 @@ void ScrollPane::manageWidget(Widget* w) { + if(!mEnabled) + return; + if(w->getParentWidget() != mParentWidget) return; @@ -167,7 +185,7 @@ void ScrollPane::manageWidgets() { - if(mParentWidget == NULL) + if(mParentWidget == NULL || !mEnabled) return; setSize(mParentWidget->getSize()); Modified: trunk/python-ogre/ThirdParty/quickgui/QuickGUIScrollPane.h =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUIScrollPane.h 2008-04-01 04:05:25 UTC (rev 582) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUIScrollPane.h 2008-04-05 07:54:56 UTC (rev 583) @@ -57,6 +57,18 @@ // When widgets become managed/unmanaged, the pane may grow or shrink. void _determinePaneBounds(); + /** + * Enable Widget, allowing it to accept and handle events. + * NOTE: Sheets cannot be enabled/disabled + */ + virtual void enable(); + + /** + * Disable Widget, making it unresponsive to events. + * NOTE: Sheets cannot be disabled. + */ + virtual void disable(); + HorizontalScrollBar::ButtonLayout getHorizontalButtonLayout(); virtual Widget* getTargetWidget(const Point& pixelPosition); virtual const Widget* getTargetWidget(const Point& pixelPosition) const; Modified: trunk/python-ogre/ThirdParty/quickgui/QuickGUIWidget.cpp =================================================================== --- trunk/python-ogre/ThirdParty/quickgui/QuickGUIWidget.cpp 2008-04-01 04:05:25 UTC (rev 582) +++ trunk/python-ogre/ThirdParty/quickgui/QuickGUIWidget.cpp 2008-04-05 07:54:56 UTC (rev 583) @@ -1385,8 +1385,9 @@ void Widget::setDimensions(const Rect& pixelDimensions) { + // Its important to set the size before the position, as this may affect scrollbars. + setSize(pixelDimensions.width,pixelDimensions.height); setPosition(pixelDimensions.x,pixelDimensions.y); - setSize(pixelDimensions.width,pixelDimensions.height); } void Widget::setDraggingWidget(Widget* w) Modified: trunk/python-ogre/code_generators/nxogre/python_nxogre_aliases.h =================================================================== --- trunk/python-ogre/code_generators/nxogre/python_nxogre_aliases.h 2008-04-01 04:05:25 UTC (rev 582) +++ trunk/python-ogre/code_generators/nxogre/python_nxogre_aliases.h 2008-04-05 07:54:56 UTC (rev 583) @@ -41,8 +41,8 @@ MapContainerJoint; typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::Material*>::Containee, std::less<std::string> >\ MapContainerMaterial; -typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::Character*>::Containee, std::less<std::string> >\ - MapContainerCharacter; +// typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::Character*>::Containee, std::less<std::string> >\ +// MapContainerCharacter; typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::Fluid*>::Containee, std::less<std::string> >\ MapContainerFluid; typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::FluidDrain*>::Containee, std::less<std::string> >\ @@ -90,7 +90,7 @@ // typedef NxOgre::Container<NxOgre::NxCollisionGroup, NxOgre::ShapeGroup*> ShapeGroupsByIndex; typedef NxOgre::Container<NxOgre::NxString, NxOgre::Trigger*> Triggers; typedef NxOgre::List<NxOgre::Wheel*> Wheels; -typedef NxOgre::Container<NxOgre::NxString, NxOgre::Character*> Characters; +// typedef NxOgre::Container<NxOgre::NxString, NxOgre::Character*> Characters; typedef NxOgre::List<NxOgre::CharacterHitReport*> CharacterHitReports; typedef NxOgre::Container<NxOgre::NxString, NxOgre::Fluid*> Fluids; typedef NxOgre::Container<NxOgre::NxString, NxOgre::FluidDrain*> FluidDrains; @@ -103,12 +103,12 @@ typedef NxOgre::Container<std::string, NxConvexMesh*> NxConvexMeshes; typedef NxOgre::Container<std::string, NxTriangleMesh*> NxTriangleMeshes; -typedef NxOgre::Container<std::string, NxOgre::MaterialAlias*> MaterialAliases; +// typedef NxOgre::Container<std::string, NxOgre::MaterialAlias*> MaterialAliases; typedef NxOgre::Container<unsigned int, NxTriangleMesh*> NxTriangleMesheInts; -typedef NxOgre::Container<unsigned int, NxOgre::ResourceSystem*> ResourceSystemInts; -typedef NxOgre::Container<unsigned int, NxOgre::MaterialAlias*> MaterialAliasInts; -typedef NxOgre::Container<unsigned int, NxOgre::CharacterMovementModel*> CharacterMovementModelInts; +// typedef NxOgre::Container<unsigned int, NxOgre::ResourceSystem*> ResourceSystemInts; +// typedef NxOgre::Container<unsigned int, NxOgre::MaterialAlias*> MaterialAliasInts; +// typedef NxOgre::Container<unsigned int, NxOgre::CharacterMovementModel*> CharacterMovementModelInts; // typedef NxOgre::Container<NxOgre::NxString, ::ActorGroup*> ActorGroups; // typedef NxOgre::Container<NxOgre::NxActorGroup, NxOgre::ActorGroup*> ActorGroupsByIndex; @@ -149,21 +149,21 @@ typedef std::map<unsigned int, NxOgre::Container<unsigned int, NxOgre::RenderableSource*>::Containee, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, NxOgre::Container<unsigned int, NxOgre::RenderableSource*>::Containee> > >\ MapContainerRenderableSource; -typedef std::map<unsigned int, NxOgre::Container<unsigned int, NxOgre::CharacterMovementModel*>::Containee, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, NxOgre::Container<unsigned int, NxOgre::CharacterMovementModel*>::Containee> > >\ - MapContainerCharacterMovementModel; -typedef std::map<unsigned int, NxOgre::Container<unsigned int, NxOgre::MaterialAlias*>::Containee, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, NxOgre::Container<unsigned int, NxOgre::MaterialAlias*>::Containee> > >\ - MapContainerMaterialAlias; -typedef std::map<unsigned int, NxOgre::Container<unsigned int, NxOgre::ResourceSystem*>::Containee, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, NxOgre::Container<unsigned int, NxOgre::ResourceSystem*>::Containee> > >\ - MapContainerResourceSystem; +// typedef std::map<unsigned int, NxOgre::Container<unsigned int, NxOgre::CharacterMovementModel*>::Containee, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, NxOgre::Container<unsigned int, NxOgre::CharacterMovementModel*>::Containee> > >\ +// MapContainerCharacterMovementModel; +// typedef std::map<unsigned int, NxOgre::Container<unsigned int, NxOgre::MaterialAlias*>::Containee, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, NxOgre::Container<unsigned int, NxOgre::MaterialAlias*>::Containee> > >\ +// MapContainerMaterialAlias; +// typedef std::map<unsigned int, NxOgre::Container<unsigned int, NxOgre::ResourceSystem*>::Containee, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, NxOgre::Container<unsigned int, NxOgre::ResourceSystem*>::Containee> > >\ +// MapContainerResourceSystem; typedef std::map<unsigned int, NxOgre::Container<unsigned int, NxTriangleMesh*>::Containee, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, NxOgre::Container<unsigned int, NxTriangleMesh*>::Containee> > >\ MapContainerNxTriangleMesh; -typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::MaterialAlias*>::Containee, std::less<std::string>, std::allocator<std::pair<std::string const, NxOgre::Container<std::string, NxOgre::MaterialAlias*>::Containee> > >\ - MapStringContainerMaterialAlias; +// typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::MaterialAlias*>::Containee, std::less<std::string>, std::allocator<std::pair<std::string const, NxOgre::Container<std::string, NxOgre::MaterialAlias*>::Containee> > >\ +// MapStringContainerMaterialAlias; typedef std::map<std::string, NxOgre::Container<std::string, NxTriangleMesh*>::Containee, std::less<std::string>, std::allocator<std::pair<std::string const, NxOgre::Container<std::string, NxTriangleMesh*>::Containee> > >\ MapStringContainerNxTriangleMesh; -typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::CharacterMovementModel*>::Containee, std::less<std::string>, std::allocator<std::pair<std::string const, NxOgre::Container<std::string, NxOgre::CharacterMovementModel*>::Containee> > >\ - MapStringContainerCharacterMovementModel; +// typedef std::map<std::string, NxOgre::Container<std::string, NxOgre::CharacterMovementModel*>::Containee, std::less<std::strin... [truncated message content] |