[Python-ogre-commit] SF.net SVN: python-ogre:[845] trunk/python-ogre
Brought to you by:
andy_miller,
roman_yakovenko
|
From: <and...@us...> - 2009-01-25 03:51:18
|
Revision: 845
http://python-ogre.svn.sourceforge.net/python-ogre/?rev=845&view=rev
Author: andy_miller
Date: 2009-01-25 03:51:12 +0000 (Sun, 25 Jan 2009)
Log Message:
-----------
Updated to Caelum 0.4
Small fixes for Ogre 1.6.1 (exposed a missing class)
Added Mac changes to environment.py
Modified Paths:
--------------
trunk/python-ogre/PythonOgreConfig_nt.py
trunk/python-ogre/ThirdParty/caelum/Caelum.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/CloudSystem.cpp
trunk/python-ogre/ThirdParty/caelum/CloudSystem.h
trunk/python-ogre/ThirdParty/caelum/DepthComposer.cpp
trunk/python-ogre/ThirdParty/caelum/DepthComposer.h
trunk/python-ogre/ThirdParty/caelum/FlatCloudLayer.cpp
trunk/python-ogre/ThirdParty/caelum/FlatCloudLayer.h
trunk/python-ogre/ThirdParty/caelum/GeometryFactory.cpp
trunk/python-ogre/ThirdParty/caelum/GeometryFactory.h
trunk/python-ogre/ThirdParty/caelum/GroundFog.cpp
trunk/python-ogre/ThirdParty/caelum/GroundFog.h
trunk/python-ogre/ThirdParty/caelum/Moon.h
trunk/python-ogre/ThirdParty/caelum/OwnedPtr.h
trunk/python-ogre/ThirdParty/caelum/PointStarfield.cpp
trunk/python-ogre/ThirdParty/caelum/PointStarfield.h
trunk/python-ogre/ThirdParty/caelum/PrecipitationController.cpp
trunk/python-ogre/ThirdParty/caelum/PrecipitationController.h
trunk/python-ogre/ThirdParty/caelum/SkyDome.cpp
trunk/python-ogre/ThirdParty/caelum/SkyDome.h
trunk/python-ogre/ThirdParty/caelum/SkyLight.cpp
trunk/python-ogre/ThirdParty/caelum/SkyLight.h
trunk/python-ogre/ThirdParty/caelum/Sun.cpp
trunk/python-ogre/ThirdParty/caelum/UniversalClock.h
trunk/python-ogre/code_generators/caelum/generate_code.py
trunk/python-ogre/code_generators/caelum/python_caelum_aliases.h
trunk/python-ogre/code_generators/ogre/generate_code.py
trunk/python-ogre/code_generators/ogre/python_ogre_aliases.h
trunk/python-ogre/code_generators/ogre/python_ogre_masterlist.h
trunk/python-ogre/code_generators/ogre/python_ogre_sizeof.h
trunk/python-ogre/code_generators/quickgui/python_quickgui_aliases.h
trunk/python-ogre/environment.py
trunk/python-ogre/scripts/UpdateDLLs.bat
trunk/python-ogre/setup.py
Added Paths:
-----------
trunk/python-ogre/ThirdParty/caelum/CaelumDefaultTypeDescriptorData.cpp
trunk/python-ogre/ThirdParty/caelum/CaelumPlugin.cpp
trunk/python-ogre/ThirdParty/caelum/CaelumPlugin.h
trunk/python-ogre/ThirdParty/caelum/CaelumScriptTranslator.cpp
trunk/python-ogre/ThirdParty/caelum/CaelumScriptTranslator.h
trunk/python-ogre/ThirdParty/caelum/TypeDescriptor.cpp
trunk/python-ogre/ThirdParty/caelum/TypeDescriptor.h
Modified: trunk/python-ogre/PythonOgreConfig_nt.py
===================================================================
--- trunk/python-ogre/PythonOgreConfig_nt.py 2009-01-24 05:00:41 UTC (rev 844)
+++ trunk/python-ogre/PythonOgreConfig_nt.py 2009-01-25 03:51:12 UTC (rev 845)
@@ -1,6 +1,6 @@
import os
-SDK=True # Changes Ogre include path settings
+SDK=False # Changes Ogre include path settings
## The root directory is where this module is located
module_dir = os.path.abspath(os.path.dirname(__file__) )
@@ -31,7 +31,8 @@
## Parent directories of the libraries
PATH_THIRDPARTY = os.path.join(module_dir, 'ThirdParty' )
PATH_Ogre = os.path.join(BASE_DIR, 'ogre')
-PATH_Ogre = "C:\\OgreSDK"
+if SDK:
+ PATH_Ogre = "C:\\OgreSDK"
PATH_OgreAddons = os.path.join(BASE_DIR, 'OgreAddons')
PATH_CEGUI = os.path.join(BASE_DIR, 'CEGUI-0.6.2')
@@ -96,7 +97,7 @@
###
PATH_LIB_Ogre_CEGUIRenderer = os.path.join( PATH_Ogre, 'Samples/Common/CEGUIRenderer/lib')
PATH_LIB_Ogre_OgreMain= os.path.join( PATH_Ogre, 'lib' )
-PATH_LIB_Ogre_Dependencies = ""# os.path.join( PATH_Ogre, 'Dependencies/lib/Release')
+PATH_LIB_Ogre_Dependencies = os.path.join( PATH_Ogre, 'Dependencies/lib/Release')
PATH_LIB_OgreRefApp = os.path.join( PATH_Ogre, 'lib')
PATH_LIB_OgreNewt = os.path.join( PATH_OgreAddons, 'ogrenewt/OgreNewt_Main/lib/Release')
PATH_LIB_Newton = os.path.join( PATH_Newton ,'dll') ##NOTE Posix platforms this lives in 'lib-mt'
@@ -140,7 +141,7 @@
PATH_INCLUDE_Ogre= os.path.join(PATH_Ogre,'OgreMain/include')
PATH_INCLUDE_NEDMALLOC= "" #os.path.join(PATH_Ogre,'OgreMain', 'src', 'nedmalloc')
-PATH_INCLUDE_Ogre_Dependencies = "" #os.path.join( PATH_Ogre, 'Dependencies/include')
+PATH_INCLUDE_Ogre_Dependencies = os.path.join( PATH_Ogre, 'Dependencies/include')
PATH_INCLUDE_OIS = os.path.join(PATH_OIS,'includes') ## Note the plural include's
PATH_INCLUDE_OgreRefApp = os.path.join(PATH_Ogre,'ReferenceApplication/ReferenceAppLayer/include')
PATH_INCLUDE_OgreNewt = os.path.join(PATH_OgreAddons,'ogrenewt/OgreNewt_Main/inc')
Modified: trunk/python-ogre/ThirdParty/caelum/Caelum.h
===================================================================
--- trunk/python-ogre/ThirdParty/caelum/Caelum.h 2009-01-24 05:00:41 UTC (rev 844)
+++ trunk/python-ogre/ThirdParty/caelum/Caelum.h 2009-01-25 03:51:12 UTC (rev 845)
@@ -22,6 +22,9 @@
#define CAELUM_H
#include "CaelumPrerequisites.h"
+#include "CaelumScriptTranslator.h"
+#include "TypeDescriptor.h"
+#include "CaelumPlugin.h"
#include "CaelumExceptions.h"
#include "CaelumSystem.h"
#include "CameraBoundElement.h"
Added: trunk/python-ogre/ThirdParty/caelum/CaelumDefaultTypeDescriptorData.cpp
===================================================================
--- trunk/python-ogre/ThirdParty/caelum/CaelumDefaultTypeDescriptorData.cpp (rev 0)
+++ trunk/python-ogre/ThirdParty/caelum/CaelumDefaultTypeDescriptorData.cpp 2009-01-25 03:51:12 UTC (rev 845)
@@ -0,0 +1,419 @@
+/*
+This file is part of Caelum.
+See http://www.ogre3d.org/wiki/index.php/Caelum
+
+Copyright (c) 2008 Caelum team. See Contributors.txt for details.
+
+Caelum is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published
+by the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+Caelum is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with Caelum. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "CaelumPrecompiled.h"
+#include "CaelumPrerequisites.h"
+
+#if CAELUM_TYPE_DESCRIPTORS
+
+#include "TypeDescriptor.h"
+#include "CaelumSystem.h"
+#include "FlatCloudLayer.h"
+
+using namespace Ogre;
+
+namespace Caelum
+{
+ CaelumDefaultTypeDescriptorData::CaelumDefaultTypeDescriptorData ():
+ CaelumSystemTypeDescriptor(0),
+ PointStarfieldTypeDescriptor(0),
+ BaseSkyLightTypeDescriptor(0),
+ GroundFogTypeDescriptor(0),
+ PrecipitationTypeDescriptor(0),
+ DepthComposerTypeDescriptor(0),
+ FlatCloudLayerTypeDescriptor(0),
+ SkyDomeTypeDescriptor(0)
+ {
+ try {
+ load ();
+ } catch (...) {
+ unload ();
+ throw;
+ }
+ }
+
+ CaelumDefaultTypeDescriptorData::~CaelumDefaultTypeDescriptorData ()
+ {
+ unload ();
+ }
+
+ template<class T>
+ inline void delete_zero(T*& member) {
+ // Remember: delete 0 is a legal no-op.
+ delete member;
+ member = 0;
+ }
+
+ void CaelumDefaultTypeDescriptorData::unload ()
+ {
+ delete_zero(CaelumSystemTypeDescriptor);
+ delete_zero(PointStarfieldTypeDescriptor);
+ delete_zero(BaseSkyLightTypeDescriptor);
+ delete_zero(GroundFogTypeDescriptor);
+ delete_zero(PrecipitationTypeDescriptor);
+ delete_zero(DepthComposerTypeDescriptor);
+ delete_zero(FlatCloudLayerTypeDescriptor);
+ delete_zero(SkyDomeTypeDescriptor);
+ }
+
+ void CaelumDefaultTypeDescriptorData::load ()
+ {
+ if (!CaelumSystemTypeDescriptor)
+ {
+ std::auto_ptr<DefaultTypeDescriptor> td (new DefaultTypeDescriptor ());
+
+ // Timing settings.
+ td->add("time_scale",
+ new AccesorPropertyDescriptor<Caelum::CaelumSystem, Real, Real, Real>(
+ &Caelum::CaelumSystem::getTimeScale,
+ &Caelum::CaelumSystem::setTimeScale));
+ td->add("julian_day",
+ new AccesorPropertyDescriptor<Caelum::CaelumSystem, LongReal, LongReal, LongReal>(
+ &Caelum::CaelumSystem::getJulianDay,
+ &Caelum::CaelumSystem::setJulianDay));
+
+ // Latitude/longitude
+ td->add("latitude",
+ new AccesorPropertyDescriptor<Caelum::CaelumSystem, Degree, Degree, const Degree>(
+ &Caelum::CaelumSystem::getObserverLatitude,
+ &Caelum::CaelumSystem::setObserverLatitude));
+ td->add("longitude",
+ new AccesorPropertyDescriptor<Caelum::CaelumSystem, Degree, Degree, const Degree>(
+ &Caelum::CaelumSystem::getObserverLongitude,
+ &Caelum::CaelumSystem::setObserverLongitude));
+
+ // Fog settings.
+ td->add("global_fog_density_multiplier",
+ new AccesorPropertyDescriptor<Caelum::CaelumSystem, Real, Real, Real>(
+ &Caelum::CaelumSystem::getGlobalFogDensityMultiplier,
+ &Caelum::CaelumSystem::setGlobalFogDensityMultiplier));
+ td->add("global_fog_colour_multiplier",
+ new AccesorPropertyDescriptor<Caelum::CaelumSystem, ColourValue>(
+ &Caelum::CaelumSystem::getGlobalFogColourMultiplier,
+ &Caelum::CaelumSystem::setGlobalFogColourMultiplier));
+ td->add("manage_scene_fog",
+ new AccesorPropertyDescriptor<Caelum::CaelumSystem, bool, bool, bool>(
+ &Caelum::CaelumSystem::getManageSceneFog,
+ &Caelum::CaelumSystem::setManageSceneFog));
+ td->add("scene_fog_density_multiplier",
+ new AccesorPropertyDescriptor<Caelum::CaelumSystem, Real, Real, Real>(
+ &Caelum::CaelumSystem::getSceneFogDensityMultiplier,
+ &Caelum::CaelumSystem::setSceneFogDensityMultiplier));
+ td->add("scene_fog_colour_multiplier",
+ new AccesorPropertyDescriptor<Caelum::CaelumSystem, ColourValue>(
+ &Caelum::CaelumSystem::getSceneFogColourMultiplier,
+ &Caelum::CaelumSystem::setSceneFogColourMultiplier));
+ td->add("ground_fog_density_multiplier",
+ new AccesorPropertyDescriptor<Caelum::CaelumSystem, Real, Real, Real>(
+ &Caelum::CaelumSystem::getGroundFogDensityMultiplier,
+ &Caelum::CaelumSystem::setGroundFogDensityMultiplier));
+ td->add("ground_fog_colour_multiplier",
+ new AccesorPropertyDescriptor<Caelum::CaelumSystem, ColourValue>(
+ &Caelum::CaelumSystem::getGroundFogColourMultiplier,
+ &Caelum::CaelumSystem::setGroundFogColourMultiplier));
+
+ // Lighting settings.
+ td->add("manage_ambient_light",
+ new AccesorPropertyDescriptor<Caelum::CaelumSystem, bool, bool, bool>(
+ &Caelum::CaelumSystem::getManageAmbientLight,
+ &Caelum::CaelumSystem::setManageAmbientLight));
+ td->add("minimum_ambient_light",
+ new AccesorPropertyDescriptor<Caelum::CaelumSystem, ColourValue>(
+ &Caelum::CaelumSystem::getMinimumAmbientLight,
+ &Caelum::CaelumSystem::setMinimumAmbientLight));
+ td->add("ensure_single_light_source",
+ new AccesorPropertyDescriptor<Caelum::CaelumSystem, bool, bool, bool>(
+ &Caelum::CaelumSystem::getEnsureSingleLightSource,
+ &Caelum::CaelumSystem::setEnsureSingleLightSource));
+ td->add("ensure_single_shadow_source",
+ new AccesorPropertyDescriptor<Caelum::CaelumSystem, bool, bool, bool>(
+ &Caelum::CaelumSystem::getEnsureSingleShadowSource,
+ &Caelum::CaelumSystem::setEnsureSingleShadowSource));
+
+ CaelumSystemTypeDescriptor = td.release ();
+ }
+
+ if (!PointStarfieldTypeDescriptor)
+ {
+ std::auto_ptr<DefaultTypeDescriptor> td (new DefaultTypeDescriptor ());
+ td->add("magnitude_scale",
+ new AccesorPropertyDescriptor<Caelum::PointStarfield, Real, Real, Real>(
+ &Caelum::PointStarfield::getMagnitudeScale,
+ &Caelum::PointStarfield::setMagnitudeScale));
+ td->add("mag0_pixel_size",
+ new AccesorPropertyDescriptor<Caelum::PointStarfield, Real, Real, Real>(
+ &Caelum::PointStarfield::getMag0PixelSize,
+ &Caelum::PointStarfield::setMag0PixelSize));
+ td->add("min_pixel_size",
+ new AccesorPropertyDescriptor<Caelum::PointStarfield, Real, Real, Real>(
+ &Caelum::PointStarfield::getMinPixelSize,
+ &Caelum::PointStarfield::setMinPixelSize));
+ td->add("max_pixel_size",
+ new AccesorPropertyDescriptor<Caelum::PointStarfield, Real, Real, Real>(
+ &Caelum::PointStarfield::getMaxPixelSize,
+ &Caelum::PointStarfield::setMaxPixelSize));
+ td->add("latitude",
+ new AccesorPropertyDescriptor<Caelum::PointStarfield, Degree, Degree, Degree>(
+ &Caelum::PointStarfield::getObserverLatitude,
+ &Caelum::PointStarfield::setObserverLatitude));
+ td->add("longitude",
+ new AccesorPropertyDescriptor<Caelum::PointStarfield, Degree, Degree, Degree>(
+ &Caelum::PointStarfield::getObserverLongitude,
+ &Caelum::PointStarfield::setObserverLongitude));
+ td->add("observer_position_rebuild_delta",
+ new AccesorPropertyDescriptor<Caelum::PointStarfield, Degree, Degree, Degree>(
+ &Caelum::PointStarfield::getObserverPositionRebuildDelta,
+ &Caelum::PointStarfield::setObserverPositionRebuildDelta));
+ PointStarfieldTypeDescriptor = td.release ();
+ }
+
+ if (!BaseSkyLightTypeDescriptor)
+ {
+ std::auto_ptr<DefaultTypeDescriptor> td (new DefaultTypeDescriptor ());
+ td->add("ambient_multiplier",
+ new AccesorPropertyDescriptor<Caelum::BaseSkyLight, ColourValue>(
+ &Caelum::BaseSkyLight::getAmbientMultiplier,
+ &Caelum::BaseSkyLight::setAmbientMultiplier));
+ td->add("specular_multiplier",
+ new AccesorPropertyDescriptor<Caelum::BaseSkyLight, ColourValue>(
+ &Caelum::BaseSkyLight::getSpecularMultiplier,
+ &Caelum::BaseSkyLight::setSpecularMultiplier));
+ td->add("diffuse_multiplier",
+ new AccesorPropertyDescriptor<Caelum::BaseSkyLight, ColourValue>(
+ &Caelum::BaseSkyLight::getDiffuseMultiplier,
+ &Caelum::BaseSkyLight::setDiffuseMultiplier));
+ td->add("light_colour",
+ new AccesorPropertyDescriptor<Caelum::BaseSkyLight, ColourValue>(
+ &Caelum::BaseSkyLight::getLightColour,
+ &Caelum::BaseSkyLight::setLightColour));
+ td->add("body_colour",
+ new AccesorPropertyDescriptor<Caelum::BaseSkyLight, ColourValue>(
+ &Caelum::BaseSkyLight::getBodyColour,
+ &Caelum::BaseSkyLight::setBodyColour));
+ td->add("auto_disable_threshold",
+ new AccesorPropertyDescriptor<Caelum::BaseSkyLight, Real, Real, Real>(
+ &Caelum::BaseSkyLight::getAutoDisableThreshold,
+ &Caelum::BaseSkyLight::setAutoDisableThreshold));
+ td->add("auto_disable",
+ new AccesorPropertyDescriptor<Caelum::BaseSkyLight, bool, bool, bool>(
+ &Caelum::BaseSkyLight::getAutoDisable,
+ &Caelum::BaseSkyLight::setAutoDisable));
+ BaseSkyLightTypeDescriptor = td.release ();
+ }
+
+ if (!GroundFogTypeDescriptor)
+ {
+ std::auto_ptr<DefaultTypeDescriptor> td (new DefaultTypeDescriptor ());
+ td->add("density",
+ new AccesorPropertyDescriptor<Caelum::GroundFog, Real, Real, Real>(
+ &Caelum::GroundFog::getDensity,
+ &Caelum::GroundFog::setDensity));
+ td->add("vertical_decay",
+ new AccesorPropertyDescriptor<Caelum::GroundFog, Real, Real, Real>(
+ &Caelum::GroundFog::getVerticalDecay,
+ &Caelum::GroundFog::setVerticalDecay));
+ td->add("ground_level",
+ new AccesorPropertyDescriptor<Caelum::GroundFog, Real, Real, Real>(
+ &Caelum::GroundFog::getGroundLevel,
+ &Caelum::GroundFog::setGroundLevel));
+ td->add("colour",
+ new AccesorPropertyDescriptor<Caelum::GroundFog, ColourValue>(
+ &Caelum::GroundFog::getColour,
+ &Caelum::GroundFog::setColour));
+ GroundFogTypeDescriptor = td.release ();
+ }
+
+ if (!DepthComposerTypeDescriptor)
+ {
+ std::auto_ptr<DefaultTypeDescriptor> td (new DefaultTypeDescriptor ());
+ td->add("debug_depth_render",
+ new AccesorPropertyDescriptor<Caelum::DepthComposer, bool, bool, bool>(
+ &Caelum::DepthComposer::getDebugDepthRender,
+ &Caelum::DepthComposer::setDebugDepthRender));
+
+ // Legacy haze
+ td->add("haze_enabled",
+ new AccesorPropertyDescriptor<Caelum::DepthComposer, bool, bool, bool>(
+ &Caelum::DepthComposer::getSkyDomeHazeEnabled,
+ &Caelum::DepthComposer::setSkyDomeHazeEnabled));
+ td->add("haze_colour",
+ new AccesorPropertyDescriptor<Caelum::DepthComposer, ColourValue>(
+ &Caelum::DepthComposer::getHazeColour,
+ &Caelum::DepthComposer::setHazeColour));
+ td->add("haze_sun_direction",
+ new AccesorPropertyDescriptor<Caelum::DepthComposer, Vector3>(
+ &Caelum::DepthComposer::getSunDirection,
+ &Caelum::DepthComposer::setSunDirection));
+
+ // Ground fog
+ td->add("ground_fog_enabled",
+ new AccesorPropertyDescriptor<Caelum::DepthComposer, bool, bool, bool>(
+ &Caelum::DepthComposer::getGroundFogEnabled,
+ &Caelum::DepthComposer::setGroundFogEnabled));
+ td->add("ground_fog_density",
+ new AccesorPropertyDescriptor<Caelum::DepthComposer, Real, Real, Real>(
+ &Caelum::DepthComposer::getGroundFogDensity,
+ &Caelum::DepthComposer::setGroundFogDensity));
+ td->add("ground_fog_vertical_decay",
+ new AccesorPropertyDescriptor<Caelum::DepthComposer, Real, Real, Real>(
+ &Caelum::DepthComposer::getGroundFogVerticalDecay,
+ &Caelum::DepthComposer::setGroundFogVerticalDecay));
+ td->add("ground_fog_base_level",
+ new AccesorPropertyDescriptor<Caelum::DepthComposer, Real, Real, Real>(
+ &Caelum::DepthComposer::getGroundFogBaseLevel,
+ &Caelum::DepthComposer::setGroundFogBaseLevel));
+ td->add("ground_fog_colour",
+ new AccesorPropertyDescriptor<Caelum::DepthComposer, ColourValue>(
+ &Caelum::DepthComposer::getGroundFogColour,
+ &Caelum::DepthComposer::setGroundFogColour));
+
+ DepthComposerTypeDescriptor = td.release ();
+ }
+
+ if (!PrecipitationTypeDescriptor)
+ {
+ std::auto_ptr<DefaultTypeDescriptor> td (new DefaultTypeDescriptor ());
+
+ td->add("texture",
+ new AccesorPropertyDescriptor<Caelum::PrecipitationController, String>(
+ &Caelum::PrecipitationController::getTextureName,
+ &Caelum::PrecipitationController::setTextureName));
+ td->add("precipitation_colour",
+ new AccesorPropertyDescriptor<Caelum::PrecipitationController, ColourValue>(
+ &Caelum::PrecipitationController::getColour,
+ &Caelum::PrecipitationController::setColour));
+ td->add("falling_speed",
+ new AccesorPropertyDescriptor<Caelum::PrecipitationController, Real, Real, Real>(
+ &Caelum::PrecipitationController::getSpeed,
+ &Caelum::PrecipitationController::setSpeed));
+ td->add("wind_speed",
+ new AccesorPropertyDescriptor<Caelum::PrecipitationController, Vector3>(
+ &Caelum::PrecipitationController::getWindSpeed,
+ &Caelum::PrecipitationController::setWindSpeed));
+ td->add("camera_speed_scale",
+ new AccesorPropertyDescriptor<Caelum::PrecipitationController, Vector3>(
+ &Caelum::PrecipitationController::getCameraSpeedScale,
+ &Caelum::PrecipitationController::setCameraSpeedScale));
+ td->add("intensity",
+ new AccesorPropertyDescriptor<Caelum::PrecipitationController, Real, Real, Real>(
+ &Caelum::PrecipitationController::getIntensity,
+ &Caelum::PrecipitationController::setIntensity));
+ td->add("auto_disable_intensity",
+ new AccesorPropertyDescriptor<Caelum::PrecipitationController, Real, Real, Real>(
+ &Caelum::PrecipitationController::getAutoDisableThreshold,
+ &Caelum::PrecipitationController::setAutoDisableThreshold));
+ td->add("falling_direction",
+ new AccesorPropertyDescriptor<Caelum::PrecipitationController, Vector3>(
+ &Caelum::PrecipitationController::getFallingDirection,
+ &Caelum::PrecipitationController::setFallingDirection));
+
+ PrecipitationTypeDescriptor = td.release ();
+ }
+
+ if (!FlatCloudLayerTypeDescriptor)
+ {
+ std::auto_ptr<DefaultTypeDescriptor> td (new DefaultTypeDescriptor ());
+
+ td->add("height",
+ new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, Real, Real, Real>(
+ &Caelum::FlatCloudLayer::getHeight,
+ &Caelum::FlatCloudLayer::setHeight));
+ td->add("coverage",
+ new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, Real, Real, Real>(
+ &Caelum::FlatCloudLayer::getCloudCover,
+ &Caelum::FlatCloudLayer::setCloudCover));
+ td->add("cloud_speed",
+ new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, Vector2>(
+ &Caelum::FlatCloudLayer::getCloudSpeed,
+ &Caelum::FlatCloudLayer::setCloudSpeed));
+ td->add("blend_time",
+ new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, Real, Real, Real>(
+ &Caelum::FlatCloudLayer::getCloudBlendTime,
+ &Caelum::FlatCloudLayer::setCloudBlendTime));
+ td->add("mesh_width",
+ new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, Real, Real, Real>(
+ &Caelum::FlatCloudLayer::getMeshWidth,
+ &Caelum::FlatCloudLayer::setMeshWidth));
+ td->add("mesh_height",
+ new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, Real, Real, Real>(
+ &Caelum::FlatCloudLayer::getMeshHeight,
+ &Caelum::FlatCloudLayer::setMeshHeight));
+ td->add("mesh_width_segments",
+ new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, int, int, int>(
+ &Caelum::FlatCloudLayer::getMeshWidthSegments,
+ &Caelum::FlatCloudLayer::setMeshWidthSegments));
+ td->add("mesh_height_segments",
+ new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, int, int, int>(
+ &Caelum::FlatCloudLayer::getMeshHeightSegments,
+ &Caelum::FlatCloudLayer::setMeshHeightSegments));
+ td->add("cloud_uv_factor",
+ new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, Real, Real, Real>(
+ &Caelum::FlatCloudLayer::getCloudUVFactor,
+ &Caelum::FlatCloudLayer::setCloudUVFactor));
+ td->add("height_red_factor",
+ new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, Real, Real, Real>(
+ &Caelum::FlatCloudLayer::getHeightRedFactor,
+ &Caelum::FlatCloudLayer::setHeightRedFactor));
+ td->add("near_fade_dist",
+ new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, Real, Real, Real>(
+ &Caelum::FlatCloudLayer::getNearFadeDist,
+ &Caelum::FlatCloudLayer::setNearFadeDist));
+ td->add("far_fade_dist",
+ new AccesorPropertyDescriptor<Caelum::FlatCloudLayer, Real, Real, Real>(
+ &Caelum::FlatCloudLayer::getFarFadeDist,
+ &Caelum::FlatCloudLayer::setFarFadeDist));
+
+ FlatCloudLayerTypeDescriptor = td.release ();
+ }
+
+ if (!SkyDomeTypeDescriptor)
+ {
+ std::auto_ptr<DefaultTypeDescriptor> td (new DefaultTypeDescriptor ());
+
+ // SkyDome is slightly special because most properties are write-only.
+
+ // Reset by CaelumSystem every frame anyway
+ td->add("sun_direction",
+ new AccesorPropertyDescriptor<Caelum::SkyDome, Ogre::Vector3>(
+ 0, &Caelum::SkyDome::setSunDirection));
+ td->add("haze_colour",
+ new AccesorPropertyDescriptor<Caelum::SkyDome, Ogre::ColourValue>(
+ 0, &Caelum::SkyDome::setHazeColour));
+
+ // Different files not supported anyway
+ td->add("sky_gradients_image",
+ new AccesorPropertyDescriptor<Caelum::SkyDome, Ogre::String>(
+ 0, &Caelum::SkyDome::setSkyGradientsImage));
+ td->add("atmosphere_depth_image",
+ new AccesorPropertyDescriptor<Caelum::SkyDome, Ogre::String>(
+ 0, &Caelum::SkyDome::setAtmosphereDepthImage));
+
+ // This does actually make sense.
+ td->add("haze_enabled",
+ new AccesorPropertyDescriptor<Caelum::SkyDome, bool, bool, bool>(
+ &Caelum::SkyDome::getHazeEnabled,
+ &Caelum::SkyDome::setHazeEnabled));
+
+ SkyDomeTypeDescriptor = td.release ();
+ }
+ }
+}
+
+#endif // CAELUM_TYPE_DESCRIPTORS
Added: trunk/python-ogre/ThirdParty/caelum/CaelumPlugin.cpp
===================================================================
--- trunk/python-ogre/ThirdParty/caelum/CaelumPlugin.cpp (rev 0)
+++ trunk/python-ogre/ThirdParty/caelum/CaelumPlugin.cpp 2009-01-25 03:51:12 UTC (rev 845)
@@ -0,0 +1,162 @@
+/*
+This file is part of Caelum.
+See http://www.ogre3d.org/wiki/index.php/Caelum
+
+Copyright (c) 2008 Caelum team. See Contributors.txt for details.
+
+Caelum is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published
+by the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+Caelum is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with Caelum. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "CaelumPrecompiled.h"
+#include "CaelumPlugin.h"
+
+template<> Caelum::CaelumPlugin* Ogre::Singleton<Caelum::CaelumPlugin>::ms_Singleton = 0;
+
+namespace Caelum
+{
+ CaelumPlugin* CaelumPlugin::getSingletonPtr () {
+ return ms_Singleton;
+ }
+
+ CaelumPlugin& CaelumPlugin::getSingleton () {
+ assert (ms_Singleton);
+ return *ms_Singleton;
+ }
+
+ extern "C" void CAELUM_EXPORT dllStartPlugin () {
+ assert (CaelumPlugin::getSingletonPtr () == 0);
+ CaelumPlugin* plugin = new CaelumPlugin();
+ assert (CaelumPlugin::getSingletonPtr () == plugin);
+ Ogre::Root::getSingleton ().installPlugin (CaelumPlugin::getSingletonPtr ());
+ }
+
+ extern "C" void CAELUM_EXPORT dllStopPlugin () {
+ assert (CaelumPlugin::getSingletonPtr () != 0);
+ Ogre::Root::getSingleton ().uninstallPlugin (CaelumPlugin::getSingletonPtr ());
+ delete CaelumPlugin::getSingletonPtr ();
+ assert (CaelumPlugin::getSingletonPtr () == 0);
+ }
+
+#if CAELUM_SCRIPT_SUPPORT
+ CaelumPlugin::CaelumPlugin(): mScriptTranslatorManager(&mTypeDescriptorData)
+#else
+ CaelumPlugin::CaelumPlugin()
+#endif
+ {
+ mIsInstalled = false;
+ }
+
+ CaelumPlugin::~CaelumPlugin() {
+ }
+
+ const Ogre::String CaelumPlugin::CAELUM_PLUGIN_NAME = "Caelum";
+
+ const Ogre::String& CaelumPlugin::getName () const {
+ return CAELUM_PLUGIN_NAME;
+ }
+
+ void CaelumPlugin::install ()
+ {
+ assert(!mIsInstalled && "Already installed");
+
+ Ogre::LogManager::getSingleton ().logMessage("Caelum plugin version " +
+ Ogre::StringConverter::toString (CAELUM_VERSION_MAIN) + "." +
+ Ogre::StringConverter::toString (CAELUM_VERSION_SEC) + "." +
+ Ogre::StringConverter::toString (CAELUM_VERSION_TER) + " "
+ "installed");
+
+#if CAELUM_SCRIPT_SUPPORT
+ Ogre::ScriptCompilerManager::getSingleton ().addTranslatorManager (
+ getScriptTranslatorManager ());
+ Ogre::ResourceGroupManager::getSingleton()._registerResourceManager (
+ getPropScriptResourceManager ()->getResourceType (),
+ getPropScriptResourceManager ());
+
+ getScriptTranslatorManager()->_setPropScriptResourceManager (
+ &mPropScriptResourceManager);
+#endif // CAELUM_SCRIPT_SUPPORT
+
+ mIsInstalled = true;
+ }
+
+ void CaelumPlugin::initialise () {
+ }
+
+ void CaelumPlugin::shutdown () {
+ }
+
+ void CaelumPlugin::uninstall ()
+ {
+ assert(mIsInstalled && "Not installed");
+
+#if CAELUM_SCRIPT_SUPPORT
+ getScriptTranslatorManager()->_setPropScriptResourceManager (0);
+
+ Ogre::ResourceGroupManager::getSingleton ()._unregisterResourceManager (
+ getPropScriptResourceManager ()->getResourceType ());
+ Ogre::ScriptCompilerManager::getSingleton ().removeTranslatorManager (
+ getScriptTranslatorManager ());
+#endif // CAELUM_SCRIPT_SUPPORT
+
+ Ogre::LogManager::getSingleton ().logMessage("Caelum plugin uninstalled");
+
+ mIsInstalled = false;
+ }
+
+#if CAELUM_SCRIPT_SUPPORT
+ void CaelumPlugin::loadCaelumSystemFromScript (
+ CaelumSystem* sys,
+ const Ogre::String& objectName,
+ const Ogre::String& groupName)
+ {
+ assert (sys);
+ assert (this->isInstalled () && "Must install CaelumPlugin before loading scripts");
+
+ // Fetch raw resource ptr. Attempt to support explicit resource groups currently in Ogre trunk.
+#if OGRE_VERSION >= 0x00010700
+ Ogre::ResourcePtr res = getPropScriptResourceManager ()->getByName (objectName, groupName);
+#else
+ Ogre::ResourcePtr res = getPropScriptResourceManager ()->getByName (objectName);
+#endif
+
+ // Check a PropScriptResource was found.
+ PropScriptResource* propRes = static_cast<PropScriptResource*> (res.get ());
+ if (!propRes) {
+ OGRE_EXCEPT (Ogre::Exception::ERR_ITEM_NOT_FOUND,
+ "Could not find caelum_sky_system " + objectName,
+ "CaelumPlugin::loadCaelumSystemFromScript");
+ }
+
+ // Fetch the resource stream. Look in the actual group of the resource!
+ const Ogre::String& scriptFileName = propRes->getOrigin();
+ const Ogre::String& scriptFileGroup = propRes->getGroup();
+ Ogre::DataStreamPtr streamPtr = Ogre::ResourceGroupManager::getSingleton ().openResource (
+ scriptFileName, scriptFileGroup, false);
+
+ // Feed it into the compiler.
+ this->getScriptTranslatorManager()->getCaelumSystemTranslator()->setTranslationTarget (sys, objectName);
+ Ogre::ScriptCompilerManager::getSingleton ().parseScript (streamPtr, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
+ bool found = this->getScriptTranslatorManager()->getCaelumSystemTranslator()->foundTranslationTarget ();
+
+ // This shouldn't normally happen.
+ if (!found) {
+ OGRE_EXCEPT (Ogre::Exception::ERR_ITEM_NOT_FOUND,
+ "Could not find caelum_sky_system " + objectName + " in file " + scriptFileName + " on reparsing. "
+ "Perhaps information in PropScriptResourceManager is out of date?",
+ "CaelumPlugin::loadCaelumSystemFromScript");
+ }
+ this->getScriptTranslatorManager()->getCaelumSystemTranslator()->clearTranslationTarget ();
+ }
+#endif // CAELUM_SCRIPT_SUPPORT
+}
Added: trunk/python-ogre/ThirdParty/caelum/CaelumPlugin.h
===================================================================
--- trunk/python-ogre/ThirdParty/caelum/CaelumPlugin.h (rev 0)
+++ trunk/python-ogre/ThirdParty/caelum/CaelumPlugin.h 2009-01-25 03:51:12 UTC (rev 845)
@@ -0,0 +1,97 @@
+/*
+This file is part of Caelum.
+See http://www.ogre3d.org/wiki/index.php/Caelum
+
+Copyright (c) 2008 Caelum team. See Contributors.txt for details.
+
+Caelum is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published
+by the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+Caelum is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with Caelum. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef CAELUM__CAELUM_PLUGIN_H
+#define CAELUM__CAELUM_PLUGIN_H
+
+#include "CaelumPrerequisites.h"
+#include "CaelumScriptTranslator.h"
+#include "TypeDescriptor.h"
+#include "OgrePlugin.h"
+
+namespace Caelum
+{
+ /** Implement an Ogre::Plugin for Caelum.
+ *
+ * Ogre plugins are usually loaded from config files and they register
+ * various stuff in ogre managers. But you can also just link to the
+ * library normally and call install functions manually.
+ */
+ class CAELUM_EXPORT CaelumPlugin: public Ogre::Singleton<CaelumPlugin>, public Ogre::Plugin
+ {
+ public:
+ /// Get reference to singleton instance; or crash if N/A.
+ static CaelumPlugin& getSingleton(void);
+ /// Get pointer to singleton instance; or pointer if N/A.
+ static CaelumPlugin* getSingletonPtr(void);
+
+ CaelumPlugin();
+ ~CaelumPlugin();
+
+ virtual void install ();
+ virtual void initialise ();
+ virtual void shutdown ();
+ virtual void uninstall ();
+
+ static const Ogre::String CAELUM_PLUGIN_NAME;
+ virtual const String& getName () const;
+
+ // Determine if the plugin was installed (if install was called).
+ inline bool isInstalled () const { return mIsInstalled; }
+
+ private:
+ bool mIsInstalled;
+
+#if CAELUM_TYPE_DESCRIPTORS
+ public:
+ /// Get default type descriptor data for caelum components.
+ CaelumDefaultTypeDescriptorData* getTypeDescriptorData () { return &mTypeDescriptorData; }
+
+ private:
+ CaelumDefaultTypeDescriptorData mTypeDescriptorData;
+#endif
+
+#if CAELUM_SCRIPT_SUPPORT
+ public:
+ /** Load CaelumSystem and it's components from a script file.
+ * @param sys Target CaelumSystem.
+ * This is cleared using CaelumSystem::clear before loading.
+ * If scripting data is not found then this is not modified.
+ * @param objectName Name of caelum_sky_system from *.os file.
+ * @param scriptFileGroup The group to search in (unused in Ogre 1.6)
+ */
+ void loadCaelumSystemFromScript (
+ CaelumSystem* sys,
+ const Ogre::String& objectName,
+ const Ogre::String& scriptFileGroup = Ogre::ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME
+ );
+
+ /// @see PropScriptResourceManager
+ PropScriptResourceManager* getPropScriptResourceManager () { return &mPropScriptResourceManager; }
+ CaelumScriptTranslatorManager* getScriptTranslatorManager () { return &mScriptTranslatorManager; }
+
+ private:
+ PropScriptResourceManager mPropScriptResourceManager;
+ CaelumScriptTranslatorManager mScriptTranslatorManager;
+#endif
+ };
+}
+
+#endif // CAELUM__CAELUM_PLUGIN_H
Modified: trunk/python-ogre/ThirdParty/caelum/CaelumPrerequisites.h
===================================================================
--- trunk/python-ogre/ThirdParty/caelum/CaelumPrerequisites.h 2009-01-24 05:00:41 UTC (rev 844)
+++ trunk/python-ogre/ThirdParty/caelum/CaelumPrerequisites.h 2009-01-25 03:51:12 UTC (rev 845)
@@ -31,21 +31,21 @@
#include <memory>
// Define the dll export qualifier if compiling for Windows
-// #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
-// #ifdef CAELUM_LIB
-// #define CAELUM_EXPORT __declspec (dllexport)
-// #else
-// #ifdef __MINGW32__
-// #define CAELUM_EXPORT
-// #else
-// #define CAELUM_EXPORT __declspec (dllimport)
-// #endif
-// #endif
-// #elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE
-// #define CAELUM_EXPORT __attribute__ ((visibility("default")))
-// #else
+/*#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
+ #ifdef CAELUM_LIB
+ #define CAELUM_EXPORT __declspec (dllexport)
+ #else
+ #ifdef __MINGW32__
+ #define CAELUM_EXPORT
+ #else
+ #define CAELUM_EXPORT __declspec (dllimport)
+ #endif
+ #endif
+#elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+ #define CAELUM_EXPORT __attribute__ ((visibility("default")))
+#else */
#define CAELUM_EXPORT
-// #endif
+//#endif
// Define the version code
#define CAELUM_VERSION_MAIN 0
@@ -53,6 +53,35 @@
#define CAELUM_VERSION_TER 0
#define CAELUM_VERSION = (CAELUM_VERSION_MAIN << 16) | (CAELUM_VERSION_SEC << 8) | CAELUM_VERSION_TER
+// By default only compile type descriptors for scripting.
+#ifndef CAELUM_TYPE_DESCRIPTORS
+ #if (OGRE_VERSION >= 0x00010600) && OGRE_USE_NEW_COMPILERS
+ #define CAELUM_TYPE_DESCRIPTORS 1
+ #else
+ #define CAELUM_TYPE_DESCRIPTORS 0
+ #endif
+#endif
+
+// Scripting support requires Ogre 1.6
+// Can be also configured on compiler command line
+#ifndef CAELUM_SCRIPT_SUPPORT
+ #if (OGRE_VERSION >= 0x00010600) && OGRE_USE_NEW_COMPILERS
+ #define CAELUM_SCRIPT_SUPPORT 1
+ #else
+ #define CAELUM_SCRIPT_SUPPORT 0
+ #endif
+#else
+ #if !(OGRE_VERSION > 0x00010600)
+ #error "Caelum script support requires Ogre 1.6."
+ #endif
+ #if !(OGRE_USE_NEW_COMPILERS)
+ #error "Caelum script support requires Ogre 1.6 with OGRE_USE_NEW_COMPILERS."
+ #endif
+ #if !(CAELUM_TYPE_DESCRIPTORS)
+ #error "Caelum script support also requires type descriptors."
+ #endif
+#endif
+
/// @file
/** @mainpage
@@ -62,8 +91,11 @@
* Caelum::CaelumSystem class which ties them all together in an easy-to-use
* way.
*
- * For more information see the great %Caelum thread in the ogre forum:
- * http://www.ogre3d.org/phpBB2/viewtopic.php?t=24961&postorder=desc
+ * More information is available on the wiki page:
+ * http://www.ogre3d.org/wiki/index.php/Caelum
+ *
+ * You can discuss and report issues in the forum:
+ * http://www.ogre3d.org/addonforums/viewforum.php?f=21
*/
/** Caelum namespace
@@ -114,6 +146,7 @@
class ImageStarfield;
class PointStarfield;
class CloudSystem;
+ class CaelumSystem;
class FlatCloudLayer;
class PrecipitationController;
class PrecipitationInstance;
@@ -123,4 +156,17 @@
class DepthRenderer;
}
+namespace Ogre {
+ // Write an Ogre::Degree to a stream.
+ //
+ // Ogre::Any requires that the wrapped type can be written to a stream;
+ // otherwise it will fail on instantation. This function was placed here
+ // so it's available everywhere.
+ //
+ // This can't be placed in namespace Caelum.
+ inline std::ostream& operator << (std::ostream& out, Ogre::Degree deg) {
+ return out << deg.valueDegrees();
+ }
+}
+
#endif // CAELUM__CAELUM_PREREQUISITES_H
Added: trunk/python-ogre/ThirdParty/caelum/CaelumScriptTranslator.cpp
===================================================================
--- trunk/python-ogre/ThirdParty/caelum/CaelumScriptTranslator.cpp (rev 0)
+++ trunk/python-ogre/ThirdParty/caelum/CaelumScriptTranslator.cpp 2009-01-25 03:51:12 UTC (rev 845)
@@ -0,0 +1,635 @@
+/*
+This file is part of Caelum.
+See http://www.ogre3d.org/wiki/index.php/Caelum
+
+Copyright (c) 2006-2008 Caelum team. See Contributors.txt for details.
+
+Caelum is free software: you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published
+by the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+Caelum is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with Caelum. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "CaelumPrecompiled.h"
+#include "CaelumPrerequisites.h"
+
+#if CAELUM_SCRIPT_SUPPORT
+
+#include "CaelumScriptTranslator.h"
+#include "CaelumSystem.h"
+#include "CaelumExceptions.h"
+
+using namespace Ogre;
+
+namespace Caelum
+{
+ PropScriptResource::PropScriptResource
+ (
+ Ogre::ResourceManager* creator, const Ogre::String& name, Ogre::ResourceHandle handle,
+ const Ogre::String& group, bool isManual, Ogre::ManualResourceLoader* loader
+ ):
+ Ogre::Resource (creator, name, handle, group, isManual, loader)
+ {
+ //Ogre::LogManager::getSingleton().logMessage(
+ // "PropScriptResource::PropScriptResource");
+ }
+
+ PropScriptResource::~PropScriptResource() {
+ //Ogre::LogManager::getSingleton().logMessage(
+ // "PropScriptResource::~PropScriptResource");
+ }
+
+ PropScriptResourceManager::PropScriptResourceManager() {
+ mLoadOrder = 1000;
+ mResourceType = "PropertyScript";
+ }
+
+ PropScriptResource* PropScriptResourceManager::createImpl(
+ const String& name, ResourceHandle handle, const String& group,
+ bool isManual, ManualResourceLoader* loader, const NameValuePairList* createParams)
+ {
+ //Ogre::LogManager::getSingleton().logMessage(
+ // "PropScriptResourceManager::createImpl");
+ return new PropScriptResource (this, name, handle, group, isManual, loader);
+ }
+
+ TypeDescriptorScriptTranslator::TypeDescriptorScriptTranslator (TypeDescriptor* typeDescriptor):
+ mTypeDescriptor(typeDescriptor)
+ {
+ }
+
+ bool TypeDescriptorScriptTranslator::getPropValueOrAddError (
+ ScriptCompiler* compiler,
+ PropertyAbstractNode* prop,
+ bool& value)
+ {
+ if (prop->values.empty ()) {
+ compiler->addError (ScriptCompiler::CE_STRINGEXPECTED, prop->file, prop->line);
+ return false;
+ }
+ if (prop->values.size () > 1) {
+ compiler->addError (ScriptCompiler::CE_FEWERPARAMETERSEXPECTED, prop->file, prop->line,
+ prop->name + " must have at most 1 argument");
+ return false;
+ }
+ if (!Ogre::ScriptTranslator::getBoolean(prop->values.front(), &value)) {
+ compiler->addError (ScriptCompiler::CE_INVALIDPARAMETERS, prop->file, prop->line,
+ prop->values.front()->getValue() + " is not a valid number");
+ return false;
+ }
+ return true;
+ }
+
+ bool TypeDescriptorScriptTranslator::getPropValueOrAddError (
+ ScriptCompiler* compiler,
+ PropertyAbstractNode* prop,
+ ColourValue& value)
+ {
+ if (prop->values.empty ()) {
+ compiler->addError (ScriptCompiler::CE_STRINGEXPECTED, prop->file, prop->line);
+ return false;
+ }
+ if (prop->values.size () > 4) {
+ compiler->addError (ScriptCompiler::CE_FEWERPARAMETERSEXPECTED, prop->file, prop->line,
+ prop->name + " must have at most 4 arguments");
+ return false;
+ }
+ if (prop->values.size () < 3) {
+ compiler->addError (ScriptCompiler::CE_FEWERPARAMETERSEXPECTED, prop->file, prop->line,
+ prop->name + " must have at least 3 arguments");
+ }
+ if (!getColour(prop->values.begin(), prop->values.end(), &value)) {
+ compiler->addError (ScriptCompiler::CE_INVALIDPARAMETERS, prop->file, prop->line,
+ prop->name + " requires a colour argument");
+ }
+ return true;
+ }
+
+ bool TypeDescriptorScriptTranslator::getPropValueOrAddError (
+ ScriptCompiler* compiler,
+ PropertyAbstractNode* prop,
+ float& value)
+ {
+ if (prop->values.empty ()) {
+ compiler->addError (ScriptCompiler::CE_STRINGEXPECTED, prop->file, prop->line);
+ return false;
+ }
+ if (prop->values.size () > 1) {
+ compiler->addError (ScriptCompiler::CE_FEWERPARAMETERSEXPECTED, prop->file, prop->line,
+ prop->name + " must have at most 1 argument");
+ return false;
+ }
+ if (!Ogre::ScriptTranslator::getFloat(prop->values.front(), &value)) {
+ compiler->addError (ScriptCompiler::CE_INVALIDPARAMETERS, prop->file, prop->line,
+ prop->values.front()->getValue() + " is not a valid number");
+ return false;
+ }
+ return true;
+ }
+
+ bool TypeDescriptorScriptTranslator::getPropValueOrAddError (
+ ScriptCompiler* compiler,
+ PropertyAbstractNode* prop,
+ int& value)
+ {
+ if (prop->values.empty ()) {
+ compiler->addError (ScriptCompiler::CE_STRINGEXPECTED, prop->file, prop->line);
+ return false;
+ }
+ if (prop->values.size () > 1) {
+ compiler->addError (ScriptCompiler::CE_FEWERPARAMETERSEXPECTED, prop->file, prop->line,
+ prop->name + " must have at most 1 argument");
+ return false;
+ }
+ if (!Ogre::ScriptTranslator::getInt(prop->values.front(), &value)) {
+ compiler->addError (ScriptCompiler::CE_INVALIDPARAMETERS, prop->file, prop->line,
+ prop->values.front()->getValue() + " is not a valid integer");
+ return false;
+ }
+ return true;
+ }
+
+ bool TypeDescriptorScriptTranslator::getPropValueOrAddError (
+ ScriptCompiler* compiler,
+ PropertyAbstractNode* prop,
+ double& value)
+ {
+ if (prop->values.empty ()) {
+ compiler->addError (ScriptCompiler::CE_STRINGEXPECTED, prop->file, prop->line);
+ return false;
+ }
+ if (prop->values.size () > 1) {
+ compiler->addError (ScriptCompiler::CE_FEWERPARAMETERSEXPECTED, prop->file, prop->line,
+ prop->name + " must have at most 1 argument");
+ return false;
+ }
+ // We do need a string stream here for the extra precision.
+ std::stringstream strStream (std::string(prop->values.front()->getValue()));
+ strStream >> value;
+ if (strStream.fail()) {
+ compiler->addError (ScriptCompiler::CE_INVALIDPARAMETERS, prop->file, prop->line,
+ prop->values.front()->getValue() + " is not a valid number");
+ return false;
+ }
+ return true;
+ }
+
+ bool TypeDescriptorScriptTranslator::getPropValueOrAddError (
+ ScriptCompiler* compiler,
+ PropertyAbstractNode* prop,
+ Ogre::Degree& value)
+ {
+ if (prop->values.size () == 0) {
+ compiler->addError (ScriptCompiler::CE_STRINGEXPECTED, prop->file, prop->line);
+ return false;
+ }
+ if (prop->values.size () > 3) {
+ compiler->addError (ScriptCompiler::CE_FEWERPARAMETERSEXPECTED, prop->file, prop->line,
+ prop->name + " must have at most 3 arguments");
+ return false;
+ }
+ // Allow 3 components.
+ float degMinSec[3] = { 0, 0, 0 };
+ int k = 0;
+ for (AbstractNodeList::const_iterator it = prop->values.begin(), endIt = prop->values.end(); it != endIt; ++it, ++k) {
+ if (!Ogre::ScriptTranslator::getFloat(*it, °MinSec[k])) {
+ compiler->addError (ScriptCompiler::CE_INVALIDPARAMETERS, prop->file, prop->line,
+ (*it)->getValue () + " is not a valid number");
+ return false;
+ }
+ }
+ value = Ogre::Degree(degMinSec[0] + degMinSec[1] / 60.0 + degMinSec[2] / 3600);
+ return true;
+ }
+
+ bool TypeDescriptorScriptTranslator::getPropValueOrAddError (
+ ScriptCompiler* compiler,
+ PropertyAbstractNode* prop,
+ Ogre::String& value)
+ {
+ if (prop->values.size () == 0) {
+ compiler->addError (ScriptCompiler::CE_STRINGEXPECTED, prop->file, prop->line);
+ return false;
+ }
+ if (prop->values.size () > 1) {
+ compiler->addError (ScriptCompiler::CE_FEWERPARAMETERSEXPECTED, prop->file, prop->line,
+ prop->name + " must have at most 1 arguments");
+ return false;
+ }
+ if (!Ogre::ScriptTranslator::getString(prop->values.front(), &value)) {
+ compiler->addError (ScriptCompiler::CE_INVALIDPARAMETERS, prop->file, prop->line,
+ prop->values.front()->getValue() + " is not a valid string");
+ return false;
+ }
+ return true;
+ }
+
+ bool TypeDescriptorScriptTranslator::getPropValueOrAddError (
+ ScriptCompiler* compiler,
+ PropertyAbstractNode* prop,
+ Ogre::Vector3& value)
+ {
+ if (prop->values.size () == 0) {
+ compiler->addError (ScriptCompiler::CE_STRINGEXPECTED, prop->file, prop->line);
+ return false;
+ }
+ if (prop->values.size () > 3) {
+ compiler->addError (ScriptCompiler::CE_FEWERPARAMETERSEXPECTED, prop->file, prop->line,
+ prop->name + " must have at most 3 arguments");
+ return false;
+ }
+ float floats[3];
+ if (!Ogre::ScriptTranslator::getFloats(prop->values.begin(), prop->values.end(), floats, 3)) {
+ compiler->addError (ScriptCompiler::CE_INVALIDPARAMETERS, prop->file, prop->line,
+ "incorrect vector parameters.");
+ return false;
+ }
+ value.x = floats[0];
+ value.y = floats[1];
+ value.z = floats[2];
+ return true;
+ }
+
+ bool TypeDescriptorScriptTranslator::getPropValueOrAddError (
+ ScriptCompiler* compiler,
+ PropertyAbstractNode* prop,
+ Ogre::Vector2& value)
+ {
+ if (prop->values.size () == 0) {
+ compiler->addError (ScriptCompiler::CE_STRINGEXPECTED, prop->file, prop->line);
+ return false;
+ }
+ if (prop->values.size () > 2) {
+ compiler->addError (ScriptCompiler::CE_FEWERPARAMETERSEXPECTED, prop->file, prop->line,
+ prop->name + " must have at most 3 arguments");
+ return false;
+ }
+ float floats[2];
+ if (!Ogre::ScriptTranslator::getFloats(prop->values.begin(), prop->values.end(), floats, 2)) {
+ compiler->addError (ScriptCompiler::CE_INVALIDPARAMETERS, prop->file, prop->line,
+ "incorrect vector parameters.");
+ return false;
+ }
+ value.x = floats[0];
+ value.y = floats[1];
+ return true;
+ }
+
+ template<class T>
+ static bool tryHandlePropertyType (
+ ScriptCompiler* compiler, PropertyAbstractNode* propNode,
+ void* targetObject, const ValuePropertyDescriptor* propDesc)
+ {
+ if (propDesc->getValueTypeId () == typeid(T)) {
+ T val;
+ if (TypeDescriptorScriptTranslator::getPropValueOrAddError (compiler, propNode, val)) {
+ propDesc->setValue (targetObject, Ogre::Any(val));
+ }
+ return true;
+ }
+ return false;
+ }
+
+ void TypeDescriptorScriptTranslator::translateProperty (
+ ScriptCompiler* compiler,
+ PropertyAbstractNode* prop,
+ void* targetObject,
+ const TypeDescriptor* typeDescriptor)
+ {
+ const ValuePropertyDescriptor* propDesc = typeDescriptor->getPropertyDescriptor (prop->name);
+ if (!propDesc) {
+ compiler->addError (ScriptCompiler::CE_UNEXPECTEDTOKEN, prop->file, prop->line,
+ "property \"" + prop->name + "\" not recognized; missing from type descriptor.");
+ return;
+ }
+ if (!propDesc->canSetValue ()) {
+ compiler->addError (ScriptCompiler::CE_UNEXPECTEDTOKEN, prop->file, prop->line,
+ "property \"" + prop->name + "\" is read-only and can't be set from a script.");
+ return;
+ }
+
+ //LogManager::getSingleton ().logMessage ("TypeDescriptorScriptTranslator::translateProperty"
+ // " name '" + prop->name + "'");
+
+ bool handled = false
+ || tryHandlePropertyType<int> (compiler, prop, targetObject, propDesc)
+ || tryHandlePropertyType<float> (compiler, prop, targetObject, propDesc)
+ || tryHandlePropertyType<double> (compiler, prop, targetObject, propDesc)
+ || tryHandlePropertyType<bool> (compiler, prop, targetObject, propDesc)
+ || tryHandlePropertyType<Ogre::Degree> (compiler, prop, targetObject, propDesc)
+ || tryHandlePropertyType<Ogre::String> (compiler, prop, targetObject, propDesc)
+ || tryHandlePropertyType<Ogre::Vector3> (compiler, prop, targetObject, propDesc)
+ || tryHandlePropertyType<Ogre::Vector2> (compiler, prop, targetObject, propDesc)
+ || tryHandlePropertyType<Ogre::ColourValue> (compiler, prop, targetObject, propDesc);
+
+ if (!handled) {
+ compiler->addError (ScriptCompiler::CE_UNEXPECTEDTOKEN, prop->file, prop->line,
+ "property \"" + prop->name + "\" is found in type descriptor but has "
+ "unsupported type. Mangled typeid is '" + propDesc->getValueTypeId().name() + "'");
+ }
+ }
+
+ void TypeDescriptorScriptTranslator::translate (ScriptCompiler* compiler, const AbstractNodePtr& node)
+ {
+ //LogManager::getSingleton ().logMessage ("TypeDescriptorScriptTranslator::translate begin");
+
+ // Check type descriptor was set.
+ assert (getTypeDescriptor () && "Type descriptor must be set before we can translate.");
+
+ // Fetch target object.
+ ObjectAbstractNode *objNode = reinterpret_cast<ObjectAbstractNode*>(node.get());
+ assert (!objNode->context.isEmpty ());
+ void* targetObject = any_cast<void*> (objNode->context);
+ assert (targetObject);
+
+ for (AbstractNodeList::iterator i = objNode->children.begin(); i != objNode->children.end(); ++i)
+ {
+ if ((*i)->type == ANT_PROPERTY)
+ {
+ PropertyAbstractNode *prop = reinterpret_cast<PropertyAbstractNode*>((*i).get());
+
+ translateProperty (compiler, prop, targetObject, getTypeDescriptor());
+ }
+ else if((*i)->type == ANT_OBJECT)
+ {
+ compiler->addError (ScriptCompiler::CE_INVALIDPARAMETERS, (*i)->file, (*i)->line);
+ }
+ }
+
+ //LogManager::getSingleton ().logMessage ("TypeDescriptorScriptTranslator::translate end");
+ }
+
+ CaelumSystemScriptTranslator::CaelumSystemScriptTranslator ():
+ mResourceManager(false),
+ mTranslationTarget(0),
+ mTranslationTargetFound(false),
+ mTypeDescriptor(0)
+ {
+ }
+
+ void CaelumSystemScriptTranslator::setTranslationTarget (CaelumSystem* target, const Ogre::String& name)
+ {
+ assert (target != 0);
+ this->mTranslationTarget = target;
+ this->mTranslationTargetName = name;
+ this->mTranslationTargetFound = false;
+ }
+
+ void CaelumSystemScriptTranslator::clearTranslationTarget () {
+ this->mTranslationTarget = 0;
+ this->mTranslationTargetName.clear();
+ this->mTranslationTargetFound = false;
+ }
+
+ void CaelumSystemScriptTranslator::translate (ScriptCompiler* compiler, const AbstractNodePtr& node)
+ {
+ //LogManager::getSingleton ().logMessage ("CaelumSystemScriptTranslator::translate begin");
+
+ ObjectAbstractNode *objNode = reinterpret_cast<ObjectAbstractNode*>(node.get());
+
+ CaelumSystem* sys = 0;
+
+ // Check for a translation target.
+ if (this->getTran...
[truncated message content] |