X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2FMoof%2FTransition.hh;fp=src%2FMoof%2FTransition.hh;h=0000000000000000000000000000000000000000;hb=831f04d4bc19a390415ac0bbac4331c7a65509bc;hp=2f468fc4227d8a154f94700f7ce7a7d8c3d5d335;hpb=299af4f2047e767e5d79501c26444473bda64c64;p=chaz%2Fyoink diff --git a/src/Moof/Transition.hh b/src/Moof/Transition.hh deleted file mode 100644 index 2f468fc..0000000 --- a/src/Moof/Transition.hh +++ /dev/null @@ -1,151 +0,0 @@ - -/*] Copyright (c) 2009-2010, Charles McGarvey [************************** -**] All rights reserved. -* -* vi:ts=4 sw=4 tw=75 -* -* Distributable under the terms and conditions of the 2-clause BSD license; -* see the file COPYING for a complete text of the license. -* -**************************************************************************/ - -#define _MOOF_TRANSITION_HH_ -#ifndef _MOOF_TRANSITION_HH_ -#define _MOOF_TRANSITION_HH_ - -#include - -#include -#include -#include -#include -#include -#include -#include - - -namespace Mf { - - -template -class Transition : public Layer -{ - LayerP mTo; - LayerP mFrom; - - T mInterp; - -public: - - Transition(LayerP t, LayerP f, const T& interp) : - mTo(t), - mFrom(f), - mInterp(interp) {} - - typedef boost::shared_ptr Ptr; - - static Ptr alloc(LayerP t, LayerP f, const T& interp) - { - return Ptr(new Transition(t, f, interp)); - } - - - void removedFromCore(Core& core) - { - if (mTo) core.push(mTo); - } - - void update(Core& core, Scalar t, Scalar dt) - { - mInterp.update(t, dt); - - if (mFrom) mFrom->update(core, t, dt); - if (mTo) mTo->update(core, t, dt); - - if (mInterp.isDone()) - { - // to should /replace/ this - core.pop(this); - } - } - - void drawFade(Scalar alpha) const - { - // DRAW FADE - glDisable(GL_DEPTH_TEST); - glDisable(GL_ALPHA_TEST); - glEnable(GL_BLEND); - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glLoadIdentity(); - glColor(1.0, 1.0, 1.0, alpha); - Mf::Texture::resetBind(); - - //glRectf(-1.0f, -1.0f, 1.0f, 1.0f); - glBegin(GL_QUADS); - glVertex(-1.0, -1.0, -0.1); - glVertex(1.0, -1.0, -0.1); - glVertex(1.0, 1.0, -0.1); - glVertex(-1.0, 1.0, -0.1); - glEnd(); - - glDisable(GL_BLEND); - glEnable(GL_DEPTH_TEST); - glEnable(GL_ALPHA_TEST); - - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); - glPopMatrix(); - } - - void draw(Core& core, Scalar alpha) const - { - Scalar a = mInterp.getState(alpha); - logInfo << "transition state: " << a << std::endl; - - //glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - if (mFrom) - { - glPushMatrix(); - glLoadIdentity(); - glRotate(180.0 * a, 0.0, 1.0, 0.0); - mFrom->draw(core, alpha); - glPopMatrix(); - } - //drawFade(a); - - if (mTo) - { - glPushMatrix(); - glLoadIdentity(); - glRotate(180.0 * (1.0 - a), 0.0, 1.0, 0.0); - mTo->draw(core, alpha); - glPopMatrix(); - } - //drawFade(1.0 - a); - } - - bool handleEvent(Core& core, const Event& event) - { - if (mTo) - { - return mTo->handleEvent(core, event); - } - else if (mFrom) - { - return mFrom->handleEvent(core, event); - } - return false; - } -}; - - -} // namespace Mf - -#endif // _MOOF_TRANSITION_HH_ -