public ReadOnlyColorRGBA getCaretColor() { return _strip.getDefaultColor(); }
public ReadOnlyColorRGBA getCaretColor() { return _strip.getDefaultColor(); }
/** * Sets up a new instance of the controller. The * * @param target * the object whose default color we want to change the alpha on. * @param targetAlpha * the alpha value we want to end up at. * @param rate * the amount, per second, to change the alpha. This value will be have its sign flipped if it is not the * appropriate direction given the current default color's alpha. */ public DefColorFadeController(final Mesh target, final float targetAlpha, double rate) { _target = target; _targetAlpha = targetAlpha; _dir = target.getDefaultColor().getAlpha() > targetAlpha; if ((_dir && rate > 0) || (!_dir && rate < 0)) { rate *= -1; } _rate = rate; }
/** * Sets up a new instance of the controller. The * * @param target * the object whose default color we want to change the alpha on. * @param targetAlpha * the alpha value we want to end up at. * @param rate * the amount, per second, to change the alpha. This value will be have its sign flipped if it is not the * appropriate direction given the current default color's alpha. */ public DefColorFadeController(final Mesh target, final float targetAlpha, double rate) { _target = target; _targetAlpha = targetAlpha; _dir = target.getDefaultColor().getAlpha() > targetAlpha; if ((_dir && rate > 0) || (!_dir && rate < 0)) { rate *= -1; } _rate = rate; }
protected Mesh clone(final Mesh original) { Mesh copy = null; try { copy = original.getClass().newInstance(); } catch (final InstantiationException e) { logger.log(Level.SEVERE, "Could not access final constructor of class " + original.getClass().getCanonicalName(), e); throw new RuntimeException(e); } catch (final IllegalAccessException e) { logger.log(Level.SEVERE, "Could not access final constructor of class " + original.getClass().getCanonicalName(), e); throw new RuntimeException(e); } copy.setName(original.getName() + "_copy"); copy.getSceneHints().set(original.getSceneHints()); copy.setTransform(original.getTransform()); copy.setDefaultColor(original.getDefaultColor()); for (final StateType type : StateType.values()) { final RenderState state = original.getLocalRenderState(type); if (state != null) { copy.setRenderState(state); } } return copy; }
protected Mesh clone(final Mesh original) { Mesh copy = null; try { copy = original.getClass().newInstance(); } catch (final InstantiationException e) { logger.log(Level.SEVERE, "Could not access final constructor of class " + original.getClass().getCanonicalName(), e); throw new RuntimeException(e); } catch (final IllegalAccessException e) { logger.log(Level.SEVERE, "Could not access final constructor of class " + original.getClass().getCanonicalName(), e); throw new RuntimeException(e); } copy.setName(original.getName() + "_copy"); copy.getSceneHints().set(original.getSceneHints()); copy.setTransform(original.getTransform()); copy.setDefaultColor(original.getDefaultColor()); for (final StateType type : StateType.values()) { final RenderState state = original.getLocalRenderState(type); if (state != null) { copy.setRenderState(state); } } return copy; }
/** * Interpolates between the given colors using the * {@link ColorRGBA#lerpLocal(ReadOnlyColorRGBA, ReadOnlyColorRGBA, float)} method. */ @Override protected void interpolate(final ReadOnlyColorRGBA from, final ReadOnlyColorRGBA to, final double delta, final Mesh caller) { assert (null != from) : "parameter 'from' can not be null"; assert (null != to) : "parameter 'to' can not be null"; assert (null != caller) : "parameter 'caller' can not be null"; final ColorRGBA color = ColorRGBA.fetchTempInstance().set(caller.getDefaultColor()); color.lerpLocal(from, to, (float) delta); caller.setDefaultColor(color); ColorRGBA.releaseTempInstance(color); }
/** * Interpolates between the given colors using the * {@link ColorRGBA#lerpLocal(ReadOnlyColorRGBA, ReadOnlyColorRGBA, float)} method. */ @Override protected void interpolate(final ReadOnlyColorRGBA from, final ReadOnlyColorRGBA to, final double delta, final Mesh caller) { assert (null != from) : "parameter 'from' can not be null"; assert (null != to) : "parameter 'to' can not be null"; assert (null != caller) : "parameter 'caller' can not be null"; final ColorRGBA color = ColorRGBA.fetchTempInstance().set(caller.getDefaultColor()); color.lerpLocal(from, to, (float) delta); caller.setDefaultColor(color); ColorRGBA.releaseTempInstance(color); }
public void draw(final Renderer renderer, final ReadOnlyTransform xform) { if (getSelectionLength() == 0) { return; } // set our alpha final ColorRGBA color = ColorRGBA.fetchTempInstance(); color.set(_standin.getDefaultColor()).setAlpha(UIComponent.getCurrentOpacity()); _standin.setDefaultColor(color); ColorRGBA.releaseTempInstance(color); // set our location _standin.setWorldTransform(xform); // draw _standin.render(renderer); }
public void draw(final Renderer renderer, final ReadOnlyTransform xform) { if (getSelectionLength() == 0) { return; } // set our alpha final ColorRGBA color = ColorRGBA.fetchTempInstance(); color.set(_standin.getDefaultColor()).setAlpha(UIComponent.getCurrentOpacity()); _standin.setDefaultColor(color); ColorRGBA.releaseTempInstance(color); // set our location _standin.setWorldTransform(xform); // draw _standin.render(renderer); }
public void update(final double time, final Spatial caller) { if (_target == null) { return; } final ColorRGBA color = ColorRGBA.fetchTempInstance().set(_target.getDefaultColor()); float alpha = color.getAlpha(); alpha += _rate * time; if (_dir && alpha <= _targetAlpha) { alpha = _targetAlpha; } else if (!_dir && alpha >= _targetAlpha) { alpha = _targetAlpha; } if (alpha != 0) { _target.getSceneHints().setCullHint(CullHint.Inherit); } else { _target.getSceneHints().setCullHint(CullHint.Always); } color.setAlpha(alpha); _target.setDefaultColor(color); ColorRGBA.releaseTempInstance(color); if (alpha == _targetAlpha) { _target.removeController(this); // enable gc _target = null; } }
public void update(final double time, final Spatial caller) { if (_target == null) { return; } final ColorRGBA color = ColorRGBA.fetchTempInstance().set(_target.getDefaultColor()); float alpha = color.getAlpha(); alpha += _rate * time; if (_dir && alpha <= _targetAlpha) { alpha = _targetAlpha; } else if (!_dir && alpha >= _targetAlpha) { alpha = _targetAlpha; } if (alpha != 0) { _target.getSceneHints().setCullHint(CullHint.Inherit); } else { _target.getSceneHints().setCullHint(CullHint.Always); } color.setAlpha(alpha); _target.setDefaultColor(color); ColorRGBA.releaseTempInstance(color); if (alpha == _targetAlpha) { _target.removeController(this); // enable gc _target = null; } }