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:
@@ -62,6 +62,13 @@ public class FadeInOutEffect extends Node
|
|||||||
color.r, color.g, color.b, alphaFunc.getValue(0));
|
color.r, color.g, color.b, alphaFunc.getValue(0));
|
||||||
_alphaFunc = alphaFunc;
|
_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) {
|
if (quad != null) {
|
||||||
setQuad(quad);
|
setQuad(quad);
|
||||||
}
|
}
|
||||||
@@ -69,14 +76,6 @@ public class FadeInOutEffect extends Node
|
|||||||
setRenderQueueMode(Renderer.QUEUE_ORTHO);
|
setRenderQueueMode(Renderer.QUEUE_ORTHO);
|
||||||
setZOrder(overUI ? -1 : 1);
|
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();
|
updateRenderState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,6 +86,7 @@ public class FadeInOutEffect extends Node
|
|||||||
{
|
{
|
||||||
attachChild(quad);
|
attachChild(quad);
|
||||||
quad.setDefaultColor(_color);
|
quad.setDefaultColor(_color);
|
||||||
|
quad.setRenderState(_astate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -137,12 +137,13 @@ public class FadeInOutEffect extends Node
|
|||||||
// create a quad the size of the screen
|
// create a quad the size of the screen
|
||||||
DisplaySystem ds = DisplaySystem.getDisplaySystem();
|
DisplaySystem ds = DisplaySystem.getDisplaySystem();
|
||||||
float width = ds.getWidth(), height = ds.getHeight();
|
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));
|
curtain.setLocalTranslation(new Vector3f(width/2, height/2, 0f));
|
||||||
return curtain;
|
return curtain;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ColorRGBA _color;
|
protected ColorRGBA _color;
|
||||||
|
protected AlphaState _astate;
|
||||||
protected TimeFunction _alphaFunc;
|
protected TimeFunction _alphaFunc;
|
||||||
protected boolean _paused;
|
protected boolean _paused;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,6 +76,12 @@ public abstract class TimeFunction
|
|||||||
return _elapsed >= _duration;
|
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
|
* This must be implemented by our derived class to compute our value given
|
||||||
* the currently stored {@link #_elapsed} time.
|
* the currently stored {@link #_elapsed} time.
|
||||||
|
|||||||
Reference in New Issue
Block a user