Revision: 568
http://python-ogre.svn.sourceforge.net/python-ogre/?rev=568&view=rev
Author: andy_miller
Date: 2008-02-15 17:38:02 -0800 (Fri, 15 Feb 2008)
Log Message:
-----------
Thirdparty Updates
Added Paths:
-----------
trunk/python-ogre/ThirdParty/caelum/Astronomy.cpp
trunk/python-ogre/ThirdParty/caelum/Astronomy.h
trunk/python-ogre/ThirdParty/caelum/CaelumPrerequisites.h.bak
trunk/python-ogre/ThirdParty/caelum/SolarSystemModel.cpp
trunk/python-ogre/ThirdParty/caelum/SolarSystemModel.h
trunk/python-ogre/ThirdParty/nxogre/BetajaenCC.cpp
trunk/python-ogre/ThirdParty/nxogre/BetajaenCC.h
trunk/python-ogre/ThirdParty/nxogre/NxOgreActors.h
trunk/python-ogre/ThirdParty/nxogre/NxOgreAllocator.cpp
trunk/python-ogre/ThirdParty/nxogre/NxOgreAllocator.h
trunk/python-ogre/ThirdParty/nxogre/NxOgreConfig.h
trunk/python-ogre/ThirdParty/nxogre/NxOgreContactCallback.cpp
trunk/python-ogre/ThirdParty/nxogre/NxOgreContactCallback.h
trunk/python-ogre/ThirdParty/nxogre/NxOgreContactCallbackController.cpp
trunk/python-ogre/ThirdParty/nxogre/NxOgreContactCallbackController.h
trunk/python-ogre/ThirdParty/nxogre/NxOgreDualIdentifier.cpp
trunk/python-ogre/ThirdParty/nxogre/NxOgreDualIdentifier.h
trunk/python-ogre/ThirdParty/nxogre/NxOgreDynamicMesh.cpp
trunk/python-ogre/ThirdParty/nxogre/NxOgreDynamicMesh.h
trunk/python-ogre/ThirdParty/nxogre/NxOgreEffectsSystem.cpp
trunk/python-ogre/ThirdParty/nxogre/NxOgreEffectsSystem.h
trunk/python-ogre/ThirdParty/nxogre/NxOgreFileResourceStream.cpp
trunk/python-ogre/ThirdParty/nxogre/NxOgreFileResourceStream.h
trunk/python-ogre/ThirdParty/nxogre/NxOgreInflatable.h
trunk/python-ogre/ThirdParty/nxogre/NxOgreJointCallback.h
trunk/python-ogre/ThirdParty/nxogre/NxOgreMeshRenderable.cpp
trunk/python-ogre/ThirdParty/nxogre/NxOgreMeshRenderable.h
trunk/python-ogre/ThirdParty/nxogre/NxOgreNXM.cpp
trunk/python-ogre/ThirdParty/nxogre/NxOgreNXM.h
trunk/python-ogre/ThirdParty/nxogre/NxOgreOBJStream.cpp
trunk/python-ogre/ThirdParty/nxogre/NxOgreOBJStream.h
trunk/python-ogre/ThirdParty/nxogre/NxOgreOgreMesh.cpp
trunk/python-ogre/ThirdParty/nxogre/NxOgreOgreMesh.h
trunk/python-ogre/ThirdParty/nxogre/NxOgreOgreMeshRenderable.cpp
trunk/python-ogre/ThirdParty/nxogre/NxOgreOgreMeshRenderable.h
trunk/python-ogre/ThirdParty/nxogre/NxOgreOgreResourceStream.cpp
trunk/python-ogre/ThirdParty/nxogre/NxOgreOgreResourceStream.h
trunk/python-ogre/ThirdParty/nxogre/NxOgreOgreTimeController.cpp
trunk/python-ogre/ThirdParty/nxogre/NxOgreOgreTimeController.h
trunk/python-ogre/ThirdParty/nxogre/NxOgrePlatform.h
trunk/python-ogre/ThirdParty/nxogre/NxOgreResourceManager_Cloth.cpp
trunk/python-ogre/ThirdParty/nxogre/NxOgreSheet.cpp
trunk/python-ogre/ThirdParty/nxogre/NxOgreSheet.h
trunk/python-ogre/ThirdParty/nxogre/NxOgreSimpleActor.cpp
trunk/python-ogre/ThirdParty/nxogre/NxOgreSimpleActor.h
trunk/python-ogre/ThirdParty/nxogre/NxOgreSleepCallback.cpp
trunk/python-ogre/ThirdParty/nxogre/NxOgreSleepCallback.h
trunk/python-ogre/ThirdParty/nxogre/NxOgreThrow.cpp
trunk/python-ogre/ThirdParty/nxogre/NxOgreTimeController.cpp
trunk/python-ogre/ThirdParty/nxogre/NxOgreTimeController.h
trunk/python-ogre/ThirdParty/nxogre/NxOgreTransitionalMesh.cpp
trunk/python-ogre/ThirdParty/nxogre/NxOgreTransitionalMesh.h
trunk/python-ogre/ThirdParty/nxogre/NxOgreTriggerCallback.cpp
trunk/python-ogre/ThirdParty/nxogre/NxOgreTriggerCallback.h
trunk/python-ogre/ThirdParty/quickgui/QuickGUIExportDLL.h.bak
trunk/python-ogre/ThirdParty/quickgui/QuickGUIForwardDeclarations.h
trunk/python-ogre/ThirdParty/quickgui/QuickGUIRadioButton.cpp
trunk/python-ogre/ThirdParty/quickgui/QuickGUIRadioButton.h
trunk/python-ogre/ThirdParty/quickgui/QuickGUIRadioButtonGroup.cpp
trunk/python-ogre/ThirdParty/quickgui/QuickGUIRadioButtonGroup.h
trunk/python-ogre/ThirdParty/quickgui/QuickGUITypedef.h
trunk/python-ogre/ThirdParty/quickgui/QuickGUIVector4.cpp
trunk/python-ogre/ThirdParty/quickgui/QuickGUIVector4.h
Added: trunk/python-ogre/ThirdParty/caelum/Astronomy.cpp
===================================================================
--- trunk/python-ogre/ThirdParty/caelum/Astronomy.cpp (rev 0)
+++ trunk/python-ogre/ThirdParty/caelum/Astronomy.cpp 2008-02-16 01:38:02 UTC (rev 568)
@@ -0,0 +1,240 @@
+/*
+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 "Astronomy.h"
+
+using Ogre::Degree;
+using Ogre::Radian;
+using Ogre::Math;
+
+namespace caelum
+{
+ const Ogre::Degree Astronomy::normalizeAngle (Ogre::Degree value)
+ {
+ value = fmod (value.valueDegrees (), 360);
+ if (value < Degree (0)) {
+ value += Degree (360);
+ }
+ return value;
+ }
+
+ void Astronomy::convertRectangularToSpherical (
+ LongReal x, LongReal y, LongReal z,
+ Degree &rasc, Degree &decl, LongReal &dist)
+ {
+ dist = Math::Sqrt (x * x + y * y + z * z);
+ rasc = Math::ATan2 (y, x);
+ decl = Math::ATan2 (z, Math::Sqrt (x * x + y * y));
+ }
+
+ void Astronomy::convertSphericalToRectangular (
+ Degree rasc, Degree decl, LongReal dist,
+ LongReal &x, LongReal &y, LongReal &z)
+ {
+ x = dist * Math::Cos (rasc) * Math::Cos (decl);
+ y = dist * Math::Sin (rasc) * Math::Cos (decl);
+ z = dist * Math::Sin (decl);
+ }
+
+ void Astronomy::convertEquatorialToHorizontal (
+ LongReal jday,
+ Degree longitude, Degree latitude,
+ Degree rasc, Degree decl,
+ Degree &azimuth, Degree &altitude)
+ {
+ LongReal d = jday - 2451543.5;
+ Degree w = Degree (282.9404 + 4.70935E-5 * d);
+ Degree M = Degree (356.0470 + 0.9856002585 * d);
+ // Sun's mean longitude
+ Degree L = w + M;
+ // Universal time of day in degrees.
+ Degree UT = Degree(fmod(d, 1) * 360);
+ Degree hourAngle = longitude + L + Degree (180) + UT - rasc;
+
+ LongReal x = Math::Cos (hourAngle) * Math::Cos (decl);
+ LongReal y = Math::Sin (hourAngle) * Math::Cos (decl);
+ LongReal z = Math::Sin (decl);
+
+ LongReal xhor = x * Math::Sin (latitude) - z * Math::Cos (latitude);
+ LongReal yhor = y;
+ LongReal zhor = x * Math::Cos (latitude) + z * Math::Sin (latitude);
+
+ azimuth = Math::ATan2 (yhor, xhor) + Degree (180);
+ altitude = Math::ATan2 (zhor, Math::Sqrt (xhor * xhor + yhor * yhor));
+ }
+
+ void Astronomy::getHorizontalSunPosition (
+ LongReal jday,
+ Ogre::Degree longitude, Ogre::Degree latitude,
+ Ogre::Degree &azimuth, Ogre::Degree &altitude)
+ {
+ // Midnight at the start of 31 december 2000
+ // 2451543.5 == Astronomy::getJulianDayFromGregorianDateTime(1999, 12, 31, 0, 0, 0));
+ LongReal d = jday - 2451543.5;
+
+ // Sun's Orbital elements:
+ // argument of perihelion
+ Degree w = Degree (282.9404 + 4.70935E-5 * d);
+ // eccentricity (0=circle, 0-1=ellipse, 1=parabola)
+ LongReal e = 0.016709 - 1.151E-9 * d;
+ // mean anomaly (0 at perihelion; increases uniformly with time)
+ Degree M = Degree(356.0470 + 0.9856002585 * d);
+ // Obliquity of the ecliptic.
+ Degree oblecl = Degree (23.4393 - 3.563E-7 * d);
+
+ // Eccentric anomaly
+ Degree E = M + Radian(e * Math::Sin (M) * (1 + e * Math::Cos (M)));
+
+ // Sun's Distance(R) and true longitude(L)
+ LongReal xv = Math::Cos (E) - e;
+ LongReal yv = Math::Sin (E) * Math::Sqrt (1 - e * e);
+ LongReal r = Math::Sqrt (xv * xv + yv * yv);
+ Degree lon = Math::ATan2 (yv, xv) + w;
+
+ // Ecliptic rectangular.
+ LongReal xecl = r * Math::Cos(lon);
+ LongReal yecl = r * Math::Sin(lon);
+ LongReal zecl = 0;
+
+ // Equatorial rectangular.
+ LongReal xequ = xecl;
+ LongReal yequ = yecl * Math::Cos (oblecl) - zecl * Math::Sin (oblecl);
+ LongReal zequ = yecl * Math::Sin (oblecl) + zecl * Math::Cos (oblecl);
+
+ // Equatorial spherical.
+ Degree rasc, decl;
+ Astronomy::convertRectangularToSpherical (xequ, yequ, zequ, rasc, decl, r);
+
+ // Horizontal spherical.
+ Astronomy::convertEquatorialToHorizontal (
+ jday, longitude, latitude, rasc, decl, azimuth, altitude);
+ }
+
+ int Astronomy::getJulianDayFromGregorianDate(
+ int year, int month, int day)
+ {
+ // Formulas from http://en.wikipedia.org/wiki/Julian_day
+ // These are all integer divisions, but I'm not sure it works
+ // correctly for negative values.
+ int a = (14 - month) / 12;
+ int y = year + 4800 - a;
+ int m = month + 12 * a - 3;
+ return day + (153 * m + 2) / 5 + 365 * y + y / 4 - y / 100 + y / 400 - 32045;
+ }
+
+ LongReal Astronomy::getJulianDayFromGregorianDateTime(
+ int year, int month, int day,
+ int hour, int minute, LongReal second)
+ {
+ int fpmode = Astronomy::enterHighPrecissionFloatingPointMode ();
+
+ int jdn = getJulianDayFromGregorianDate (year, month, day);
+ // These are NOT integer divisions.
+ LongReal jd = jdn + (hour - 12) / 24.0 + minute / 1440.0 + second / 86400.0;
+
+ Astronomy::restoreFloatingPointMode(fpmode);
+ return jd;
+ }
+
+ LongReal Astronomy::getJulianDayFromGregorianDateTime(
+ int year, int month, int day,
+ LongReal secondsFromMidnight)
+ {
+ int jdn = getJulianDayFromGregorianDate(year, month, day);
+ LongReal jd = jdn + secondsFromMidnight / 86400.0 - 0.5;
+ return jd;
+ }
+
+ void Astronomy::getGregorianDateFromJulianDay(
+ int julianDay, int &year, int &month, int &day)
+ {
+ // From http://en.wikipedia.org/wiki/Julian_day
+ int J = julianDay;
+ int j = J + 32044;
+ int g = j / 146097;
+ int dg = j % 146097;
+ int c = (dg / 36524 + 1) * 3 / 4;
+ int dc = dg - c * 36524;
+ int b = dc / 1461;
+ int db = dc % 1461;
+ int a = (db / 365 + 1) * 3 / 4;
+ int da = db - a * 365;
+ int y = g * 400 + c * 100 + b * 4 + a;
+ int m = (da * 5 + 308) / 153 - 2;
+ int d = da - (m + 4) * 153 / 5 + 122;
+ year = y - 4800 + (m + 2) / 12;
+ month = (m + 2) % 12 + 1;
+ day = d + 1;
+ }
+
+ void Astronomy::getGregorianDateTimeFromJulianDay(
+ LongReal julianDay, int &year, int &month, int &day,
+ int &hour, int &minute, LongReal &second)
+ {
+ // Integer julian days are at noon.
+ // static_cast<int)(floor( is more precise than Ogre::Math::IFloor.
+ // Yes, it does matter.
+ int ijd = static_cast<int>(floor(julianDay + 0.5));
+ getGregorianDateFromJulianDay(ijd, year, month, day);
+
+ LongReal s = (julianDay + 0.5 - ijd) * 86400.0;
+ hour = static_cast<int>(floor(s / 3600));
+ s -= hour * 3600;
+ minute = static_cast<int>(floor(s / 60));
+ s -= minute * 60;
+ second = s;
+ }
+
+ void Astronomy::getGregorianDateFromJulianDay(
+ LongReal julianDay, int &year, int &month, int &day)
+ {
+ int hour;
+ int minute;
+ LongReal second;
+ getGregorianDateTimeFromJulianDay(julianDay, year, month, day, hour, minute, second);
+ }
+
+#if (OGRE_PLATFORM == OGRE_PLATFORM_WIN32) && (OGRE_COMPILER == OGRE_COMPILER_MSVC)
+ int Astronomy::enterHighPrecissionFloatingPointMode ()
+ {
+ int oldMode = ::_controlfp (0, 0);
+ ::_controlfp (_PC_64, _MCW_PC);
+ return oldMode;
+ }
+
+ void Astronomy::restoreFloatingPointMode (int oldMode)
+ {
+ ::_controlfp (oldMode, _MCW_PC);
+ }
+#else
+ void Astronomy::enterHighPrecissionFloatingPointMode ()
+ {
+ // Meaningless
+ return 0xC0FFEE;
+ }
+
+ void Astronomy::restoreFloatingPointMode (int oldMode)
+ {
+ // Useless check.
+ assert(oldMode == 0xC0FFEE);
+ }
+#endif
+}
Added: trunk/python-ogre/ThirdParty/caelum/Astronomy.h
===================================================================
--- trunk/python-ogre/ThirdParty/caelum/Astronomy.h (rev 0)
+++ trunk/python-ogre/ThirdParty/caelum/Astronomy.h 2008-02-16 01:38:02 UTC (rev 568)
@@ -0,0 +1,154 @@
+/*
+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 ASTRONOMY_H
+#define ASTRONOMY_H
+
+#include "CaelumPrerequisites.h"
+
+namespace caelum
+{
+ /** Static class with astronomy routines.
+ * This class contains various astronomical routines useful in Caelum.
+ *
+ * Most of the formulas are from http://stjarnhimlen.se/comp/ppcomp.html
+ * That site contains much more than was implemented here; it has code
+ * for determining the positions of all the planets. Only the sun and
+ * moon are actually useful for caelum.
+ *
+ * The formulas are isolated here in pure procedural code for easier
+ * testing (Tests are done as assert in the demo).
+ *
+ * Precision is vital here, and this class should be converted to use
+ * caelum::LongReal instead of Ogre::Real and Ogre::Degree.
+ */
+ class DllExport Astronomy
+ {
+ private:
+ Astronomy() {}
+
+ public:
+ /** Normalize an angle to the 0, 360 range.
+ * @param x The angle to normalize
+ */
+ static const Ogre::Degree normalizeAngle(Ogre::Degree x);
+
+ static void convertRectangularToSpherical (
+ LongReal x, LongReal y, LongReal z,
+ Ogre::Degree &rasc, Ogre::Degree &decl, LongReal &dist);
+
+ static void convertSphericalToRectangular (
+ Ogre::Degree rasc, Ogre::Degree decl, LongReal dist,
+ LongReal &x, LongReal &y, LongReal &z);
+
+ /** Convert from equatorial to horizontal coordinates.
+ * This function converts from angles relative to the earth's equator
+ * to angle relative to the horizon at a given point.
+ * @param jday Astronomical time as julian day.
+ * @param longitude Observer's longitude in degrees east.
+ * @param latitude Observer's latitude in degrees north.
+ * @param rasc Object's right ascension.
+ * @param decl Object's declination.
+ * @param azimuth Object's azimuth (clockwise degrees from true north).
+ * @param altitude Object's altitude (degrees above the horizon).
+ */
+ static void convertEquatorialToHorizontal (
+ LongReal jday,
+ Ogre::Degree longitude, Ogre::Degree latitude,
+ Ogre::Degree rasc, Ogre::Degree decl,
+ Ogre::Degree &azimuth, Ogre::Degree &altitude);
+
+ /** Get the sun's position in the sky in, relative to the horizon.
+ * @param jday Astronomical time as julian day.
+ * @param longitude Observer longitude
+ * @param latitude Observer latitude
+ * @param azimuth Astronomical azimuth, measured clockwise from North = 0.
+ * @param altitude Astronomical altitude, elevation above the horizon.
+ */
+ static void getHorizontalSunPosition (
+ LongReal jday,
+ Ogre::Degree longitude, Ogre::Degree latitude,
+ Ogre::Degree &azimuth, Ogre::Degree &altitude);
+
+ /** Get astronomical julian day from normal gregorian calendar.
+ * From wikipedia: the integer number of days that have elapsed
+ * since the initial epoch defined as
+ * noon Universal Time (UT) Monday, January 1, 4713 BC
+ * @note this is the time at noon, not midnight.
+ */
+ static int getJulianDayFromGregorianDate(
+ int year, int month, int day);
+
+ /** Get astronomical julian day from normal gregorian calendar.
+ * Calculate julian day from a day in the normal gregorian calendar.
+ * Time should be given as UTC.
+ * @see http://en.wikipedia.org/wiki/Julian_day
+ */
+ static LongReal getJulianDayFromGregorianDateTime(
+ int year, int month, int day,
+ int hour, int minute, LongReal second);
+
+ /** Get astronomical julian day from normal gregorian calendar.
+ * @see above (I don't know the proper doxygen syntax).
+ */
+ static LongReal getJulianDayFromGregorianDateTime(
+ int year, int month, int day,
+ LongReal secondsFromMidnight);
+
+ /// Get gregorian date from integer julian day.
+ static void getGregorianDateFromJulianDay(
+ int julianDay, int &year, int &month, int &day);
+
+ /// Get gregorian date time from floating point julian day.
+ static void getGregorianDateTimeFromJulianDay(
+ LongReal julianDay, int &year, int &month, int &day,
+ int &hour, int &minute, LongReal &second);
+
+ /// Get gregorian date from floating point julian day.
+ static void getGregorianDateFromJulianDay(
+ LongReal julianDay, int &year, int &month, int &day);
+
+ /** Enter high-precission floating-point mode.
+ *
+ * By default Direct3D decreases the precission of ALL floating
+ * point calculations, enough to stop Caelum's astronomy routines
+ * from working correctly.
+ *
+ * To trigger this behaviour in a standard ogre demo select the
+ * Direct3D render system and set "Floating-point mode" to
+ * "Fastest". Otherwise it's not a problem.
+ *
+ * It can be fixed by changing the precission only inside caelum's
+ * astronomy routines using the _controlfp function. This only works
+ * for MSVC on WIN32; This is a no-op on other compilers.
+ *
+ * @note: Must be paired with restoreFloatingPointMode.
+ * @return Value to pass to restoreFloatingModeMode.
+ */
+ static int enterHighPrecissionFloatingPointMode ();
+
+ /** Restore old floating point precission.
+ * @see enterHighPrecissionFloatingPointMode.
+ */
+ static void restoreFloatingPointMode (int oldMode);
+ };
+}
+
+#endif // SOLARSYSTEMMODEL_H
\ No newline at end of file
Added: trunk/python-ogre/ThirdParty/caelum/CaelumPrerequisites.h.bak
===================================================================
--- trunk/python-ogre/ThirdParty/caelum/CaelumPrerequisites.h.bak (rev 0)
+++ trunk/python-ogre/ThirdParty/caelum/CaelumPrerequisites.h.bak 2008-02-16 01:38:02 UTC (rev 568)
@@ -0,0 +1,71 @@
+/*
+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/>.
+*/
+
+#ifndef CAELUMPREREQUISITES_H
+#define CAELUMPREREQUISITES_H
+
+// Include external headers
+#include "Ogre.h"
+
+// 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 DllExport
+#endif
+
+// Define the version code
+#define CAELUM_VERSION_MAIN 0
+#define CAELUM_VERSION_SEC 2
+#define CAELUM_VERSION_TER 1
+#define CAELUM_VERSION = (CAELUM_VERSION_MAIN << 16) | (CAELUM_VERSION_SEC << 8) | CAELUM_VERSION_TER
+
+namespace caelum {
+ /// Resource group name for caelum resources.
+ extern DllExport Ogre::String RESOURCE_GROUP_NAME;
+
+ // Render group for caelum stuff
+ // It's best to have them all together
+ enum CaelumRenderQueueGroupId
+ {
+ CAELUM_RENDER_QUEUE_STARFIELD = Ogre::RENDER_QUEUE_SKIES_EARLY + 0,
+ CAELUM_RENDER_QUEUE_SKYDOME = Ogre::RENDER_QUEUE_SKIES_EARLY + 1,
+ CAELUM_RENDER_QUEUE_SUN = Ogre::RENDER_QUEUE_SKIES_EARLY + 2,
+ CAELUM_RENDER_QUEUE_CLOUDS = Ogre::RENDER_QUEUE_SKIES_EARLY + 3,
+ CAELUM_RENDER_QUEUE_GROUND_FOG = Ogre::RENDER_QUEUE_SKIES_EARLY + 4,
+ };
+
+ // Caelum needs a lot of precission for astronomical calculations.
+ // Very few calculations use it, and the precission IS required.
+ typedef double LongReal;
+}
+
+// Log macro
+#define LOG(msg) Ogre::LogManager::getSingleton().logMessage(msg);
+
+#endif //CAELUMPREREQUISITES_H
Added: trunk/python-ogre/ThirdParty/caelum/SolarSystemModel.cpp
===================================================================
--- trunk/python-ogre/ThirdParty/caelum/SolarSystemModel.cpp (rev 0)
+++ trunk/python-ogre/ThirdParty/caelum/SolarSystemModel.cpp 2008-02-16 01:38:02 UTC (rev 568)
@@ -0,0 +1,60 @@
+/*
+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 "SolarSystemModel.h"
+#include "UniversalClock.h"
+#include "Astronomy.h"
+
+using Ogre::Degree;
+using Ogre::Radian;
+using Ogre::Math;
+using Ogre::Real;
+
+namespace caelum
+{
+ SolarSystemModel::SolarSystemModel (
+ Ogre::Degree longitude, Ogre::Degree latitude):
+ mObserverLatitude(latitude), mObserverLongitude(longitude)
+ {
+ }
+
+ const Ogre::Vector3 SolarSystemModel::getSunDirection (LongReal jday)
+ {
+ int fpmode = Astronomy::enterHighPrecissionFloatingPointMode ();
+
+ // Horizontal spherical.
+ Degree azimuth;
+ Degree altitude;
+ Astronomy::getHorizontalSunPosition(jday,
+ getObserverLongitude(), getObserverLatitude(),
+ azimuth, altitude);
+
+ // Ogre direction.
+ Ogre::Vector3 res;
+ res.x = Math::Sin (azimuth); // East
+ res.y = -Math::Sin (altitude); // Zenith
+ res.z = -Math::Cos (azimuth); // North
+
+ Astronomy::restoreFloatingPointMode(fpmode);
+
+ return res;
+ }
+}
Added: trunk/python-ogre/ThirdParty/caelum/SolarSystemModel.h
===================================================================
--- trunk/python-ogre/ThirdParty/caelum/SolarSystemModel.h (rev 0)
+++ trunk/python-ogre/ThirdParty/caelum/SolarSystemModel.h 2008-02-16 01:38:02 UTC (rev 568)
@@ -0,0 +1,64 @@
+/*
+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/>.
+*/
+
+#ifndef SOLARSYSTEMMODEL_H
+#define SOLARSYSTEMMODEL_H
+
+#include "CaelumPrerequisites.h"
+
+namespace caelum
+{
+ /** Class which calculates sun and moon positions on the sky.
+ * Most of the calculations are done in the astronomy class.
+ */
+ class DllExport SolarSystemModel
+ {
+ private:
+ Ogre::Degree mObserverLatitude;
+ Ogre::Degree mObserverLongitude;
+
+ public:
+ /** Constructor, initializes observer's position on earth.
+ */
+ SolarSystemModel (
+ Ogre::Degree longitude = Ogre::Degree (0),
+ Ogre::Degree latitude = Ogre::Degree (45));
+
+ /// Get the observer's longitude. East is positive, west is negative.
+ inline const Ogre::Degree getObserverLongitude () const { return mObserverLongitude; }
+
+ /// Set the observer's longitude. East is positive, west is negative.
+ inline void setObserverLongitude (Ogre::Degree value) { mObserverLongitude = value; }
+
+ /// Get the observer's latitude. North is positive, south is negative.
+ inline const Ogre::Degree getObserverLatitude () const { return mObserverLatitude; }
+
+ /// Set the observer's latitude. North is positive, south is negative.
+ inline void setObserverLatitude (Ogre::Degree value) { mObserverLatitude = value; }
+
+ /** Get the sun's direction at a certain time.
+ * @param jday astronomical julian day.
+ * @see UniversalClock for julian day calculations.
+ */
+ const Ogre::Vector3 getSunDirection (LongReal jday);
+ };
+}
+
+#endif // SOLARSYSTEMMODEL_H
\ No newline at end of file
Added: trunk/python-ogre/ThirdParty/nxogre/BetajaenCC.cpp
===================================================================
--- trunk/python-ogre/ThirdParty/nxogre/BetajaenCC.cpp (rev 0)
+++ trunk/python-ogre/ThirdParty/nxogre/BetajaenCC.cpp 2008-02-16 01:38:02 UTC (rev 568)
@@ -0,0 +1,28 @@
+/*
+
+Betajaen's Container Classes
+
+Copyright (c) 2007 Robin Southern, http://www.nxogre.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+*/
+
+#include "NxOgreStable.h"
+#include "BetajaenCC.h"
\ No newline at end of file
Added: trunk/python-ogre/ThirdParty/nxogre/BetajaenCC.h
===================================================================
--- trunk/python-ogre/ThirdParty/nxogre/BetajaenCC.h (rev 0)
+++ trunk/python-ogre/ThirdParty/nxogre/BetajaenCC.h 2008-02-16 01:38:02 UTC (rev 568)
@@ -0,0 +1,1654 @@
+/*
+
+Betajaen's Container Classes
+
+Copyright (c) 2007 Robin Southern, http://www.nxogre.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+*/
+
+#ifndef BETAJAENS_CC_H
+#define BETAJAENS_CC_H
+
+#include "NxOgrePlatform.h"
+#include "NxOgreAllocator.h"
+
+// Configuration
+
+/** \brief Namespace to place the Containers in. Comment out if you want it in the global namespace.
+*/
+#define BETAJAEN_CC_NAMESPACE Betajaen
+
+
+/** \brief Enable debug comments. Set to zero to disable, 1 to enable
+*/
+#define BETAJAEN_CC_DEBUG_COMMENTS 1
+
+
+/** \brief Export Class Macro, replace value with your export macro
+*/
+#define BETAJAEN_CC_CLASS_EXPORT __declspec(dllexport)
+#define BETAJAEN_CC_TEMPLATE_CLASS_EXPORT __forceinline
+// #define BETAJAEN_CC_FUNCTION_EXPORT NxPublicFunction
+
+//////////////////////////////////////////////////////////////////////////
+
+#if (BETAJAEN_CC_DEBUG_COMMENTS == 1)
+# include <stdio.h>
+#endif
+
+#ifdef BETAJAEN_CC_NAMESPACE
+# define BETAJAEN_CC_NAMESPACE_START namespace BETAJAEN_CC_NAMESPACE {
+# define BETAJAEN_CC_NAMESPACE_END }
+#else
+# define BETAJAEN_CC_NAMESPACE_START /**/
+# define BETAJAEN_CC_NAMESPACE_END /**/
+#endif
+
+BETAJAEN_CC_NAMESPACE_START
+
+#if (BETAJAEN_CC_DEBUG_COMMENTS == 1)
+# define BETAJAEN_CC_PRINT(x) printf(x "\n");
+# define BETAJAEN_CC_PRINTF(x, y) printf(x "\n",y);
+#else
+# define BETAJAEN_CC_PRINT(x) /* x */
+# define BETAJAEN_CC_PRINTF(x,y) /* x, y*/
+#endif
+
+#if (_MSC_VER>=1000)
+# define BETAJAEN_CC_INLINE
+// __forceinline
+#else
+# define BETAJAEN_CC_INLINE
+//inline
+#endif
+
+#ifndef BETAJAEN_CC_CLASS_EXPORT
+# define BETAJAEN_CC_CLASS_EXPORT
+#endif
+
+#ifndef BETAJAEN_CC_TEMPLATE_CLASS_EXPORT
+# define BETAJAEN_CC_TEMPLATE_CLASS_EXPORT
+#endif
+
+#ifndef BETAJAEN_CC_FUNCTION_EXPORT
+# define BETAJAEN_CC_FUNCTION_EXPORT
+#endif
+
+BETAJAEN_CC_NAMESPACE_END
+
+//////////////////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_NAMESPACE_START
+class SharedAllocator;
+
+template <class TypePtr, class AllocatorType = SharedAllocator> class Flat;
+
+template <class BaseType, class AllocatorType = SharedAllocator> class SharedList;
+template <typename IdentifierType, class BaseType, class AllocatorType = SharedAllocator> class SharedMap;
+template <typename IdentifierType, class TypePtr> class Tree;
+template <typename> class Vector2;
+template <typename> class Vector3;
+template <typename> class Vector4;
+
+BETAJAEN_CC_NAMESPACE_END
+
+//////////////////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_NAMESPACE_START
+
+class BETAJAEN_CC_CLASS_EXPORT SharedAllocator {
+
+public:
+
+/////////////////////////////////////////////////////////////
+
+void* Allocate(size_t size)
+{
+ return malloc(size);
+}
+
+/////////////////////////////////////////////////////////////
+
+void Deallocate(void* mem)
+{
+ if (mem)
+ free(mem);
+}
+
+/////////////////////////////////////////////////////////////
+
+void* Reallocate(void* mem, size_t size)
+{
+ return realloc(mem, size);
+}
+
+/////////////////////////////////////////////////////////////
+
+}; // End of the SharedAllocator class.
+
+BETAJAEN_CC_NAMESPACE_END
+
+//////////////////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_NAMESPACE_START
+
+template
+ <
+ class Type,
+ class AllocatorType
+ >
+class BETAJAEN_CC_CLASS_EXPORT Flat
+{
+
+public:
+
+typedef Type * Iterator;
+typedef AllocatorType* AllocatorPtr;
+
+/////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_INLINE Flat(AllocatorPtr allocator, bool deleteAllocator)
+ : First(NULL), Last(NULL), End(NULL), Allocator(allocator), AutoDeleteAllocator(deleteAllocator)
+{
+}
+
+/////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_INLINE ~Flat()
+{
+ _deallocate(First);
+ if (AutoDeleteAllocator)
+ delete Allocator;
+}
+
+/////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_INLINE unsigned int _size() const
+{
+ return (unsigned int) (Last - First);
+}
+
+/////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_INLINE unsigned int _capacity() const
+{
+ return (unsigned int) (First == 0 ? 0 : End - First);
+}
+
+/////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_INLINE Type* _allocate(unsigned int size)
+{
+ return (Type*) Allocator->Allocate(size * sizeof(Type));
+}
+
+/////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_INLINE void _deallocate(Type* p)
+{
+ if (p)
+ Allocator->Deallocate(p);
+}
+
+/////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_INLINE Iterator _reallocate(Iterator p, unsigned int size)
+{
+ return (Iterator) Allocator->Reallocate(p, size * sizeof(Type));
+}
+
+/////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_INLINE void _clip(unsigned int size)
+{
+
+ if (size < _size())
+ return;
+
+ Iterator new_first = _allocate(size);
+ _copy(First, Last, new_first);
+ _destroy(First, Last);
+ _deallocate(First);
+ End = new_first + size;
+ Last = new_first + _size();
+ First = new_first;
+
+}
+
+/////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_INLINE void _reserve(unsigned int new_size)
+{
+ if (_capacity() >= new_size)
+ return;
+
+ Iterator new_first = _allocate(new_size);
+ _copy(First, Last, new_first);
+ _destroy(First, Last);
+ _deallocate(First);
+ End = new_first + new_size;
+ Last = new_first + _size();
+ First = new_first;
+
+}
+
+/////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_INLINE Iterator _copy(Iterator begin, Iterator end, Iterator dest)
+{
+ for (;begin != end; ++dest, ++begin)
+ *dest = *begin;
+ return dest;
+}
+
+/////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_INLINE void _delete_range(Iterator begin, Iterator end)
+{
+ for (; begin != end; ++begin) {
+ {::NxOgre::Allocator::getPtr()->watch_delete(static_cast<void*>(*begin));};
+ delete *begin;
+ /** NxOgre Remove*/ // delete *begin;
+ }
+}
+
+/////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_INLINE void _destroy(Iterator begin, Iterator end)
+{
+ for (; begin != end; ++begin) {
+ /** NxOgre */ ::NxOgre::Allocator::getPtr()->watch_delete(begin);
+ begin->~Type();
+ }
+}
+
+/////////////////////////////////////////////////////////////
+
+private: AllocatorPtr Allocator;
+private: bool AutoDeleteAllocator;
+public: Iterator First, Last, End;
+
+}; // End of Flat<Type,AllocatorType> class.
+
+BETAJAEN_CC_NAMESPACE_END
+
+//////////////////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_NAMESPACE_START
+
+/** \brief A list of pointers with garbage collections and the ability to
+ share the same list with similar lists. Like STL's Vector.
+
+ \example
+ <code>
+ class A;
+
+ SharedList<A> aList;
+ a.Insert(new A());
+ a.Remove(a.Last);
+ </code>
+
+*/
+template
+ <
+ class Type, /* Class to Store; A, myClassName, etc. */
+ class AllocatorType /* Allocator to use, or leave blank for SharedAllocator */
+ >
+class BETAJAEN_CC_CLASS_EXPORT SharedList {
+
+public:
+
+typedef Type* TypePtr;
+typedef TypePtr* Iterator;
+typedef SharedList<Type, AllocatorType> SharedListType;
+typedef Flat<TypePtr, AllocatorType> FlatType;
+typedef FlatType* FlatPtr;
+
+/////////////////////////////////////////////////////////////
+
+enum AbsolutePosition
+{
+ First,
+ Last
+};
+
+/**
+ Constructor with optional custom allocator
+*/
+BETAJAEN_CC_INLINE SharedList(AllocatorType* _allocator = NULL, bool _auto_delete_allocator = true)
+{
+ if (_allocator == NULL)
+ _allocator = new AllocatorType();
+
+ _Flat = new FlatType(_allocator, _auto_delete_allocator);
+ _Usage = new unsigned int(1);
+
+}
+
+/** \brief Copy Constructor between SharedList's. The Flat will not be copied but referenced.
+ Any action on this list will effect all lists using the same Flat. Clean up will only
+ happen on the destruction of the last surviving list.
+
+ \example
+ <code>
+ typedef SharedList<A> AList;
+ AList a;
+ AList b(a);
+ </code>
+*/
+BETAJAEN_CC_INLINE SharedList(const SharedListType& other)
+{
+
+ _Flat = other._Flat;
+ _Usage = other._Usage;
+ ++(*_Usage);
+
+}
+
+
+/** \brief Copy Operator. Functions the same as Copy Constructor but deletes the set that this
+ may already have.
+
+ \example
+ <code>
+ typedef SharedList<A> AList;
+ AList a;
+ AList b;
+ b = a;
+ </code>
+*/
+BETAJAEN_CC_INLINE SharedListType& operator=(const SharedListType& other)
+{
+
+ if (_Flat)
+ {
+ _Flat->_delete_range(_Flat->First, _Flat->Last);
+ delete _Flat;
+ }
+
+ if (_Usage)
+ delete _Usage;
+
+ _Flat = other._Flat;
+ _Usage = other._Usage;
+ ++(*_Usage);
+
+ return *this;
+
+}
+
+
+/** \brief Destructor. If this is the last of all SharedLists sharing the same set,
+ the set will be destroyed otherwise the Flat will be ignored and this SharedList
+ dies gracefully.
+*/
+BETAJAEN_CC_INLINE ~SharedList()
+{
+
+ if (--(*_Usage) == 0)
+ {
+ _Flat->_delete_range(_Flat->First, _Flat->Last);
+ delete _Flat;
+ delete _Usage;
+ }
+
+}
+
+
+/** \brief Gets the pointer to the nth Type in the list. Alternate interface to operator[].
+*/
+BETAJAEN_CC_INLINE TypePtr Get(size_t pos)
+{
+ if (pos > Size())
+ return NULL;
+
+ return *(_Flat->First + pos);
+}
+
+
+/** \brief Gets the pointer to the nth TypePtr in the list.
+*/
+BETAJAEN_CC_INLINE TypePtr operator[](size_t pos)
+{
+ if (pos > Size())
+ return NULL;
+
+ return *(_Flat->First + pos);
+}
+
+
+/** \brief Where is something in the list.
+*/
+BETAJAEN_CC_INLINE unsigned int WhereIs(TypePtr ptr)
+{
+
+ if (_Flat->_size() == 0)
+ return 0;
+
+ unsigned int i=0;
+ for(Iterator begin = _Flat->First; begin != _Flat->Last; ++begin, ++i)
+ {
+ if (ptr == (*begin))
+ return i;
+ }
+
+ return 0;
+}
+
+BETAJAEN_CC_INLINE bool Has(TypePtr ptr)
+{
+
+ if (_Flat->_size() == 0)
+ return false;
+
+ for(Iterator begin = _Flat->First; begin != _Flat->Last; ++begin)
+ {
+ if (ptr == (*begin))
+ return true;
+ }
+
+ return false;
+
+}
+
+/** \brief The size of the SharedList.
+*/
+BETAJAEN_CC_INLINE unsigned Size() const
+{
+ return _Flat->_size();
+}
+
+
+/** \brief Insert something into the list
+*/
+BETAJAEN_CC_INLINE void Insert(const TypePtr& val)
+{
+
+ if (_Flat->End <= _Flat->Last)
+ _Flat->_reserve( (1 + Size()) * 2);
+
+ *_Flat->Last = val;
+ _Flat->Last++;
+
+}
+
+
+/** \brief Resize the capacity of the list to size + n.
+*/
+BETAJAEN_CC_INLINE void Clean(unsigned int n = 4)
+{
+ _Flat->_clip(_Flat->_size() + n);
+}
+
+
+/** \brief Destroy something nth position into the list.
+*/
+BETAJAEN_CC_INLINE void Destroy(unsigned int n)
+{
+ if (n == 0)
+ return Destroy(First);
+
+ if (n == Size())
+ return Destroy(Last);
+
+ delete *(_Flat->First + n);
+
+ _Flat->_destroy(_Flat->First + n, _Flat->First + n + 1);
+ _Flat->_copy(_Flat->First + n + 1, _Flat->Last, _Flat->First + n);
+ _Flat->Last--;
+
+}
+
+// \brief Destroys everything
+//
+BETAJAEN_CC_INLINE void DestroyAll()
+{
+ if (Size() == 0)
+ return;
+
+ _Flat->_delete_range(_Flat->First, _Flat->Last);
+ // Could be iffy.
+ _Flat->Last = _Flat->First;
+
+}
+
+/** \brief Destroys something in the list based on the pointer in the list.
+*/
+BETAJAEN_CC_INLINE void Destroy(TypePtr val) {
+ unsigned int i = WhereIs(val);
+ Destroy(i);
+}
+
+/** \brief Deletes something from the list based on AbsolutePosition
+*/
+BETAJAEN_CC_INLINE void Destroy(AbsolutePosition position)
+{
+
+ switch(position) {
+
+ case First:
+ {
+ delete *_Flat->First;
+ _Flat->_copy(_Flat->First + 1, _Flat->Last + 1, _Flat->First);
+ _Flat->Last--;
+ }
+ break;
+
+ case Last:
+ {
+ _Flat->Last--;
+ delete *_Flat->Last;
+ }
+ break;
+
+ }
+
+}
+
+
+/** \brief Removes something from the list based on numerical position.
+*/
+BETAJAEN_CC_INLINE TypePtr Remove(unsigned int n)
+{
+
+ if (n == 0)
+ return Remove(First);
+
+ if (n == Size())
+ return Remove(Last);
+
+ TypePtr ptr = Get(n);
+ _Flat->_destroy(_Flat->First + n, _Flat->First + n + 1);
+ _Flat->_copy(_Flat->First + n + 1, _Flat->Last, _Flat->First + n);
+ _Flat->Last--;
+
+ return ptr;
+}
+
+
+/** \brief Removes something from the list based on AbsolutePosition
+*/
+BETAJAEN_CC_INLINE TypePtr Remove(AbsolutePosition position)
+{
+
+ if (_Flat->_size() == 0)
+ return NULL;
+
+ switch(position) {
+
+ case First:
+ {
+ TypePtr t = *(_Flat->First);
+ _Flat->_copy(_Flat->First + 1, _Flat->Last + 1, _Flat->First);
+ _Flat->Last--;
+ return t;
+ }
+
+ break;
+
+ case Last:
+ {
+ _Flat->Last--;
+ return *(_Flat->Last);
+ }
+ break;
+ }
+
+ return NULL;
+
+}
+
+
+/** \brief Places the Iterator at the beginning of the List
+*/
+BETAJAEN_CC_INLINE TypePtr Begin()
+{
+
+ if (_Flat->_size() == 0)
+ return NULL;
+
+ _Iterator = _Flat->First;
+ return *_Iterator;
+
+}
+
+
+/** \brief Advances the Iterator forward by one, and returns the value of the list or NULL
+ \returns The next item in the list, or NULL if it has reached the end of it.
+*/
+BETAJAEN_CC_INLINE TypePtr Next()
+{
+
+ if (_Flat->_size() == 0)
+ return NULL;
+ else if (_Iterator == _Flat->Last)
+ return NULL;
+ else
+ return (*_Iterator++);
+
+}
+
+
+/** \brief Places the iterator at the end of the List
+*/
+BETAJAEN_CC_INLINE TypePtr End()
+{
+
+ if (_Flat->_size() == 0)
+ return NULL;
+
+ _Iterator = _Flat->Last - 1;
+ return *_Iterator;
+
+}
+
+
+/** \brief Advances the Iterator backwards by one, and returns the value of the list or NULL
+ \returns The previous item in the list, or NULL if it has reached the beginning of it.
+*/
+BETAJAEN_CC_INLINE TypePtr Previous()
+{
+
+ if (_Flat->_size() == 0)
+ return NULL;
+ else if (_Iterator == _Flat->First - 1)
+ return NULL;
+ else
+ return (*_Iterator--);
+
+}
+
+/** \brief For each item in the list call it's own method.
+*/
+BETAJAEN_CC_INLINE void Each(void (Type::*MethodPtr)()) {
+
+ if (_Flat->_size() == 0)
+ return;
+
+ for(Iterator begin = _Flat->First; begin != _Flat->Last; ++begin) {
+ (*begin->*MethodPtr)();
+ }
+
+}
+
+
+/** \brief For each item in the list call it's own method, with one argument.
+*/
+template <typename _A>
+BETAJAEN_CC_INLINE void Each(void (Type::*MethodPtr)(_A), _A _1) {
+
+ if (_Flat->_size() == 0)
+ return;
+
+ for(Iterator begin = _Flat->First; begin != _Flat->Last; ++begin) {
+ (*begin->*MethodPtr)(_1);
+ }
+
+}
+
+
+/** \brief For each item in the list call it's own method, with two arguments.
+*/
+template <typename _A, typename _B>
+BETAJAEN_CC_INLINE void Each(void (Type::*MethodPtr)(_A, _B), _A _1, _B _2) {
+
+ if (_Flat->_size() == 0)
+ return;
+
+ for(Iterator begin = _Flat->First; begin != _Flat->Last; ++begin)
+ (*begin->*MethodPtr)(_1, _2);
+
+}
+
+
+/** \brief For each item in the list call it's own method, with three arguments.
+*/
+template <typename _A, typename _B, typename _C>
+BETAJAEN_CC_INLINE void Each(void (Type::*MethodPtr)(_A, _B, _C), _A _1, _B _2, _C _3) {
+
+ if (_Flat->_size() == 0)
+ return;
+
+ for(Iterator begin = _Flat->First; begin != _Flat->Last; ++begin)
+ (*begin->*MethodPtr)(_1, _2, _3);
+
+}
+
+
+/** \brief For each item in the list call it's own method, with four arguments.
+*/
+template <typename _A, typename _B, typename _C, typename _D>
+BETAJAEN_CC_INLINE void Each(void (Type::*MethodPtr)(_A, _B, _C, _D), _A _1, _B _2, _C _3, _D _4) {
+
+ if (_Flat->_size() == 0)
+ return;
+
+ for(Iterator begin = _Flat->First; begin != _Flat->Last; ++begin)
+ (*begin->*MethodPtr)(_1, _2, _3, _4);
+
+}
+
+
+/** \brief For each item in the list call it's own method, with five arguments.
+*/
+template <typename _A, typename _B, typename _C, typename _D, typename _E>
+BETAJAEN_CC_INLINE void Each(void (Type::*MethodPtr)(_A, _B, _C, _D), _A _1, _B _2, _C _3, _D _4, _E _5) {
+
+ if (_Flat->_size() == 0)
+ return;
+
+ for(Iterator begin = _Flat->First; begin != _Flat->Last; ++begin)
+ (*begin->*MethodPtr)(_1, _2, _3, _4, _5);
+
+}
+
+
+/** \brief For each item in the list call it's own method, with six arguments.
+*/
+template <typename _A, typename _B, typename _C, typename _D, typename _E, typename _F>
+BETAJAEN_CC_INLINE void Each(void (Type::*MethodPtr)(_A, _B, _C, _D), _A _1, _B _2, _C _3, _D _4, _E _5, _F _6) {
+
+ if (_Flat->_size() == 0)
+ return;
+
+ for(Iterator begin = _Flat->First; begin != _Flat->Last; ++begin)
+ (*begin->*MethodPtr)(_1, _2, _3, _4, _5, _6);
+
+}
+
+
+/** \brief For each item in the list call it's own method, with seven arguments.
+*/
+template <typename _A, typename _B, typename _C, typename _D, typename _E, typename _F, typename _G>
+BETAJAEN_CC_INLINE void Each(void (Type::*MethodPtr)(_A, _B, _C, _D), _A _1, _B _2, _C _3, _D _4, _E _5, _F _6, _G _7) {
+
+ if (_Flat->_size() == 0)
+ return;
+
+ for(Iterator begin = _Flat->First; begin != _Flat->Last; ++begin)
+ (*begin->*MethodPtr)(_1, _2, _3, _4, _5, _6, _7);
+
+}
+
+
+/** \brief For each item in the list call it's own method, with eight arguments.
+*/
+template <typename _A, typename _B, typename _C, typename _D, typename _E, typename _F, typename _G, typename _H>
+BETAJAEN_CC_INLINE void Each(void (Type::*MethodPtr)(_A, _B, _C, _D), _A _1, _B _2, _C _3, _D _4, _E _5, _F _6, _G _7, _H _8) {
+
+ if (_Flat->_size() == 0)
+ return;
+
+ for(Iterator begin = _Flat->First; begin != _Flat->Last; ++begin)
+ (*begin->*MethodPtr)(_1, _2, _3, _4, _5, _6, _7, _8);
+
+}
+
+/** \brief Returns the pointer to the working set.
+*/
+BETAJAEN_CC_INLINE FlatPtr getFlat() const {
+ return _Flat;
+}
+
+
+/** \brief Returns the number of SharedLists using this set.
+*/
+BETAJAEN_CC_INLINE unsigned int getUsageCount() const {
+ return *_Usage;
+}
+
+
+private: unsigned int* _Usage;
+private: FlatPtr _Flat;
+private: Iterator _Iterator;
+
+}; // End of SharedList<Type, AllocatorType> Class.
+
+BETAJAEN_CC_NAMESPACE_END
+
+//////////////////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_NAMESPACE_START
+
+
+/** \brief Binary Tree with variable identifer and storage type.
+
+*/
+template <typename NodeIdentifier, class Type>
+class BETAJAEN_CC_CLASS_EXPORT Tree
+{
+ // Much of this Tree was from the excellent tutorial by Julienne Walker
+ // http://eternallyconfuzzled.com/tuts/datastructures/jsw_tut_bst1.aspx
+
+public:
+
+class Node;
+typedef Node* NodePtr;
+typedef Type* TypePtr;
+
+/** \brief A tree is made up of nodes.
+*/
+class BETAJAEN_CC_CLASS_EXPORT Node
+{
+
+public:
+
+Node(NodeIdentifier id, TypePtr val) : _ID(id), _Val(val)
+{
+ _Children[0] = NULL;
+ _Children[1] = NULL;
+}
+
+void Replace(Node* n)
+{
+ _ID = n->_ID;
+ _Val = n->_Val;
+}
+
+NodeIdentifier _ID;
+TypePtr _Val;
+NodePtr _Children[2];
+
+};
+
+
+/** \brief Tree constructor
+*/
+public: BETAJAEN_CC_INLINE Tree() : _Root(NULL)
+{
+}
+
+
+/** \brief Tree destructor.
+ \note Does not remove or destroy the contents of the tree.
+*/
+public: BETAJAEN_CC_INLINE ~Tree()
+{
+}
+
+
+/** \brief Destroys all the nodes in the tree and deletes all of the values referenced in it.
+*/
+public: BETAJAEN_CC_INLINE void DestroyAll()
+{
+
+ NodePtr iterator = _Root;
+ NodePtr save = 0;
+
+ while (iterator != NULL)
+ {
+ if (iterator->_Children[0] != NULL)
+ {
+ save = iterator->_Children[0];
+ iterator->_Children[0] = save->_Children[1];
+ save->_Children[1] = iterator;
+ }
+ else
+ {
+ save = iterator->_Children[1];
+ delete iterator->_Val;
+ delete iterator;
+ }
+
+ iterator = save;
+ }
+
+}
+
+
+/** \brief Destroys all the nodes in the tree, but not all of the values referenced in it.
+*/
+public: BETAJAEN_CC_INLINE void RemoveAll()
+{
+ NodePtr iterator = _Root;
+ NodePtr save = 0;
+
+ while (iterator != NULL)
+ {
+ if (iterator->_Children[0] != NULL)
+ {
+ save = iterator->_Children[0];
+ iterator->_Children[0] = save->_Children[1];
+ save->_Children[1] = iterator;
+ }
+ else
+ {
+ save = iterator->_Children[1];
+ delete iterator;
+ }
+
+ iterator = save;
+ }
+
+}
+
+
+/** \brief Remove a Node based of an identifier
+*/
+public: BETAJAEN_CC_INLINE void Remove(NodeIdentifier id)
+{
+
+ if (_Root == NULL)
+ return;
+
+ Node head = {0};
+ NodePtr iterator = &head;
+ NodePtr *f = 0, *p = 0;
+ int direction = 1;
+
+ iterator->_Children[1] = _Root;
+
+ //while (iterator =
+
+}
+
+
+
+/** \brief Removes a ranges of nodes based on max. and min. identifiers.
+ \note This operates based on the "operator <" of the TypeIdentifier the class,
+ which defines if the type is in the range or not. Types such as ints, or reals
+ aren't a problem but things like strings or complicated classes may produce
+ strange results.
+*/
+public: BETAJAEN_CC_INLINE void RemoveRange(NodeIdentifier id_min, NodeIdentifier id_max)
+{
+
+
+}
+
+
+/**
+*/
+public: BETAJAEN_CC_INLINE void Destroy(NodeIdentifier id)
+{
+
+}
+
+
+/**
+*/
+public: BETAJAEN_CC_INLINE void DestroyRange(NodeIdentifier id_min, NodeIdentifier id_max)
+{
+
+}
+
+
+/**
+*/
+public: BETAJAEN_CC_INLINE TypePtr Find(NodeIdentifier target)
+{
+ NodePtr iterator = _Root;
+ while (iterator != NULL)
+ {
+ if (iterator->_ID == target)
+ {
+ return iterator->_Val;
+ }
+ else
+ {
+ iterator = iterator->_Children[int(iterator->_ID < target)];
+ }
+ }
+
+ return 0;
+}
+
+
+/**
+*/
+public: BETAJAEN_CC_INLINE bool Insert(NodeIdentifier target, TypePtr val)
+{
+ Node* node = new Node(target, val);
+
+
+ if (_Root == NULL)
+ {
+ _Root = node;
+ return true;
+ }
+ else
+ {
+ Node* iterator = _Root;
+ unsigned int direction;
+
+ for ( ; ; )
+ {
+ direction = iterator->_ID < target;
+
+ if (iterator->_ID == target)
+ {
+ delete node;
+ return false;
+ }
+ else if (iterator->_Children[direction] == NULL)
+ break;
+
+
+ iterator = iterator->_Children[direction];
+ }
+
+ iterator->_Children[direction] = node;
+ }
+
+ return true;
+}
+
+private: NodePtr _Root;
+
+};
+
+BETAJAEN_CC_NAMESPACE_END
+
+//////////////////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_NAMESPACE_START
+
+template <
+ typename IdentifierType,
+ class Type,
+ class AllocatorType
+ >
+class BETAJAEN_CC_CLASS_EXPORT SharedMap
+{
+
+public:
+
+typedef Type* TypePtr;
+typedef Tree<IdentifierType, Type> TreeType;
+typedef TreeType* TreePtr;
+
+
+/////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_INLINE SharedMap()
+{
+ _Tree = new TreeType();
+}
+
+/////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_INLINE ~SharedMap()
+{
+ _Tree->DestroyAll();
+ delete _Tree;
+}
+
+/////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_INLINE TypePtr Get(IdentifierType identifier)
+{
+ return _Tree->Find(identifier);
+}
+
+/////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_INLINE TypePtr operator[](IdentifierType identifier)
+{
+ return _Tree->Find(identifier);
+}
+
+/////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_INLINE void Insert(IdentifierType identifier, TypePtr ptr)
+{
+ _Tree->Insert(identifier, ptr);
+}
+
+/////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_INLINE void DestroyAll()
+{
+
+}
+
+/////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_INLINE void RemoveAll()
+{
+
+}
+
+/////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_INLINE void Destroy(IdentifierType)
+{
+
+}
+
+/////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_INLINE void Remove(IdentifierType)
+{
+
+}
+
+/////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_INLINE TypePtr Begin()
+{
+
+}
+
+/////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_INLINE TypePtr Next()
+{
+
+}
+
+/////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_INLINE TypePtr End()
+{
+
+}
+
+/////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_INLINE TypePtr Previous()
+{
+
+}
+
+/////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_INLINE void Each(void (Type::*MethodPtr)())
+{
+
+}
+
+/////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_INLINE TreePtr getTree() const
+{
+ return _Tree;
+}
+
+/////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_INLINE unsigned int getUsage() const
+{
+ return *_Usage;
+}
+
+/////////////////////////////////////////////////////////////
+
+private: TreePtr _Tree;
+private: unsigned int* _Usage;
+
+/////////////////////////////////////////////////////////////
+
+};
+
+BETAJAEN_CC_NAMESPACE_END
+
+//////////////////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_NAMESPACE_START
+
+/** \brief Vector with two rows.
+*/
+template <
+ typename Type
+ >
+class BETAJAEN_CC_CLASS_EXPORT Vector2
+{
+
+public:
+
+typedef Vector2<Type> ThisType;
+
+/* \brief First */
+Type i;
+
+/* \brief Second */
+Type j;
+
+BETAJAEN_CC_INLINE Vector2()
+{
+}
+
+BETAJAEN_CC_INLINE Vector2(Type _i, Type _j)
+: i(_i), j(_j)
+{
+}
+
+BETAJAEN_CC_INLINE void swap(ThisType& other)
+{
+ Type First = i, Second = j;
+ i = other.i; other.i = First;
+ j = other.j; other.j = Second;
+}
+
+BETAJAEN_CC_INLINE ThisType& operator = (const ThisType& other)
+{
+ i = other.i; j = other.j;
+ return *this;
+}
+
+BETAJAEN_CC_INLINE ThisType& operator = (const Type& other)
+{
+ i = other; j = other;
+ return *this;
+}
+
+BETAJAEN_CC_INLINE ThisType& operator *= (const Type& other)
+{
+ i *= other; j *= other;
+}
+
+BETAJAEN_CC_INLINE ThisType& operator *= (const ThisType& other)
+{
+ i *= other.i; j *= other.j;
+}
+
+BETAJAEN_CC_INLINE bool operator == (const ThisType& other) const
+{
+ return (i == other.i && j == other.j);
+}
+
+BETAJAEN_CC_INLINE bool operator != (const ThisType& other) const
+{
+ return (i != other.i || j != other.j);
+}
+
+};
+
+BETAJAEN_CC_NAMESPACE_END
+
+//////////////////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_NAMESPACE_START
+
+/** \brief Vector with three rows.
+*/
+template <
+ typename Type
+ >
+class BETAJAEN_CC_CLASS_EXPORT Vector3
+{
+
+public:
+
+typedef Vector3<Type> ThisType;
+
+/* \brief First */
+Type i;
+
+/* \brief Second */
+Type j;
+
+/* \brief Third */
+Type k;
+
+
+BETAJAEN_CC_INLINE Vector3()
+{
+}
+
+BETAJAEN_CC_INLINE Vector3(Type _i, Type _j, Type _k)
+: i(_i), j(_j), k(_k)
+{
+}
+
+BETAJAEN_CC_INLINE void swap(ThisType& other)
+{
+ Type First = i, Second = j, Third = k;
+ i = other.i; other.i = First;
+ j = other.j; other.j = Second;
+ k = other.k; other.k = Third;
+}
+
+BETAJAEN_CC_INLINE ThisType& operator = (const ThisType& other)
+{
+ i = other.i; j = other.j; k = other.k;
+ return *this;
+}
+
+BETAJAEN_CC_INLINE ThisType& operator = (const Type& other)
+{
+ i = other; j = other; k = other;
+ return *this;
+}
+
+BETAJAEN_CC_INLINE ThisType& operator *= (const Type& other)
+{
+ i *= other; j *= other; k *= other;
+}
+
+BETAJAEN_CC_INLINE ThisType& operator *= (const ThisType& other)
+{
+ i *= other.i; j *= other.j; k *= other.k;
+}
+
+BETAJAEN_CC_INLINE bool operator == (const ThisType& other) const
+{
+ return (i == other.i && j == other.j && k == other.k);
+}
+
+BETAJAEN_CC_INLINE bool operator != (const ThisType& other) const
+{
+ return (i != other.i || j != other.j || k != other.k);
+}
+
+};
+
+BETAJAEN_CC_NAMESPACE_END
+
+//////////////////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_NAMESPACE_START
+
+/** \brief Vector with four rows.
+*/
+template <
+ typename Type
+ >
+class BETAJAEN_CC_CLASS_EXPORT Vector4 {
+
+public:
+
+typedef Vector4<Type> ThisType;
+
+/* \brief First */
+Type i;
+
+/* \brief Second */
+Type j;
+
+/* \brief Third */
+Type k;
+
+/* \brief Fourth */
+Type l;
+
+BETAJAEN_CC_INLINE Vector4()
+{
+}
+
+BETAJAEN_CC_INLINE Vector4(Type _i, Type _j, Type _k, Type _l)
+: i(_i), j(_j), k(_k), l(_l)
+{
+}
+
+BETAJAEN_CC_INLINE void swap(ThisType& other)
+{
+ Type First = i, Second = j, Third = k, Fourth = l;
+ i = other.i; other.i = First;
+ j = other.j; other.j = Second;
+ k = other.k; other.k = Third;
+ l = other.l; other.l = Fourth;
+}
+
+BETAJAEN_CC_INLINE ThisType& operator = (const ThisType& other) {
+ i = other.i; j = other.j; k = other.k; l = other.l;
+ return *this;
+}
+
+BETAJAEN_CC_INLINE ThisType& operator *= (const Type& other)
+{
+ i *= other; j *= other; k *= other; l *= other
+}
+
+BETAJAEN_CC_INLINE ThisType& operator *= (const ThisType& other)
+{
+ i *= other.i; j *= other.j; k *= other.k; l *= other.l;
+}
+
+BETAJAEN_CC_INLINE bool operator == (const ThisType& other) const {
+ return (i == other.i && j == other.j && k == other.k && l == other.l);
+}
+
+BETAJAEN_CC_INLINE bool operator != (const ThisType& other) const {
+ return (i != other.i || j != other.j || k != other.k || l != other.l);
+}
+
+};
+
+BETAJAEN_CC_NAMESPACE_END
+
+//////////////////////////////////////////////////////////////////////////
+
+BETAJAEN_CC_NAMESPACE_START
+
+template <typename Type>
+class BETAJAEN_CC_CLASS_EXPORT Vector {
+
+ public:
+ typedef Type* TypePtr;
+
+ TypePtr j;
+ unsigned int jSize;
+
+ Vector(unsigned int j_size)
+ {
+
+ }
+
+ ~Vector()
+ {
+
+ }
+
+};
+
+BETAJAEN_CC_NAMESPACE_END
+
+//////////////////////////////////////////////////////////////////////////
+#if 0
+BETAJAEN_CC_NAMESPACE_START
+
+template <typename Type>
+class BETAJAEN_CC_TEMPLATE_CLASS_EXPORT Matrix {
+
+public:
+ typedef Type* TypePtr;
+
+ TypePtr ij;
+ unsigned int iSize,
+ jSize;
+
+ class MatrixIterator {
+ public:
+
+ enum IteratorRole {
+ IR_COLUMN,
+ IR_ROW
+ };
+
+ MatrixIterator(Matrix* _matrix, IteratorRole _role, unsigned int _iterator = 0)
+ mMatrix(_matrix), mRole(_role), mIterator(_iterator)
+ {
+ }
+
+ Ma...
[truncated message content] |