Merge remote branch 'scrawl/next' into test

Conflicts:
	libs/openengine
actorid
Marc Zinnschlag 13 years ago
commit db205cf8aa

@ -96,6 +96,7 @@ source_group(libs\\mangle FILES ${MANGLE_ALL})
set(OENGINE_OGRE set(OENGINE_OGRE
${LIBDIR}/openengine/ogre/renderer.cpp ${LIBDIR}/openengine/ogre/renderer.cpp
${LIBDIR}/openengine/ogre/mouselook.cpp ${LIBDIR}/openengine/ogre/mouselook.cpp
${LIBDIR}/openengine/ogre/fader.cpp
) )
set(OENGINE_GUI set(OENGINE_GUI
${LIBDIR}/openengine/gui/events.cpp ${LIBDIR}/openengine/gui/events.cpp

@ -75,6 +75,11 @@ MWRender::Player& RenderingManager::getPlayer(){
return (*mPlayer); return (*mPlayer);
} }
OEngine::Render::Fader* RenderingManager::getFader()
{
return mRendering.getFader();
}
void RenderingManager::removeCell (MWWorld::Ptr::CellStore *store){ void RenderingManager::removeCell (MWWorld::Ptr::CellStore *store){
mObjects.removeCell(store); mObjects.removeCell(store);
mActors.removeCell(store); mActors.removeCell(store);
@ -123,6 +128,8 @@ void RenderingManager::moveObjectToCell (const MWWorld::Ptr& ptr, const Ogre::Ve
void RenderingManager::update (float duration){ void RenderingManager::update (float duration){
mActors.update (duration); mActors.update (duration);
mRendering.update(duration);
} }
void RenderingManager::skyEnable () void RenderingManager::skyEnable ()
@ -165,8 +172,24 @@ void RenderingManager::skySetMoonColour (bool red){
if(mSkyManager) if(mSkyManager)
mSkyManager->setMoonColour(red); mSkyManager->setMoonColour(red);
} }
bool RenderingManager::toggleRenderMode(int mode){
return mDebugging.toggleRenderMode(mode); bool RenderingManager::toggleRenderMode(int mode)
{
if (mode == MWWorld::World::Render_CollisionDebug)
return mDebugging.toggleRenderMode(mode);
else // if (mode == MWWorld::World::Render_Wireframe)
{
if (mRendering.getCamera()->getPolygonMode() == PM_SOLID)
{
mRendering.getCamera()->setPolygonMode(PM_WIREFRAME);
return true;
}
else
{
mRendering.getCamera()->setPolygonMode(PM_SOLID);
return false;
}
}
} }
void RenderingManager::configureFog(ESMS::CellStore<MWWorld::RefData> &mCell) void RenderingManager::configureFog(ESMS::CellStore<MWWorld::RefData> &mCell)

@ -9,6 +9,7 @@
#include <utility> #include <utility>
#include <openengine/ogre/renderer.hpp> #include <openengine/ogre/renderer.hpp>
#include <openengine/ogre/fader.hpp>
#include <openengine/bullet/physic.hpp> #include <openengine/bullet/physic.hpp>
#include <vector> #include <vector>
@ -63,6 +64,8 @@ class RenderingManager: private RenderingInterface {
void toggleLight(); void toggleLight();
bool toggleRenderMode(int mode); bool toggleRenderMode(int mode);
OEngine::Render::Fader* getFader();
void removeCell (MWWorld::Ptr::CellStore *store); void removeCell (MWWorld::Ptr::CellStore *store);

@ -115,4 +115,8 @@ op 0x2000136: GetPCCell
op 0x2000137: GetButtonPressed op 0x2000137: GetButtonPressed
op 0x2000138: SkipAnim op 0x2000138: SkipAnim
op 0x2000139: SkipAnim, expplicit reference op 0x2000139: SkipAnim, expplicit reference
opcodes 0x200013a-0x3ffffff unused op 0x200013b: twf
op 0x200013c: FadeIn
op 0x200013d: FadeOut
op 0x200013e: FadeTo
opcodes 0x200013f-0x3ffffff unused

@ -103,7 +103,75 @@ namespace MWScript
context.getWorld().toggleRenderMode (MWWorld::World::Render_CollisionDebug); context.getWorld().toggleRenderMode (MWWorld::World::Render_CollisionDebug);
context.report (enabled ? context.report (enabled ?
"Collsion Mesh Rendering -> On" : "Collision Mesh Rendering -> Off"); "Collision Mesh Rendering -> On" : "Collision Mesh Rendering -> Off");
}
};
class OpToggleWireframe : 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_Wireframe);
context.report (enabled ?
"Wireframe Rendering -> On" : "Wireframe Rendering -> Off");
}
};
class OpFadeIn : public Interpreter::Opcode0
{
public:
virtual void execute (Interpreter::Runtime& runtime)
{
InterpreterContext& context =
static_cast<InterpreterContext&> (runtime.getContext());
Interpreter::Type_Float time = runtime[0].mFloat;
runtime.pop();
context.getWorld().getFader()->fadeIn(time);
}
};
class OpFadeOut : public Interpreter::Opcode0
{
public:
virtual void execute (Interpreter::Runtime& runtime)
{
InterpreterContext& context =
static_cast<InterpreterContext&> (runtime.getContext());
Interpreter::Type_Float time = runtime[0].mFloat;
runtime.pop();
context.getWorld().getFader()->fadeOut(time);
}
};
class OpFadeTo : public Interpreter::Opcode0
{
public:
virtual void execute (Interpreter::Runtime& runtime)
{
InterpreterContext& context =
static_cast<InterpreterContext&> (runtime.getContext());
Interpreter::Type_Float alpha = runtime[0].mFloat;
runtime.pop();
Interpreter::Type_Float time = runtime[0].mFloat;
runtime.pop();
context.getWorld().getFader()->fadeTo(alpha, time);
} }
}; };
@ -115,6 +183,10 @@ namespace MWScript
const int opcodeUnlock = 0x200008c; const int opcodeUnlock = 0x200008c;
const int opcodeUnlockExplicit = 0x200008d; const int opcodeUnlockExplicit = 0x200008d;
const int opcodeToggleCollisionDebug = 0x2000132; const int opcodeToggleCollisionDebug = 0x2000132;
const int opcodeToggleWireframe = 0x200013b;
const int opcodeFadeIn = 0x200013c;
const int opcodeFadeOut = 0x200013d;
const int opcodeFadeTo = 0x200013e;
void registerExtensions (Compiler::Extensions& extensions) void registerExtensions (Compiler::Extensions& extensions)
{ {
@ -127,6 +199,11 @@ namespace MWScript
extensions.registerInstruction ("togglecollisiongrid", "", opcodeToggleCollisionDebug); extensions.registerInstruction ("togglecollisiongrid", "", opcodeToggleCollisionDebug);
extensions.registerInstruction ("tcb", "", opcodeToggleCollisionDebug); extensions.registerInstruction ("tcb", "", opcodeToggleCollisionDebug);
extensions.registerInstruction ("tcg", "", opcodeToggleCollisionDebug); extensions.registerInstruction ("tcg", "", opcodeToggleCollisionDebug);
extensions.registerInstruction ("twf", "", opcodeToggleWireframe);
extensions.registerInstruction ("togglewireframe", "", opcodeToggleWireframe);
extensions.registerInstruction ("fadein", "f", opcodeFadeIn);
extensions.registerInstruction ("fadeout", "f", opcodeFadeOut);
extensions.registerInstruction ("fadeto", "ff", opcodeFadeTo);
} }
void installOpcodes (Interpreter::Interpreter& interpreter) void installOpcodes (Interpreter::Interpreter& interpreter)
@ -139,6 +216,10 @@ namespace MWScript
interpreter.installSegment5 (opcodeUnlock, new OpUnlock<ImplicitRef>); interpreter.installSegment5 (opcodeUnlock, new OpUnlock<ImplicitRef>);
interpreter.installSegment5 (opcodeUnlockExplicit, new OpUnlock<ExplicitRef>); interpreter.installSegment5 (opcodeUnlockExplicit, new OpUnlock<ExplicitRef>);
interpreter.installSegment5 (opcodeToggleCollisionDebug, new OpToggleCollisionDebug); interpreter.installSegment5 (opcodeToggleCollisionDebug, new OpToggleCollisionDebug);
interpreter.installSegment5 (opcodeToggleWireframe, new OpToggleWireframe);
interpreter.installSegment5 (opcodeFadeIn, new OpFadeIn);
interpreter.installSegment5 (opcodeFadeOut, new OpFadeOut);
interpreter.installSegment5 (opcodeFadeTo, new OpFadeTo);
} }
} }
} }

@ -689,4 +689,9 @@ namespace MWWorld
{ {
mWorldScene->update (duration); mWorldScene->update (duration);
} }
OEngine::Render::Fader* World::getFader()
{
return mRendering->getFader();
}
} }

@ -20,6 +20,7 @@
#include "localscripts.hpp" #include "localscripts.hpp"
#include <openengine/bullet/physic.hpp> #include <openengine/bullet/physic.hpp>
#include <openengine/ogre/fader.hpp>
namespace Ogre namespace Ogre
{ {
@ -60,7 +61,8 @@ namespace MWWorld
enum RenderMode enum RenderMode
{ {
Render_CollisionDebug Render_CollisionDebug,
Render_Wireframe
}; };
private: private:
@ -101,6 +103,8 @@ namespace MWWorld
Environment& environment, const std::string& encoding); Environment& environment, const std::string& encoding);
~World(); ~World();
OEngine::Render::Fader* getFader();
Ptr::CellStore *getExterior (int x, int y); Ptr::CellStore *getExterior (int x, int y);

@ -1 +1 @@
Subproject commit 4a188f2820c037ca4ad8ef35492d3857ea8d7df8 Subproject commit 420e611a4beb2d45fef1f4b93618b22269fc89e6
Loading…
Cancel
Save