mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 18:19:55 +00:00
remove the plugins.cfg files, do not enforce CG plugin
This commit is contained in:
parent
21728020f6
commit
014396e80c
19 changed files with 131 additions and 97 deletions
|
@ -20,14 +20,6 @@ set (OPENMW_VERSION_RELEASE 0)
|
|||
|
||||
set (OPENMW_VERSION "${OPENMW_VERSION_MAJOR}.${OPENMW_VERSION_MINOR}.${OPENMW_VERSION_RELEASE}")
|
||||
|
||||
# Debug suffix for plugins
|
||||
set(DEBUG_SUFFIX "")
|
||||
if (DEFINED CMAKE_BUILD_TYPE)
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(DEBUG_SUFFIX "_d")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# doxygen main page
|
||||
|
||||
configure_file ("${OpenMW_SOURCE_DIR}/Docs/mainpage.hpp.cmake" "${OpenMW_SOURCE_DIR}/Docs/mainpage.hpp")
|
||||
|
@ -230,6 +222,22 @@ if (APPLE)
|
|||
${OGRE_Plugin_ParticleFX_LIBRARY_REL})
|
||||
endif (APPLE)
|
||||
|
||||
|
||||
# Set up Ogre plugin folder & debug suffix
|
||||
set(DEBUG_SUFFIX "")
|
||||
if (DEFINED CMAKE_BUILD_TYPE)
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(DEBUG_SUFFIX "_d")
|
||||
add_definitions(-DOGRE_PLUGIN_DEBUG_SUFFIX="_d")
|
||||
else()
|
||||
add_definitions(-DOGRE_PLUGIN_DEBUG_SUFFIX="")
|
||||
endif()
|
||||
endif()
|
||||
add_definitions(-DOGRE_PLUGIN_DIR_REL="${OGRE_PLUGIN_DIR_REL}")
|
||||
add_definitions(-DOGRE_PLUGIN_DIR_DBG="${OGRE_PLUGIN_DIR_DBG}")
|
||||
add_definitions(-DOGRE_PLUGIN_DIR="${OGRE_PLUGIN_DIR}")
|
||||
|
||||
|
||||
add_subdirectory(files/)
|
||||
add_subdirectory(files/mygui)
|
||||
|
||||
|
@ -254,15 +262,8 @@ configure_file(${OpenMW_SOURCE_DIR}/files/openmw.cfg.local
|
|||
configure_file(${OpenMW_SOURCE_DIR}/files/openmw.cfg
|
||||
"${OpenMW_BINARY_DIR}/openmw.cfg.install")
|
||||
|
||||
if (WIN32)
|
||||
configure_file(${OpenMW_SOURCE_DIR}/files/plugins.cfg.win32
|
||||
"${OpenMW_BINARY_DIR}/plugins.cfg" COPYONLY)
|
||||
endif (WIN32)
|
||||
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
configure_file(${OpenMW_SOURCE_DIR}/files/plugins.cfg.linux
|
||||
"${OpenMW_BINARY_DIR}/plugins.cfg")
|
||||
|
||||
configure_file(${OpenMW_SOURCE_DIR}/files/openmw.desktop
|
||||
"${OpenMW_BINARY_DIR}/openmw.desktop")
|
||||
endif()
|
||||
|
@ -284,13 +285,8 @@ if (APPLE)
|
|||
|
||||
set(OGRE_PLUGIN_DIR "${OGRE_PLUGIN_DIR}/")
|
||||
|
||||
configure_file(${OpenMW_SOURCE_DIR}/files/plugins.cfg.mac
|
||||
"${OpenMW_BINARY_DIR}/plugins.cfg")
|
||||
|
||||
set(OGRE_PLUGIN_DIR_2 ${OGRE_PLUGIN_DIR})
|
||||
set(OGRE_PLUGIN_DIR "")
|
||||
configure_file(${OpenMW_SOURCE_DIR}/files/plugins.cfg.mac
|
||||
"${OpenMW_BINARY_DIR}/plugins.cfg.install")
|
||||
set(OGRE_PLUGIN_DIR ${OGRE_PLUGIN_DIR_2})
|
||||
|
||||
configure_file(${OpenMW_SOURCE_DIR}/files/mac/Info.plist
|
||||
|
@ -337,7 +333,6 @@ if(DPKG_PROGRAM)
|
|||
INSTALL(FILES "${OpenMW_BINARY_DIR}/settings-default.cfg" DESTINATION "../etc/openmw/" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw")
|
||||
INSTALL(FILES "${OpenMW_BINARY_DIR}/transparency-overrides.cfg" DESTINATION "../etc/openmw/" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw")
|
||||
INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.cfg.install" DESTINATION "../etc/openmw/" RENAME "openmw.cfg" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw")
|
||||
INSTALL(FILES "${OpenMW_BINARY_DIR}/plugins.cfg" DESTINATION "../etc/openmw/" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ COMPONENT "openmw")
|
||||
|
||||
#Install resources
|
||||
INSTALL(DIRECTORY "${OpenMW_BINARY_DIR}/resources" DESTINATION "share/games/openmw/" FILE_PERMISSIONS OWNER_READ GROUP_READ WORLD_READ COMPONENT "Resources")
|
||||
|
@ -375,7 +370,6 @@ if(WIN32)
|
|||
INSTALL(FILES ${dll_files} DESTINATION ".")
|
||||
INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.cfg.install" DESTINATION "." RENAME "openmw.cfg")
|
||||
INSTALL(FILES
|
||||
"${OpenMW_BINARY_DIR}/plugins.cfg"
|
||||
"${OpenMW_SOURCE_DIR}/readme.txt"
|
||||
"${OpenMW_SOURCE_DIR}/GPL3.txt"
|
||||
"${OpenMW_SOURCE_DIR}/OFL.txt"
|
||||
|
@ -547,7 +541,6 @@ if (APPLE)
|
|||
install(DIRECTORY "${APP_BUNDLE_DIR}" USE_SOURCE_PERMISSIONS DESTINATION "${INSTALL_SUBDIR}" COMPONENT Runtime)
|
||||
install(DIRECTORY "${OpenMW_BINARY_DIR}/resources" DESTINATION "${INSTALL_SUBDIR}" COMPONENT Runtime)
|
||||
install(FILES "${OpenMW_BINARY_DIR}/openmw.cfg.install" RENAME "openmw.cfg" DESTINATION "${INSTALL_SUBDIR}" COMPONENT Runtime)
|
||||
install(FILES "${OpenMW_BINARY_DIR}/plugins.cfg.install" RENAME "plugins.cfg" DESTINATION "${INSTALL_SUBDIR}" COMPONENT Runtime)
|
||||
install(FILES "${OpenMW_BINARY_DIR}/launcher.qss" DESTINATION "${INSTALL_SUBDIR}" COMPONENT Runtime)
|
||||
|
||||
install(FILES "${OpenMW_BINARY_DIR}/settings-default.cfg" DESTINATION "${INSTALL_SUBDIR}" COMPONENT Runtime)
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
#include <QtGui>
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
#include <boost/math/common_factor.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#include <components/files/configurationmanager.hpp>
|
||||
#include <components/settings/settings.hpp>
|
||||
|
@ -70,9 +73,6 @@ GraphicsPage::GraphicsPage(Files::ConfigurationManager &cfg, QWidget *parent)
|
|||
|
||||
bool GraphicsPage::setupOgre()
|
||||
{
|
||||
QString pluginCfg = mCfgMgr.getPluginsConfigPath().string().c_str();
|
||||
QFile file(pluginCfg);
|
||||
|
||||
// Create a log manager so we can surpress debug text to stdout/stderr
|
||||
Ogre::LogManager* logMgr = OGRE_NEW Ogre::LogManager;
|
||||
logMgr->createLog((mCfgMgr.getLogPath().string() + "/launcherOgre.log"), true, false, false);
|
||||
|
@ -82,7 +82,7 @@ bool GraphicsPage::setupOgre()
|
|||
#if defined(ENABLE_PLUGIN_GL) || defined(ENABLE_PLUGIN_Direct3D9)
|
||||
mOgre = new Ogre::Root("", "", "./launcherOgre.log");
|
||||
#else
|
||||
mOgre = new Ogre::Root(pluginCfg.toStdString(), "", "./launcherOgre.log");
|
||||
mOgre = new Ogre::Root("", "", "./launcherOgre.log");
|
||||
#endif
|
||||
}
|
||||
catch(Ogre::Exception &ex)
|
||||
|
@ -93,7 +93,6 @@ bool GraphicsPage::setupOgre()
|
|||
msgBox.setIcon(QMessageBox::Critical);
|
||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||
msgBox.setText(tr("<br><b>Failed to create the Ogre::Root object</b><br><br> \
|
||||
Make sure the plugins.cfg is present and valid.<br><br> \
|
||||
Press \"Show Details...\" for more information.<br>"));
|
||||
msgBox.setDetailedText(ogreError);
|
||||
msgBox.exec();
|
||||
|
@ -102,6 +101,32 @@ bool GraphicsPage::setupOgre()
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
std::string pluginDir;
|
||||
const char* pluginEnv = getenv("OPENMW_OGRE_PLUGIN_DIR");
|
||||
if (pluginEnv)
|
||||
pluginDir = pluginEnv;
|
||||
else
|
||||
{
|
||||
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
|
||||
pluginDir = ".\\";
|
||||
#endif
|
||||
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
|
||||
pluginDir = OGRE_PLUGIN_DIR;
|
||||
#endif
|
||||
#if OGRE_PLATFORM == OGRE_PLATFORM_LINUX
|
||||
pluginDir = OGRE_PLUGIN_DIR_REL;
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string glPlugin = std::string(pluginDir) + "/RenderSystem_GL" + OGRE_PLUGIN_DEBUG_SUFFIX;
|
||||
if (boost::filesystem::exists(glPlugin + ".so") || boost::filesystem::exists(glPlugin + ".dll"))
|
||||
mOgre->loadPlugin (glPlugin);
|
||||
|
||||
std::string dxPlugin = std::string(pluginDir) + "/RenderSystem_Direct3D9" + OGRE_PLUGIN_DEBUG_SUFFIX;
|
||||
if (boost::filesystem::exists(dxPlugin + ".so") || boost::filesystem::exists(dxPlugin + ".dll"))
|
||||
mOgre->loadPlugin (dxPlugin);
|
||||
|
||||
#ifdef ENABLE_PLUGIN_GL
|
||||
mGLPlugin = new Ogre::GLPlugin();
|
||||
mOgre->installPlugin(mGLPlugin);
|
||||
|
|
|
@ -292,7 +292,6 @@ void OMW::Engine::go()
|
|||
}
|
||||
mOgre->configure(
|
||||
mCfgMgr.getLogPath().string(),
|
||||
mCfgMgr.getPluginsConfigPath().string(),
|
||||
renderSystem,
|
||||
false);
|
||||
|
||||
|
|
|
@ -111,6 +111,9 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const
|
|||
sh::Factory::getInstance ().setGlobalSetting ("underwater_effects", Settings::Manager::getString("underwater effect", "Water"));
|
||||
sh::Factory::getInstance ().setGlobalSetting ("simple_water", Settings::Manager::getBool("shader", "Water") ? "false" : "true");
|
||||
|
||||
sh::Factory::getInstance ().setSharedParameter ("viewportBackground", sh::makeProperty<sh::Vector3> (new sh::Vector3(0,0,0)));
|
||||
sh::Factory::getInstance ().setSharedParameter ("waterEnabled", sh::makeProperty<sh::FloatValue> (new sh::FloatValue(0.0)));
|
||||
|
||||
applyCompositors();
|
||||
|
||||
// Turn the entire scene (represented by the 'root' node) -90
|
||||
|
@ -379,11 +382,9 @@ void RenderingManager::configureFog(const float density, const Ogre::ColourValue
|
|||
mRendering.getCamera()->setFarClipDistance ( max / density );
|
||||
mRendering.getViewport()->setBackgroundColour (colour);
|
||||
|
||||
CompositorInstance* inst = CompositorManager::getSingleton().getCompositorChain(mRendering.getViewport())->getCompositor("gbuffer");
|
||||
if (inst != 0)
|
||||
inst->getCompositor()->getTechnique(0)->getTargetPass(0)->getPass(0)->setClearColour(colour);
|
||||
if (mWater)
|
||||
mWater->setViewportBackground(colour);
|
||||
sh::Factory::getInstance ().setSharedParameter ("viewportBackground",
|
||||
sh::makeProperty<sh::Vector3> (new sh::Vector3(colour.r, colour.g, colour.b)));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -141,6 +141,8 @@ void Water::setActive(bool active)
|
|||
{
|
||||
mActive = active;
|
||||
updateVisible();
|
||||
|
||||
sh::Factory::getInstance ().setSharedParameter ("waterEnabled", sh::makeProperty<sh::FloatValue> (new sh::FloatValue(active ? 1.0 : 0.0)));
|
||||
}
|
||||
|
||||
Water::~Water()
|
||||
|
@ -413,6 +415,8 @@ void Water::createdConfiguration (sh::MaterialInstance* m, const std::string& co
|
|||
}
|
||||
|
||||
Ogre::Technique* t = static_cast<sh::OgreMaterial*>(m->getMaterial())->getOgreTechniqueForConfiguration(configuration);
|
||||
if (t->getPass(0)->getNumTextureUnitStates () == 0)
|
||||
return;
|
||||
t->getPass(0)->getTextureUnitState(0)->setAnimatedTextureName(textureNames, 32, 2);
|
||||
t->getPass(0)->setDepthWriteEnabled (false);
|
||||
t->getPass(0)->setSceneBlending (Ogre::SBT_TRANSPARENT_ALPHA);
|
||||
|
|
|
@ -15,7 +15,6 @@ namespace Files
|
|||
{
|
||||
|
||||
static const char* const openmwCfgFile = "openmw.cfg";
|
||||
static const char* const pluginsCfgFile = "plugins.cfg";
|
||||
|
||||
const char* const mwToken = "?mw?";
|
||||
const char* const localToken = "?local?";
|
||||
|
@ -27,17 +26,6 @@ ConfigurationManager::ConfigurationManager()
|
|||
{
|
||||
setupTokensMapping();
|
||||
|
||||
mPluginsCfgPath = mFixedPath.getLocalPath() / pluginsCfgFile;
|
||||
if (!boost::filesystem::is_regular_file(mPluginsCfgPath))
|
||||
{
|
||||
mPluginsCfgPath = mFixedPath.getGlobalPath() / pluginsCfgFile;
|
||||
if (!boost::filesystem::is_regular_file(mPluginsCfgPath))
|
||||
{
|
||||
std::cerr << "Failed to find " << pluginsCfgFile << " file!" << std::endl;
|
||||
mPluginsCfgPath.clear();
|
||||
}
|
||||
}
|
||||
|
||||
mLogPath = mFixedPath.getUserPath();
|
||||
}
|
||||
|
||||
|
@ -162,11 +150,6 @@ const boost::filesystem::path& ConfigurationManager::getInstallPath() const
|
|||
return mFixedPath.getInstallPath();
|
||||
}
|
||||
|
||||
const boost::filesystem::path& ConfigurationManager::getPluginsConfigPath() const
|
||||
{
|
||||
return mPluginsCfgPath;
|
||||
}
|
||||
|
||||
const boost::filesystem::path& ConfigurationManager::getLogPath() const
|
||||
{
|
||||
return mLogPath;
|
||||
|
|
|
@ -40,7 +40,6 @@ struct ConfigurationManager
|
|||
const boost::filesystem::path& getLocalDataPath() const;
|
||||
const boost::filesystem::path& getInstallPath() const;
|
||||
|
||||
const boost::filesystem::path& getPluginsConfigPath() const;
|
||||
const boost::filesystem::path& getLogPath() const;
|
||||
|
||||
private:
|
||||
|
@ -57,7 +56,6 @@ struct ConfigurationManager
|
|||
|
||||
FixedPathType mFixedPath;
|
||||
|
||||
boost::filesystem::path mPluginsCfgPath;
|
||||
boost::filesystem::path mLogPath;
|
||||
|
||||
TokensMappingContainer mTokensMapping;
|
||||
|
|
|
@ -9,11 +9,16 @@ compositor gbuffer
|
|||
target mrt_output
|
||||
{
|
||||
input none
|
||||
|
||||
pass clear
|
||||
{
|
||||
// make sure to set this to the viewport background color from outside
|
||||
colour_value 0 0 0 1
|
||||
}
|
||||
pass render_quad
|
||||
{
|
||||
// this makes sure the depth for background is set to 1
|
||||
material openmw_viewport_init
|
||||
}
|
||||
pass render_scene
|
||||
{
|
||||
// Renders everything except water
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
{
|
||||
shOutputColour(0) = colourPassthrough * atmosphereColour;
|
||||
|
||||
shOutputColour(0) = float3(0,0,0,1);
|
||||
|
||||
#if MRT
|
||||
shOutputColour(1) = float4(1,1,1,1);
|
||||
#endif
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
float4 albedo = shSample(diffuseMap1, scrolledUV) * (1-cloudBlendFactor) + shSample(diffuseMap2, scrolledUV) * cloudBlendFactor;
|
||||
|
||||
shOutputColour(0) = colourPassthrough * float4(cloudColour, 1) * albedo * float4(1,1,1, cloudOpacity);
|
||||
|
||||
shOutputColour(0) = float3(0,0,0,1);
|
||||
#if MRT
|
||||
shOutputColour(1) = float4(1,1,1,1);
|
||||
#endif
|
||||
|
|
|
@ -164,6 +164,7 @@
|
|||
|
||||
shUniform(float, waterTimer) @shSharedParameter(waterTimer)
|
||||
shUniform(float2, waterSunFade_sunHeight) @shSharedParameter(waterSunFade_sunHeight)
|
||||
shUniform(float, waterEnabled) @shSharedParameter(waterEnabled)
|
||||
|
||||
shUniform(float3, windDir_windSpeed) @shSharedParameter(windDir_windSpeed)
|
||||
#endif
|
||||
|
@ -204,7 +205,7 @@
|
|||
#if UNDERWATER
|
||||
float3 worldPos = shMatrixMult(worldMatrix, float4(objSpacePositionPassthrough,1)).xyz;
|
||||
float3 waterEyePos = float3(1,1,1);
|
||||
if (worldPos.y < waterLevel)
|
||||
if (worldPos.y < waterLevel && waterEnabled == 1)
|
||||
{
|
||||
float4 worldNormal = shMatrixMult(worldMatrix, float4(normal.xyz, 0));
|
||||
waterEyePos = intercept(worldPos, cameraPos.xyz - worldPos, float3(0,1,0), waterLevel);
|
||||
|
@ -286,7 +287,7 @@
|
|||
watercolour *= darkness;
|
||||
|
||||
float isUnderwater = (worldPos.y < waterLevel) ? 1.0 : 0.0;
|
||||
shOutputColour(0).xyz = shLerp (shOutputColour(0).xyz, watercolour, fogAmount * isUnderwater);
|
||||
shOutputColour(0).xyz = shLerp (shOutputColour(0).xyz, watercolour, fogAmount * isUnderwater * waterEnabled);
|
||||
#endif
|
||||
|
||||
#if MRT
|
||||
|
|
|
@ -20,3 +20,16 @@ material quad_noDepthWrite
|
|||
parent quad
|
||||
depth_write off
|
||||
}
|
||||
|
||||
material openmw_viewport_init
|
||||
{
|
||||
pass
|
||||
{
|
||||
vertex_program viewport_init_vertex
|
||||
fragment_program viewport_init_fragment
|
||||
|
||||
depth_write off
|
||||
depth_check off
|
||||
scene_blend add
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,3 +13,19 @@ shader_set quad_fragment
|
|||
profiles_cg ps_2_x ps_2_0 ps fp40 arbfp1
|
||||
profiles_hlsl ps_2_0
|
||||
}
|
||||
|
||||
shader_set viewport_init_vertex
|
||||
{
|
||||
source quad2.shader
|
||||
type vertex
|
||||
profiles_cg vs_2_0 vp40 arbvp1
|
||||
profiles_hlsl vs_2_0
|
||||
}
|
||||
|
||||
shader_set viewport_init_fragment
|
||||
{
|
||||
source quad2.shader
|
||||
type fragment
|
||||
profiles_cg ps_2_x ps_2_0 ps fp40 arbfp1
|
||||
profiles_hlsl ps_2_0
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@
|
|||
#define SMALL_WAVES_Y 0.1
|
||||
|
||||
#define WAVE_CHOPPYNESS 0.15 // wave choppyness
|
||||
#define WAVE_SCALE 150 // overall wave scale
|
||||
#define WAVE_SCALE 75 // overall wave scale
|
||||
|
||||
#define ABBERATION 0.001 // chromatic abberation amount
|
||||
#define BUMP 1.5 // overall water surface bumpiness
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
# Defines plugins to load
|
||||
|
||||
# Define plugin folder
|
||||
PluginFolder=${OGRE_PLUGIN_DIR_REL}
|
||||
|
||||
# Define plugins
|
||||
Plugin=RenderSystem_GL${DEBUG_SUFFIX}
|
||||
Plugin=Plugin_ParticleFX${DEBUG_SUFFIX}
|
||||
Plugin=Plugin_OctreeSceneManager${DEBUG_SUFFIX}
|
||||
Plugin=Plugin_CgProgramManager${DEBUG_SUFFIX}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
# Defines plugins to load
|
||||
|
||||
# Define plugin folder
|
||||
PluginFolder=${OGRE_PLUGIN_DIR}
|
||||
|
||||
# Define plugins
|
||||
Plugin=RenderSystem_GL${DEBUG_SUFFIX}.1.8.0
|
||||
Plugin=Plugin_ParticleFX${DEBUG_SUFFIX}.1.8.0
|
||||
Plugin=Plugin_OctreeSceneManager${DEBUG_SUFFIX}.1.8.0
|
||||
Plugin=Plugin_CgProgramManager${DEBUG_SUFFIX}.1.8.0
|
||||
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
# Defines plugins to load
|
||||
|
||||
# Define plugin folder
|
||||
PluginFolder=.\
|
||||
|
||||
# Define plugins
|
||||
Plugin=RenderSystem_Direct3D9${DEBUG_SUFFIX}
|
||||
Plugin=RenderSystem_GL${DEBUG_SUFFIX}
|
||||
Plugin=Plugin_ParticleFX${DEBUG_SUFFIX}
|
||||
Plugin=Plugin_OctreeSceneManager${DEBUG_SUFFIX}
|
||||
Plugin=Plugin_CgProgramManager${DEBUG_SUFFIX}
|
||||
|
||||
|
|
@ -9,7 +9,10 @@
|
|||
#include "OgreTexture.h"
|
||||
#include "OgreHardwarePixelBuffer.h"
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
#include <stdexcept>
|
||||
|
||||
using namespace Ogre;
|
||||
|
@ -70,7 +73,6 @@ float OgreRenderer::getFPS()
|
|||
}
|
||||
|
||||
void OgreRenderer::configure(const std::string &logPath,
|
||||
const std::string &pluginCfg,
|
||||
const std::string& renderSystem,
|
||||
bool _logging)
|
||||
{
|
||||
|
@ -90,9 +92,38 @@ void OgreRenderer::configure(const std::string &logPath,
|
|||
mRoot = new Root("", "", "");
|
||||
loadPlugins();
|
||||
#else
|
||||
mRoot = new Root(pluginCfg, "", "");
|
||||
mRoot = new Root("", "", "");
|
||||
#endif
|
||||
|
||||
std::string pluginDir;
|
||||
const char* pluginEnv = getenv("OPENMW_OGRE_PLUGIN_DIR");
|
||||
if (pluginEnv)
|
||||
pluginDir = pluginEnv;
|
||||
else
|
||||
{
|
||||
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
|
||||
pluginDir = ".\\";
|
||||
#endif
|
||||
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
|
||||
pluginDir = OGRE_PLUGIN_DIR;
|
||||
#endif
|
||||
#if OGRE_PLATFORM == OGRE_PLATFORM_LINUX
|
||||
pluginDir = OGRE_PLUGIN_DIR_REL;
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string glPlugin = std::string(pluginDir) + "/RenderSystem_GL" + OGRE_PLUGIN_DEBUG_SUFFIX;
|
||||
if (boost::filesystem::exists(glPlugin + ".so") || boost::filesystem::exists(glPlugin + ".dll"))
|
||||
mRoot->loadPlugin (glPlugin);
|
||||
|
||||
std::string dxPlugin = std::string(pluginDir) + "/RenderSystem_Direct3D9" + OGRE_PLUGIN_DEBUG_SUFFIX;
|
||||
if (boost::filesystem::exists(dxPlugin + ".so") || boost::filesystem::exists(dxPlugin + ".dll"))
|
||||
mRoot->loadPlugin (dxPlugin);
|
||||
|
||||
std::string cgPlugin = std::string(pluginDir) + "/Plugin_CgProgramManager" + OGRE_PLUGIN_DEBUG_SUFFIX;
|
||||
if (boost::filesystem::exists(cgPlugin + ".so") || boost::filesystem::exists(cgPlugin + ".dll"))
|
||||
mRoot->loadPlugin (cgPlugin);
|
||||
|
||||
RenderSystem* rs = mRoot->getRenderSystemByName(renderSystem);
|
||||
if (rs == 0)
|
||||
throw std::runtime_error ("RenderSystem with name " + renderSystem + " not found, make sure the plugins are loaded");
|
||||
|
|
|
@ -110,7 +110,6 @@ namespace OEngine
|
|||
set up the Root and logging classes. */
|
||||
void configure(
|
||||
const std::string &logPath, // Path to directory where to store log files
|
||||
const std::string &pluginCfg, // plugin.cfg file
|
||||
const std::string &renderSystem,
|
||||
bool _logging); // Enable or disable logging
|
||||
|
||||
|
|
Loading…
Reference in a new issue