mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-15 18:39:51 +00:00
implemented script functions FadeIn, FadeOut, FadeTo
This commit is contained in:
parent
899aa5b870
commit
f81b615976
@ -94,6 +94,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
|
||||||
|
@ -162,6 +162,9 @@ bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
|
|||||||
// report focus object (for debugging)
|
// report focus object (for debugging)
|
||||||
if (mReportFocus)
|
if (mReportFocus)
|
||||||
updateFocusReport (mEnvironment.mFrameDuration);
|
updateFocusReport (mEnvironment.mFrameDuration);
|
||||||
|
|
||||||
|
// update ogre renderer
|
||||||
|
mOgre->update(evt.timeSinceLastFrame);
|
||||||
}
|
}
|
||||||
catch (const std::exception& e)
|
catch (const std::exception& e)
|
||||||
{
|
{
|
||||||
|
@ -72,6 +72,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);
|
||||||
|
@ -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);
|
||||||
|
|
||||||
|
@ -123,6 +123,57 @@ namespace MWScript
|
|||||||
"Wireframe Rendering -> On" : "Wireframe Rendering -> Off");
|
"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);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const int opcodeXBox = 0x200000c;
|
const int opcodeXBox = 0x200000c;
|
||||||
const int opcodeOnActivate = 0x200000d;
|
const int opcodeOnActivate = 0x200000d;
|
||||||
@ -133,6 +184,9 @@ namespace MWScript
|
|||||||
const int opcodeUnlockExplicit = 0x200008d;
|
const int opcodeUnlockExplicit = 0x200008d;
|
||||||
const int opcodeToggleCollisionDebug = 0x2000132;
|
const int opcodeToggleCollisionDebug = 0x2000132;
|
||||||
const int opcodeToggleWireframe = 0x200013b;
|
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)
|
||||||
{
|
{
|
||||||
@ -147,6 +201,9 @@ namespace MWScript
|
|||||||
extensions.registerInstruction ("tcg", "", opcodeToggleCollisionDebug);
|
extensions.registerInstruction ("tcg", "", opcodeToggleCollisionDebug);
|
||||||
extensions.registerInstruction ("twf", "", opcodeToggleWireframe);
|
extensions.registerInstruction ("twf", "", opcodeToggleWireframe);
|
||||||
extensions.registerInstruction ("togglewireframe", "", 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)
|
||||||
@ -160,6 +217,9 @@ namespace MWScript
|
|||||||
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 (opcodeToggleWireframe, new OpToggleWireframe);
|
||||||
|
interpreter.installSegment5 (opcodeFadeIn, new OpFadeIn);
|
||||||
|
interpreter.installSegment5 (opcodeFadeOut, new OpFadeOut);
|
||||||
|
interpreter.installSegment5 (opcodeFadeTo, new OpFadeTo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -688,4 +688,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
|
||||||
{
|
{
|
||||||
@ -102,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 6c7e5d00e4f5bf954afe15f10e56f03520abfee4
|
Subproject commit b77f5c06cc3fd818a5efbbb42d6c2a079fa91143
|
Loading…
x
Reference in New Issue
Block a user