forked from teamnwah/openmw-tes3coop
Merge remote branch 'corristo/pgrd-rendering'
reduced cout spam. Conflicts: apps/openmw/mwrender/debugging.cpp apps/openmw/mwrender/renderingmanager.cpp components/bsa/bsa_archive.cpp libs/openengine/bullet/physic.hpp
This commit is contained in:
commit
6022d3ab13
9 changed files with 371 additions and 49 deletions
|
@ -249,8 +249,14 @@ if (APPLE)
|
|||
"${APP_BUNDLE_DIR}/Contents/Resources/OpenMW.icns" COPYONLY)
|
||||
|
||||
# prepare plugins
|
||||
if (${CMAKE_BUILD_TYPE} MATCHES "Release" OR
|
||||
${CMAKE_BUILD_TYPE} MATCHES "RelWithDebugInfo")
|
||||
if (${CMAKE_BUILD_TYPE} MATCHES "Release")
|
||||
set(OPENMW_RELEASE_BUILD 1)
|
||||
endif()
|
||||
if (${CMAKE_BUILD_TYPE} MATCHES "RelWithDebugInfo")
|
||||
set(OPENMW_RELEASE_BUILD 1)
|
||||
endif()
|
||||
|
||||
if (${OPENMW_RELEASE_BUILD})
|
||||
set(OGRE_PLUGIN_DIR ${OGRE_PLUGIN_DIR_REL})
|
||||
else()
|
||||
set(OGRE_PLUGIN_DIR ${OGRE_PLUGIN_DIR_DBG})
|
||||
|
|
|
@ -2,33 +2,283 @@
|
|||
|
||||
#include <assert.h>
|
||||
|
||||
#include "OgreRoot.h"
|
||||
#include "OgreRenderWindow.h"
|
||||
#include "OgreSceneManager.h"
|
||||
#include "OgreViewport.h"
|
||||
#include "OgreCamera.h"
|
||||
#include "OgreTextureManager.h"
|
||||
#include <OgreNode.h>
|
||||
#include <OgreSceneManager.h>
|
||||
#include <OgreMaterial.h>
|
||||
#include <OgreMaterialManager.h>
|
||||
|
||||
#include "../mwworld/world.hpp" // these includes can be removed once the static-hack is gone
|
||||
#include "../mwworld/environment.hpp"
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include <components/esm/loadstat.hpp>
|
||||
#include <components/esm/loadpgrd.hpp>
|
||||
|
||||
#include "player.hpp"
|
||||
|
||||
using namespace MWRender;
|
||||
using namespace Ogre;
|
||||
|
||||
Debugging::Debugging(OEngine::Physic::PhysicEngine* engine){
|
||||
eng = engine;
|
||||
namespace MWRender
|
||||
{
|
||||
|
||||
static const std::string PATHGRID_POINT_MATERIAL = "pathgridPointMaterial";
|
||||
static const std::string PATHGRID_LINE_MATERIAL = "pathgridLineMaterial";
|
||||
static const std::string DEBUGGING_GROUP = "debugging";
|
||||
static const int POINT_MESH_BASE = 35;
|
||||
|
||||
void Debugging::createGridMaterials()
|
||||
{
|
||||
if (mGridMatsCreated) return;
|
||||
|
||||
if (MaterialManager::getSingleton().getByName(PATHGRID_LINE_MATERIAL, DEBUGGING_GROUP).isNull())
|
||||
{
|
||||
MaterialPtr lineMatPtr = MaterialManager::getSingleton().create(PATHGRID_LINE_MATERIAL, DEBUGGING_GROUP);
|
||||
lineMatPtr->setReceiveShadows(false);
|
||||
lineMatPtr->getTechnique(0)->setLightingEnabled(true);
|
||||
lineMatPtr->getTechnique(0)->getPass(0)->setDiffuse(1,1,0,0);
|
||||
lineMatPtr->getTechnique(0)->getPass(0)->setAmbient(1,1,0);
|
||||
lineMatPtr->getTechnique(0)->getPass(0)->setSelfIllumination(1,1,0);
|
||||
}
|
||||
|
||||
if (MaterialManager::getSingleton().getByName(PATHGRID_POINT_MATERIAL, DEBUGGING_GROUP).isNull())
|
||||
{
|
||||
MaterialPtr pointMatPtr = MaterialManager::getSingleton().create(PATHGRID_POINT_MATERIAL, DEBUGGING_GROUP);
|
||||
pointMatPtr->setReceiveShadows(false);
|
||||
pointMatPtr->getTechnique(0)->setLightingEnabled(true);
|
||||
pointMatPtr->getTechnique(0)->getPass(0)->setDiffuse(1,0,0,0);
|
||||
pointMatPtr->getTechnique(0)->getPass(0)->setAmbient(1,0,0);
|
||||
pointMatPtr->getTechnique(0)->getPass(0)->setSelfIllumination(1,0,0);
|
||||
}
|
||||
mGridMatsCreated = true;
|
||||
}
|
||||
|
||||
void Debugging::destroyGridMaterials()
|
||||
{
|
||||
if (mGridMatsCreated)
|
||||
{
|
||||
MaterialManager::getSingleton().remove(PATHGRID_POINT_MATERIAL);
|
||||
MaterialManager::getSingleton().remove(PATHGRID_LINE_MATERIAL);
|
||||
mGridMatsCreated = false;
|
||||
}
|
||||
}
|
||||
|
||||
ManualObject *Debugging::createPathgridLines(const ESM::Pathgrid *pathgrid)
|
||||
{
|
||||
ManualObject *result = mSceneMgr->createManualObject();
|
||||
|
||||
result->begin(PATHGRID_LINE_MATERIAL, RenderOperation::OT_LINE_LIST);
|
||||
for(ESM::Pathgrid::EdgeList::const_iterator it = pathgrid->edges.begin();
|
||||
it != pathgrid->edges.end();
|
||||
it++)
|
||||
{
|
||||
const ESM::Pathgrid::Edge &edge = *it;
|
||||
const ESM::Pathgrid::Point &p1 = pathgrid->points[edge.v0], &p2 = pathgrid->points[edge.v1];
|
||||
Vector3 direction = (Vector3(p2.x, p2.y, p2.z) - Vector3(p1.x, p1.y, p1.z));
|
||||
Vector3 lineDisplacement = direction.crossProduct(Vector3::UNIT_Z).normalisedCopy();
|
||||
lineDisplacement = lineDisplacement * POINT_MESH_BASE +
|
||||
Vector3(0, 0, 10); // move lines up a little, so they will be less covered by meshes/landscape
|
||||
result->position(Vector3(p1.x, p1.y, p1.z) + lineDisplacement);
|
||||
result->position(Vector3(p2.x, p2.y, p2.z) + lineDisplacement);
|
||||
}
|
||||
result->end();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
ManualObject *Debugging::createPathgridPoints(const ESM::Pathgrid *pathgrid)
|
||||
{
|
||||
ManualObject *result = mSceneMgr->createManualObject();
|
||||
const float height = POINT_MESH_BASE * sqrtf(2);
|
||||
|
||||
result->begin(PATHGRID_POINT_MATERIAL, RenderOperation::OT_TRIANGLE_STRIP);
|
||||
|
||||
bool first = true;
|
||||
uint32 startIndex = 0;
|
||||
for(ESM::Pathgrid::PointList::const_iterator it = pathgrid->points.begin();
|
||||
it != pathgrid->points.end();
|
||||
it++, startIndex += 6)
|
||||
{
|
||||
Vector3 pointPos(it->x, it->y, it->z);
|
||||
|
||||
if (!first)
|
||||
{
|
||||
// degenerate triangle from previous octahedron
|
||||
result->index(startIndex - 4); // 2nd point of previous octahedron
|
||||
result->index(startIndex); // start point of current octahedron
|
||||
}
|
||||
|
||||
result->position(pointPos + Vector3(0, 0, height)); // 0
|
||||
result->position(pointPos + Vector3(-POINT_MESH_BASE, -POINT_MESH_BASE, 0)); // 1
|
||||
result->position(pointPos + Vector3(POINT_MESH_BASE, -POINT_MESH_BASE, 0)); // 2
|
||||
result->position(pointPos + Vector3(POINT_MESH_BASE, POINT_MESH_BASE, 0)); // 3
|
||||
result->position(pointPos + Vector3(-POINT_MESH_BASE, POINT_MESH_BASE, 0)); // 4
|
||||
result->position(pointPos + Vector3(0, 0, -height)); // 5
|
||||
|
||||
result->index(startIndex + 0);
|
||||
result->index(startIndex + 1);
|
||||
result->index(startIndex + 2);
|
||||
result->index(startIndex + 5);
|
||||
result->index(startIndex + 3);
|
||||
result->index(startIndex + 4);
|
||||
// degenerates
|
||||
result->index(startIndex + 4);
|
||||
result->index(startIndex + 5);
|
||||
result->index(startIndex + 5);
|
||||
// end degenerates
|
||||
result->index(startIndex + 1);
|
||||
result->index(startIndex + 4);
|
||||
result->index(startIndex + 0);
|
||||
result->index(startIndex + 3);
|
||||
result->index(startIndex + 2);
|
||||
|
||||
first = false;
|
||||
}
|
||||
|
||||
result->end();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Debugging::Debugging(SceneNode *mwRoot, MWWorld::Environment &env, OEngine::Physic::PhysicEngine *engine) :
|
||||
mMwRoot(mwRoot), mEnvironment(env), mEngine(engine),
|
||||
mSceneMgr(mwRoot->getCreator()),
|
||||
mPathgridEnabled(false),
|
||||
mInteriorPathgridNode(NULL), mPathGridRoot(NULL),
|
||||
mGridMatsCreated(false)
|
||||
{
|
||||
ResourceGroupManager::getSingleton().createResourceGroup(DEBUGGING_GROUP);
|
||||
}
|
||||
|
||||
Debugging::~Debugging()
|
||||
{
|
||||
if (mPathgridEnabled)
|
||||
{
|
||||
togglePathgrid();
|
||||
}
|
||||
|
||||
ResourceGroupManager::getSingleton().destroyResourceGroup(DEBUGGING_GROUP);
|
||||
}
|
||||
|
||||
|
||||
bool Debugging::toggleRenderMode (int mode){
|
||||
switch (mode)
|
||||
switch (mode)
|
||||
{
|
||||
case MWWorld::World::Render_CollisionDebug:
|
||||
return eng->toggleDebugRendering();
|
||||
|
||||
return mEngine->toggleDebugRendering();
|
||||
|
||||
case MWWorld::World::Render_Pathgrid:
|
||||
togglePathgrid();
|
||||
return mPathgridEnabled;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Debugging::cellAdded(MWWorld::Ptr::CellStore *store)
|
||||
{
|
||||
mActiveCells.push_back(store);
|
||||
if (mPathgridEnabled)
|
||||
enableCellPathgrid(store);
|
||||
}
|
||||
|
||||
void Debugging::cellRemoved(MWWorld::Ptr::CellStore *store)
|
||||
{
|
||||
mActiveCells.erase(std::remove(mActiveCells.begin(), mActiveCells.end(), store), mActiveCells.end());
|
||||
if (mPathgridEnabled)
|
||||
disableCellPathgrid(store);
|
||||
}
|
||||
|
||||
void Debugging::togglePathgrid()
|
||||
{
|
||||
mPathgridEnabled = !mPathgridEnabled;
|
||||
if (mPathgridEnabled)
|
||||
{
|
||||
createGridMaterials();
|
||||
|
||||
// add path grid meshes to already loaded cells
|
||||
mPathGridRoot = mMwRoot->createChildSceneNode();
|
||||
for(CellList::iterator it = mActiveCells.begin(); it != mActiveCells.end(); it++)
|
||||
{
|
||||
enableCellPathgrid(*it);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// remove path grid meshes from already loaded cells
|
||||
for(CellList::iterator it = mActiveCells.begin(); it != mActiveCells.end(); it++)
|
||||
{
|
||||
disableCellPathgrid(*it);
|
||||
}
|
||||
mPathGridRoot->removeAndDestroyAllChildren();
|
||||
mSceneMgr->destroySceneNode(mPathGridRoot);
|
||||
mPathGridRoot = NULL;
|
||||
destroyGridMaterials();
|
||||
}
|
||||
}
|
||||
|
||||
void Debugging::enableCellPathgrid(MWWorld::Ptr::CellStore *store)
|
||||
{
|
||||
ESM::Pathgrid *pathgrid = mEnvironment.mWorld->getStore().pathgrids.search(*store->cell);
|
||||
if (!pathgrid) return;
|
||||
|
||||
Vector3 cellPathGridPos(0, 0, 0);
|
||||
if (store->cell->isExterior())
|
||||
{
|
||||
cellPathGridPos.x = store->cell->data.gridX * ESM::Land::REAL_SIZE;
|
||||
cellPathGridPos.y = store->cell->data.gridY * ESM::Land::REAL_SIZE;
|
||||
}
|
||||
SceneNode *cellPathGrid = mPathGridRoot->createChildSceneNode(cellPathGridPos);
|
||||
cellPathGrid->attachObject(createPathgridLines(pathgrid));
|
||||
cellPathGrid->attachObject(createPathgridPoints(pathgrid));
|
||||
|
||||
if (store->cell->isExterior())
|
||||
{
|
||||
mExteriorPathgridNodes[std::make_pair(store->cell->data.gridX, store->cell->data.gridY)] = cellPathGrid;
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(mInteriorPathgridNode == NULL);
|
||||
mInteriorPathgridNode = cellPathGrid;
|
||||
}
|
||||
}
|
||||
|
||||
void Debugging::disableCellPathgrid(MWWorld::Ptr::CellStore *store)
|
||||
{
|
||||
if (store->cell->isExterior())
|
||||
{
|
||||
ExteriorPathgridNodes::iterator it =
|
||||
mExteriorPathgridNodes.find(std::make_pair(store->cell->data.gridX, store->cell->data.gridY));
|
||||
if (it != mExteriorPathgridNodes.end())
|
||||
{
|
||||
destroyCellPathgridNode(it->second);
|
||||
mExteriorPathgridNodes.erase(it);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mInteriorPathgridNode)
|
||||
{
|
||||
destroyCellPathgridNode(mInteriorPathgridNode);
|
||||
mInteriorPathgridNode = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Debugging::destroyCellPathgridNode(SceneNode *node)
|
||||
{
|
||||
mPathGridRoot->removeChild(node);
|
||||
destroyAttachedObjects(node);
|
||||
mSceneMgr->destroySceneNode(node);
|
||||
}
|
||||
|
||||
void Debugging::destroyAttachedObjects(SceneNode *node)
|
||||
{
|
||||
SceneNode::ObjectIterator objIt = node->getAttachedObjectIterator();
|
||||
while (objIt.hasMoreElements())
|
||||
{
|
||||
MovableObject *mesh = static_cast<MovableObject *>(objIt.getNext());
|
||||
mSceneMgr->destroyMovableObject(mesh);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <utility>
|
||||
#include <openengine/ogre/renderer.hpp>
|
||||
#include <openengine/bullet/physic.hpp>
|
||||
#include "../mwworld/ptr.hpp"
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
@ -22,20 +23,58 @@ namespace Ogre
|
|||
namespace MWWorld
|
||||
{
|
||||
class World;
|
||||
class Environment;
|
||||
}
|
||||
|
||||
namespace MWRender
|
||||
{
|
||||
class Player;
|
||||
|
||||
class Debugging{
|
||||
OEngine::Physic::PhysicEngine* eng;
|
||||
class Debugging
|
||||
{
|
||||
OEngine::Physic::PhysicEngine* mEngine;
|
||||
Ogre::SceneManager *mSceneMgr;
|
||||
MWWorld::Environment& mEnvironment;
|
||||
|
||||
// Path grid stuff
|
||||
bool mPathgridEnabled;
|
||||
|
||||
public:
|
||||
Debugging(OEngine::Physic::PhysicEngine* engine);
|
||||
bool toggleRenderMode (int mode);
|
||||
};
|
||||
void togglePathgrid();
|
||||
|
||||
typedef std::vector<MWWorld::Ptr::CellStore *> CellList;
|
||||
CellList mActiveCells;
|
||||
|
||||
Ogre::SceneNode *mMwRoot;
|
||||
|
||||
Ogre::SceneNode *mPathGridRoot;
|
||||
|
||||
typedef std::map<std::pair<int,int>, Ogre::SceneNode *> ExteriorPathgridNodes;
|
||||
ExteriorPathgridNodes mExteriorPathgridNodes;
|
||||
Ogre::SceneNode *mInteriorPathgridNode;
|
||||
|
||||
void enableCellPathgrid(MWWorld::Ptr::CellStore *store);
|
||||
void disableCellPathgrid(MWWorld::Ptr::CellStore *store);
|
||||
|
||||
// utility
|
||||
void destroyCellPathgridNode(Ogre::SceneNode *node);
|
||||
void destroyAttachedObjects(Ogre::SceneNode *node);
|
||||
|
||||
// materials
|
||||
bool mGridMatsCreated;
|
||||
void createGridMaterials();
|
||||
void destroyGridMaterials();
|
||||
|
||||
// path grid meshes
|
||||
Ogre::ManualObject *createPathgridLines(const ESM::Pathgrid *pathgrid);
|
||||
Ogre::ManualObject *createPathgridPoints(const ESM::Pathgrid *pathgrid);
|
||||
public:
|
||||
Debugging(Ogre::SceneNode* mwRoot, MWWorld::Environment &env, OEngine::Physic::PhysicEngine *engine);
|
||||
~Debugging();
|
||||
bool toggleRenderMode (int mode);
|
||||
|
||||
void cellAdded(MWWorld::Ptr::CellStore* store);
|
||||
void cellRemoved(MWWorld::Ptr::CellStore* store);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ using namespace Ogre;
|
|||
namespace MWRender {
|
||||
|
||||
RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const boost::filesystem::path& resDir, OEngine::Physic::PhysicEngine* engine, MWWorld::Environment& environment)
|
||||
:mRendering(_rend), mObjects(mRendering), mActors(mRendering, environment), mAmbientMode(0), mDebugging(engine)
|
||||
:mRendering(_rend), mObjects(mRendering), mActors(mRendering, environment), mAmbientMode(0)
|
||||
{
|
||||
mRendering.createScene("PlayerCam", 55, 5);
|
||||
mTerrainManager = new TerrainManager(mRendering.getScene(),
|
||||
|
@ -52,7 +52,7 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const
|
|||
Ogre::SceneNode *cameraYawNode = playerNode->createChildSceneNode();
|
||||
Ogre::SceneNode *cameraPitchNode = cameraYawNode->createChildSceneNode();
|
||||
cameraPitchNode->attachObject(mRendering.getCamera());
|
||||
|
||||
|
||||
//mSkyManager = 0;
|
||||
mSkyManager = new SkyManager(mMwRoot, mRendering.getCamera(), &environment);
|
||||
|
||||
|
@ -63,6 +63,7 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const
|
|||
mPlayer = new MWRender::Player (mRendering.getCamera(), playerNode);
|
||||
mSun = 0;
|
||||
|
||||
mDebugging = new Debugging(mMwRoot, environment, engine);
|
||||
mLocalMap = new MWRender::LocalMap(&mRendering, &environment);
|
||||
}
|
||||
|
||||
|
@ -71,6 +72,7 @@ RenderingManager::~RenderingManager ()
|
|||
//TODO: destroy mSun?
|
||||
delete mPlayer;
|
||||
delete mSkyManager;
|
||||
delete mDebugging;
|
||||
delete mTerrainManager;
|
||||
delete mLocalMap;
|
||||
delete mOcclusionQuery;
|
||||
|
@ -101,6 +103,7 @@ void RenderingManager::removeCell (MWWorld::Ptr::CellStore *store)
|
|||
{
|
||||
mObjects.removeCell(store);
|
||||
mActors.removeCell(store);
|
||||
mDebugging->cellRemoved(store);
|
||||
if (store->cell->isExterior())
|
||||
mTerrainManager->cellRemoved(store);
|
||||
}
|
||||
|
@ -122,6 +125,7 @@ void RenderingManager::toggleWater()
|
|||
void RenderingManager::cellAdded (MWWorld::Ptr::CellStore *store)
|
||||
{
|
||||
mObjects.buildStaticGeometry (*store);
|
||||
mDebugging->cellAdded(store);
|
||||
if (store->cell->isExterior())
|
||||
mTerrainManager->cellAdded(store);
|
||||
}
|
||||
|
@ -188,7 +192,7 @@ void RenderingManager::waterAdded (MWWorld::Ptr::CellStore *store){
|
|||
}
|
||||
else
|
||||
removeWater();
|
||||
|
||||
|
||||
}
|
||||
|
||||
void RenderingManager::setWaterHeight(const float height)
|
||||
|
@ -226,7 +230,7 @@ void RenderingManager::skySetDate (int day, int month)
|
|||
|
||||
int RenderingManager::skyGetMasserPhase() const
|
||||
{
|
||||
|
||||
|
||||
return mSkyManager->getMasserPhase();
|
||||
}
|
||||
|
||||
|
@ -242,8 +246,8 @@ void RenderingManager::skySetMoonColour (bool red){
|
|||
|
||||
bool RenderingManager::toggleRenderMode(int mode)
|
||||
{
|
||||
if (mode == MWWorld::World::Render_CollisionDebug)
|
||||
return mDebugging.toggleRenderMode(mode);
|
||||
if (mode != MWWorld::World::Render_Wireframe)
|
||||
return mDebugging->toggleRenderMode(mode);
|
||||
else // if (mode == MWWorld::World::Render_Wireframe)
|
||||
{
|
||||
if (mRendering.getCamera()->getPolygonMode() == PM_SOLID)
|
||||
|
@ -268,10 +272,10 @@ void RenderingManager::configureFog(ESMS::CellStore<MWWorld::RefData> &mCell)
|
|||
}
|
||||
|
||||
void RenderingManager::configureFog(const float density, const Ogre::ColourValue& colour)
|
||||
{
|
||||
{
|
||||
/// \todo make the viewing distance and fog start/end configurable
|
||||
|
||||
// right now we load 3x3 cells, so the maximum viewing distance we
|
||||
// right now we load 3x3 cells, so the maximum viewing distance we
|
||||
// can allow (to prevent objects suddenly popping up) equals:
|
||||
// 8192 * 0.69
|
||||
// ^ cell size ^ minimum density value used (clear weather)
|
||||
|
@ -279,7 +283,7 @@ void RenderingManager::configureFog(const float density, const Ogre::ColourValue
|
|||
float high = 5652.48 / density;
|
||||
|
||||
mRendering.getScene()->setFog (FOG_LINEAR, colour, 0, low, high);
|
||||
|
||||
|
||||
mRendering.getCamera()->setFarClipDistance ( high );
|
||||
mRendering.getViewport()->setBackgroundColour (colour);
|
||||
}
|
||||
|
@ -382,10 +386,10 @@ void RenderingManager::sunDisable()
|
|||
|
||||
void RenderingManager::setSunDirection(const Ogre::Vector3& direction)
|
||||
{
|
||||
// direction * -1 (because 'direction' is camera to sun vector and not sun to camera),
|
||||
// direction * -1 (because 'direction' is camera to sun vector and not sun to camera),
|
||||
// then convert from MW to ogre coordinates (swap y,z and make y negative)
|
||||
if (mSun) mSun->setDirection(Vector3(-direction.x, -direction.z, direction.y));
|
||||
|
||||
|
||||
mSkyManager->setSunDirection(direction);
|
||||
}
|
||||
|
||||
|
|
|
@ -174,7 +174,8 @@ class RenderingManager: private RenderingInterface {
|
|||
OEngine::Physic::PhysicEngine* mPhysicsEngine;
|
||||
|
||||
MWRender::Player *mPlayer;
|
||||
MWRender::Debugging mDebugging;
|
||||
|
||||
MWRender::Debugging *mDebugging;
|
||||
|
||||
MWRender::LocalMap* mLocalMap;
|
||||
};
|
||||
|
|
|
@ -127,4 +127,5 @@ op 0x2000141: GetWaterLevel
|
|||
op 0x2000142: SetWaterLevel
|
||||
op 0x2000143: ModWaterLevel
|
||||
op 0x2000144: ToggleWater, twa
|
||||
opcodes 0x2000145-0x3ffffff unused
|
||||
op 0x2000145: TogglePathgrid
|
||||
opcodes 0x2000146-0x3ffffff unused
|
||||
|
|
|
@ -106,7 +106,7 @@ namespace MWScript
|
|||
"Collision Mesh Rendering -> On" : "Collision Mesh Rendering -> Off");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class OpToggleWireframe : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
@ -123,7 +123,23 @@ namespace MWScript
|
|||
"Wireframe Rendering -> On" : "Wireframe Rendering -> Off");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class OpTogglePathgrid : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
InterpreterContext& context =
|
||||
static_cast<InterpreterContext&> (runtime.getContext());
|
||||
|
||||
bool enabled =
|
||||
context.getWorld().toggleRenderMode (MWWorld::World::Render_Pathgrid);
|
||||
|
||||
context.report (enabled ?
|
||||
"Path Grid rendering -> On" : "Path Grid Rendering -> Off");
|
||||
}
|
||||
};
|
||||
|
||||
class OpFadeIn : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
@ -135,11 +151,11 @@ namespace MWScript
|
|||
|
||||
Interpreter::Type_Float time = runtime[0].mFloat;
|
||||
runtime.pop();
|
||||
|
||||
|
||||
context.getWorld().getFader()->fadeIn(time);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class OpFadeOut : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
@ -151,11 +167,11 @@ namespace MWScript
|
|||
|
||||
Interpreter::Type_Float time = runtime[0].mFloat;
|
||||
runtime.pop();
|
||||
|
||||
|
||||
context.getWorld().getFader()->fadeOut(time);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class OpFadeTo : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
@ -167,10 +183,10 @@ namespace MWScript
|
|||
|
||||
Interpreter::Type_Float alpha = runtime[0].mFloat;
|
||||
runtime.pop();
|
||||
|
||||
|
||||
Interpreter::Type_Float time = runtime[0].mFloat;
|
||||
runtime.pop();
|
||||
|
||||
|
||||
context.getWorld().getFader()->fadeTo(alpha, time);
|
||||
}
|
||||
};
|
||||
|
@ -201,6 +217,7 @@ namespace MWScript
|
|||
const int opcodeFadeOut = 0x200013d;
|
||||
const int opcodeFadeTo = 0x200013e;
|
||||
const int opcodeToggleWater = 0x2000144;
|
||||
const int opcodeTogglePathgrid = 0x2000145;
|
||||
|
||||
void registerExtensions (Compiler::Extensions& extensions)
|
||||
{
|
||||
|
@ -220,6 +237,8 @@ namespace MWScript
|
|||
extensions.registerInstruction ("fadeto", "ff", opcodeFadeTo);
|
||||
extensions.registerInstruction ("togglewater", "", opcodeToggleWater);
|
||||
extensions.registerInstruction ("twa", "", opcodeToggleWater);
|
||||
extensions.registerInstruction ("togglepathgrid", "", opcodeTogglePathgrid);
|
||||
extensions.registerInstruction ("tpg", "", opcodeTogglePathgrid);
|
||||
}
|
||||
|
||||
void installOpcodes (Interpreter::Interpreter& interpreter)
|
||||
|
@ -236,6 +255,7 @@ namespace MWScript
|
|||
interpreter.installSegment5 (opcodeFadeIn, new OpFadeIn);
|
||||
interpreter.installSegment5 (opcodeFadeOut, new OpFadeOut);
|
||||
interpreter.installSegment5 (opcodeFadeTo, new OpFadeTo);
|
||||
interpreter.installSegment5 (opcodeTogglePathgrid, new OpTogglePathgrid);
|
||||
interpreter.installSegment5 (opcodeToggleWater, new OpToggleWater);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,13 +63,14 @@ namespace MWWorld
|
|||
enum RenderMode
|
||||
{
|
||||
Render_CollisionDebug,
|
||||
Render_Wireframe
|
||||
Render_Wireframe,
|
||||
Render_Pathgrid
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
MWRender::RenderingManager* mRendering;
|
||||
|
||||
|
||||
MWWorld::WeatherManager* mWeatherManager;
|
||||
|
||||
MWWorld::Scene *mWorldScene;
|
||||
|
@ -112,7 +113,7 @@ namespace MWWorld
|
|||
Environment& environment, const std::string& encoding);
|
||||
|
||||
~World();
|
||||
|
||||
|
||||
OEngine::Render::Fader* getFader();
|
||||
|
||||
Ptr::CellStore *getExterior (int x, int y);
|
||||
|
@ -121,7 +122,7 @@ namespace MWWorld
|
|||
|
||||
void setWaterHeight(const float height);
|
||||
void toggleWater();
|
||||
|
||||
|
||||
void adjustSky();
|
||||
|
||||
MWWorld::Player& getPlayer();
|
||||
|
@ -134,7 +135,7 @@ namespace MWWorld
|
|||
|
||||
bool hasCellChanged() const;
|
||||
///< Has the player moved to a different cell, since the last frame?
|
||||
|
||||
|
||||
bool isCellExterior() const;
|
||||
bool isCellQuasiExterior() const;
|
||||
|
||||
|
@ -172,9 +173,9 @@ namespace MWWorld
|
|||
|
||||
bool toggleSky();
|
||||
///< \return Resulting mode
|
||||
|
||||
|
||||
void changeWeather(const std::string& region, const unsigned int id);
|
||||
|
||||
|
||||
int getCurrentWeather() const;
|
||||
|
||||
int getMasserPhase() const;
|
||||
|
|
|
@ -457,7 +457,7 @@ namespace ESMS
|
|||
}
|
||||
}
|
||||
|
||||
Pathgrid *find(int cellX, int cellY, std::string cellName) const
|
||||
Pathgrid *find(int cellX, int cellY, const std::string &cellName) const
|
||||
{
|
||||
Pathgrid *result = search(cellX, cellY, cellName);
|
||||
if (!result)
|
||||
|
@ -467,7 +467,7 @@ namespace ESMS
|
|||
return result;
|
||||
}
|
||||
|
||||
Pathgrid *search(int cellX, int cellY, std::string cellName) const
|
||||
Pathgrid *search(int cellX, int cellY, const std::string &cellName) const
|
||||
{
|
||||
Pathgrid *result = NULL;
|
||||
if (cellX == 0 && cellY == 0) // possibly interior
|
||||
|
|
Loading…
Reference in a new issue