mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 18:19:55 +00:00
Merge remote branch 'upstream/master'
This commit is contained in:
commit
2e0bdf3a5c
10 changed files with 105 additions and 52 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -18,3 +18,4 @@ resources
|
||||||
mwcompiler
|
mwcompiler
|
||||||
mwinterpreter
|
mwinterpreter
|
||||||
clientconsole
|
clientconsole
|
||||||
|
MyGUI.log
|
||||||
|
|
|
@ -130,9 +130,9 @@ file(GLOB ESM_HEADER components/esm/*.hpp)
|
||||||
source_group(components\\esm FILES ${ESM_HEADER})
|
source_group(components\\esm FILES ${ESM_HEADER})
|
||||||
|
|
||||||
set(OGRE
|
set(OGRE
|
||||||
components/engine/ogre/renderer.cpp)
|
${CMAKE_SOURCE_DIR}/components/engine/ogre/renderer.cpp)
|
||||||
set(OGRE_HEADER
|
set(OGRE_HEADER
|
||||||
components/engine/ogre/renderer.hpp)
|
${CMAKE_SOURCE_DIR}/components/engine/ogre/renderer.hpp)
|
||||||
source_group(components\\engine\\ogre FILES ${OGRE} ${OGRE_HEADER})
|
source_group(components\\engine\\ogre FILES ${OGRE} ${OGRE_HEADER})
|
||||||
|
|
||||||
set(INPUT
|
set(INPUT
|
||||||
|
@ -203,7 +203,12 @@ include_directories("."
|
||||||
${OGRE_INCLUDE_DIR} ${OGRE_INCLUDE_DIR}/Ogre
|
${OGRE_INCLUDE_DIR} ${OGRE_INCLUDE_DIR}/Ogre
|
||||||
${OIS_INCLUDE_DIR} ${Boost_INCLUDE_DIR}
|
${OIS_INCLUDE_DIR} ${Boost_INCLUDE_DIR}
|
||||||
${PLATFORM_INCLUDE_DIR}
|
${PLATFORM_INCLUDE_DIR}
|
||||||
${CMAKE_HOME_DIRECTORY}/extern/caelum/include)
|
${CMAKE_HOME_DIRECTORY}/extern/caelum/include
|
||||||
|
${CMAKE_HOME_DIRECTORY}/extern/mygui_3.0.1/MyGUIEngine/include
|
||||||
|
${CMAKE_HOME_DIRECTORY}/extern/mygui_3.0.1/OgrePlatform/include
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
link_directories(${Boost_LIBRARY_DIRS} ${OGRE_LIB_DIR})
|
link_directories(${Boost_LIBRARY_DIRS} ${OGRE_LIB_DIR})
|
||||||
|
|
||||||
add_subdirectory( extern/caelum )
|
add_subdirectory( extern/caelum )
|
||||||
|
@ -264,6 +269,7 @@ endif (APPLE)
|
||||||
|
|
||||||
# Other apps and tools
|
# Other apps and tools
|
||||||
add_subdirectory( apps/clientconsole )
|
add_subdirectory( apps/clientconsole )
|
||||||
|
add_subdirectory( apps/mygui_dev )
|
||||||
|
|
||||||
# Apple bundling
|
# Apple bundling
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
|
|
11
apps/mygui_dev/CMakeLists.txt
Normal file
11
apps/mygui_dev/CMakeLists.txt
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
add_executable(mygui_test
|
||||||
|
main.cpp
|
||||||
|
${OGRE}
|
||||||
|
${OGRE_HEADER}
|
||||||
|
)
|
||||||
|
target_link_libraries(mygui_test
|
||||||
|
${OGRE_LIBRARIES}
|
||||||
|
${OIS_LIBRARIES}
|
||||||
|
MyGUIEngine
|
||||||
|
MyGUI.OgrePlatform
|
||||||
|
)
|
35
apps/mygui_dev/main.cpp
Normal file
35
apps/mygui_dev/main.cpp
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
#include <iostream>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#include <MyGUI.h>
|
||||||
|
#include <MyGUI_OgrePlatform.h>
|
||||||
|
using namespace MyGUI;
|
||||||
|
|
||||||
|
#include <components/engine/ogre/renderer.hpp>
|
||||||
|
#include <OgreResourceGroupManager.h>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
Render::OgreRenderer ogre;
|
||||||
|
ogre.configure(false, "plugins.cfg", false);
|
||||||
|
ogre.createWindow("MyGUI test");
|
||||||
|
ogre.createScene();
|
||||||
|
|
||||||
|
// Disable MyGUI logging
|
||||||
|
LogManager::initialise();
|
||||||
|
LogManager::setSTDOutputEnabled(false);
|
||||||
|
|
||||||
|
// Set up OGRE connection to MyGUI
|
||||||
|
OgrePlatform *platform = new OgrePlatform();
|
||||||
|
platform->initialise(ogre.getWindow(), ogre.getScene());
|
||||||
|
|
||||||
|
// Create GUI
|
||||||
|
Gui *gui = new Gui();
|
||||||
|
gui->initialise();
|
||||||
|
|
||||||
|
// Add the Morrowind windows resources
|
||||||
|
Ogre::ResourceGroupManager::getSingleton().
|
||||||
|
addResourceLocation("resources/mygui/", "FileSystem", "General");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -15,22 +15,7 @@ using namespace Ogre;
|
||||||
MWScene::MWScene(Render::OgreRenderer &_rend)
|
MWScene::MWScene(Render::OgreRenderer &_rend)
|
||||||
: rend(_rend)
|
: rend(_rend)
|
||||||
{
|
{
|
||||||
Root *root = rend.getRoot();
|
rend.createScene("PlayerCam", 55, 5);
|
||||||
RenderWindow *window = rend.getWindow();
|
|
||||||
|
|
||||||
// Get the SceneManager, in this case a generic one
|
|
||||||
sceneMgr = root->createSceneManager(ST_GENERIC);
|
|
||||||
|
|
||||||
// Create the camera
|
|
||||||
camera = sceneMgr->createCamera("PlayerCam");
|
|
||||||
camera->setNearClipDistance(5);
|
|
||||||
|
|
||||||
// Create one viewport, entire window
|
|
||||||
vp = window->addViewport(camera);
|
|
||||||
|
|
||||||
// Alter the camera aspect ratio to match the viewport
|
|
||||||
camera->setAspectRatio(Real(vp->getActualWidth()) / Real(vp->getActualHeight()));
|
|
||||||
camera->setFOVy(Degree(55));
|
|
||||||
|
|
||||||
// Set default mipmap level (NB some APIs ignore this)
|
// Set default mipmap level (NB some APIs ignore this)
|
||||||
TextureManager::getSingleton().setDefaultNumMipmaps(5);
|
TextureManager::getSingleton().setDefaultNumMipmaps(5);
|
||||||
|
@ -43,10 +28,7 @@ MWScene::MWScene(Render::OgreRenderer &_rend)
|
||||||
// the screen (when x is to the right.) This is the orientation that
|
// the screen (when x is to the right.) This is the orientation that
|
||||||
// Morrowind uses, and it automagically makes everything work as it
|
// Morrowind uses, and it automagically makes everything work as it
|
||||||
// should.
|
// should.
|
||||||
SceneNode *rt = sceneMgr->getRootSceneNode();
|
SceneNode *rt = rend.getScene()->getRootSceneNode();
|
||||||
mwRoot = rt->createChildSceneNode();
|
mwRoot = rt->createChildSceneNode();
|
||||||
mwRoot->pitch(Degree(-90));
|
mwRoot->pitch(Degree(-90));
|
||||||
|
|
||||||
// For testing
|
|
||||||
sceneMgr->setAmbientLight(ColourValue(1,1,1));
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,9 +21,6 @@ namespace MWRender
|
||||||
class MWScene
|
class MWScene
|
||||||
{
|
{
|
||||||
Render::OgreRenderer &rend;
|
Render::OgreRenderer &rend;
|
||||||
Ogre::SceneManager *sceneMgr;
|
|
||||||
Ogre::Camera *camera;
|
|
||||||
Ogre::Viewport *vp;
|
|
||||||
|
|
||||||
// Root node for all objects added to the scene. This is rotated so
|
// Root node for all objects added to the scene. This is rotated so
|
||||||
// that the OGRE coordinate system matches that used internally in
|
// that the OGRE coordinate system matches that used internally in
|
||||||
|
@ -33,10 +30,10 @@ namespace MWRender
|
||||||
public:
|
public:
|
||||||
MWScene(Render::OgreRenderer &_rend);
|
MWScene(Render::OgreRenderer &_rend);
|
||||||
|
|
||||||
|
Ogre::Camera *getCamera() { return rend.getCamera(); }
|
||||||
Ogre::SceneNode *getRoot() { return mwRoot; }
|
Ogre::SceneNode *getRoot() { return mwRoot; }
|
||||||
Ogre::SceneManager *getMgr() { return sceneMgr; }
|
Ogre::SceneManager *getMgr() { return rend.getScene(); }
|
||||||
Ogre::Camera *getCamera() { return camera; }
|
Ogre::Viewport *getViewport() { return rend.getViewport(); }
|
||||||
Ogre::Viewport *getViewport() { return vp; }
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
#include "OgreLogManager.h"
|
#include "OgreLogManager.h"
|
||||||
#include "OgreLog.h"
|
#include "OgreLog.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
using namespace Ogre;
|
using namespace Ogre;
|
||||||
using namespace Render;
|
using namespace Render;
|
||||||
|
|
||||||
|
@ -53,6 +55,26 @@ bool OgreRenderer::configure(bool showConfig,
|
||||||
|
|
||||||
void OgreRenderer::createWindow(const std::string &title)
|
void OgreRenderer::createWindow(const std::string &title)
|
||||||
{
|
{
|
||||||
|
assert(mRoot);
|
||||||
// Initialize OGRE window
|
// Initialize OGRE window
|
||||||
mWindow = mRoot->initialise(true, title, "");
|
mWindow = mRoot->initialise(true, title, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OgreRenderer::createScene(const std::string camName, float fov, float nearClip)
|
||||||
|
{
|
||||||
|
assert(mRoot);
|
||||||
|
assert(mWindow);
|
||||||
|
// Get the SceneManager, in this case a generic one
|
||||||
|
mScene = mRoot->createSceneManager(ST_GENERIC);
|
||||||
|
|
||||||
|
// Create the camera
|
||||||
|
mCamera = mScene->createCamera(camName);
|
||||||
|
mCamera->setNearClipDistance(nearClip);
|
||||||
|
mCamera->setFOVy(Degree(fov));
|
||||||
|
|
||||||
|
// Create one viewport, entire window
|
||||||
|
mView = mWindow->addViewport(mCamera);
|
||||||
|
|
||||||
|
// Alter the camera aspect ratio to match the viewport
|
||||||
|
mCamera->setAspectRatio(Real(mView->getActualWidth()) / Real(mView->getActualHeight()));
|
||||||
|
}
|
||||||
|
|
|
@ -12,6 +12,9 @@ namespace Ogre
|
||||||
{
|
{
|
||||||
class Root;
|
class Root;
|
||||||
class RenderWindow;
|
class RenderWindow;
|
||||||
|
class SceneManager;
|
||||||
|
class Camera;
|
||||||
|
class Viewport;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Render
|
namespace Render
|
||||||
|
@ -20,11 +23,14 @@ namespace Render
|
||||||
{
|
{
|
||||||
Ogre::Root *mRoot;
|
Ogre::Root *mRoot;
|
||||||
Ogre::RenderWindow *mWindow;
|
Ogre::RenderWindow *mWindow;
|
||||||
|
Ogre::SceneManager *mScene;
|
||||||
|
Ogre::Camera *mCamera;
|
||||||
|
Ogre::Viewport *mView;
|
||||||
bool logging;
|
bool logging;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
OgreRenderer()
|
OgreRenderer()
|
||||||
: mRoot(NULL) {}
|
: mRoot(NULL), mWindow(NULL), mScene(NULL) {}
|
||||||
~OgreRenderer() { cleanup(); }
|
~OgreRenderer() { cleanup(); }
|
||||||
|
|
||||||
/** Configure the renderer. This will load configuration files and
|
/** Configure the renderer. This will load configuration files and
|
||||||
|
@ -36,6 +42,12 @@ namespace Render
|
||||||
/// Create a window with the given title
|
/// Create a window with the given title
|
||||||
void createWindow(const std::string &title);
|
void createWindow(const std::string &title);
|
||||||
|
|
||||||
|
/// Set up the scene manager, camera and viewport
|
||||||
|
void createScene(const std::string camName="Camera",// Camera name
|
||||||
|
float fov=55, // Field of view angle
|
||||||
|
float nearClip=5 // Near clip distance
|
||||||
|
);
|
||||||
|
|
||||||
/// Kill the renderer.
|
/// Kill the renderer.
|
||||||
void cleanup();
|
void cleanup();
|
||||||
|
|
||||||
|
@ -50,6 +62,15 @@ namespace Render
|
||||||
|
|
||||||
/// Get the rendering window
|
/// Get the rendering window
|
||||||
Ogre::RenderWindow *getWindow() { return mWindow; }
|
Ogre::RenderWindow *getWindow() { return mWindow; }
|
||||||
|
|
||||||
|
/// Get the scene manager
|
||||||
|
Ogre::SceneManager *getScene() { return mScene; }
|
||||||
|
|
||||||
|
/// Camera
|
||||||
|
Ogre::Camera *getCamera() { return mCamera; }
|
||||||
|
|
||||||
|
/// Viewport
|
||||||
|
Ogre::Viewport *getViewport() { return mView; }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -463,16 +463,6 @@ extern "C" void gui_showHUD()
|
||||||
|
|
||||||
extern "C" void gui_setupGUI(int32_t debugOut)
|
extern "C" void gui_setupGUI(int32_t debugOut)
|
||||||
{
|
{
|
||||||
ResourceGroupManager::getSingleton().
|
|
||||||
addResourceLocation("media_mygui", "FileSystem", "General");
|
|
||||||
|
|
||||||
// Enable/disable logging to stdout
|
|
||||||
MyGUI::LogManager::initialise();
|
|
||||||
MyGUI::LogManager::setSTDOutputEnabled(debugOut);
|
|
||||||
|
|
||||||
mGUI = new MyGUI::Gui();
|
|
||||||
mGUI->initialise(mWindow);
|
|
||||||
|
|
||||||
int mWidth = mWindow->getWidth();
|
int mWidth = mWindow->getWidth();
|
||||||
int mHeight = mWindow->getHeight();
|
int mHeight = mWindow->getHeight();
|
||||||
|
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
#include <MyGUI.h>
|
|
||||||
|
|
||||||
// The global GUI object
|
|
||||||
MyGUI::Gui *mGUI;
|
|
||||||
|
|
||||||
// This is used to determine if we are displaying any gui elements
|
|
||||||
// right now. If we are (and guiMode > 0), we redirect mouse/keyboard
|
|
||||||
// input into MyGUI.
|
|
||||||
int32_t guiMode = 0;
|
|
||||||
|
|
||||||
#include "../gui/cpp_mygui.cpp"
|
|
||||||
#include "../terrain/cpp_terrain.cpp"
|
|
Loading…
Reference in a new issue