Index: /code/branches/main_reto/include/Bullet.h
===================================================================
--- /code/branches/main_reto/include/Bullet.h (revision 145)
+++ /code/branches/main_reto/include/Bullet.h (revision 146)
@@ -27,6 +27,6 @@
-#ifndef __Bullet__
-#define __Bullet__
+#ifndef BULLET_H
+#define BULLET_H
#include "Ogre.h"
@@ -49,3 +49,3 @@
-#endif
+#endif /* BULLET_H */
Index: de/branches/main_reto/include/CameraManager.h
===================================================================
--- /code/branches/main_reto/include/CameraManager.h (revision 145)
+++ (revision )
@@ -1,50 +1,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- *
- *
- * License notice:
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- *
- * Author:
- * Reto Grieder
- * Co-authors:
- * ...
- *
- */
-
-
-#ifndef __CameraManager__
-#define __CameraManager__
-
-#include "Ogre.h"
-
-using namespace Ogre;
-
-class CameraManager
-{
-public:
- CameraManager(SceneManager*);
- ~CameraManager();
-
- bool setCameraPosition(int);
-
-protected:
- SceneManager *mSceneMgr;
- Camera *mCamera;
-};
-
-
-#endif
Index: de/branches/main_reto/include/ExampleApplication.h
===================================================================
--- /code/branches/main_reto/include/ExampleApplication.h (revision 145)
+++ (revision )
@@ -1,257 +1,0 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-(Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2006 Torus Knot Software Ltd
-Also see acknowledgements in Readme.html
-
-You may use this sample code for anything you like, it is not covered by the
-LGPL like the rest of the engine.
------------------------------------------------------------------------------
-*/
-/*
------------------------------------------------------------------------------
-Filename: ExampleApplication.h
-Description: Base class for all the OGRE examples
------------------------------------------------------------------------------
-*/
-
-#ifndef __ExampleApplication_H__
-#define __ExampleApplication_H__
-
-#include "Ogre.h"
-#include "OgreConfigFile.h"
-#include "ExampleFrameListener.h"
-
-#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
-#include
-
-// This function will locate the path to our application on OS X,
-// unlike windows you can not rely on the curent working directory
-// for locating your configuration files and resources.
-std::string macBundlePath()
-{
- char path[1024];
- CFBundleRef mainBundle = CFBundleGetMainBundle();
- assert(mainBundle);
-
- CFURLRef mainBundleURL = CFBundleCopyBundleURL(mainBundle);
- assert(mainBundleURL);
-
- CFStringRef cfStringRef = CFURLCopyFileSystemPath( mainBundleURL, kCFURLPOSIXPathStyle);
- assert(cfStringRef);
-
- CFStringGetCString(cfStringRef, path, 1024, kCFStringEncodingASCII);
-
- CFRelease(mainBundleURL);
- CFRelease(cfStringRef);
-
- return std::string(path);
-}
-#endif
-
-using namespace Ogre;
-
-/** Base class which manages the standard startup of an Ogre application.
-Designed to be subclassed for specific examples if required.
-*/
-class ExampleApplication
-{
-public:
- /// Standard constructor
- ExampleApplication()
- {
- mFrameListener = 0;
- mRoot = 0;
- // Provide a nice cross platform solution for locating the configuration files
- // On windows files are searched for in the current working directory, on OS X however
- // you must provide the full path, the helper function macBundlePath does this for us.
-#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
- mResourcePath = macBundlePath() + "/Contents/Resources/";
-#else
- mResourcePath = "";
-#endif
- }
- /// Standard destructor
- virtual ~ExampleApplication()
- {
- if (mFrameListener)
- delete mFrameListener;
- if (mRoot)
- delete mRoot;
- }
-
- /// Start the example
- virtual void go(void)
- {
- if (!setup())
- return;
-
- mRoot->startRendering();
-
- // clean up
- destroyScene();
- }
-
-protected:
- Root *mRoot;
- Camera* mCamera;
- SceneManager* mSceneMgr;
- ExampleFrameListener* mFrameListener;
- RenderWindow* mWindow;
- Ogre::String mResourcePath;
-
- // These internal methods package up the stages in the startup process
- /** Sets up the application - returns false if the user chooses to abandon configuration. */
- virtual bool setup(void)
- {
-
- String pluginsPath;
- // only use plugins.cfg if not static
-#ifndef OGRE_STATIC_LIB
- pluginsPath = mResourcePath + "plugins.cfg";
-#endif
-
- mRoot = new Root(pluginsPath,
- mResourcePath + "ogre.cfg", mResourcePath + "Ogre.log");
-
- setupResources();
-
- bool carryOn = configure();
- if (!carryOn) return false;
-
- chooseSceneManager();
- createCamera();
- createViewports();
-
- // Set default mipmap level (NB some APIs ignore this)
- TextureManager::getSingleton().setDefaultNumMipmaps(5);
-
- // Create any resource listeners (for loading screens)
- createResourceListener();
- // Load resources
- loadResources();
-
- // Create the scene
- createScene();
-
- createFrameListener();
-
- return true;
-
- }
- /** Configures the application - returns false if the user chooses to abandon configuration. */
- virtual bool configure(void)
- {
- // Show the configuration dialog and initialise the system
- // You can skip this and use root.restoreConfig() to load configuration
- // settings if you were sure there are valid ones saved in ogre.cfg
- if(mRoot->showConfigDialog())
- {
- // If returned true, user clicked OK so initialise
- // Here we choose to let the system create a default rendering window by passing 'true'
- mWindow = mRoot->initialise(true);
- return true;
- }
- else
- {
- return false;
- }
- }
-
- virtual void chooseSceneManager(void)
- {
- // Create the SceneManager, in this case a generic one
- mSceneMgr = mRoot->createSceneManager(ST_GENERIC, "ExampleSMInstance");
- }
- virtual void createCamera(void)
- {
- // Create the camera
- mCamera = mSceneMgr->createCamera("PlayerCam");
-
- // Position it at 500 in Z direction
- mCamera->setPosition(Vector3(0,0,500));
- // Look back along -Z
- mCamera->lookAt(Vector3(0,0,-300));
- mCamera->setNearClipDistance(5);
-
- }
- virtual void createFrameListener(void)
- {
- mFrameListener= new ExampleFrameListener(mWindow, mCamera);
- mFrameListener->showDebugOverlay(true);
- mRoot->addFrameListener(mFrameListener);
- }
-
- virtual void createScene(void) = 0; // pure virtual - this has to be overridden
-
- virtual void destroyScene(void){} // Optional to override this
-
- virtual void createViewports(void)
- {
- // Create one viewport, entire window
- Viewport* vp = mWindow->addViewport(mCamera);
- vp->setBackgroundColour(ColourValue(0,0,0));
-
- // Alter the camera aspect ratio to match the viewport
- mCamera->setAspectRatio(
- Real(vp->getActualWidth()) / Real(vp->getActualHeight()));
- }
-
- /// Method which will define the source of resources (other than current folder)
- virtual void setupResources(void)
- {
- // Load resource paths from config file
- ConfigFile cf;
- cf.load(mResourcePath + "resources.cfg");
-
- // Go through all sections & settings in the file
- ConfigFile::SectionIterator seci = cf.getSectionIterator();
-
- String secName, typeName, archName;
- while (seci.hasMoreElements())
- {
- secName = seci.peekNextKey();
- ConfigFile::SettingsMultiMap *settings = seci.getNext();
- ConfigFile::SettingsMultiMap::iterator i;
- for (i = settings->begin(); i != settings->end(); ++i)
- {
- typeName = i->first;
- archName = i->second;
-#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
- // OS X does not set the working directory relative to the app,
- // In order to make things portable on OS X we need to provide
- // the loading with it's own bundle path location
- ResourceGroupManager::getSingleton().addResourceLocation(
- String(macBundlePath() + "/" + archName), typeName, secName);
-#else
- ResourceGroupManager::getSingleton().addResourceLocation(
- archName, typeName, secName);
-#endif
- }
- }
- }
-
- /// Optional override method where you can create resource listeners (e.g. for loading screens)
- virtual void createResourceListener(void)
- {
-
- }
-
- /// Optional override method where you can perform resource group loading
- /// Must at least do ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
- virtual void loadResources(void)
- {
- // Initialise, parse scripts etc
- ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
-
- }
-
-
-
-};
-
-
-#endif
Index: de/branches/main_reto/include/ExampleFrameListener.h
===================================================================
--- /code/branches/main_reto/include/ExampleFrameListener.h (revision 145)
+++ (revision )
@@ -1,401 +1,0 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
- (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2006 Torus Knot Software Ltd
-Also see acknowledgements in Readme.html
-
-You may use this sample code for anything you like, it is not covered by the
-LGPL like the rest of the engine.
------------------------------------------------------------------------------
-*/
-/*
------------------------------------------------------------------------------
-Filename: ExampleFrameListener.h
-Description: Defines an example frame listener which responds to frame events.
-This frame listener just moves a specified camera around based on
-keyboard and mouse movements.
-Mouse: Freelook
-W or Up: Forward
-S or Down:Backward
-A: Step left
-D: Step right
- PgUp: Move upwards
- PgDown: Move downwards
- F: Toggle frame rate stats on/off
- R: Render mode
- T: Cycle texture filtering
- Bilinear, Trilinear, Anisotropic(8)
- P: Toggle on/off display of camera position / orientation
------------------------------------------------------------------------------
-*/
-
-#ifndef __ExampleFrameListener_H__
-#define __ExampleFrameListener_H__
-
-#include "Ogre.h"
-#include "OgreStringConverter.h"
-#include "OgreException.h"
-
-//Use this define to signify OIS will be used as a DLL
-//(so that dll import/export macros are in effect)
-#define OIS_DYNAMIC_LIB
-#include
-
-using namespace Ogre;
-
-class ExampleFrameListener: public FrameListener, public WindowEventListener
-{
-protected:
- void updateStats(void)
- {
- static String currFps = "Current FPS: ";
- static String avgFps = "Average FPS: ";
- static String bestFps = "Best FPS: ";
- static String worstFps = "Worst FPS: ";
- static String tris = "Triangle Count: ";
- static String batches = "Batch Count: ";
-
- // update stats when necessary
- try {
- OverlayElement* guiAvg = OverlayManager::getSingleton().getOverlayElement("Core/AverageFps");
- OverlayElement* guiCurr = OverlayManager::getSingleton().getOverlayElement("Core/CurrFps");
- OverlayElement* guiBest = OverlayManager::getSingleton().getOverlayElement("Core/BestFps");
- OverlayElement* guiWorst = OverlayManager::getSingleton().getOverlayElement("Core/WorstFps");
-
- const RenderTarget::FrameStats& stats = mWindow->getStatistics();
- guiAvg->setCaption(avgFps + StringConverter::toString(stats.avgFPS));
- guiCurr->setCaption(currFps + StringConverter::toString(stats.lastFPS));
- guiBest->setCaption(bestFps + StringConverter::toString(stats.bestFPS)
- +" "+StringConverter::toString(stats.bestFrameTime)+" ms");
- guiWorst->setCaption(worstFps + StringConverter::toString(stats.worstFPS)
- +" "+StringConverter::toString(stats.worstFrameTime)+" ms");
-
- OverlayElement* guiTris = OverlayManager::getSingleton().getOverlayElement("Core/NumTris");
- guiTris->setCaption(tris + StringConverter::toString(stats.triangleCount));
-
- OverlayElement* guiBatches = OverlayManager::getSingleton().getOverlayElement("Core/NumBatches");
- guiBatches->setCaption(batches + StringConverter::toString(stats.batchCount));
-
- OverlayElement* guiDbg = OverlayManager::getSingleton().getOverlayElement("Core/DebugText");
- guiDbg->setCaption(mDebugText);
- }
- catch(...) { /* ignore */ }
- }
-
-public:
- // Constructor takes a RenderWindow because it uses that to determine input context
- ExampleFrameListener(RenderWindow* win, Camera* cam, bool bufferedKeys = false, bool bufferedMouse = false,
- bool bufferedJoy = false ) :
- mCamera(cam), mTranslateVector(Vector3::ZERO), mWindow(win), mStatsOn(true), mNumScreenShots(0),
- mMoveScale(0.0f), mRotScale(0.0f), mTimeUntilNextToggle(0), mFiltering(TFO_BILINEAR),
- mAniso(1), mSceneDetailIndex(0), mMoveSpeed(100), mRotateSpeed(36), mDebugOverlay(0),
- mInputManager(0), mMouse(0), mKeyboard(0), mJoy(0)
- {
- using namespace OIS;
-
- mDebugOverlay = OverlayManager::getSingleton().getByName("Core/DebugOverlay");
-
- LogManager::getSingletonPtr()->logMessage("*** Initializing OIS ***");
- ParamList pl;
- size_t windowHnd = 0;
- std::ostringstream windowHndStr;
-
- win->getCustomAttribute("WINDOW", &windowHnd);
- windowHndStr << windowHnd;
- pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
-
- mInputManager = InputManager::createInputSystem( pl );
-
- //Create all devices (We only catch joystick exceptions here, as, most people have Key/Mouse)
- mKeyboard = static_cast(mInputManager->createInputObject( OISKeyboard, bufferedKeys ));
- mMouse = static_cast(mInputManager->createInputObject( OISMouse, bufferedMouse ));
- try {
- mJoy = static_cast(mInputManager->createInputObject( OISJoyStick, bufferedJoy ));
- }
- catch(...) {
- mJoy = 0;
- }
-
- //Set initial mouse clipping size
- windowResized(mWindow);
-
- showDebugOverlay(true);
-
- //Register as a Window listener
- WindowEventUtilities::addWindowEventListener(mWindow, this);
- }
-
- //Adjust mouse clipping area
- virtual void windowResized(RenderWindow* rw)
- {
- unsigned int width, height, depth;
- int left, top;
- rw->getMetrics(width, height, depth, left, top);
-
- const OIS::MouseState &ms = mMouse->getMouseState();
- ms.width = width;
- ms.height = height;
- }
-
- //Unattach OIS before window shutdown (very important under Linux)
- virtual void windowClosed(RenderWindow* rw)
- {
- //Only close for window that created OIS (the main window in these demos)
- if( rw == mWindow )
- {
- if( mInputManager )
- {
- mInputManager->destroyInputObject( mMouse );
- mInputManager->destroyInputObject( mKeyboard );
- mInputManager->destroyInputObject( mJoy );
-
- OIS::InputManager::destroyInputSystem(mInputManager);
- mInputManager = 0;
- }
- }
- }
-
- virtual ~ExampleFrameListener()
- {
- //Remove ourself as a Window listener
- WindowEventUtilities::removeWindowEventListener(mWindow, this);
- windowClosed(mWindow);
- }
-
- virtual bool processUnbufferedKeyInput(const FrameEvent& evt)
- {
- using namespace OIS;
-
- if(mKeyboard->isKeyDown(KC_A))
- mTranslateVector.x = -mMoveScale; // Move camera left
-
- if(mKeyboard->isKeyDown(KC_D))
- mTranslateVector.x = mMoveScale; // Move camera RIGHT
-
- if(mKeyboard->isKeyDown(KC_UP) || mKeyboard->isKeyDown(KC_W) )
- mTranslateVector.z = -mMoveScale; // Move camera forward
-
- if(mKeyboard->isKeyDown(KC_DOWN) || mKeyboard->isKeyDown(KC_S) )
- mTranslateVector.z = mMoveScale; // Move camera backward
-
- if(mKeyboard->isKeyDown(KC_PGUP))
- mTranslateVector.y = mMoveScale; // Move camera up
-
- if(mKeyboard->isKeyDown(KC_PGDOWN))
- mTranslateVector.y = -mMoveScale; // Move camera down
-
- if(mKeyboard->isKeyDown(KC_RIGHT))
- mCamera->yaw(-mRotScale);
-
- if(mKeyboard->isKeyDown(KC_LEFT))
- mCamera->yaw(mRotScale);
-
- if( mKeyboard->isKeyDown(KC_ESCAPE) || mKeyboard->isKeyDown(KC_Q) )
- return false;
-
- if( mKeyboard->isKeyDown(KC_F) && mTimeUntilNextToggle <= 0 )
- {
- mStatsOn = !mStatsOn;
- showDebugOverlay(mStatsOn);
- mTimeUntilNextToggle = 1;
- }
-
- if( mKeyboard->isKeyDown(KC_T) && mTimeUntilNextToggle <= 0 )
- {
- switch(mFiltering)
- {
- case TFO_BILINEAR:
- mFiltering = TFO_TRILINEAR;
- mAniso = 1;
- break;
- case TFO_TRILINEAR:
- mFiltering = TFO_ANISOTROPIC;
- mAniso = 8;
- break;
- case TFO_ANISOTROPIC:
- mFiltering = TFO_BILINEAR;
- mAniso = 1;
- break;
- default: break;
- }
- MaterialManager::getSingleton().setDefaultTextureFiltering(mFiltering);
- MaterialManager::getSingleton().setDefaultAnisotropy(mAniso);
-
- showDebugOverlay(mStatsOn);
- mTimeUntilNextToggle = 1;
- }
-
- if(mKeyboard->isKeyDown(KC_SYSRQ) && mTimeUntilNextToggle <= 0)
- {
- std::ostringstream ss;
- ss << "screenshot_" << ++mNumScreenShots << ".png";
- mWindow->writeContentsToFile(ss.str());
- mTimeUntilNextToggle = 0.5;
- mDebugText = "Saved: " + ss.str();
- }
-
- if(mKeyboard->isKeyDown(KC_R) && mTimeUntilNextToggle <=0)
- {
- mSceneDetailIndex = (mSceneDetailIndex+1)%3 ;
- switch(mSceneDetailIndex) {
- case 0 : mCamera->setPolygonMode(PM_SOLID); break;
- case 1 : mCamera->setPolygonMode(PM_WIREFRAME); break;
- case 2 : mCamera->setPolygonMode(PM_POINTS); break;
- }
- mTimeUntilNextToggle = 0.5;
- }
-
- static bool displayCameraDetails = false;
- if(mKeyboard->isKeyDown(KC_P) && mTimeUntilNextToggle <= 0)
- {
- displayCameraDetails = !displayCameraDetails;
- mTimeUntilNextToggle = 0.5;
- if (!displayCameraDetails)
- mDebugText = "";
- }
-
- // Print camera details
- if(displayCameraDetails)
- mDebugText = "P: " + StringConverter::toString(mCamera->getDerivedPosition()) +
- " " + "O: " + StringConverter::toString(mCamera->getDerivedOrientation());
-
- // Return true to continue rendering
- return true;
- }
-
- bool processUnbufferedMouseInput(const FrameEvent& evt)
- {
- using namespace OIS;
-
- // Rotation factors, may not be used if the second mouse button is pressed
- // 2nd mouse button - slide, otherwise rotate
- const MouseState &ms = mMouse->getMouseState();
- if( ms.buttonDown( MB_Right ) )
- {
- mTranslateVector.x += ms.X.rel * 0.13;
- mTranslateVector.y -= ms.Y.rel * 0.13;
- }
- else
- {
- mRotX = Degree(-ms.X.rel * 0.13);
- mRotY = Degree(-ms.Y.rel * 0.13);
- }
-
- return true;
- }
-
- void moveCamera()
- {
- // Make all the changes to the camera
- // Note that YAW direction is around a fixed axis (freelook style) rather than a natural YAW
- //(e.g. airplane)
- mCamera->yaw(mRotX);
- mCamera->pitch(mRotY);
- mCamera->moveRelative(mTranslateVector);
- }
-
- void showDebugOverlay(bool show)
- {
- if (mDebugOverlay)
- {
- if (show)
- mDebugOverlay->show();
- else
- mDebugOverlay->hide();
- }
- }
-
- // Override frameStarted event to process that (don't care about frameEnded)
- bool frameStarted(const FrameEvent& evt)
- {
- using namespace OIS;
-
- if(mWindow->isClosed()) return false;
-
- //Need to capture/update each device
- mKeyboard->capture();
- mMouse->capture();
- if( mJoy ) mJoy->capture();
-
- bool buffJ = (mJoy) ? mJoy->buffered() : true;
-
- //Check if one of the devices is not buffered
- if( !mMouse->buffered() || !mKeyboard->buffered() || !buffJ )
- {
- // one of the input modes is immediate, so setup what is needed for immediate movement
- if (mTimeUntilNextToggle >= 0)
- mTimeUntilNextToggle -= evt.timeSinceLastFrame;
-
- // If this is the first frame, pick a speed
- if (evt.timeSinceLastFrame == 0)
- {
- mMoveScale = 1;
- mRotScale = 0.1;
- }
- // Otherwise scale movement units by time passed since last frame
- else
- {
- // Move about 100 units per second,
- mMoveScale = mMoveSpeed * evt.timeSinceLastFrame;
- // Take about 10 seconds for full rotation
- mRotScale = mRotateSpeed * evt.timeSinceLastFrame;
- }
- mRotX = 0;
- mRotY = 0;
- mTranslateVector = Ogre::Vector3::ZERO;
- }
-
- //Check to see which device is not buffered, and handle it
- if( !mKeyboard->buffered() )
- if( processUnbufferedKeyInput(evt) == false )
- return false;
- if( !mMouse->buffered() )
- if( processUnbufferedMouseInput(evt) == false )
- return false;
-
- if( !mMouse->buffered() || !mKeyboard->buffered() || !buffJ )
- moveCamera();
-
- return true;
- }
-
- bool frameEnded(const FrameEvent& evt)
- {
- updateStats();
- return true;
- }
-
-protected:
- Camera* mCamera;
-
- Vector3 mTranslateVector;
- RenderWindow* mWindow;
- bool mStatsOn;
-
- std::string mDebugText;
-
- unsigned int mNumScreenShots;
- float mMoveScale;
- Degree mRotScale;
- // just to stop toggles flipping too fast
- Real mTimeUntilNextToggle ;
- Radian mRotX, mRotY;
- TextureFilterOptions mFiltering;
- int mAniso;
-
- int mSceneDetailIndex ;
- Real mMoveSpeed;
- Degree mRotateSpeed;
- Overlay* mDebugOverlay;
-
- //OIS Input devices
- OIS::InputManager* mInputManager;
- OIS::Mouse* mMouse;
- OIS::Keyboard* mKeyboard;
- OIS::JoyStick* mJoy;
-};
-
-#endif
Index: de/branches/main_reto/include/OgreControl.h
===================================================================
--- /code/branches/main_reto/include/OgreControl.h (revision 145)
+++ (revision )
@@ -1,71 +1,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- *
- *
- * License notice:
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- *
- * Author:
- * Reto Grieder
- * Co-authors:
- * ...
- *
- */
-
-
-#ifndef __OgreControl__
-#define __OgreControl__
-
-#include "Ogre.h"
-#include "OgreConfigFile.h"
-
-
-#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
-#include
-#endif
-
-using namespace Ogre;
-
-class OgreControl
-{
-public:
- OgreControl();
-
- virtual ~OgreControl();
-
- /** Sets up the application - returns false if the user chooses to abandon configuration. */
- virtual bool initialise(void);
-
- virtual Root* getRoot(void);
-
- virtual RenderWindow* getRenderWindow(void);
-
- virtual Ogre::String getResourcePath(void);
-
-protected:
- Root *mRoot;
- RenderWindow *mWindow;
- Ogre::String mResourcePath;
-
- /** Configures the application - returns false if the user chooses to abandon configuration. */
- virtual bool configure(void);
-
- /// Method which will define the source of resources (other than current folder)
- virtual void setupResources(void);
-
-};
-
-#endif
Index: /code/branches/main_reto/include/Orxonox.h
===================================================================
--- /code/branches/main_reto/include/Orxonox.h (revision 145)
+++ /code/branches/main_reto/include/Orxonox.h (revision 146)
@@ -27,12 +27,12 @@
-#ifndef __Orxonox__
-#define __Orxonox__
+#ifndef ORXONOX_H
+#define ORXONOX_H
#include "Ogre.h"
#include "OgreTimer.h"
-#include "OgreControl.h"
-#include "RunManager.h"
+#include "ogre_control.h"
+#include "run_manager.h"
class Orxonox
@@ -52,3 +52,3 @@
};
-#endif
+#endif /* ORXONOX_H */
Index: de/branches/main_reto/include/OrxonoxScene.h
===================================================================
--- /code/branches/main_reto/include/OrxonoxScene.h (revision 145)
+++ (revision )
@@ -1,62 +1,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- *
- *
- * License notice:
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- *
- * Author:
- * Reto Grieder
- * Co-authors:
- * ...
- *
- */
-
-
-#ifndef __DemoScene__
-#define __DemoScene__
-
-#include "Ogre.h"
-
-using namespace Ogre;
-
-class OrxonoxScene
-{
-public:
- OrxonoxScene(SceneManager*);
-
- virtual ~OrxonoxScene();
-
- virtual bool initialise();
-
- virtual void tick(unsigned long, float);
-
-private:
- SceneManager* mSceneMgr;
-
- //specific variables for test purposes
- Light *mLight;
- SceneNode *lightNode;
- BillboardSet *bbs;
- float distance, radius;
-
- /// method where you can perform resource group loading
- virtual void loadResources(void);
-
- // Define what is in the scene
- virtual void createScene(void);
-};
-#endif
Index: de/branches/main_reto/include/OrxonoxShip.h
===================================================================
--- /code/branches/main_reto/include/OrxonoxShip.h (revision 145)
+++ (revision )
@@ -1,72 +1,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- *
- *
- * License notice:
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- *
- * Author:
- * Reto Grieder
- * Co-authors:
- * ...
- *
- */
-
-
-#ifndef __OrxonoxShip__
-#define __OrxonoxShip__
-
-#include "Ogre.h"
-#include "Bullet.h"
-
-using namespace Ogre;
-
-class OrxonoxShip
-{
-public:
- Vector3 speed;
- float thrust, sideThrust, baseThrust;
- Vector3 bulletSpeed;
-
- OrxonoxShip(SceneManager*, SceneNode*);
- virtual ~OrxonoxShip();
-
- virtual bool initialise();
-
- void setThrust(const Real);
- void setSideThrust(const Real);
- void setYaw(const Radian);
- void setPitch(const Radian);
- void setRoll(const Radian);
-
- Real getThrust();
-
- Bullet* fire();
-
- bool tick(unsigned long, Real);
-
- SceneNode *mRootNode;
-
-protected:
- SceneManager *mSceneMgr;
- Entity *mShip;
-
- int n;
-
-};
-
-
-#endif
Index: de/branches/main_reto/include/RunManager.h
===================================================================
--- /code/branches/main_reto/include/RunManager.h (revision 145)
+++ (revision )
@@ -1,125 +1,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- *
- *
- * License notice:
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- *
- * Author:
- * Reto Grieder
- * Co-authors:
- * ...
- *
- */
-
-
-#ifndef __RunManager__
-#define __RunManager__
-
-#include "Ogre.h"
-#include "OgreStringConverter.h"
-#include "OgreException.h"
-
-#include "OgreControl.h"
-#include "OrxonoxScene.h"
-#include "OrxonoxShip.h"
-
-//Use this define to signify OIS will be used as a DLL
-//(so that dll import/export macros are in effect)
-#define OIS_DYNAMIC_LIB
-#include
-
-using namespace Ogre;
-
-
-// let the class inherit from WindowEventListener in order for the RunMgr
-// to act as the central point of all the calcuations in Orxonox
-class RunManager : WindowEventListener
-{
-public:
- RunManager(OgreControl*, bool = false, bool = false, bool = false);
-
- virtual ~RunManager();
-
- virtual bool tick(unsigned long, float);
-
-protected:
- OgreControl *mOgre;
-
- SceneManager *mSceneMgr;
- RenderWindow* mWindow;
-
- OrxonoxScene *mScene;
- Camera* mCamera;
- SceneNode *mShipNode;
- OrxonoxShip *mShip;
-
- bool mStatsOn;
-
- std::string mDebugText;
-
- unsigned int mNumScreenShots;
- // just to stop toggles flipping too fast
- Real mTimeUntilNextToggle ;
- TextureFilterOptions mFiltering;
- int mAniso;
-
- int mSceneDetailIndex ;
- Overlay* mDebugOverlay;
-
- //OIS Input devices
- OIS::InputManager* mInputManager;
- OIS::Mouse* mMouse;
- OIS::Keyboard* mKeyboard;
- OIS::JoyStick* mJoy;
-
- bool leftButtonDown;
- Bullet **mBullets;
- int mBulletsSize;
- int mBulletsPosition;
-
- // previously elapsed render time
- unsigned long mTime;
-
- virtual void createCamera(void);
-
- virtual void createViewports(void);
-
-
- /** EVENT HANDLING **/
-
- //Adjust mouse clipping area
- virtual void windowResized(RenderWindow*);
-
- //Unattach OIS before window shutdown (very important under Linux)
- virtual void windowClosed(RenderWindow*);
-
-
- /** INPUT PROCESSING **/
- virtual bool processUnbufferedKeyInput();
-
- virtual bool processUnbufferedMouseInput();
-
-
- /** OUTPUT **/
-
- virtual void updateStats(void);
-
- virtual void showDebugOverlay(bool);
-
-};
-
-#endif
Index: de/branches/main_reto/include/WeaponManager.h
===================================================================
--- /code/branches/main_reto/include/WeaponManager.h (revision 145)
+++ (revision )
@@ -1,47 +1,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- *
- *
- * License notice:
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- *
- * Author:
- * Reto Grieder
- * Co-authors:
- * ...
- *
- */
-
-
-#ifndef __WeaponManager__
-#define __WeaponManager__
-
-#include "Ogre.h"
-
-using namespace Ogre;
-
-class WeaponManager
-{
-public:
- WeaponManager(SceneManager*);
- virtual ~WeaponManager();
-
-protected:
-
-};
-
-
-#endif
Index: /code/branches/main_reto/include/camera_manager.h
===================================================================
--- /code/branches/main_reto/include/camera_manager.h (revision 146)
+++ /code/branches/main_reto/include/camera_manager.h (revision 146)
@@ -0,0 +1,50 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ * License notice:
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+
+#ifndef CAMERA_MANAGER_H
+#define CAMERA_MANAGER_H
+
+#include "Ogre.h"
+
+using namespace Ogre;
+
+class CameraManager
+{
+public:
+ CameraManager(SceneManager*);
+ ~CameraManager();
+
+ bool setCameraPosition(int);
+
+protected:
+ SceneManager *mSceneMgr;
+ Camera *mCamera;
+};
+
+
+#endif /* CAMERA_MANAGER_H */
Index: /code/branches/main_reto/include/ogre_control.h
===================================================================
--- /code/branches/main_reto/include/ogre_control.h (revision 146)
+++ /code/branches/main_reto/include/ogre_control.h (revision 146)
@@ -0,0 +1,71 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ * License notice:
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+
+#ifndef OGRE_CONTROL_H
+#define OGRE_CONTROL_H
+
+#include "Ogre.h"
+#include "OgreConfigFile.h"
+
+
+#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+#include
+#endif
+
+using namespace Ogre;
+
+class OgreControl
+{
+public:
+ OgreControl();
+
+ virtual ~OgreControl();
+
+ /** Sets up the application - returns false if the user chooses to abandon configuration. */
+ virtual bool initialise(void);
+
+ virtual Root* getRoot(void);
+
+ virtual RenderWindow* getRenderWindow(void);
+
+ virtual Ogre::String getResourcePath(void);
+
+protected:
+ Root *mRoot;
+ RenderWindow *mWindow;
+ Ogre::String mResourcePath;
+
+ /** Configures the application - returns false if the user chooses to abandon configuration. */
+ virtual bool configure(void);
+
+ /// Method which will define the source of resources (other than current folder)
+ virtual void setupResources(void);
+
+};
+
+#endif /* OGRE_CONTROL_H */
Index: /code/branches/main_reto/include/orxonox_scene.h
===================================================================
--- /code/branches/main_reto/include/orxonox_scene.h (revision 146)
+++ /code/branches/main_reto/include/orxonox_scene.h (revision 146)
@@ -0,0 +1,62 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ * License notice:
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+
+#ifndef ORXONOX_SCENE_H
+#define ORXONOX_SCENE_H
+
+#include "Ogre.h"
+
+using namespace Ogre;
+
+class OrxonoxScene
+{
+public:
+ OrxonoxScene(SceneManager*);
+
+ virtual ~OrxonoxScene();
+
+ virtual bool initialise();
+
+ virtual void tick(unsigned long, float);
+
+private:
+ SceneManager* mSceneMgr;
+
+ //specific variables for test purposes
+ Light *mLight;
+ SceneNode *lightNode;
+ BillboardSet *bbs;
+ float distance, radius;
+
+ /// method where you can perform resource group loading
+ virtual void loadResources(void);
+
+ // Define what is in the scene
+ virtual void createScene(void);
+};
+#endif /* ORXONOX_SCENE_H */
Index: /code/branches/main_reto/include/orxonox_ship.h
===================================================================
--- /code/branches/main_reto/include/orxonox_ship.h (revision 146)
+++ /code/branches/main_reto/include/orxonox_ship.h (revision 146)
@@ -0,0 +1,73 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ * License notice:
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+
+#ifndef ORXONOX_SHIP_H
+#define ORXONOX_SHIP_H
+
+#include "Ogre.h"
+
+#include "bullet.h"
+
+using namespace Ogre;
+
+class OrxonoxShip
+{
+public:
+ Vector3 speed;
+ float thrust, sideThrust, baseThrust;
+ Vector3 bulletSpeed;
+
+ OrxonoxShip(SceneManager*, SceneNode*);
+ virtual ~OrxonoxShip();
+
+ virtual bool initialise();
+
+ void setThrust(const Real);
+ void setSideThrust(const Real);
+ void setYaw(const Radian);
+ void setPitch(const Radian);
+ void setRoll(const Radian);
+
+ Real getThrust();
+
+ Bullet* fire();
+
+ bool tick(unsigned long, Real);
+
+ SceneNode *mRootNode;
+
+protected:
+ SceneManager *mSceneMgr;
+ Entity *mShip;
+
+ int n;
+
+};
+
+
+#endif /* ORXONOX_SHIP_H */
Index: /code/branches/main_reto/include/run_manager.h
===================================================================
--- /code/branches/main_reto/include/run_manager.h (revision 146)
+++ /code/branches/main_reto/include/run_manager.h (revision 146)
@@ -0,0 +1,125 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ * License notice:
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+
+#ifndef RUN_MANAGER_H
+#define RUN_MANAGER_H
+
+#include "Ogre.h"
+#include "OgreStringConverter.h"
+#include "OgreException.h"
+
+#include "ogre_control.h"
+#include "orxonox_scene.h"
+#include "orxonox_ship.h"
+
+//Use this define to signify OIS will be used as a DLL
+//(so that dll import/export macros are in effect)
+#define OIS_DYNAMIC_LIB
+#include
+
+using namespace Ogre;
+
+
+// let the class inherit from WindowEventListener in order for the RunMgr
+// to act as the central point of all the calcuations in Orxonox
+class RunManager : WindowEventListener
+{
+public:
+ RunManager(OgreControl*, bool = false, bool = false, bool = false);
+
+ virtual ~RunManager();
+
+ virtual bool tick(unsigned long, float);
+
+protected:
+ OgreControl *mOgre;
+
+ SceneManager *mSceneMgr;
+ RenderWindow* mWindow;
+
+ OrxonoxScene *mScene;
+ Camera* mCamera;
+ SceneNode *mShipNode;
+ OrxonoxShip *mShip;
+
+ bool mStatsOn;
+
+ std::string mDebugText;
+
+ unsigned int mNumScreenShots;
+ // just to stop toggles flipping too fast
+ Real mTimeUntilNextToggle ;
+ TextureFilterOptions mFiltering;
+ int mAniso;
+
+ int mSceneDetailIndex ;
+ Overlay* mDebugOverlay;
+
+ //OIS Input devices
+ OIS::InputManager* mInputManager;
+ OIS::Mouse* mMouse;
+ OIS::Keyboard* mKeyboard;
+ OIS::JoyStick* mJoy;
+
+ bool leftButtonDown;
+ Bullet **mBullets;
+ int mBulletsSize;
+ int mBulletsPosition;
+
+ // previously elapsed render time
+ unsigned long mTime;
+
+ virtual void createCamera(void);
+
+ virtual void createViewports(void);
+
+
+ /** EVENT HANDLING **/
+
+ //Adjust mouse clipping area
+ virtual void windowResized(RenderWindow*);
+
+ //Unattach OIS before window shutdown (very important under Linux)
+ virtual void windowClosed(RenderWindow*);
+
+
+ /** INPUT PROCESSING **/
+ virtual bool processUnbufferedKeyInput();
+
+ virtual bool processUnbufferedMouseInput();
+
+
+ /** OUTPUT **/
+
+ virtual void updateStats(void);
+
+ virtual void showDebugOverlay(bool);
+
+};
+
+#endif /* RUN_MANAGER_H */
Index: /code/branches/main_reto/include/weapon_manager.h
===================================================================
--- /code/branches/main_reto/include/weapon_manager.h (revision 146)
+++ /code/branches/main_reto/include/weapon_manager.h (revision 146)
@@ -0,0 +1,47 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ * License notice:
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+
+#ifndef WEAPON_MANAGER_H
+#define WEAPON_MANAGER_H
+
+#include "Ogre.h"
+
+using namespace Ogre;
+
+class WeaponManager
+{
+public:
+ WeaponManager(SceneManager*);
+ virtual ~WeaponManager();
+
+protected:
+
+};
+
+
+#endif /* WEAPON_MANAGER_H */
Index: de/branches/main_reto/src/Bullet.cpp
===================================================================
--- /code/branches/main_reto/src/Bullet.cpp (revision 145)
+++ (revision )
@@ -1,40 +1,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- *
- *
- * License notice:
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- *
- * Author:
- * Reto Grieder
- * Co-authors:
- * ...
- *
- */
-
-#include "Bullet.h"
-
-
-Bullet::Bullet(SceneNode *mNode, Entity *mEntity, Vector3 mSpeed)
- : mNode(mNode), mEntity(mEntity), mSpeed(mSpeed)
-{
- mNode->attachObject(mEntity);
-}
-
-
-Bullet::~Bullet()
-{
-}
Index: de/branches/main_reto/src/CameraManager.cpp
===================================================================
--- /code/branches/main_reto/src/CameraManager.cpp (revision 145)
+++ (revision )
@@ -1,44 +1,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- *
- *
- * License notice:
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- *
- * Author:
- * Reto Grieder
- * Co-authors:
- * ...
- *
- */
-
-#include "CameraManager.h"
-
-
-CameraManager::CameraManager(SceneManager *mScene) : mSceneMgr(mSceneMgr)
-{
-}
-
-
-CameraManager::~CameraManager()
-{
-}
-
-
-bool CameraManager::setCameraPosition(int n)
-{
- return true;
-}
Index: de/branches/main_reto/src/OgreControl.cpp
===================================================================
--- /code/branches/main_reto/src/OgreControl.cpp (revision 145)
+++ (revision )
@@ -1,170 +1,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- *
- *
- * License notice:
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- *
- * Author:
- * Reto Grieder
- * Co-authors:
- * ...
- *
- */
-
-#include "OgreControl.h"
-
-#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
-// This function will locate the path to our application on OS X,
-// unlike windows you can not rely on the curent working directory
-// for locating your configuration files and resources.
-std::string macBundlePath()
-{
- char path[1024];
- CFBundleRef mainBundle = CFBundleGetMainBundle();
- assert(mainBundle);
-
- CFURLRef mainBundleURL = CFBundleCopyBundleURL(mainBundle);
- assert(mainBundleURL);
-
- CFStringRef cfStringRef =
- CFURLCopyFileSystemPath( mainBundleURL, kCFURLPOSIXPathStyle);
- assert(cfStringRef);
-
- CFStringGetCString(cfStringRef, path, 1024, kCFStringEncodingASCII);
-
- CFRelease(mainBundleURL);
- CFRelease(cfStringRef);
-
- return std::string(path);
-}
-#endif
-
-
-OgreControl::OgreControl()
-{
- mRoot = 0;
- // Provide a nice cross platform solution for locating the configuration
- // files. On windows files are searched for in the current working
- // directory, on OS X however you must provide the full path, the helper
- // function macBundlePath does this for us.
-#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
- mResourcePath = macBundlePath() + "/Contents/Resources/";
-#else
- mResourcePath = "";
-#endif
-}
-
-
-// standard destructor
-OgreControl::~OgreControl()
-{
- if (mRoot)
- delete mRoot;
-}
-
-
-/**------------- SETTING UP OGRE --------------**/
-
-bool OgreControl::initialise(void)
-{
- String pluginsPath;
- // only use plugins.cfg if not static
-#ifndef OGRE_STATIC_LIB
- pluginsPath = mResourcePath + "plugins.cfg";
-#endif
-
- mRoot = new Root(pluginsPath,
- mResourcePath + "ogre.cfg", mResourcePath + "Ogre.log");
-
- setupResources();
-
- if (!configure())
- return false;
-
- return true;
-}
-
-
-// Method which will define the source of resources
-// (other than current folder)
-void OgreControl::setupResources(void)
-{
- // Load resource paths from config file
- ConfigFile cf;
- cf.load(mResourcePath + "resources.cfg");
-
- // Go through all sections & settings in the file
- ConfigFile::SectionIterator seci = cf.getSectionIterator();
-
- String secName, typeName, archName;
- while (seci.hasMoreElements())
- {
- secName = seci.peekNextKey();
- ConfigFile::SettingsMultiMap *settings = seci.getNext();
- ConfigFile::SettingsMultiMap::iterator i;
- for (i = settings->begin(); i != settings->end(); ++i)
- {
- typeName = i->first;
- archName = i->second;
-#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
- // OS X does not set the working directory relative to the app,
- // In order to make things portable on OS X we need to provide
- // the loading with it's own bundle path location
- ResourceGroupManager::getSingleton().addResourceLocation(
- String(macBundlePath() + "/" + archName), typeName, secName);
-#else
- ResourceGroupManager::getSingleton().addResourceLocation(
- archName, typeName, secName);
-#endif
- }
- }
-}
-
-
-bool OgreControl::configure(void)
-{
- // Show the configuration dialog and initialise the system
- // You can skip this and use root.restoreConfig() to load configuration
- // settings if you were sure there are valid ones saved in ogre.cfg
- if(!mRoot->restoreConfig() && !mRoot->showConfigDialog())
- return false;
-
- // user clicked OK so initialise
- // Here we choose to let the system create a default
- // rendering window by passing 'true'
- mWindow = mRoot->initialise(true);
- mRoot->saveConfig();
- return true;
-}
-
-
-Root* OgreControl::getRoot(void)
-{
- return mRoot;
-}
-
-
-RenderWindow* OgreControl::getRenderWindow(void)
-{
- return mWindow;
-}
-
-
-Ogre::String OgreControl::getResourcePath(void)
-{
- return mResourcePath;
-}
Index: de/branches/main_reto/src/Orxonox.cpp
===================================================================
--- /code/branches/main_reto/src/Orxonox.cpp (revision 145)
+++ (revision )
@@ -1,79 +1,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- *
- *
- * License notice:
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- *
- * Author:
- * Reto Grieder
- * Co-authors:
- * ...
- *
- */
-
-
-#include "Orxonox.h"
-
-
-void Orxonox::go(void)
-{
- if (!setup())
- return;
-
- mTimer = new Timer();
-
- unsigned long lastTime = mTimer->getMilliseconds();
-
- while (true)
- {
- //Pump messages in all registered RenderWindow windows
- WindowEventUtilities::messagePump();
-
- mOgre->getRoot()->renderOneFrame();
-
- if (!mRunMgr->tick(mTimer->getMilliseconds(),
- (mTimer->getMilliseconds() - lastTime) / 1000.0))
- break;
- lastTime = mTimer->getMilliseconds();
- }
-
- // clean up
- destroy();
-}
-
-
-bool Orxonox::setup(void)
-{
- // create new 3D ogre render engine
- mOgre = new OgreControl();
- mOgre->initialise();
-
- mRunMgr = new RunManager(mOgre);
-
- return true;
-}
-
-
-void Orxonox::destroy()
-{
- if (mTimer)
- delete mTimer;
- if (mRunMgr)
- delete mRunMgr;
- if (mOgre)
- delete mOgre;
-}
Index: de/branches/main_reto/src/OrxonoxScene.cpp
===================================================================
--- /code/branches/main_reto/src/OrxonoxScene.cpp (revision 145)
+++ (revision )
@@ -1,114 +1,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- *
- *
- * License notice:
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- *
- * Author:
- * Reto Grieder
- * Co-authors:
- * ...
- *
- */
-
-#include "OrxonoxScene.h"
-
-
-OrxonoxScene::OrxonoxScene(SceneManager *mSceneMgr) : mSceneMgr(mSceneMgr)
-{
-}
-
-
-OrxonoxScene::~OrxonoxScene()
-{
-}
-
-
-bool OrxonoxScene::initialise()
-{
- // Load resources
- loadResources();
-
- distance = 0;
- radius = 100;
-
- createScene();
-
- return true;
-}
-
-
-// method where you can perform resource group loading
-// Must at least do
-// ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
-void OrxonoxScene::loadResources(void)
-{
- // Initialise, parse scripts etc
- ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
-}
-
-
-// Currently just a test scene with an ogre head an a surrounding light
-void OrxonoxScene::createScene(void)
-{
- mSceneMgr->setAmbientLight(ColourValue(0.3,0.3,0.3));
-
- //create first entity
- Entity *head = mSceneMgr->createEntity("head", "ogrehead.mesh");
-
- //create a scene node to attach the head to
- SceneNode *node = mSceneMgr->getRootSceneNode()
- ->createChildSceneNode("OgreHeadNode", Vector3(0,0,0));
- //attach the ogre head
- node->attachObject(head);
-
- // set up skybox
- mSceneMgr->setSkyBox(true, "Examples/SceneSkyBox2");
-
- // set up one mLight source
- mLight = mSceneMgr->createLight("Light1");
- mLight->setType(Light::LT_POINT);
- mLight->setPosition(Vector3(0, 0, 0));
- mLight->setDiffuseColour(1.0, 1.0, 1.0);
- mLight->setSpecularColour(1.0, 1.0, 1.0);
-
- //create billboard
- bbs = mSceneMgr->createBillboardSet("bb", 1);
- bbs->createBillboard(Vector3::ZERO, ColourValue(1.0, 1.0, 1.0));
- bbs->setMaterialName("Examples/Flare");
-
- lightNode = mSceneMgr->getRootSceneNode()
- ->createChildSceneNode("LightNode", Vector3(0, 100, 0));
-
- lightNode->attachObject(bbs);
- lightNode->attachObject(mLight);
-}
-
-
-// compute something between frames if neccessary
-void OrxonoxScene::tick(unsigned long time, float deltaTime)
-{
- float t = time/1000.0;
-
- lightNode->setPosition(radius*sin(5*t), radius*cos(5*t), sin(1*t)*distance);
-
- mLight->setDiffuseColour(sin(1*t), sin(1*t + 2.09), sin(1*t + 2.09*2));
- mLight->setSpecularColour(sin(1*t), sin(1*t + 2.09), sin(1*t + 2.09*2));
-
- bbs->getBillboard(0)->setColour(ColourValue(sin(1*t),
- sin(1*t + 2.09), sin(1*t + 2.09*2)));
-}
Index: de/branches/main_reto/src/OrxonoxShip.cpp
===================================================================
--- /code/branches/main_reto/src/OrxonoxShip.cpp (revision 145)
+++ (revision )
@@ -1,117 +1,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- *
- *
- * License notice:
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- *
- * Author:
- * Reto Grieder
- * Co-authors:
- * ...
- *
- */
-
-#include "OrxonoxShip.h"
-
-
-OrxonoxShip::OrxonoxShip(SceneManager *mSceneMgr, SceneNode *mNode)
- : mSceneMgr(mSceneMgr), mRootNode(mNode), speed(Vector3(0, 0, 0)),
- baseThrust(1000), thrust(0), sideThrust(0), n(0),
- bulletSpeed(400)
-{
-}
-
-
-OrxonoxShip::~OrxonoxShip()
-{
-}
-
-
-bool OrxonoxShip::initialise()
-{
- // load all the resources needed (no resource groups yet,
- // so the allInit is not executed!)
- // ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
-
- // create the "space ship" (currently a fish..)
- // TODO: names must be unique!
- mShip = mSceneMgr->createEntity("Ship", "fish.mesh");
- SceneNode *fishNode = mRootNode->createChildSceneNode("fishNode");
- fishNode->yaw(Degree(-90));
- fishNode->attachObject(mShip);
- fishNode->setScale(Vector3(10, 10, 10));
-
- return true;
-}
-
-
-void OrxonoxShip::setThrust(const Real value)
-{
- thrust = value * baseThrust;
-}
-
-void OrxonoxShip::setSideThrust(const Real value)
-{
- sideThrust = value * baseThrust;
-}
-
-void OrxonoxShip::setYaw(const Radian value)
-{
- mRootNode->yaw(value);
-}
-
-void OrxonoxShip::setPitch(const Radian value)
-{
- mRootNode->pitch(value);
-}
-
-void OrxonoxShip::setRoll(const Radian value)
-{
- mRootNode->roll(value);
-}
-
-Real OrxonoxShip::getThrust()
-{
- return thrust;
-}
-
-Bullet* OrxonoxShip::fire()
-{
- // TODO: Names must be unique!
- SceneNode *temp = mRootNode->getParentSceneNode()->createChildSceneNode(
- "BulletNode" + StringConverter::toString(n));
- temp->setOrientation(mRootNode->getOrientation());
- temp->setPosition(mRootNode->getPosition());
- temp->setScale(Vector3(1, 1, 1) * 10);
- temp->yaw(Degree(-90));
- return new Bullet(temp, mSceneMgr->createEntity("bullet"
- + StringConverter::toString(n++), "Barrel.mesh"), speed
- + (mRootNode->getLocalAxes() * Vector3(0, 0, -1)).normalisedCopy()
- * bulletSpeed);
-}
-
-bool OrxonoxShip::tick(unsigned long time, Real deltaTime)
-{
- Quaternion quad = mRootNode->getOrientation();
- quad.normalise();
- speed += quad * Vector3(0, 0, -1) * thrust * deltaTime;
- speed += quad * Vector3(-1, 0, 0) * sideThrust * deltaTime;
-
- mRootNode->translate(speed * deltaTime);
-
- return true;
-}
Index: de/branches/main_reto/src/RunManager.cpp
===================================================================
--- /code/branches/main_reto/src/RunManager.cpp (revision 145)
+++ (revision )
@@ -1,541 +1,0 @@
-/*
-* ORXONOX - the hottest 3D action shooter ever to exist
-*
-*
-* License notice:
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see .
-*
-*
-* Author:
-* Reto Grieder
-* Co-authors:
-* ...
-*/
-
-/**
-* RunManager is the basic control object during the game.
-*
-* The RunManger class is designed to actually "run" the main part of the
-* game. The Idea is, that you could derive from the RunManager in order
-* to distinguish between a first person shooter or a space craft shooter.
-* RunManager loads and initialises everything in the scene (like the ship,
-* the enemies in the scene, any scripts, the physics, window events,
-* environment, HUD, etc.).
-* It also captures any input from keyboard, mous, joystick (optional) or
-* Ogre (window events).
-*/
-
-#include "RunManager.h"
-
-
-/**
-* Contructor only needs the render window and the Root object which are both
-* the OgreControl object.
-* Right now the constructor does all the initialisation work. This could also
-* be done in a new method "initialize()", for whatever purpose.
-*
-*
-* @param mOgre The OgreControl object holding the render window and the Root
-*/
-RunManager::RunManager(OgreControl * mOgre, bool bufferedKeys,
- bool bufferedMouse, bool bufferedJoy )
- : mOgre(mOgre), mWindow(mOgre->getRenderWindow()), leftButtonDown(false),
- mStatsOn(true), mNumScreenShots(0), mTimeUntilNextToggle(0),
- mFiltering(TFO_BILINEAR), mAniso(1), mSceneDetailIndex(0),
- mDebugOverlay(0), mInputManager(0), mMouse(0), mKeyboard(0), mJoy(0)
-{
-
- // SETTING UP THE SCENE
-
- // create one new SceneManger
- mSceneMgr = mOgre->getRoot()->createSceneManager(ST_GENERIC, "mScene");
-
- // background scene (world objects, skybox, lights, etc.)
- mScene = new OrxonoxScene(mSceneMgr);
-
- // PLAYER SPACESHIP
-
- // create a steerable SceneNode (not derived!) object. The idea is that this
- // object only receives the mouse and the keyboard input (not specifi keys,
- // more like up, down, left, right, roll left, roll right, move down,
- // move up). The steering class can then decide how to control the node for
- // the spaceship. This gives a certain flexibility.
- // It should also be considered, that this class should provide another Node
- // for a camera to be attached (otherwise the spaceship in front of the
- // would be very static, never moving at all.
- mShipNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("ShipNode",
- Vector3(20, 20, 20));
-
- // Construct a new spaceship and attach it to the node
- mShip = new OrxonoxShip(mSceneMgr, mShipNode);
-
-
- // RESOURCE LOADING (using ResourceGroups if implemented)
-
- // load all resources and create the entities by calling the initialise()
- // methods for each object (don't initialise in the constructor!).
- mScene->initialise();
- mShip->initialise();
-
-
- // CAMERA AND VIEWPORT
- // TODO: create a camera manager. It should be able to change its position
- // around the space ship (predefined states would be nice too). And it should
- // also be able to switch between different locations (like ship, spactator,
- // certain fixed positions (e.g. finish line, etc.)). These are just ideas.
-
- // create camera and viewport
- createCamera();
- createViewports();
-
-
- // Set default mipmap level (NB some APIs ignore this)
- TextureManager::getSingleton().setDefaultNumMipmaps(5);
-
-
- // BULLET LIST FOR THE TEST APPLICATION
-
- // TODO: Use STL to make life easier. But it works this way too..
- mBullets = new Bullet*[10];
- mBulletsPosition = 0;
- mBulletsSize = 10;
-
-
- // HUMAN INTERFACE
-
- using namespace OIS;
-
- mDebugOverlay = OverlayManager::getSingleton()
- .getByName("Core/DebugOverlay");
-
- LogManager::getSingletonPtr()->logMessage("*** Initializing OIS ***");
- ParamList pl;
- size_t windowHnd = 0;
- std::ostringstream windowHndStr;
-
- mWindow->getCustomAttribute("WINDOW", &windowHnd);
- windowHndStr << windowHnd;
- pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
-
- mInputManager = InputManager::createInputSystem( pl );
-
- // Create all devices (We only catch joystick exceptions here,
- // as, most people have Key/Mouse)
- mKeyboard = static_cast(mInputManager
- ->createInputObject( OISKeyboard, bufferedKeys ));
- mMouse = static_cast(mInputManager
- ->createInputObject( OISMouse, bufferedMouse ));
- try {
- mJoy = static_cast(mInputManager
- ->createInputObject( OISJoyStick, bufferedJoy ));
- }
- catch(...) {
- mJoy = 0;
- }
-
- //Set initial mouse clipping size
- windowResized(mWindow);
-
- showDebugOverlay(true);
-
- // REGISTER THIS OBJECT AS A WINDOW EVENT LISTENER IN OGRE
- // It will then receive events liek windowClosed, windowResized, etc.
- WindowEventUtilities::addWindowEventListener(mWindow, this);
-}
-
-/**
-* Standard destructor.
-* Removes this object as a window event listener and deletes all created
-* variables.
-*/
-RunManager::~RunManager()
-{
- //Remove ourself as a Window listener
- WindowEventUtilities::removeWindowEventListener(mWindow, this);
- windowClosed(mWindow);
-
- if (mScene)
- delete mScene;
- if (mShip)
- delete mShip;
-
- // clean up the bullet list
- for (int i = 0; i < mBulletsPosition; i++)
- delete mBullets[i];
- delete mBullets;
-}
-
-
-/**
-* Method to compute anyting between 2 frames.
-*
-* Everything that needs to be computed during the games happens right here.
-* The only exception are the listeners (which should only set variables,
-* not actually do something).
-*
-* @param time Absolute play time
-* @param deltaTime Time passed since last frame
-* @return Return false to end rendering
-*/
-bool RunManager::tick(unsigned long time, float deltaTime)
-{
- // synchronize with internal class timer
- mTime = time;
-
- // Call tick() for every object
- // This could be done by registering (needs a factory..)
- mScene->tick(time, deltaTime);
- mShip->tick(time, deltaTime);
-
-
- // Update the 'HUD'
- updateStats();
-
- // update the bullet positions
- for (int i = 0; i < mBulletsPosition; i++)
- {
- mBullets[i]->mNode->translate(mBullets[i]->mSpeed*deltaTime);
- mBullets[i]->mNode->yaw(Degree(deltaTime*100));
- mBullets[i]->mNode->roll(Degree(deltaTime*300));
- }
-
- // HUMAN INTERFACE
-
- using namespace OIS;
-
- if(mWindow->isClosed()) return false;
-
- //Need to capture/update each device
- mKeyboard->capture();
- mMouse->capture();
- if( mJoy ) mJoy->capture();
-
- bool buffJ = (mJoy) ? mJoy->buffered() : true;
-
- //Check if one of the devices is not buffered
- if( !mMouse->buffered() || !mKeyboard->buffered() || !buffJ )
- {
- // one of the input modes is immediate, so setup what
- // is needed for immediate movement
- if (mTimeUntilNextToggle >= 0)
- mTimeUntilNextToggle -= deltaTime;
- }
-
- //Check to see which device is not buffered, and handle it
- if( !mKeyboard->buffered() )
- if( processUnbufferedKeyInput() == false )
- return false;
- if( !mMouse->buffered() )
- if( processUnbufferedMouseInput() == false )
- return false;
-
- // keep rendering
- return true;
-}
-
-
-/**
-* Adjust mouse clipping area.
-* This method is called by Ogre without regards of tick()!
-* Avoid doing too much in this call.
-* @param rw render window
-*/
-void RunManager::windowResized(RenderWindow* rw)
-{
- unsigned int width, height, depth;
- int left, top;
- rw->getMetrics(width, height, depth, left, top);
-
- const OIS::MouseState &ms = mMouse->getMouseState();
- ms.width = width;
- ms.height = height;
-}
-
-
-/**
-* Unattach OIS before window shutdown (very important under Linux).
-* Again, avoid computing a lot in this function.
-* @param rw Render Window
-*/
-void RunManager::windowClosed(RenderWindow* rw)
-{
- //Only close for window that created OIS (the main window in these demos)
- if( rw == mWindow )
- {
- if( mInputManager )
- {
- mInputManager->destroyInputObject( mMouse );
- mInputManager->destroyInputObject( mKeyboard );
- mInputManager->destroyInputObject( mJoy );
-
- OIS::InputManager::destroyInputSystem(mInputManager);
- mInputManager = 0;
- }
- }
-}
-
-/**
-* Processes the Keyboard input.
-* TODO: Use listeners to improve performance.
-* A lookup table should be implemented to bind any key to a specific action.
-* @return Return true to keep rendering
-*/
-bool RunManager::processUnbufferedKeyInput()
-{
- using namespace OIS;
-
- if(mKeyboard->isKeyDown(KC_A) || mKeyboard->isKeyDown(KC_LEFT))
- mShip->setSideThrust(1);
- else if(mKeyboard->isKeyDown(KC_D) || mKeyboard->isKeyDown(KC_RIGHT))
- mShip->setSideThrust(-1);
- else
- mShip->setSideThrust(0);
-
- if(mKeyboard->isKeyDown(KC_UP) || mKeyboard->isKeyDown(KC_W) )
- mShip->setThrust(1);
- else if(mKeyboard->isKeyDown(KC_DOWN) || mKeyboard->isKeyDown(KC_S) )
- mShip->setThrust(-1);
- else
- mShip->setThrust(0);
-
- if( mKeyboard->isKeyDown(KC_ESCAPE) || mKeyboard->isKeyDown(KC_Q) )
- return false;
-
- if( mKeyboard->isKeyDown(KC_F) && mTimeUntilNextToggle <= 0 )
- {
- mStatsOn = !mStatsOn;
- showDebugOverlay(mStatsOn);
- mTimeUntilNextToggle = 1;
- }
-
- if( mKeyboard->isKeyDown(KC_T) && mTimeUntilNextToggle <= 0 )
- {
- switch(mFiltering)
- {
- case TFO_BILINEAR:
- mFiltering = TFO_TRILINEAR;
- mAniso = 1;
- break;
- case TFO_TRILINEAR:
- mFiltering = TFO_ANISOTROPIC;
- mAniso = 8;
- break;
- case TFO_ANISOTROPIC:
- mFiltering = TFO_BILINEAR;
- mAniso = 1;
- break;
- default: break;
- }
- MaterialManager::getSingleton().setDefaultTextureFiltering(mFiltering);
- MaterialManager::getSingleton().setDefaultAnisotropy(mAniso);
-
- showDebugOverlay(mStatsOn);
- mTimeUntilNextToggle = 1;
- }
-
- if(mKeyboard->isKeyDown(KC_SYSRQ) && mTimeUntilNextToggle <= 0)
- {
- std::ostringstream ss;
- ss << "screenshot_" << ++mNumScreenShots << ".png";
- mWindow->writeContentsToFile(ss.str());
- mTimeUntilNextToggle = 0.5;
- mDebugText = "Saved: " + ss.str();
- }
-
- if(mKeyboard->isKeyDown(KC_R) && mTimeUntilNextToggle <=0)
- {
- mSceneDetailIndex = (mSceneDetailIndex+1)%3 ;
- switch(mSceneDetailIndex) {
- case 0 : mCamera->setPolygonMode(PM_SOLID); break;
- case 1 : mCamera->setPolygonMode(PM_WIREFRAME); break;
- case 2 : mCamera->setPolygonMode(PM_POINTS); break;
- }
- mTimeUntilNextToggle = 0.5;
- }
-
- static bool displayCameraDetails = false;
- if(mKeyboard->isKeyDown(KC_P) && mTimeUntilNextToggle <= 0)
- {
- displayCameraDetails = !displayCameraDetails;
- mTimeUntilNextToggle = 0.5;
- if (!displayCameraDetails)
- mDebugText = "";
- }
-
- // Print camera details
- if(displayCameraDetails)
- mDebugText = StringConverter::toString(mShip->getThrust())
- + " | Speed = " + StringConverter::toString(mShip->speed);
- // mDebugText = "P: " + StringConverter::toString(mCamera
- // ->getDerivedPosition()) + " " + "O: "
- // + StringConverter::toString(mCamera->getDerivedOrientation());
-
- // Return true to continue rendering
- return true;
-}
-
-
-/**
-* Processes the Mouse input.
-* TODO: Use listeners to improve performance.
-* A lookup table should be implemented to bind ANY button or movement
-* to a specific action.
-* @return Return true to keep rendering
-*/
-bool RunManager::processUnbufferedMouseInput()
-{
- using namespace OIS;
-
- const MouseState &ms = mMouse->getMouseState();
-
- // This is a 'hack' to show some flying barrels..
- // Usually, the Bullet created by the ship should be managed
- // by the physics engine..
- if (ms.buttonDown(MB_Left) && !leftButtonDown)
- {
- // Prevent continuous fire for the moment.
- leftButtonDown = true;
-
- // let ship fire one shot with its only weapon (Barrels..)
- Bullet *mTempBullet = mShip->fire();
-
- // resize array if neccessary (double the size then)
- if (mBulletsPosition >= mBulletsSize)
- {
- // redimension the array
- Bullet **mTempArray = new Bullet*[2*mBulletsSize];
- for (int i = 0; i < mBulletsSize; i++)
- mTempArray[i] = mBullets[i];
- mBulletsSize *= 2;
- delete mBullets;
- mBullets = mTempArray;
- }
-
- // add the bullet to the list
- mBullets[mBulletsPosition++] = mTempBullet;
-
- }
- else if (!ms.buttons)
- leftButtonDown = false;
-
- // space ship steering. This should definitely be done in the steering object
- // Simply give it the mouse movements.
- mShip->mRootNode->pitch(Degree(-ms.Y.rel * 0.13), Ogre::Node::TransformSpace::TS_LOCAL);
- mShip->mRootNode->yaw(Degree(-ms.X.rel * 0.13), Ogre::Node::TransformSpace::TS_PARENT);
-
- // keep rendering
- return true;
-}
-
-/**
-* Show the debug overlay of desired.
-* @param show Whether or not to show the debug overlay
-*/
-void RunManager::showDebugOverlay(bool show)
-{
- if (mDebugOverlay)
- {
- if (show)
- mDebugOverlay->show();
- else
- mDebugOverlay->hide();
- }
-}
-
-
-/**
-* Show stats (e.g. FPS) in the left lower corner of the screen.
-* Copied from the ExampleFrameListener.h in the Ogre SDK
-*/
-void RunManager::updateStats(void)
-{
- static String currFps = "Current FPS: ";
- static String avgFps = "Average FPS: ";
- static String bestFps = "Best FPS: ";
- static String worstFps = "Worst FPS: ";
- static String tris = "Triangle Count: ";
- static String batches = "Batch Count: ";
-
- // update stats when necessary
- try {
- OverlayElement* guiAvg = OverlayManager::getSingleton()
- .getOverlayElement("Core/AverageFps");
- OverlayElement* guiCurr = OverlayManager::getSingleton()
- .getOverlayElement("Core/CurrFps");
- OverlayElement* guiBest = OverlayManager::getSingleton()
- .getOverlayElement("Core/BestFps");
- OverlayElement* guiWorst = OverlayManager::getSingleton()
- .getOverlayElement("Core/WorstFps");
-
- const RenderTarget::FrameStats& stats = mWindow->getStatistics();
- guiAvg->setCaption(avgFps + StringConverter::toString(stats.avgFPS));
- guiCurr->setCaption(currFps + StringConverter::toString(stats.lastFPS));
- guiBest->setCaption(bestFps + StringConverter::toString(stats.bestFPS)
- +" "+StringConverter::toString(stats.bestFrameTime)+" ms");
- guiWorst->setCaption(worstFps + StringConverter::toString(stats.worstFPS)
- +" "+StringConverter::toString(stats.worstFrameTime)+" ms");
-
- OverlayElement* guiTris = OverlayManager::getSingleton()
- .getOverlayElement("Core/NumTris");
- guiTris->setCaption(tris + StringConverter::toString(stats.triangleCount));
-
- OverlayElement* guiBatches = OverlayManager::getSingleton()
- .getOverlayElement("Core/NumBatches");
- guiBatches->setCaption(batches
- + StringConverter::toString(stats.batchCount));
-
- OverlayElement* guiDbg = OverlayManager::getSingleton()
- .getOverlayElement("Core/DebugText");
- guiDbg->setCaption(mDebugText);
- }
- catch(...) { /* ignore */ }
-}
-
-
-
-/**
-* Simple camera creator.
-* mShipNode->attachObject(mCamera) should no be here! This is what the camera
-* manager is for. Right now, this method should do just fine, setting the
-* cam behind the ship.
-*/
-void RunManager::createCamera(void)
-{
- mCamera = mSceneMgr->createCamera("PlayerCam");
- mShipNode->attachObject(mCamera);
- mCamera->setNearClipDistance(5);
- mCamera->setPosition(Vector3(0,10,500));
- mCamera->lookAt(Vector3(0,0,0));
-}
-
-/**
-* Simple viewport creator.
-* TODO: fully understand the concept of viewports concerning orxnox.
-* E.g. do we need splitscreen mode?
-* For now the viewport uses the entire render window and is based on the one
-* camera created so far.
-*/
-void RunManager::createViewports(void)
-{
- // Create one viewport, entire window
- Viewport* vp = mWindow->addViewport(mCamera);
- vp->setBackgroundColour(ColourValue(0,0,0));
-
- // Alter the camera aspect ratio to match the viewport
- mCamera->setAspectRatio(
- Real(vp->getActualWidth()) / Real(vp->getActualHeight()));
-}
-
-
Index: de/branches/main_reto/src/WeaponManager.cpp
===================================================================
--- /code/branches/main_reto/src/WeaponManager.cpp (revision 145)
+++ (revision )
@@ -1,38 +1,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- *
- *
- * License notice:
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- *
- * Author:
- * Reto Grieder
- * Co-authors:
- * ...
- *
- */
-
-#include "WeaponManager.h"
-
-WeaponManager::WeaponManager(SceneManager *mSceneMgr)
-{
-
-}
-
-
-WeaponManager::~WeaponManager()
-{
-}
Index: /code/branches/main_reto/src/bullet.cc
===================================================================
--- /code/branches/main_reto/src/bullet.cc (revision 146)
+++ /code/branches/main_reto/src/bullet.cc (revision 146)
@@ -0,0 +1,40 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ * License notice:
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "bullet.h"
+
+
+Bullet::Bullet(SceneNode *mNode, Entity *mEntity, Vector3 mSpeed)
+ : mNode(mNode), mEntity(mEntity), mSpeed(mSpeed)
+{
+ mNode->attachObject(mEntity);
+}
+
+
+Bullet::~Bullet()
+{
+}
Index: /code/branches/main_reto/src/camera_manager.cc
===================================================================
--- /code/branches/main_reto/src/camera_manager.cc (revision 146)
+++ /code/branches/main_reto/src/camera_manager.cc (revision 146)
@@ -0,0 +1,44 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ * License notice:
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "camera_manager.h"
+
+
+CameraManager::CameraManager(SceneManager *mScene) : mSceneMgr(mSceneMgr)
+{
+}
+
+
+CameraManager::~CameraManager()
+{
+}
+
+
+bool CameraManager::setCameraPosition(int n)
+{
+ return true;
+}
Index: /code/branches/main_reto/src/main.cc
===================================================================
--- /code/branches/main_reto/src/main.cc (revision 146)
+++ /code/branches/main_reto/src/main.cc (revision 146)
@@ -0,0 +1,66 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ * License notice:
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+
+
+#include "orxonox.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
+#define WIN32_LEAN_AND_MEAN
+#include "windows.h"
+ INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT)
+#else
+ int main(int argc, char **argv)
+#endif
+ {
+ try {
+ // create an orxonox aplication and run it
+ Orxonox myApp;
+
+ myApp.go();
+ }
+ catch (Ogre::Exception& e) {
+#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
+ MessageBoxA(NULL, e.getFullDescription().c_str(),
+ "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
+#else
+ std::cerr << "Exception:\n";
+ std::cerr << e.getFullDescription().c_str() << "\n";
+#endif
+ return 1;
+ }
+
+ return 0;
+ }
+
+#ifdef __cplusplus
+}
+#endif
Index: de/branches/main_reto/src/main.cpp
===================================================================
--- /code/branches/main_reto/src/main.cpp (revision 145)
+++ (revision )
@@ -1,66 +1,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- *
- *
- * License notice:
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- *
- * Author:
- * Reto Grieder
- * Co-authors:
- * ...
- *
- */
-
-
-
-#include "Orxonox.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
-#define WIN32_LEAN_AND_MEAN
-#include "windows.h"
- INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT)
-#else
- int main(int argc, char **argv)
-#endif
- {
- try {
- // create an orxonox aplication and run it
- Orxonox myApp;
-
- myApp.go();
- }
- catch (Ogre::Exception& e) {
-#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
- MessageBoxA(NULL, e.getFullDescription().c_str(),
- "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
-#else
- std::cerr << "Exception:\n";
- std::cerr << e.getFullDescription().c_str() << "\n";
-#endif
- return 1;
- }
-
- return 0;
- }
-
-#ifdef __cplusplus
-}
-#endif
Index: /code/branches/main_reto/src/ogre_control.cc
===================================================================
--- /code/branches/main_reto/src/ogre_control.cc (revision 146)
+++ /code/branches/main_reto/src/ogre_control.cc (revision 146)
@@ -0,0 +1,171 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ * License notice:
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "ogre_control.h"
+
+
+#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+// This function will locate the path to our application on OS X,
+// unlike windows you can not rely on the curent working directory
+// for locating your configuration files and resources.
+std::string macBundlePath()
+{
+ char path[1024];
+ CFBundleRef mainBundle = CFBundleGetMainBundle();
+ assert(mainBundle);
+
+ CFURLRef mainBundleURL = CFBundleCopyBundleURL(mainBundle);
+ assert(mainBundleURL);
+
+ CFStringRef cfStringRef =
+ CFURLCopyFileSystemPath( mainBundleURL, kCFURLPOSIXPathStyle);
+ assert(cfStringRef);
+
+ CFStringGetCString(cfStringRef, path, 1024, kCFStringEncodingASCII);
+
+ CFRelease(mainBundleURL);
+ CFRelease(cfStringRef);
+
+ return std::string(path);
+}
+#endif
+
+
+OgreControl::OgreControl()
+{
+ mRoot = 0;
+ // Provide a nice cross platform solution for locating the configuration
+ // files. On windows files are searched for in the current working
+ // directory, on OS X however you must provide the full path, the helper
+ // function macBundlePath does this for us.
+#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+ mResourcePath = macBundlePath() + "/Contents/Resources/";
+#else
+ mResourcePath = "";
+#endif
+}
+
+
+// standard destructor
+OgreControl::~OgreControl()
+{
+ if (mRoot)
+ delete mRoot;
+}
+
+
+/**------------- SETTING UP OGRE --------------**/
+
+bool OgreControl::initialise(void)
+{
+ String pluginsPath;
+ // only use plugins.cfg if not static
+#ifndef OGRE_STATIC_LIB
+ pluginsPath = mResourcePath + "plugins.cfg";
+#endif
+
+ mRoot = new Root(pluginsPath,
+ mResourcePath + "ogre.cfg", mResourcePath + "Ogre.log");
+
+ setupResources();
+
+ if (!configure())
+ return false;
+
+ return true;
+}
+
+
+// Method which will define the source of resources
+// (other than current folder)
+void OgreControl::setupResources(void)
+{
+ // Load resource paths from config file
+ ConfigFile cf;
+ cf.load(mResourcePath + "resources.cfg");
+
+ // Go through all sections & settings in the file
+ ConfigFile::SectionIterator seci = cf.getSectionIterator();
+
+ String secName, typeName, archName;
+ while (seci.hasMoreElements())
+ {
+ secName = seci.peekNextKey();
+ ConfigFile::SettingsMultiMap *settings = seci.getNext();
+ ConfigFile::SettingsMultiMap::iterator i;
+ for (i = settings->begin(); i != settings->end(); ++i)
+ {
+ typeName = i->first;
+ archName = i->second;
+#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+ // OS X does not set the working directory relative to the app,
+ // In order to make things portable on OS X we need to provide
+ // the loading with it's own bundle path location
+ ResourceGroupManager::getSingleton().addResourceLocation(
+ String(macBundlePath() + "/" + archName), typeName, secName);
+#else
+ ResourceGroupManager::getSingleton().addResourceLocation(
+ archName, typeName, secName);
+#endif
+ }
+ }
+}
+
+
+bool OgreControl::configure(void)
+{
+ // Show the configuration dialog and initialise the system
+ // You can skip this and use root.restoreConfig() to load configuration
+ // settings if you were sure there are valid ones saved in ogre.cfg
+ if(!mRoot->restoreConfig() && !mRoot->showConfigDialog())
+ return false;
+
+ // user clicked OK so initialise
+ // Here we choose to let the system create a default
+ // rendering window by passing 'true'
+ mWindow = mRoot->initialise(true);
+ mRoot->saveConfig();
+ return true;
+}
+
+
+Root* OgreControl::getRoot(void)
+{
+ return mRoot;
+}
+
+
+RenderWindow* OgreControl::getRenderWindow(void)
+{
+ return mWindow;
+}
+
+
+Ogre::String OgreControl::getResourcePath(void)
+{
+ return mResourcePath;
+}
Index: /code/branches/main_reto/src/orxonox.cc
===================================================================
--- /code/branches/main_reto/src/orxonox.cc (revision 146)
+++ /code/branches/main_reto/src/orxonox.cc (revision 146)
@@ -0,0 +1,79 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ * License notice:
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+
+#include "orxonox.h"
+
+
+void Orxonox::go(void)
+{
+ if (!setup())
+ return;
+
+ mTimer = new Timer();
+
+ unsigned long lastTime = mTimer->getMilliseconds();
+
+ while (true)
+ {
+ //Pump messages in all registered RenderWindow windows
+ WindowEventUtilities::messagePump();
+
+ mOgre->getRoot()->renderOneFrame();
+
+ if (!mRunMgr->tick(mTimer->getMilliseconds(),
+ (mTimer->getMilliseconds() - lastTime) / 1000.0))
+ break;
+ lastTime = mTimer->getMilliseconds();
+ }
+
+ // clean up
+ destroy();
+}
+
+
+bool Orxonox::setup(void)
+{
+ // create new 3D ogre render engine
+ mOgre = new OgreControl();
+ mOgre->initialise();
+
+ mRunMgr = new RunManager(mOgre);
+
+ return true;
+}
+
+
+void Orxonox::destroy()
+{
+ if (mTimer)
+ delete mTimer;
+ if (mRunMgr)
+ delete mRunMgr;
+ if (mOgre)
+ delete mOgre;
+}
Index: /code/branches/main_reto/src/orxonox_scene.cc
===================================================================
--- /code/branches/main_reto/src/orxonox_scene.cc (revision 146)
+++ /code/branches/main_reto/src/orxonox_scene.cc (revision 146)
@@ -0,0 +1,114 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ * License notice:
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "orxonox_scene.h"
+
+
+OrxonoxScene::OrxonoxScene(SceneManager *mSceneMgr) : mSceneMgr(mSceneMgr)
+{
+}
+
+
+OrxonoxScene::~OrxonoxScene()
+{
+}
+
+
+bool OrxonoxScene::initialise()
+{
+ // Load resources
+ loadResources();
+
+ distance = 0;
+ radius = 100;
+
+ createScene();
+
+ return true;
+}
+
+
+// method where you can perform resource group loading
+// Must at least do
+// ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
+void OrxonoxScene::loadResources(void)
+{
+ // Initialise, parse scripts etc
+ ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
+}
+
+
+// Currently just a test scene with an ogre head an a surrounding light
+void OrxonoxScene::createScene(void)
+{
+ mSceneMgr->setAmbientLight(ColourValue(0.3,0.3,0.3));
+
+ //create first entity
+ Entity *head = mSceneMgr->createEntity("head", "ogrehead.mesh");
+
+ //create a scene node to attach the head to
+ SceneNode *node = mSceneMgr->getRootSceneNode()
+ ->createChildSceneNode("OgreHeadNode", Vector3(0,0,0));
+ //attach the ogre head
+ node->attachObject(head);
+
+ // set up skybox
+ mSceneMgr->setSkyBox(true, "Examples/SceneSkyBox2");
+
+ // set up one mLight source
+ mLight = mSceneMgr->createLight("Light1");
+ mLight->setType(Light::LT_POINT);
+ mLight->setPosition(Vector3(0, 0, 0));
+ mLight->setDiffuseColour(1.0, 1.0, 1.0);
+ mLight->setSpecularColour(1.0, 1.0, 1.0);
+
+ //create billboard
+ bbs = mSceneMgr->createBillboardSet("bb", 1);
+ bbs->createBillboard(Vector3::ZERO, ColourValue(1.0, 1.0, 1.0));
+ bbs->setMaterialName("Examples/Flare");
+
+ lightNode = mSceneMgr->getRootSceneNode()
+ ->createChildSceneNode("LightNode", Vector3(0, 100, 0));
+
+ lightNode->attachObject(bbs);
+ lightNode->attachObject(mLight);
+}
+
+
+// compute something between frames if neccessary
+void OrxonoxScene::tick(unsigned long time, float deltaTime)
+{
+ float t = time/1000.0;
+
+ lightNode->setPosition(radius*sin(5*t), radius*cos(5*t), sin(1*t)*distance);
+
+ mLight->setDiffuseColour(sin(1*t), sin(1*t + 2.09), sin(1*t + 2.09*2));
+ mLight->setSpecularColour(sin(1*t), sin(1*t + 2.09), sin(1*t + 2.09*2));
+
+ bbs->getBillboard(0)->setColour(ColourValue(sin(1*t),
+ sin(1*t + 2.09), sin(1*t + 2.09*2)));
+}
Index: /code/branches/main_reto/src/orxonox_ship.cc
===================================================================
--- /code/branches/main_reto/src/orxonox_ship.cc (revision 146)
+++ /code/branches/main_reto/src/orxonox_ship.cc (revision 146)
@@ -0,0 +1,117 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ * License notice:
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "orxonox_ship.h"
+
+
+OrxonoxShip::OrxonoxShip(SceneManager *mSceneMgr, SceneNode *mNode)
+ : mSceneMgr(mSceneMgr), mRootNode(mNode), speed(Vector3(0, 0, 0)),
+ baseThrust(1000), thrust(0), sideThrust(0), n(0),
+ bulletSpeed(400)
+{
+}
+
+
+OrxonoxShip::~OrxonoxShip()
+{
+}
+
+
+bool OrxonoxShip::initialise()
+{
+ // load all the resources needed (no resource groups yet,
+ // so the allInit is not executed!)
+ // ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
+
+ // create the "space ship" (currently a fish..)
+ // TODO: names must be unique!
+ mShip = mSceneMgr->createEntity("Ship", "fish.mesh");
+ SceneNode *fishNode = mRootNode->createChildSceneNode("fishNode");
+ fishNode->yaw(Degree(-90));
+ fishNode->attachObject(mShip);
+ fishNode->setScale(Vector3(10, 10, 10));
+
+ return true;
+}
+
+
+void OrxonoxShip::setThrust(const Real value)
+{
+ thrust = value * baseThrust;
+}
+
+void OrxonoxShip::setSideThrust(const Real value)
+{
+ sideThrust = value * baseThrust;
+}
+
+void OrxonoxShip::setYaw(const Radian value)
+{
+ mRootNode->yaw(value);
+}
+
+void OrxonoxShip::setPitch(const Radian value)
+{
+ mRootNode->pitch(value);
+}
+
+void OrxonoxShip::setRoll(const Radian value)
+{
+ mRootNode->roll(value);
+}
+
+Real OrxonoxShip::getThrust()
+{
+ return thrust;
+}
+
+Bullet* OrxonoxShip::fire()
+{
+ // TODO: Names must be unique!
+ SceneNode *temp = mRootNode->getParentSceneNode()->createChildSceneNode(
+ "BulletNode" + StringConverter::toString(n));
+ temp->setOrientation(mRootNode->getOrientation());
+ temp->setPosition(mRootNode->getPosition());
+ temp->setScale(Vector3(1, 1, 1) * 10);
+ temp->yaw(Degree(-90));
+ return new Bullet(temp, mSceneMgr->createEntity("bullet"
+ + StringConverter::toString(n++), "Barrel.mesh"), speed
+ + (mRootNode->getLocalAxes() * Vector3(0, 0, -1)).normalisedCopy()
+ * bulletSpeed);
+}
+
+bool OrxonoxShip::tick(unsigned long time, Real deltaTime)
+{
+ Quaternion quad = mRootNode->getOrientation();
+ quad.normalise();
+ speed += quad * Vector3(0, 0, -1) * thrust * deltaTime;
+ speed += quad * Vector3(-1, 0, 0) * sideThrust * deltaTime;
+
+ mRootNode->translate(speed * deltaTime);
+
+ return true;
+}
Index: /code/branches/main_reto/src/run_manager.cc
===================================================================
--- /code/branches/main_reto/src/run_manager.cc (revision 146)
+++ /code/branches/main_reto/src/run_manager.cc (revision 146)
@@ -0,0 +1,539 @@
+/*
+* ORXONOX - the hottest 3D action shooter ever to exist
+*
+*
+* License notice:
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program 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 General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see .
+*
+*
+* Author:
+* Reto Grieder
+* Co-authors:
+* ...
+*/
+
+/**
+* RunManager is the basic control object during the game.
+*
+* The RunManger class is designed to actually "run" the main part of the
+* game. The Idea is, that you could derive from the RunManager in order
+* to distinguish between a first person shooter or a space craft shooter.
+* RunManager loads and initialises everything in the scene (like the ship,
+* the enemies in the scene, any scripts, the physics, window events,
+* environment, HUD, etc.).
+* It also captures any input from keyboard, mous, joystick (optional) or
+* Ogre (window events).
+*/
+
+#include "run_manager.h"
+
+
+/**
+* Contructor only needs the render window and the Root object which are both
+* the OgreControl object.
+* Right now the constructor does all the initialisation work. This could also
+* be done in a new method "initialize()", for whatever purpose.
+*
+*
+* @param mOgre The OgreControl object holding the render window and the Root
+*/
+RunManager::RunManager(OgreControl * mOgre, bool bufferedKeys,
+ bool bufferedMouse, bool bufferedJoy )
+ : mOgre(mOgre), mWindow(mOgre->getRenderWindow()), leftButtonDown(false),
+ mStatsOn(true), mNumScreenShots(0), mTimeUntilNextToggle(0),
+ mFiltering(TFO_BILINEAR), mAniso(1), mSceneDetailIndex(0),
+ mDebugOverlay(0), mInputManager(0), mMouse(0), mKeyboard(0), mJoy(0)
+{
+
+ // SETTING UP THE SCENE
+
+ // create one new SceneManger
+ mSceneMgr = mOgre->getRoot()->createSceneManager(ST_GENERIC, "mScene");
+
+ // background scene (world objects, skybox, lights, etc.)
+ mScene = new OrxonoxScene(mSceneMgr);
+
+ // PLAYER SPACESHIP
+
+ // create a steerable SceneNode (not derived!) object. The idea is that this
+ // object only receives the mouse and the keyboard input (not specifi keys,
+ // more like up, down, left, right, roll left, roll right, move down,
+ // move up). The steering class can then decide how to control the node for
+ // the spaceship. This gives a certain flexibility.
+ // It should also be considered, that this class should provide another Node
+ // for a camera to be attached (otherwise the spaceship in front of the
+ // would be very static, never moving at all.
+ mShipNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("ShipNode",
+ Vector3(20, 20, 20));
+
+ // Construct a new spaceship and attach it to the node
+ mShip = new OrxonoxShip(mSceneMgr, mShipNode);
+
+
+ // RESOURCE LOADING (using ResourceGroups if implemented)
+
+ // load all resources and create the entities by calling the initialise()
+ // methods for each object (don't initialise in the constructor!).
+ mScene->initialise();
+ mShip->initialise();
+
+
+ // CAMERA AND VIEWPORT
+ // TODO: create a camera manager. It should be able to change its position
+ // around the space ship (predefined states would be nice too). And it should
+ // also be able to switch between different locations (like ship, spactator,
+ // certain fixed positions (e.g. finish line, etc.)). These are just ideas.
+
+ // create camera and viewport
+ createCamera();
+ createViewports();
+
+
+ // Set default mipmap level (NB some APIs ignore this)
+ TextureManager::getSingleton().setDefaultNumMipmaps(5);
+
+
+ // BULLET LIST FOR THE TEST APPLICATION
+
+ // TODO: Use STL to make life easier. But it works this way too..
+ mBullets = new Bullet*[10];
+ mBulletsPosition = 0;
+ mBulletsSize = 10;
+
+
+ // HUMAN INTERFACE
+
+ using namespace OIS;
+
+ mDebugOverlay = OverlayManager::getSingleton()
+ .getByName("Core/DebugOverlay");
+
+ LogManager::getSingletonPtr()->logMessage("*** Initializing OIS ***");
+ ParamList pl;
+ size_t windowHnd = 0;
+ std::ostringstream windowHndStr;
+
+ mWindow->getCustomAttribute("WINDOW", &windowHnd);
+ windowHndStr << windowHnd;
+ pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
+
+ mInputManager = InputManager::createInputSystem( pl );
+
+ // Create all devices (We only catch joystick exceptions here,
+ // as, most people have Key/Mouse)
+ mKeyboard = static_cast(mInputManager
+ ->createInputObject( OISKeyboard, bufferedKeys ));
+ mMouse = static_cast(mInputManager
+ ->createInputObject( OISMouse, bufferedMouse ));
+ try {
+ mJoy = static_cast(mInputManager
+ ->createInputObject( OISJoyStick, bufferedJoy ));
+ }
+ catch(...) {
+ mJoy = 0;
+ }
+
+ //Set initial mouse clipping size
+ windowResized(mWindow);
+
+ showDebugOverlay(true);
+
+ // REGISTER THIS OBJECT AS A WINDOW EVENT LISTENER IN OGRE
+ // It will then receive events liek windowClosed, windowResized, etc.
+ WindowEventUtilities::addWindowEventListener(mWindow, this);
+}
+
+/**
+* Standard destructor.
+* Removes this object as a window event listener and deletes all created
+* variables.
+*/
+RunManager::~RunManager()
+{
+ //Remove ourself as a Window listener
+ WindowEventUtilities::removeWindowEventListener(mWindow, this);
+ windowClosed(mWindow);
+
+ if (mScene)
+ delete mScene;
+ if (mShip)
+ delete mShip;
+
+ // clean up the bullet list
+ for (int i = 0; i < mBulletsPosition; i++)
+ delete mBullets[i];
+ delete mBullets;
+}
+
+
+/**
+* Method to compute anyting between 2 frames.
+*
+* Everything that needs to be computed during the games happens right here.
+* The only exception are the listeners (which should only set variables,
+* not actually do something).
+*
+* @param time Absolute play time
+* @param deltaTime Time passed since last frame
+* @return Return false to end rendering
+*/
+bool RunManager::tick(unsigned long time, float deltaTime)
+{
+ // synchronize with internal class timer
+ mTime = time;
+
+ // Call tick() for every object
+ // This could be done by registering (needs a factory..)
+ mScene->tick(time, deltaTime);
+ mShip->tick(time, deltaTime);
+
+
+ // Update the 'HUD'
+ updateStats();
+
+ // update the bullet positions
+ for (int i = 0; i < mBulletsPosition; i++)
+ {
+ mBullets[i]->mNode->translate(mBullets[i]->mSpeed*deltaTime);
+ mBullets[i]->mNode->yaw(Degree(deltaTime*100));
+ mBullets[i]->mNode->roll(Degree(deltaTime*300));
+ }
+
+ // HUMAN INTERFACE
+
+ using namespace OIS;
+
+ if(mWindow->isClosed()) return false;
+
+ //Need to capture/update each device
+ mKeyboard->capture();
+ mMouse->capture();
+ if( mJoy ) mJoy->capture();
+
+ bool buffJ = (mJoy) ? mJoy->buffered() : true;
+
+ //Check if one of the devices is not buffered
+ if( !mMouse->buffered() || !mKeyboard->buffered() || !buffJ )
+ {
+ // one of the input modes is immediate, so setup what
+ // is needed for immediate movement
+ if (mTimeUntilNextToggle >= 0)
+ mTimeUntilNextToggle -= deltaTime;
+ }
+
+ //Check to see which device is not buffered, and handle it
+ if( !mKeyboard->buffered() )
+ if( processUnbufferedKeyInput() == false )
+ return false;
+ if( !mMouse->buffered() )
+ if( processUnbufferedMouseInput() == false )
+ return false;
+
+ // keep rendering
+ return true;
+}
+
+
+/**
+* Adjust mouse clipping area.
+* This method is called by Ogre without regards of tick()!
+* Avoid doing too much in this call.
+* @param rw render window
+*/
+void RunManager::windowResized(RenderWindow* rw)
+{
+ unsigned int width, height, depth;
+ int left, top;
+ rw->getMetrics(width, height, depth, left, top);
+
+ const OIS::MouseState &ms = mMouse->getMouseState();
+ ms.width = width;
+ ms.height = height;
+}
+
+
+/**
+* Unattach OIS before window shutdown (very important under Linux).
+* Again, avoid computing a lot in this function.
+* @param rw Render Window
+*/
+void RunManager::windowClosed(RenderWindow* rw)
+{
+ //Only close for window that created OIS (the main window in these demos)
+ if( rw == mWindow )
+ {
+ if( mInputManager )
+ {
+ mInputManager->destroyInputObject( mMouse );
+ mInputManager->destroyInputObject( mKeyboard );
+ mInputManager->destroyInputObject( mJoy );
+
+ OIS::InputManager::destroyInputSystem(mInputManager);
+ mInputManager = 0;
+ }
+ }
+}
+
+/**
+* Processes the Keyboard input.
+* TODO: Use listeners to improve performance.
+* A lookup table should be implemented to bind any key to a specific action.
+* @return Return true to keep rendering
+*/
+bool RunManager::processUnbufferedKeyInput()
+{
+ using namespace OIS;
+
+ if(mKeyboard->isKeyDown(KC_A) || mKeyboard->isKeyDown(KC_LEFT))
+ mShip->setSideThrust(1);
+ else if(mKeyboard->isKeyDown(KC_D) || mKeyboard->isKeyDown(KC_RIGHT))
+ mShip->setSideThrust(-1);
+ else
+ mShip->setSideThrust(0);
+
+ if(mKeyboard->isKeyDown(KC_UP) || mKeyboard->isKeyDown(KC_W) )
+ mShip->setThrust(1);
+ else if(mKeyboard->isKeyDown(KC_DOWN) || mKeyboard->isKeyDown(KC_S) )
+ mShip->setThrust(-1);
+ else
+ mShip->setThrust(0);
+
+ if( mKeyboard->isKeyDown(KC_ESCAPE) || mKeyboard->isKeyDown(KC_Q) )
+ return false;
+
+ if( mKeyboard->isKeyDown(KC_F) && mTimeUntilNextToggle <= 0 )
+ {
+ mStatsOn = !mStatsOn;
+ showDebugOverlay(mStatsOn);
+ mTimeUntilNextToggle = 1;
+ }
+
+ if( mKeyboard->isKeyDown(KC_T) && mTimeUntilNextToggle <= 0 )
+ {
+ switch(mFiltering)
+ {
+ case TFO_BILINEAR:
+ mFiltering = TFO_TRILINEAR;
+ mAniso = 1;
+ break;
+ case TFO_TRILINEAR:
+ mFiltering = TFO_ANISOTROPIC;
+ mAniso = 8;
+ break;
+ case TFO_ANISOTROPIC:
+ mFiltering = TFO_BILINEAR;
+ mAniso = 1;
+ break;
+ default: break;
+ }
+ MaterialManager::getSingleton().setDefaultTextureFiltering(mFiltering);
+ MaterialManager::getSingleton().setDefaultAnisotropy(mAniso);
+
+ showDebugOverlay(mStatsOn);
+ mTimeUntilNextToggle = 1;
+ }
+
+ if(mKeyboard->isKeyDown(KC_SYSRQ) && mTimeUntilNextToggle <= 0)
+ {
+ std::ostringstream ss;
+ ss << "screenshot_" << ++mNumScreenShots << ".png";
+ mWindow->writeContentsToFile(ss.str());
+ mTimeUntilNextToggle = 0.5;
+ mDebugText = "Saved: " + ss.str();
+ }
+
+ if(mKeyboard->isKeyDown(KC_R) && mTimeUntilNextToggle <=0)
+ {
+ mSceneDetailIndex = (mSceneDetailIndex+1)%3 ;
+ switch(mSceneDetailIndex) {
+ case 0 : mCamera->setPolygonMode(PM_SOLID); break;
+ case 1 : mCamera->setPolygonMode(PM_WIREFRAME); break;
+ case 2 : mCamera->setPolygonMode(PM_POINTS); break;
+ }
+ mTimeUntilNextToggle = 0.5;
+ }
+
+ static bool displayCameraDetails = false;
+ if(mKeyboard->isKeyDown(KC_P) && mTimeUntilNextToggle <= 0)
+ {
+ displayCameraDetails = !displayCameraDetails;
+ mTimeUntilNextToggle = 0.5;
+ if (!displayCameraDetails)
+ mDebugText = "";
+ }
+
+ // Print camera details
+ if(displayCameraDetails)
+ mDebugText = StringConverter::toString(mShip->getThrust())
+ + " | Speed = " + StringConverter::toString(mShip->speed);
+ // mDebugText = "P: " + StringConverter::toString(mCamera
+ // ->getDerivedPosition()) + " " + "O: "
+ // + StringConverter::toString(mCamera->getDerivedOrientation());
+
+ // Return true to continue rendering
+ return true;
+}
+
+
+/**
+* Processes the Mouse input.
+* TODO: Use listeners to improve performance.
+* A lookup table should be implemented to bind ANY button or movement
+* to a specific action.
+* @return Return true to keep rendering
+*/
+bool RunManager::processUnbufferedMouseInput()
+{
+ using namespace OIS;
+
+ const MouseState &ms = mMouse->getMouseState();
+
+ // This is a 'hack' to show some flying barrels..
+ // Usually, the Bullet created by the ship should be managed
+ // by the physics engine..
+ if (ms.buttonDown(MB_Left) && !leftButtonDown)
+ {
+ // Prevent continuous fire for the moment.
+ leftButtonDown = true;
+
+ // let ship fire one shot with its only weapon (Barrels..)
+ Bullet *mTempBullet = mShip->fire();
+
+ // resize array if neccessary (double the size then)
+ if (mBulletsPosition >= mBulletsSize)
+ {
+ // redimension the array
+ Bullet **mTempArray = new Bullet*[2*mBulletsSize];
+ for (int i = 0; i < mBulletsSize; i++)
+ mTempArray[i] = mBullets[i];
+ mBulletsSize *= 2;
+ delete mBullets;
+ mBullets = mTempArray;
+ }
+
+ // add the bullet to the list
+ mBullets[mBulletsPosition++] = mTempBullet;
+
+ }
+ else if (!ms.buttons)
+ leftButtonDown = false;
+
+ // space ship steering. This should definitely be done in the steering object
+ // Simply give it the mouse movements.
+ mShip->mRootNode->pitch(Degree(-ms.Y.rel * 0.13), Ogre::Node::TransformSpace::TS_LOCAL);
+ mShip->mRootNode->yaw(Degree(-ms.X.rel * 0.13), Ogre::Node::TransformSpace::TS_PARENT);
+
+ // keep rendering
+ return true;
+}
+
+/**
+* Show the debug overlay of desired.
+* @param show Whether or not to show the debug overlay
+*/
+void RunManager::showDebugOverlay(bool show)
+{
+ if (mDebugOverlay)
+ {
+ if (show)
+ mDebugOverlay->show();
+ else
+ mDebugOverlay->hide();
+ }
+}
+
+
+/**
+* Show stats (e.g. FPS) in the left lower corner of the screen.
+* Copied from the ExampleFrameListener.h in the Ogre SDK
+*/
+void RunManager::updateStats(void)
+{
+ static String currFps = "Current FPS: ";
+ static String avgFps = "Average FPS: ";
+ static String bestFps = "Best FPS: ";
+ static String worstFps = "Worst FPS: ";
+ static String tris = "Triangle Count: ";
+ static String batches = "Batch Count: ";
+
+ // update stats when necessary
+ try {
+ OverlayElement* guiAvg = OverlayManager::getSingleton()
+ .getOverlayElement("Core/AverageFps");
+ OverlayElement* guiCurr = OverlayManager::getSingleton()
+ .getOverlayElement("Core/CurrFps");
+ OverlayElement* guiBest = OverlayManager::getSingleton()
+ .getOverlayElement("Core/BestFps");
+ OverlayElement* guiWorst = OverlayManager::getSingleton()
+ .getOverlayElement("Core/WorstFps");
+
+ const RenderTarget::FrameStats& stats = mWindow->getStatistics();
+ guiAvg->setCaption(avgFps + StringConverter::toString(stats.avgFPS));
+ guiCurr->setCaption(currFps + StringConverter::toString(stats.lastFPS));
+ guiBest->setCaption(bestFps + StringConverter::toString(stats.bestFPS)
+ +" "+StringConverter::toString(stats.bestFrameTime)+" ms");
+ guiWorst->setCaption(worstFps + StringConverter::toString(stats.worstFPS)
+ +" "+StringConverter::toString(stats.worstFrameTime)+" ms");
+
+ OverlayElement* guiTris = OverlayManager::getSingleton()
+ .getOverlayElement("Core/NumTris");
+ guiTris->setCaption(tris + StringConverter::toString(stats.triangleCount));
+
+ OverlayElement* guiBatches = OverlayManager::getSingleton()
+ .getOverlayElement("Core/NumBatches");
+ guiBatches->setCaption(batches
+ + StringConverter::toString(stats.batchCount));
+
+ OverlayElement* guiDbg = OverlayManager::getSingleton()
+ .getOverlayElement("Core/DebugText");
+ guiDbg->setCaption(mDebugText);
+ }
+ catch(...) { /* ignore */ }
+}
+
+
+
+/**
+* Simple camera creator.
+* mShipNode->attachObject(mCamera) should no be here! This is what the camera
+* manager is for. Right now, this method should do just fine, setting the
+* cam behind the ship.
+*/
+void RunManager::createCamera(void)
+{
+ mCamera = mSceneMgr->createCamera("PlayerCam");
+ mShipNode->attachObject(mCamera);
+ mCamera->setNearClipDistance(5);
+ mCamera->setPosition(Vector3(0,10,500));
+ mCamera->lookAt(Vector3(0,0,0));
+}
+
+/**
+* Simple viewport creator.
+* TODO: fully understand the concept of viewports concerning orxnox.
+* E.g. do we need splitscreen mode?
+* For now the viewport uses the entire render window and is based on the one
+* camera created so far.
+*/
+void RunManager::createViewports(void)
+{
+ // Create one viewport, entire window
+ Viewport* vp = mWindow->addViewport(mCamera);
+ vp->setBackgroundColour(ColourValue(0,0,0));
+
+ // Alter the camera aspect ratio to match the viewport
+ mCamera->setAspectRatio(
+ Real(vp->getActualWidth()) / Real(vp->getActualHeight()));
+}
Index: /code/branches/main_reto/src/weapon_manager.cc
===================================================================
--- /code/branches/main_reto/src/weapon_manager.cc (revision 146)
+++ /code/branches/main_reto/src/weapon_manager.cc (revision 146)
@@ -0,0 +1,38 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ *
+ *
+ * License notice:
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "weapon_manager.h"
+
+WeaponManager::WeaponManager(SceneManager *mSceneMgr)
+{
+
+}
+
+
+WeaponManager::~WeaponManager()
+{
+}
Index: /code/branches/main_reto/weapon_framework/weapon_framework.vcproj
===================================================================
--- /code/branches/main_reto/weapon_framework/weapon_framework.vcproj (revision 145)
+++ /code/branches/main_reto/weapon_framework/weapon_framework.vcproj (revision 146)
@@ -184,37 +184,37 @@
>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -226,33 +226,33 @@
>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+