Revision: 1752
          http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=1752&view=rev
Author:   rorthomas
Date:     2011-03-13 00:42:35 +0000 (Sun, 13 Mar 2011)

Log Message:
-----------
editor compiling again :)

Modified Paths:
--------------
    trunk/source/main/framework/AdvancedOgreFramework.cpp
    trunk/source/main/framework/AdvancedOgreFramework.h
    trunk/source/main/framework/AppStateManager.cpp
    trunk/source/main/framework/AppStateManager.h
    trunk/source/main/gameplay/RoRFrameListener.cpp
    trunk/source/main/main_editor/CMakeLists.txt
    trunk/source/main/main_editor/RoREditor.cpp
    trunk/source/main/main_editor/RoREditor.h
    trunk/source/main/main_editor/icon.rc
    trunk/source/main/main_editor/main.cpp
    trunk/source/main/main_editor/main.h
    trunk/source/main/main_editor/panel_meshprop.h
    trunk/source/main/main_editor/panel_meshtree.h
    trunk/source/main/main_sim/CMakeLists.txt

Added Paths:
-----------
    trunk/source/main/gameplay/RigsOfRods.cpp
    trunk/source/main/gameplay/RigsOfRods.h

Removed Paths:
-------------
    trunk/source/main/main_sim/RigsOfRods.cpp
    trunk/source/main/main_sim/RigsOfRods.h

Modified: trunk/source/main/framework/AdvancedOgreFramework.cpp
===================================================================
--- trunk/source/main/framework/AdvancedOgreFramework.cpp       2011-03-11 
22:59:32 UTC (rev 1751)
+++ trunk/source/main/framework/AdvancedOgreFramework.cpp       2011-03-13 
00:42:35 UTC (rev 1752)
@@ -148,7 +148,30 @@
     return true;
 }
 
-void OgreFramework::updateOgre(double timeSinceLastFrame)
+void OgreFramework::updateOgre(Real timeSinceLastFrame)
 {
+       if(m_pRoot)
+               m_pRoot->renderOneFrame(timeSinceLastFrame);
 }
-//|||||||||||||||||||||||||||||||||||||||||||||||
\ No newline at end of file
+
+void OgreFramework::resized(Ogre::Vector2 size)
+{
+       if(m_pRenderWnd)
+       {
+               m_pRenderWnd->resize(size.x, size.y);
+
+               // Letting Ogre know the window has been resized;
+               m_pRenderWnd->windowMovedOrResized();
+       }
+
+       // Set the aspect ratio for the new size
+       if(m_pViewport->getCamera())
+               m_pViewport->getCamera()->setAspectRatio(Ogre::Real(size.x) / 
Ogre::Real(size.y));
+}
+//|||||||||||||||||||||||||||||||||||||||||||||||
+
+
+
+
+
+

Modified: trunk/source/main/framework/AdvancedOgreFramework.h
===================================================================
--- trunk/source/main/framework/AdvancedOgreFramework.h 2011-03-11 22:59:32 UTC 
(rev 1751)
+++ trunk/source/main/framework/AdvancedOgreFramework.h 2011-03-13 00:42:35 UTC 
(rev 1752)
@@ -30,14 +30,14 @@
        ~OgreFramework();
 
        bool initOgre(Ogre::String name, unsigned int hwnd, unsigned int 
mainhwnd);
-       void updateOgre(double timeSinceLastFrame);
+       void updateOgre(Ogre::Real timeSinceLastFrame);
+    void resized(Ogre::Vector2 size);
 
        Ogre::Root*                                     m_pRoot;
        Ogre::RenderWindow*                     m_pRenderWnd;
        Ogre::Viewport*                         m_pViewport;
        Ogre::Timer*                            m_pTimer;
 
-    //OgreBites::SdkTrayManager*       m_pTrayMgr;
 
        bool isEmbedded(void) { return (hwnd != 0); };
        unsigned int getMainHWND() { return mainhwnd; };

Modified: trunk/source/main/framework/AppStateManager.cpp
===================================================================
--- trunk/source/main/framework/AppStateManager.cpp     2011-03-11 22:59:32 UTC 
(rev 1751)
+++ trunk/source/main/framework/AppStateManager.cpp     2011-03-13 00:42:35 UTC 
(rev 1752)
@@ -68,7 +68,17 @@
 }
 
 //|||||||||||||||||||||||||||||||||||||||||||||||
+void AppStateManager::update(double dt)
+{
+       if(OgreFramework::getSingletonPtr()->m_pRenderWnd->isClosed())
+               m_bShutdown = true;
 
+       m_ActiveStateStack.back()->update(dt);
+
+       OgreFramework::getSingletonPtr()->updateOgre(dt);
+       OgreFramework::getSingletonPtr()->m_pRoot->renderOneFrame();
+}
+
 void AppStateManager::start(AppState* state)
 {
        changeAppState(state);
@@ -78,31 +88,23 @@
 
        while(!m_bShutdown)
        {
-               if(OgreFramework::getSingletonPtr()->m_pRenderWnd->isClosed())
-                       m_bShutdown = true;
-
+               startTime = 
OgreFramework::getSingletonPtr()->m_pTimer->getMillisecondsCPU();
 #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 || OGRE_PLATFORM == 
OGRE_PLATFORM_LINUX
-               Ogre::WindowEventUtilities::messagePump();
+       Ogre::WindowEventUtilities::messagePump();
 #endif
                if(OgreFramework::getSingletonPtr()->m_pRenderWnd->isActive())
                {
-                       startTime = 
OgreFramework::getSingletonPtr()->m_pTimer->getMillisecondsCPU();
-
-                       m_ActiveStateStack.back()->update(timeSinceLastFrame);
-
-                       
OgreFramework::getSingletonPtr()->updateOgre(timeSinceLastFrame);
-                       
OgreFramework::getSingletonPtr()->m_pRoot->renderOneFrame();
-
-                       timeSinceLastFrame = 
OgreFramework::getSingletonPtr()->m_pTimer->getMillisecondsCPU() - startTime;
-               }
-               else
+                       update(timeSinceLastFrame);
+               } else
                {
 #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
-            Sleep(1000);
+                       Sleep(1000);
 #else
-            sleep(1);
+                       sleep(1);
 #endif
                }
+
+               timeSinceLastFrame = 
OgreFramework::getSingletonPtr()->m_pTimer->getMillisecondsCPU() - startTime;
        }
        LOG("Main loop quit");
 }

Modified: trunk/source/main/framework/AppStateManager.h
===================================================================
--- trunk/source/main/framework/AppStateManager.h       2011-03-11 22:59:32 UTC 
(rev 1751)
+++ trunk/source/main/framework/AppStateManager.h       2011-03-13 00:42:35 UTC 
(rev 1752)
@@ -26,6 +26,9 @@
 
        AppState* findByName(Ogre::String stateName);
 
+
+       void update(double dt);
+
        void start(AppState* state);
        void changeAppState(AppState* state);
        bool pushAppState(AppState* state);

Added: trunk/source/main/gameplay/RigsOfRods.cpp
===================================================================
--- trunk/source/main/gameplay/RigsOfRods.cpp                           (rev 0)
+++ trunk/source/main/gameplay/RigsOfRods.cpp   2011-03-13 00:42:35 UTC (rev 
1752)
@@ -0,0 +1,79 @@
+/*
+This source file is part of Rigs of Rods
+Copyright 2005-2011 Pierre-Michel Ricordel
+Copyright 2007-2011 Thomas Fischer
+
+For more information, see http://www.rigsofrods.com/
+
+Rigs of Rods is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License version 3, as 
+published by the Free Software Foundation.
+
+Rigs of Rods 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 Rigs of Rods.  If not, see <http://www.gnu.org/licenses/>.
+*/
+#include "RigsOfRods.h"
+
+#include <Ogre.h>
+
+#include "GameState.h"
+#include "Settings.h"
+#include "ContentManager.h"
+
+using namespace Ogre;
+
+RigsOfRods::RigsOfRods(Ogre::String name, unsigned int hwnd, unsigned int 
mainhwnd) : 
+       stateManager(0),
+       hwnd(hwnd),
+       mainhwnd(mainhwnd),
+       name(name)
+{
+}
+
+RigsOfRods::~RigsOfRods()
+{
+       delete stateManager;
+    delete OgreFramework::getSingletonPtr();
+
+}
+
+void RigsOfRods::go(void)
+{
+       // init ogre
+       new OgreFramework();
+       if(!OgreFramework::getSingletonPtr()->initOgre(name, hwnd, mainhwnd))
+               return;
+
+       // then the base content setup
+       new ContentManager();
+       ContentManager::getSingleton().init();
+
+       // now add the game states
+       stateManager = new AppStateManager();
+
+       GameState::create(stateManager,  "GameState");
+
+       // select the first one
+       if(OgreFramework::getSingleton().isEmbedded())
+       {
+
+               
stateManager->changeAppState(stateManager->findByName("GameState"));
+       } else
+       {
+               stateManager->start(stateManager->findByName("GameState"));
+       }
+
+       
+
+       LOG("Rigs of Rods initialized!");
+}
+
+void RigsOfRods::update(double dt)
+{
+       stateManager->update(dt);
+}
\ No newline at end of file

Added: trunk/source/main/gameplay/RigsOfRods.h
===================================================================
--- trunk/source/main/gameplay/RigsOfRods.h                             (rev 0)
+++ trunk/source/main/gameplay/RigsOfRods.h     2011-03-13 00:42:35 UTC (rev 
1752)
@@ -0,0 +1,50 @@
+/*
+This source file is part of Rigs of Rods
+Copyright 2005-2011 Pierre-Michel Ricordel
+Copyright 2007-2011 Thomas Fischer
+
+For more information, see http://www.rigsofrods.com/
+
+Rigs of Rods is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License version 3, as 
+published by the Free Software Foundation.
+
+Rigs of Rods 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 Rigs of Rods.  If not, see <http://www.gnu.org/licenses/>.
+*/
+/*! @mainpage
+
+       have fun coding :)
+
+       please note that the documentation is work in progress
+*/
+#ifndef RIGSOFRODS_H__
+#define RIGSOFRODS_H__
+
+#include "RoRPrerequisites.h"
+
+#include "AdvancedOgreFramework.h"
+#include "AppStateManager.h"
+
+class RigsOfRods
+{
+public:
+       RigsOfRods(Ogre::String name = Ogre::String("RoR"), unsigned int 
hwnd=0, unsigned int mainhwnd=0);
+       ~RigsOfRods();
+
+       void go();
+       void shutdown(void);
+
+       void update(double dt);
+protected:
+       AppStateManager *stateManager;
+       unsigned int hwnd, mainhwnd;
+       Ogre::String name;
+};
+
+#endif //RIGSOFRODS_H__

Modified: trunk/source/main/gameplay/RoRFrameListener.cpp
===================================================================
--- trunk/source/main/gameplay/RoRFrameListener.cpp     2011-03-11 22:59:32 UTC 
(rev 1751)
+++ trunk/source/main/gameplay/RoRFrameListener.cpp     2011-03-13 00:42:35 UTC 
(rev 1752)
@@ -884,8 +884,11 @@
        LoadingWindow::getInstance();
        SelectorWindow::getInstance();
        // create main menu :D
-       new GUI_MainMenu(this);
-       new GUI_Friction();
+       if(!isEmbedded)
+       {
+               new GUI_MainMenu(this);
+               new GUI_Friction();
+       }
 
        MyGUI::VectorWidgetPtr v = 
MyGUI::LayoutManager::getInstance().loadLayout("wallpaper.layout");
 
@@ -1878,7 +1881,7 @@
        if(ow) ow->update(dt);
 
 #ifdef USE_MYGUI
-       if(GUI_Friction::getSingleton().getVisible() && current_truck >= 0 && 
trucks[current_truck])
+       if(GUI_Friction::getSingletonPtr() && 
GUI_Friction::getSingleton().getVisible() && current_truck >= 0 && 
trucks[current_truck])
        {
                // friction GUI active
                ground_model_t *gm = 
trucks[current_truck]->getLastFuzzyGroundModel();
@@ -3773,7 +3776,8 @@
 
        if(person) person->setCollisions(collisions);
 #ifdef USE_MYGUI
-       GUI_Friction::getSingleton().setCollisions(collisions);
+       if(GUI_Friction::getSingletonPtr())
+               GUI_Friction::getSingleton().setCollisions(collisions);
 #endif //MYGUI
 
        // advanced camera collision tools
@@ -6761,7 +6765,7 @@
        screenWidth = width;
        screenHeight = height;
 
-       ow->windowResized(rw);
+       if(ow) ow->windowResized(rw);
 
        //update mouse area
        INPUTENGINE.windowResized(rw);

Modified: trunk/source/main/main_editor/CMakeLists.txt
===================================================================
--- trunk/source/main/main_editor/CMakeLists.txt        2011-03-11 22:59:32 UTC 
(rev 1751)
+++ trunk/source/main/main_editor/CMakeLists.txt        2011-03-13 00:42:35 UTC 
(rev 1752)
@@ -2,6 +2,7 @@
 
 project(${BINNAME})
 
+
 #setup libraries
 macro(setup_lib name)
    if(ROR_USE_${name})
@@ -111,17 +112,15 @@
 add_sub_dir(network/protocol)
 add_sub_dir(sqlite)
 add_sub_dir(framework)
-add_sub_dir(main_viewer)
+add_sub_dir(main_editor)
 
-
 # find wxWidgets
-SET(wxWidgets_USE_UNICODE ON)
+SET(wxWidgets_USE_UNICODE OFF)
 FIND_PACKAGE(wxWidgets REQUIRED COMPONENTS base core html net adv propgrid aui)
 include_directories(${wxWidgets_INCLUDE_DIRS})
 add_definitions("-D${wxWidgets_DEFINITIONS}" ${wxWidgets_CXX_FLAGS})
 link_directories (${wxWidgets_LIB_DIR})
 
-
 IF(WIN32)
        add_executable(${BINNAME} WIN32 ${headers} ${sources} icon.rc)
 ELSE(WIN32)

Modified: trunk/source/main/main_editor/RoREditor.cpp
===================================================================
--- trunk/source/main/main_editor/RoREditor.cpp 2011-03-11 22:59:32 UTC (rev 
1751)
+++ trunk/source/main/main_editor/RoREditor.cpp 2011-03-13 00:42:35 UTC (rev 
1752)
@@ -18,172 +18,59 @@
 along with Rigs of Rods.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include "RoRViewer.h"
+#include "RoREditor.h"
 
 #include "Settings.h"
 #include "errorutils.h"
+#include "RigsOfRods.h"
+#include "errorutils.h"
 
-RoRViewer::RoRViewer(string _meshPath)
+#include "AdvancedOgreFramework.h"
+
+RoREditor::RoREditor(string _meshPath)
 {
-       active_node = NULL;
-       active_mesh.setNull();
-       active_entity = NULL;
-       ogre_root = NULL;
-       scene_mgr = NULL;
-       window = NULL;
-       meshPath = _meshPath;
+       timer = NULL;
+       initialized=false;
+       timeSinceLastFrame = 1;
+       startTime = 0;
 }
 
-RoRViewer::~RoRViewer(void)
+RoREditor::~RoREditor(void)
 {
 }
 
-bool RoRViewer::Initialize(std::string hwndStr)
+bool RoREditor::Initialize(std::string hwndStr, std::string mainhwndStr)
 {
-       try
-       {
-               if(!SETTINGS.setupPaths())
-                       return false;
-
-               // load RoR.cfg directly after setting up paths
-               SETTINGS.loadSettings(SETTINGS.getSetting("Config 
Root")+"RoR.cfg");
-
-               String logFilename   = SETTINGS.getSetting("Log Path") + 
Ogre::String("RoRViewer.log");
-               String programPath   = SETTINGS.getSetting("Program Path");
-               String pluginsConfig = String(); 
//SETTINGS.getSetting("plugins.cfg"); // beware of this, plugins.cfg is using 
relative paths
+       if(!SETTINGS.setupPaths())
+               return false;
        
-               String ogreConfig    = SETTINGS.getSetting("ogre.cfg");
-               ogre_root = new Ogre::Root(pluginsConfig, ogreConfig, 
logFilename);
+       SETTINGS.setSetting("Preselected Truck", "none");
+       SETTINGS.setSetting("Preselected Map",   "simple.terrn");
 
-               ogre_root->loadPlugin(SETTINGS.getSetting("Program Path") + 
SETTINGS.getSetting("dirsep") + "RenderSystem_Direct3D9");
-               ogre_root->loadPlugin(SETTINGS.getSetting("Program Path") + 
SETTINGS.getSetting("dirsep") + "RenderSystem_GL");
-               ogre_root->loadPlugin(SETTINGS.getSetting("Program Path") + 
SETTINGS.getSetting("dirsep") + "Plugin_OctreeSceneManager");
-               ogre_root->loadPlugin(SETTINGS.getSetting("Program Path") + 
SETTINGS.getSetting("dirsep") + "Plugin_CgProgramManager");
-               ogre_root->loadPlugin(SETTINGS.getSetting("Program Path") + 
SETTINGS.getSetting("dirsep") + "caelum");
-               
-               ogre_root->restoreConfig();
-               ogre_root->initialise(false);
+       app = new RigsOfRods("RoREditor", 
Ogre::StringConverter::parseInt(hwndStr), 
Ogre::StringConverter::parseInt(mainhwndStr));
 
+       timer = new Ogre::Timer();
 
-               Ogre::NameValuePairList param;
-               param["externalWindowHandle"] = hwndStr;
+       app->go();
 
-               window    = ogre_root->createRenderWindow("viewer", 320, 240, 
false, &param);
-               scene_mgr = ogre_root->createSceneManager(ST_GENERIC);
-               camera    = scene_mgr->createCamera("ViewerCam");
-               viewport  = window->addViewport(camera);
-
-               camera->setNearClipDistance(0.1);
-               camera->setFarClipDistance(1000);
-               camera->setFOVy(Ogre::Radian(Ogre::Degree(60)));
-               camera->setAutoAspectRatio(true);
-               camera->lookAt(0, 0, 0);
-               camera->setPosition(Ogre::Vector3(0,12,0));
-
-               mCameraCS = new CCS::CameraControlSystem(scene_mgr, 
"CameraControlSystem", camera);
-               camModeOrbital = new CCS::OrbitalCameraMode(mCameraCS, 1);
-               mCameraCS->registerCameraMode("Orbital",camModeOrbital);
-
-               viewport->setBackgroundColour(ColourValue(0.35, 0.35, 0.35));
-
-               timer = new Ogre::Timer();
-               timer->reset();
-
-
-               light = scene_mgr->createLight("Lamp01");
-               light->setType(Light::LT_DIRECTIONAL);
-               light->setPosition(0, 50, 0);
-               light_node = scene_mgr->createSceneNode("RoRViewerLightNode");
-               light_node->attachObject(light);
-               scene_mgr->getRootSceneNode()->addChild(light_node);
-               light_node->lookAt(Vector3::NEGATIVE_UNIT_Y, Node::TS_WORLD, 
Vector3::UNIT_Z);
-
-               scene_mgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5));
-
-               // figure out the files path
-               Ogre::String filename, filepath;
-               Ogre::StringUtil::splitFilename(meshPath, filename, filepath);
-
-               // add the file path to the resource lookup path
-               
Ogre::ResourceGroupManager::getSingleton().addResourceLocation(filepath, 
"FileSystem");
-
-               // add default RoR resources, not too bad if this fails
-               try
-               {
-                       
Ogre::ResourceGroupManager::getSingleton().addResourceLocation(programPath + 
"resources/OgreCore.zip", "Zip");
-                       
Ogre::ResourceGroupManager::getSingleton().addResourceLocation(programPath + 
"resources/materials.zip", "Zip");
-                       
Ogre::ResourceGroupManager::getSingleton().addResourceLocation(programPath + 
"resources/textures.zip", "Zip");
-               } catch(Ogre::Exception& e)
-               {
-                       String url = 
"http://wiki.rigsofrods.com/index.php?title=Error_"; + 
StringConverter::toString(e.getNumber())+"#"+e.getSource();
-                       showWebError("An exception has occured!", 
e.getFullDescription(), url);
-                       exit(1);
-               }
-               // init all resource locations
-               
Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
-
-
-               // load the mesh
-               String group = 
Ogre::ResourceGroupManager::getSingleton().findGroupContainingResource(filename);
-               active_mesh = Ogre::MeshManager::getSingleton().load(filename, 
group);
-               active_entity = scene_mgr->createEntity(filepath, 
active_mesh->getName());
-
-               active_node = 
scene_mgr->getRootSceneNode()->createChildSceneNode();
-               active_node->attachObject(active_entity);
-
-               active_node->setPosition(0,0,0);
-
-               mCameraCS->setFixedYawAxis(true);
-
-               mCameraCS->setCameraTarget(active_node);
-               mCameraCS->setCurrentCameraMode(camModeOrbital);
-               camModeOrbital->setZoom(active_mesh->getBoundingSphereRadius());
-
-       } catch(Exception &e)
-       {
-               String url = 
"http://wiki.rigsofrods.com/index.php?title=Error_"; + 
StringConverter::toString(e.getNumber())+"#"+e.getSource();
-               showWebError("An exception has occured!", 
e.getFullDescription(), url);
-               exit(1);
-       }
        return true;
 }
 
-void RoRViewer::Deinitialize(void)
+void RoREditor::Deinitialize(void)
 {
        if (!initialized) return;
-       ResourceGroupManager* rg_mgr = ResourceGroupManager::getSingletonPtr();
 
        if(timer) delete timer;
-       window->removeViewport(0);
-       //scene_mgr->getRootSceneNode()->removeChild(camera_node);
-       mCameraCS->deleteAllCameraModes();
-       scene_mgr->destroyCamera(camera);
-       ogre_root->destroySceneManager(scene_mgr);
-       ogre_root->detachRenderTarget("RoRViewer");
-       ogre_root->shutdown();
 
        initialized = false;
 }
 
-void RoRViewer::Update()
+void RoREditor::Update()
 {
-       double tm = timer->getMilliseconds();
-       timer->reset();
-       ogre_root->renderOneFrame(tm);
-       mCameraCS->update(tm);
+       startTime = 
OgreFramework::getSingletonPtr()->m_pTimer->getMillisecondsCPU();
+       
+       if(app)
+               app->update(timeSinceLastFrame);
 
+       timeSinceLastFrame = 
OgreFramework::getSingletonPtr()->m_pTimer->getMillisecondsCPU() - startTime;
 }
-
-void RoRViewer::TurnCamera(Vector3 speed)
-{
-       camModeOrbital->yaw(-speed.x);
-       camModeOrbital->pitch(-speed.y);
-       camModeOrbital->zoom(-speed.z);
-}
-
-
-
-void RoRViewer::MoveCamera(Vector3 speed)
-{
-       // TODO
-}
\ No newline at end of file

Modified: trunk/source/main/main_editor/RoREditor.h
===================================================================
--- trunk/source/main/main_editor/RoREditor.h   2011-03-11 22:59:32 UTC (rev 
1751)
+++ trunk/source/main/main_editor/RoREditor.h   2011-03-13 00:42:35 UTC (rev 
1752)
@@ -23,55 +23,38 @@
 #include <string>
 #include <Ogre.h>
 
-#include <CCSCameraControlSystem.h>
-#include <CCSOrbitalCameraMode.h>
+class RigsOfRods;
 
 using namespace std;
 using namespace Ogre;
 
-class RoRViewer
+class RoREditor
 {
 public:
-       RoRViewer(string meshPath);
-       ~RoRViewer(void);
+       RoREditor(string meshPath);
+       ~RoREditor(void);
 
-       bool Initialize(std::string hwndStr);
+       bool Initialize(std::string hwndStr, std::string mainhwndStr);
        void Deinitialize(void);
        void Update(void);
        
        RenderWindow* GetOgreWindow(void){return window;}
-       SceneManager* GetSceneManager(void){return scene_mgr;}
        Viewport* GetViewport(void){return viewport;}
        Camera* GetCamera(void){return camera;}
-       MeshPtr GetMesh(void){return active_mesh;}
-       Entity* GetEntity(void){return active_entity;}
-       SceneNode* GetSceneNode(void){return active_node;}
 
-       void TurnCamera(Vector3 speed);
-       void MoveCamera(Vector3 speed);
-
 private:
        bool                    initialized;
        Root*                   ogre_root;
-       SceneManager*   scene_mgr;
        RenderWindow*   window;
        Camera*                 camera;
-       SceneNode*              camera_node;
        Viewport*               viewport;
+       RigsOfRods*     app;
 
-       MeshPtr                 active_mesh;
-       Entity*                 active_entity;
-       SceneNode*              active_node;
+       int timeSinceLastFrame;
+       int startTime;
 
-       SceneNode*              light_node;
-       Light*                  light;
 
        Ogre::Timer*    timer;
-
-       CCS::CameraControlSystem *mCameraCS;
-       CCS::OrbitalCameraMode *camModeOrbital;
-       
-       string          meshPath;
 };
 
 #endif //RORVIEWER_H__
\ No newline at end of file

Modified: trunk/source/main/main_editor/icon.rc
===================================================================
--- trunk/source/main/main_editor/icon.rc       2011-03-11 22:59:32 UTC (rev 
1751)
+++ trunk/source/main/main_editor/icon.rc       2011-03-13 00:42:35 UTC (rev 
1752)
@@ -28,7 +28,7 @@
 
 // Icon with lowest ID value placed first to ensure application icon
 // remains consistent on all systems.
-IDI_ICON1               ICON    DISCARDABLE     "RoRViewer.ico"
+IDI_ICON1               ICON    DISCARDABLE     "RoREditor.ico"
 
 //#ifdef APSTUDIO_INVOKED
 /////////////////////////////////////////////////////////////////////////////

Modified: trunk/source/main/main_editor/main.cpp
===================================================================
--- trunk/source/main/main_editor/main.cpp      2011-03-11 22:59:32 UTC (rev 
1751)
+++ trunk/source/main/main_editor/main.cpp      2011-03-13 00:42:35 UTC (rev 
1752)
@@ -26,30 +26,25 @@
 #include "wxutils.h"
 #include "Settings.h"
 
+#include "AdvancedOgreFramework.h"
+
 #include "display_mode.xpm"
 
 Window3D::Window3D(wxWindow* parent, wxWindowID id) : wxPanel(parent, id, 
wxDefaultPosition, wxDefaultSize, wxTRANSPARENT_WINDOW | wxBORDER_NONE | 
wxNO_FULL_REPAINT_ON_RESIZE)
 {
-       wnd = NULL;
-       cam = NULL;
        handler = NULL;
 }
 
 void Window3D::OnSize(wxSizeEvent& e)
 {
-       if (!wnd || !cam) return;
 
        // Setting new size;
        int width;
        int height;
        GetSize(&width, &height);
-       wnd->resize(width, height);
 
-       // Letting Ogre know the window has been resized;
-       wnd->windowMovedOrResized();
-
-       // Set the aspect ratio for the new size;
-       cam->setAspectRatio(Ogre::Real(width) / Ogre::Real(height));
+       if(OgreFramework::getSingletonPtr())
+               OgreFramework::getSingletonPtr()->resized(Vector2(width, 
height));
 }
 
 void Window3D::OnLeftUp(wxMouseEvent& e)
@@ -72,7 +67,7 @@
        if (!wxApp::OnInit())
                return false;
 
-       frame = new RoRViewerFrame(L"RoR Viewer");
+       frame = new RoRViewerFrame(L"RoR editor");
        SetTopWindow(frame);
        frame->Show();
        
@@ -88,13 +83,13 @@
 
 void RoRViewerApp::OnInitCmdLine(wxCmdLineParser& parser)
 {
-       parser.AddParam(_T("<file>"), wxCMD_LINE_VAL_STRING, 
wxCMD_LINE_OPTION_MANDATORY);
+       //parser.AddParam(_T("<file>"), wxCMD_LINE_VAL_STRING, 
wxCMD_LINE_OPTION_MANDATORY);
 }
 
 bool RoRViewerApp::OnCmdLineParsed(wxCmdLineParser& parser)
 {
-       meshPath = parser.GetParam();
-       return !meshPath.empty();
+       //meshPath = parser.GetParam();
+       return true; //!meshPath.empty();
 }
 
 int RoRViewerApp::OnExit(void)
@@ -108,7 +103,7 @@
        msy = 0;
        msw = 0;
 
-       viewer = NULL;
+       editor = NULL;
 
        SetMinSize(wxSize(640, 480));
        SetClientSize(640, 480);
@@ -127,13 +122,13 @@
        switch(e.GetId())
        {
                case ID_TOOL_MODE_TEXTURE:
-                       viewer->GetCamera()->setPolygonMode(Ogre::PM_SOLID);
+                       editor->GetCamera()->setPolygonMode(Ogre::PM_SOLID);
                        break;
                case ID_TOOL_MODE_WIREFRAME:
-                       viewer->GetCamera()->setPolygonMode(Ogre::PM_WIREFRAME);
+                       editor->GetCamera()->setPolygonMode(Ogre::PM_WIREFRAME);
                        break;
                case ID_TOOL_MODE_POINT:
-                       viewer->GetCamera()->setPolygonMode(Ogre::PM_POINTS);
+                       editor->GetCamera()->setPolygonMode(Ogre::PM_POINTS);
                        break;
        };
 }
@@ -216,7 +211,7 @@
        aui_mgr->Update();
 
        // try to load the old window layout
-       String perspective_str = SETTINGS.getSetting("ViewerPerspective");
+       String perspective_str = SETTINGS.getSetting("EditorPerspective");
        if(!perspective_str.empty())
        {
                aui_mgr->LoadPerspective(wxString(perspective_str.c_str()));
@@ -227,7 +222,7 @@
 {
        // save the window layout
        string perspective_str = 
std::string(aui_mgr->SavePerspective().mb_str());
-       SETTINGS.setSetting("ViewerPerspective",perspective_str);
+       SETTINGS.setSetting("EditorPerspective",perspective_str);
        SETTINGS.saveSettings();
 
        aui_mgr->UnInit();
@@ -236,32 +231,26 @@
 bool RoRViewerFrame::InitializeRoRViewer(wxString meshPath)
 {
        string mstr = std::string(meshPath.mb_str());
-       viewer = new RoRViewer(mstr);
-       if (!viewer->Initialize(getWindowHandle(panel_viewport)))
+       editor = new RoREditor(mstr);
+       if (!editor->Initialize(getWindowHandle(panel_viewport), 
getWindowHandle(this)))
        {
-               delete viewer;
-               viewer = NULL;
+               delete editor;
+               editor = NULL;
                return false;
        }
-       panel_meshprop->setViewer(viewer);
-       panel_meshtree->setViewer(viewer);
+       panel_meshprop->setViewer(editor);
+       panel_meshtree->setViewer(editor);
 
-       panel_viewport->wnd = viewer->GetOgreWindow();
-       panel_viewport->cam = viewer->GetCamera();
-
        return true;
 }
 
 void RoRViewerFrame::DenitializeRoRViewer(void)
 {
-       panel_viewport->handler = NULL;
-       panel_viewport->wnd = NULL;
-
-       if (viewer)
+       if (editor)
        {
-               viewer->Deinitialize();
-               delete viewer;
-               viewer = NULL;
+               editor->Deinitialize();
+               delete editor;
+               editor = NULL;
        }
 }
 
@@ -273,7 +262,7 @@
 
 void RoRViewerFrame::OnIdle(wxIdleEvent& e)
 {
-       viewer->Update();
+       editor->Update();
        updatePanelData();
 
        e.RequestMore();
@@ -294,7 +283,7 @@
        /// shit behaves badly, to be fixed!
        if (e.LeftIsDown() || wp != 0)
        {
-               viewer->TurnCamera(Vector3(xp, yp, wp*0.02f));
+               //editor->TurnCamera(Vector3(xp, yp, wp*0.02f));
        }
 }
 

Modified: trunk/source/main/main_editor/main.h
===================================================================
--- trunk/source/main/main_editor/main.h        2011-03-11 22:59:32 UTC (rev 
1751)
+++ trunk/source/main/main_editor/main.h        2011-03-13 00:42:35 UTC (rev 
1752)
@@ -39,7 +39,7 @@
 #include <wx/spinctrl.h>
 #include <wx/cmdline.h>
 
-#include "RoRViewer.h"
+#include "RoREditor.h"
 
 // RoR includes
 #include "Settings.h"
@@ -77,8 +77,6 @@
        void OnMouseMove(wxMouseEvent& e);
        void OnKeyDown(wxKeyEvent& event);
        Window3DHandler* handler;
-       Ogre::RenderWindow* wnd;
-       Ogre::Camera* cam;
 
 private:
         DECLARE_EVENT_TABLE()
@@ -130,7 +128,7 @@
        PanelMeshTree* panel_meshtree;
        wxAuiPaneInfo* pane_meshtree;
 
-       RoRViewer* viewer;
+       RoREditor* editor;
     DECLARE_EVENT_TABLE()
 };
 

Modified: trunk/source/main/main_editor/panel_meshprop.h
===================================================================
--- trunk/source/main/main_editor/panel_meshprop.h      2011-03-11 22:59:32 UTC 
(rev 1751)
+++ trunk/source/main/main_editor/panel_meshprop.h      2011-03-13 00:42:35 UTC 
(rev 1752)
@@ -32,12 +32,12 @@
 // This defines wxPropertyGridManager.
 #include <wx/propgrid/manager.h>
 
-#include "RoRViewer.h"
+#include "RoREditor.h"
 
 class PanelMeshProp : public wxPanel
 {
 protected:
-       RoRViewer *viewer;
+       RoREditor *editor;
        Ogre::MeshPtr current_mesh;
        int current_item;
        wxPropertyGrid  *pg;
@@ -48,18 +48,18 @@
        };
 
 public:
-       void setViewer(RoRViewer *_viewer)
+       void setViewer(RoREditor *_editor)
        {
-               viewer = _viewer;
+               editor = _editor;
        }
 
-    PanelMeshProp(RoRViewer *_viewer, wxWindow *parent,
+    PanelMeshProp(RoREditor *_editor, wxWindow *parent,
             wxWindowID winid = wxID_ANY,
             const wxPoint& pos = wxDefaultPosition,
             const wxSize& size = wxDefaultSize,
             long style = wxTAB_TRAVERSAL | wxNO_BORDER,
             const wxString& name = wxPanelNameStr) :
-               wxPanel(parent, winid, pos, size, style, name), 
viewer(_viewer), current_mesh(0), current_item(-1)
+               wxPanel(parent, winid, pos, size, style, name), 
editor(_editor), current_mesh(0), current_item(-1)
     {
                // create sizer and PG
                wxBoxSizer *vsizer = new wxBoxSizer ( wxVERTICAL );
@@ -86,8 +86,9 @@
        
        void updateData()
        {
-               if(!viewer) return;
-               Ogre::MeshPtr mesh = viewer->GetMesh();
+               if(!editor) return;
+               /*
+               Ogre::MeshPtr mesh = editor->GetMesh();
                if(mesh.isNull())
                        return;
 
@@ -96,6 +97,7 @@
                        return;
 
                current_mesh = mesh;
+               */
        }
 
        void OnPropertyChange(wxPropertyGridEvent &ev)

Modified: trunk/source/main/main_editor/panel_meshtree.h
===================================================================
--- trunk/source/main/main_editor/panel_meshtree.h      2011-03-11 22:59:32 UTC 
(rev 1751)
+++ trunk/source/main/main_editor/panel_meshtree.h      2011-03-13 00:42:35 UTC 
(rev 1752)
@@ -25,7 +25,7 @@
 
 #include <wx/treectrl.h> // for treectrl
 
-#include "RoRViewer.h"
+#include "RoREditor.h"
 
 #include "panel_meshprop.h"
 
@@ -48,7 +48,7 @@
 {
 protected:
        wxTreeCtrl *tree;
-       RoRViewer *viewer;
+       RoREditor *editor;
        PanelMeshProp *meshProp;
        Ogre::MeshPtr current_mesh;
        enum { 
@@ -56,9 +56,9 @@
        };
 
 public:
-       void setViewer(RoRViewer *_viewer)
+       void setViewer(RoREditor *_editor)
        {
-               viewer = _viewer;
+               editor = _editor;
        }
        
        void setPropGrid(PanelMeshProp *_meshProp)
@@ -66,13 +66,13 @@
                meshProp = _meshProp;
        }
 
-    PanelMeshTree(RoRViewer *_viewer, wxWindow *parent,
+    PanelMeshTree(RoREditor *editor, wxWindow *parent,
             wxWindowID winid = wxID_ANY,
             const wxPoint& pos = wxDefaultPosition,
             const wxSize& size = wxDefaultSize,
             long style = wxTAB_TRAVERSAL | wxNO_BORDER,
             const wxString& name = wxPanelNameStr) :
-               wxPanel(parent, winid, pos, size, style, name), 
viewer(_viewer), current_mesh(0)
+               wxPanel(parent, winid, pos, size, style, name), editor(editor), 
current_mesh(0)
     {
                // create sizer and tree
                wxBoxSizer *vsizer = new wxBoxSizer ( wxVERTICAL );
@@ -86,8 +86,13 @@
        
        void updateData()
        {
-               if(!viewer) return;
-               Ogre::MeshPtr mesh = viewer->GetMesh();
+               if(!editor) return;
+
+
+
+               return;
+               /*
+               Ogre::MeshPtr mesh = editor->GetMesh();
                if(mesh.isNull())
                        return;
 
@@ -120,6 +125,7 @@
                // update PG
                if(meshProp)
                        meshProp->updatePG(0);
+                       */
        }
 
        void OnTreeItemChange(wxTreeEvent &event)
@@ -132,7 +138,8 @@
                        return;
                
                // update 3d viewport :)
-               Ogre::Entity *e = viewer->GetEntity();
+               /*
+               Ogre::Entity *e = editor->GetEntity();
                if(e && data->value == 0)
                {
                        // show full mesh
@@ -153,6 +160,7 @@
                
                // update PG
                meshProp->updatePG(data->value);
+               */
        }
 
 private:

Modified: trunk/source/main/main_sim/CMakeLists.txt
===================================================================
--- trunk/source/main/main_sim/CMakeLists.txt   2011-03-11 22:59:32 UTC (rev 
1751)
+++ trunk/source/main/main_sim/CMakeLists.txt   2011-03-13 00:42:35 UTC (rev 
1752)
@@ -1,5 +1,8 @@
-project(RoR)
+set(BINNAME RoR)
 
+project(${BINNAME})
+
+
 #setup libraries
 macro(setup_lib name)
    if(ROR_USE_${name})
@@ -112,10 +115,10 @@
 add_sub_dir(main_sim)
 
 IF(WIN32)
-       add_executable(RoR WIN32 ${headers} ${sources} icon.rc)
+       add_executable(${BINNAME} WIN32 ${headers} ${sources} icon.rc)
 ELSE(WIN32)
-       add_executable(RoR ${headers} ${sources})
+       add_executable(${BINNAME} ${headers} ${sources})
 ENDIF(WIN32)
 
-target_link_libraries(RoR ${Ogre_LIBRARIES} ${Ogre_Terrain_LIBRARIES} 
${Ogre_Paging_LIBRARIES} ${Ogre_RTShader_LIBRARIES} ${Ois_LIBRARIES} ${OS_LIBS} 
${optional_libs})
+target_link_libraries(${BINNAME} ${Ogre_LIBRARIES} ${Ogre_Terrain_LIBRARIES} 
${Ogre_Paging_LIBRARIES} ${Ogre_RTShader_LIBRARIES} ${Ois_LIBRARIES} ${OS_LIBS} 
${optional_libs})
 

Deleted: trunk/source/main/main_sim/RigsOfRods.cpp
===================================================================
--- trunk/source/main/main_sim/RigsOfRods.cpp   2011-03-11 22:59:32 UTC (rev 
1751)
+++ trunk/source/main/main_sim/RigsOfRods.cpp   2011-03-13 00:42:35 UTC (rev 
1752)
@@ -1,65 +0,0 @@
-/*
-This source file is part of Rigs of Rods
-Copyright 2005-2011 Pierre-Michel Ricordel
-Copyright 2007-2011 Thomas Fischer
-
-For more information, see http://www.rigsofrods.com/
-
-Rigs of Rods is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 3, as 
-published by the Free Software Foundation.
-
-Rigs of Rods 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 Rigs of Rods.  If not, see <http://www.gnu.org/licenses/>.
-*/
-#include "RigsOfRods.h"
-
-#include <Ogre.h>
-
-#include "GameState.h"
-#include "Settings.h"
-#include "ContentManager.h"
-
-using namespace Ogre;
-
-RigsOfRods::RigsOfRods(Ogre::String name, unsigned int hwnd, unsigned int 
mainhwnd) : 
-       stateManager(0),
-       hwnd(hwnd),
-       mainhwnd(mainhwnd),
-       name(name)
-{
-}
-
-RigsOfRods::~RigsOfRods()
-{
-       delete stateManager;
-    delete OgreFramework::getSingletonPtr();
-
-}
-
-void RigsOfRods::go(void)
-{
-       // init ogre
-       new OgreFramework();
-       if(!OgreFramework::getSingletonPtr()->initOgre(name, hwnd, mainhwnd))
-               return;
-
-       // then the base content setup
-       new ContentManager();
-       ContentManager::getSingleton().init();
-
-       // now add the game states
-       stateManager = new AppStateManager();
-
-       GameState::create(stateManager,  "GameState");
-
-       // select the first one
-       stateManager->start(stateManager->findByName("GameState"));
-
-       LOG("Rigs of Rods initialized!");
-}

Deleted: trunk/source/main/main_sim/RigsOfRods.h
===================================================================
--- trunk/source/main/main_sim/RigsOfRods.h     2011-03-11 22:59:32 UTC (rev 
1751)
+++ trunk/source/main/main_sim/RigsOfRods.h     2011-03-13 00:42:35 UTC (rev 
1752)
@@ -1,49 +0,0 @@
-/*
-This source file is part of Rigs of Rods
-Copyright 2005-2011 Pierre-Michel Ricordel
-Copyright 2007-2011 Thomas Fischer
-
-For more information, see http://www.rigsofrods.com/
-
-Rigs of Rods is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 3, as 
-published by the Free Software Foundation.
-
-Rigs of Rods 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 Rigs of Rods.  If not, see <http://www.gnu.org/licenses/>.
-*/
-/*! @mainpage
-
-       have fun coding :)
-
-       please note that the documentation is work in progress
-*/
-#ifndef RIGSOFRODS_H__
-#define RIGSOFRODS_H__
-
-#include "RoRPrerequisites.h"
-
-#include "AdvancedOgreFramework.h"
-#include "AppStateManager.h"
-
-class RigsOfRods
-{
-public:
-       RigsOfRods(Ogre::String name = Ogre::String("RoR"), unsigned int 
hwnd=0, unsigned int mainhwnd=0);
-       ~RigsOfRods();
-
-       void go();
-       void shutdown(void);
-
-protected:
-       AppStateManager *stateManager;
-       unsigned int hwnd, mainhwnd;
-       Ogre::String name;
-};
-
-#endif //RIGSOFRODS_H__


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Rigsofrods-devel mailing list
Rigsofrods-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel

Reply via email to