|
|
@ -23,29 +23,13 @@
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <stdexcept>
|
|
|
|
#include <stdexcept>
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(__APPLE__) && !defined(__LP64__)
|
|
|
|
#ifdef __MACOSX__
|
|
|
|
#include <Carbon/Carbon.h>
|
|
|
|
#include "osx_utils.h"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
using namespace Ogre;
|
|
|
|
using namespace Ogre;
|
|
|
|
using namespace OEngine::Render;
|
|
|
|
using namespace OEngine::Render;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(__APPLE__) && !defined(__LP64__)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CustomRoot::CustomRoot(const Ogre::String& pluginFileName,
|
|
|
|
|
|
|
|
const Ogre::String& configFileName,
|
|
|
|
|
|
|
|
const Ogre::String& logFileName)
|
|
|
|
|
|
|
|
: Ogre::Root(pluginFileName, configFileName, logFileName)
|
|
|
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool CustomRoot::isQueuedEnd() const
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return mQueuedEnd;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void OgreRenderer::cleanup()
|
|
|
|
void OgreRenderer::cleanup()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
delete mFader;
|
|
|
|
delete mFader;
|
|
|
@ -68,34 +52,7 @@ void OgreRenderer::cleanup()
|
|
|
|
|
|
|
|
|
|
|
|
void OgreRenderer::start()
|
|
|
|
void OgreRenderer::start()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//TODO: Check if we still need to do this if we're using SDL's
|
|
|
|
|
|
|
|
//message pump
|
|
|
|
|
|
|
|
#if defined(__APPLE__) && !defined(__LP64__)
|
|
|
|
|
|
|
|
// OSX Carbon Message Pump
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
|
|
|
EventRef event = NULL;
|
|
|
|
|
|
|
|
EventTargetRef targetWindow;
|
|
|
|
|
|
|
|
targetWindow = GetEventDispatcherTarget();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// If we are unable to get the target then we no longer care about events.
|
|
|
|
|
|
|
|
if (!targetWindow) return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Grab the next event while possible
|
|
|
|
|
|
|
|
while (ReceiveNextEvent(0, NULL, kEventDurationNoWait, true, &event) == noErr)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// Dispatch the event
|
|
|
|
|
|
|
|
SendEventToEventTarget(event, targetWindow);
|
|
|
|
|
|
|
|
ReleaseEvent(event);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!mRoot->renderOneFrame()) {
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} while (!mRoot->isQueuedEnd());
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
mRoot->startRendering();
|
|
|
|
mRoot->startRendering();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void OgreRenderer::loadPlugins()
|
|
|
|
void OgreRenderer::loadPlugins()
|
|
|
@ -188,11 +145,7 @@ void OgreRenderer::configure(const std::string &logPath,
|
|
|
|
// Disable logging
|
|
|
|
// Disable logging
|
|
|
|
log->setDebugOutputEnabled(false);
|
|
|
|
log->setDebugOutputEnabled(false);
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(__APPLE__) && !defined(__LP64__)
|
|
|
|
|
|
|
|
mRoot = new CustomRoot("", "", "");
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
mRoot = new Root("", "", "");
|
|
|
|
mRoot = new Root("", "", "");
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(ENABLE_PLUGIN_GL) || defined(ENABLE_PLUGIN_Direct3D9) || defined(ENABLE_PLUGIN_CgProgramManager) || defined(ENABLE_PLUGIN_OctreeSceneManager) || defined(ENABLE_PLUGIN_ParticleFX)
|
|
|
|
#if defined(ENABLE_PLUGIN_GL) || defined(ENABLE_PLUGIN_Direct3D9) || defined(ENABLE_PLUGIN_CgProgramManager) || defined(ENABLE_PLUGIN_OctreeSceneManager) || defined(ENABLE_PLUGIN_ParticleFX)
|
|
|
|
loadPlugins();
|
|
|
|
loadPlugins();
|
|
|
@ -308,13 +261,13 @@ void OgreRenderer::createWindow(const std::string &title, const WindowSettings&
|
|
|
|
// Windows code
|
|
|
|
// Windows code
|
|
|
|
winHandle = Ogre::StringConverter::toString((unsigned long)wmInfo.info.win.window);
|
|
|
|
winHandle = Ogre::StringConverter::toString((unsigned long)wmInfo.info.win.window);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
#elif MACOS
|
|
|
|
#elif __MACOSX__
|
|
|
|
case SDL_SYSWM_COCOA:
|
|
|
|
case SDL_SYSWM_COCOA:
|
|
|
|
//required to make OGRE play nice with our window
|
|
|
|
//required to make OGRE play nice with our window
|
|
|
|
params.insert(std::make_pair("macAPI", "cocoa"));
|
|
|
|
params.insert(std::make_pair("macAPI", "cocoa"));
|
|
|
|
params.insert(std::make_pair("macAPICocoaUseNSView", "true"));
|
|
|
|
params.insert(std::make_pair("macAPICocoaUseNSView", "true"));
|
|
|
|
|
|
|
|
|
|
|
|
winHandle = Ogre::StringConverter::toString((unsigned long)wmInfo.info.cocoa.window);
|
|
|
|
winHandle = Ogre::StringConverter::toString(WindowContentViewHandle(wmInfo));
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
case SDL_SYSWM_X11:
|
|
|
|
case SDL_SYSWM_X11:
|
|
|
|