Added toString() to TimeFunction; moved AlphaState onto the quad being faded

rather than the node containing the quad, which shouldn't really make a
difference.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3858 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2006-02-15 21:01:39 +00:00
parent 892bdce01d
commit bbc4dcad31
2 changed files with 16 additions and 9 deletions
@@ -62,6 +62,13 @@ public class FadeInOutEffect extends Node
color.r, color.g, color.b, alphaFunc.getValue(0));
_alphaFunc = alphaFunc;
DisplaySystem ds = DisplaySystem.getDisplaySystem();
_astate = ds.getRenderer().createAlphaState();
_astate.setBlendEnabled(true);
_astate.setSrcFunction(AlphaState.SB_SRC_ALPHA);
_astate.setDstFunction(AlphaState.DB_ONE_MINUS_SRC_ALPHA);
_astate.setEnabled(true);
if (quad != null) {
setQuad(quad);
}
@@ -69,14 +76,6 @@ public class FadeInOutEffect extends Node
setRenderQueueMode(Renderer.QUEUE_ORTHO);
setZOrder(overUI ? -1 : 1);
DisplaySystem ds = DisplaySystem.getDisplaySystem();
AlphaState astate = ds.getRenderer().createAlphaState();
astate.setBlendEnabled(true);
astate.setSrcFunction(AlphaState.SB_SRC_ALPHA);
astate.setDstFunction(AlphaState.DB_ONE_MINUS_SRC_ALPHA);
astate.setEnabled(true);
setRenderState(astate);
updateRenderState();
}
@@ -87,6 +86,7 @@ public class FadeInOutEffect extends Node
{
attachChild(quad);
quad.setDefaultColor(_color);
quad.setRenderState(_astate);
}
/**
@@ -137,12 +137,13 @@ public class FadeInOutEffect extends Node
// create a quad the size of the screen
DisplaySystem ds = DisplaySystem.getDisplaySystem();
float width = ds.getWidth(), height = ds.getHeight();
Quad curtain = new Quad("curtain", width, height);
Quad curtain = new Quad("curtain" + hashCode(), width, height);
curtain.setLocalTranslation(new Vector3f(width/2, height/2, 0f));
return curtain;
}
protected ColorRGBA _color;
protected AlphaState _astate;
protected TimeFunction _alphaFunc;
protected boolean _paused;
}
@@ -76,6 +76,12 @@ public abstract class TimeFunction
return _elapsed >= _duration;
}
/** Generates a string representation of this instance. */
public String toString ()
{
return _start + " to " + _end + ", " + _elapsed + " of " + _duration;
}
/**
* This must be implemented by our derived class to compute our value given
* the currently stored {@link #_elapsed} time.