public BlendState getBlendState() { if (forceBlend || d != -1 && d < 1.0f) { final BlendState blend = new BlendState(); blend.setBlendEnabled(true); blend.setSourceFunction(BlendState.SourceFunction.SourceAlpha); blend.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha); blend.setTestEnabled(true); blend.setTestFunction(BlendState.TestFunction.GreaterThan); blend.setReference(0); return blend; } return null; }
/** * @return a blend state that does alpha blending and writes the max alpha value (source or destination) back to the * color buffer. */ private static BlendState createBlendRGBMaxAlphaBlend() { final BlendState state = new BlendState(); state.setBlendEnabled(true); state.setSourceFunctionRGB(SourceFunction.SourceAlpha); state.setDestinationFunctionRGB(DestinationFunction.OneMinusSourceAlpha); state.setBlendEquationRGB(BlendEquation.Add); state.setSourceFunctionAlpha(SourceFunction.SourceAlpha); state.setDestinationFunctionAlpha(DestinationFunction.DestinationAlpha); state.setBlendEquationAlpha(BlendEquation.Max); return state; }
public void setBlendEquation(final BlendEquation blendEquation) { setBlendEquationRGB(blendEquation); setBlendEquationAlpha(blendEquation); }
final BlendState blend = new BlendState(); blend.setBlendEnabled(true); blend.setTestEnabled(true); blend.setSourceFunction(BlendState.SourceFunction.SourceAlpha); blend.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha); mesh.setRenderState(blend); } else { final BlendState blend = new BlendState(); blend.setBlendEnabled(true); blend.setTestEnabled(true); transparent.setAlpha(transparent.getAlpha() * transparency); blend.setConstantColor(transparent); blend.setSourceFunction(BlendState.SourceFunction.ConstantAlpha); blend.setDestinationFunction(BlendState.DestinationFunction.OneMinusConstantAlpha); mesh.setRenderState(blend);
public RotateWidget withZAxis(final ReadOnlyColorRGBA color, final float scale, final float width) { if (_zRing != null) { _zRing.removeFromParent(); } _zRing = new InteractRing("zRotRing", 4, 32, scale, width); _zRing.setDefaultColor(color); _handle.attachChild(_zRing); final BlendState blend = new BlendState(); blend.setBlendEnabled(true); _zRing.setRenderState(blend); return this; }
if (record.isValid()) { if (enabled) { final int glSrcRGB = getGLSrcValue(state.getSourceFunctionRGB(), caps); final int glDstRGB = getGLDstValue(state.getDestinationFunctionRGB(), caps); final int glSrcAlpha = getGLSrcValue(state.getSourceFunctionAlpha(), caps); final int glDstAlpha = getGLDstValue(state.getDestinationFunctionAlpha(), caps); if (record.srcFactorRGB != glSrcRGB || record.dstFactorRGB != glDstRGB || record.srcFactorAlpha != glSrcAlpha || record.dstFactorAlpha != glDstAlpha) { final int glSrcRGB = getGLSrcValue(state.getSourceFunctionRGB(), caps); final int glDstRGB = getGLDstValue(state.getDestinationFunctionRGB(), caps); final int glSrcAlpha = getGLSrcValue(state.getSourceFunctionAlpha(), caps); final int glDstAlpha = getGLDstValue(state.getDestinationFunctionAlpha(), caps); GL14C.glBlendFuncSeparate(glSrcRGB, glDstRGB, glSrcAlpha, glDstAlpha); record.srcFactorRGB = glSrcRGB;
void setUseBlend(final boolean blend) { _useBlend = blend; if (!_useBlend) { blendState.setBlendEnabled(false); blendState.setReference(_blendDisabledTestRef); zBuffState.setWritable(true); } else { blendState.setBlendEnabled(true); blendState.setReference(_blendEnabledTestRef); zBuffState.setWritable(false); } } }
public static RenderState createState(final StateType type) { switch (type) { case Blend: return new BlendState(); case ColorMask: return new ColorMaskState(); case Cull: return new CullState(); case Light: return new LightState(); case Offset: return new OffsetState(); case Stencil: return new StencilState(); case Texture: return new TextureState(); case Wireframe: return new WireframeState(); case ZBuffer: return new ZBufferState(); } throw new IllegalArgumentException("Unknown state type: " + type); } }
@Override public void visit(final Spatial spatial) { final BlendState bs = (BlendState) spatial.getLocalRenderState(StateType.Blend); if (bs != null) { bs.setSourceFunction(spatial == highlight ? SourceFunction.One : SourceFunction.SourceAlpha); } } }, true);
clipTextureState.setTexture(textureClipmap.getTexture()); if (first) { blendState.setEnabled(false); first = false; } else { blendState.setEnabled(true); blendState.setNeedsRefresh(true); this.updateWorldRenderStates(true);
blendState.setEnabled(!firstDrawnClip); firstDrawnClip = false;
.setSelected(as == null || as.getDestinationFunctionRGB() == BlendState.DestinationFunction.One); if (getTexturePanel().isVisible()) { Texture tex = null;
public MoveWidget(final IFilterList filterList) { super(filterList); _handle = new Node("moveHandle"); final BlendState blend = new BlendState(); blend.setBlendEnabled(true); _handle.setRenderState(blend); final ZBufferState zstate = new ZBufferState(); zstate.setFunction(TestFunction.LessThanOrEqualTo); _handle.setRenderState(zstate); _handle.getSceneHints().setRenderBucketType(RenderBucketType.Transparent); _handle.updateGeometricState(0); if (MoveWidget.DEFAULT_CURSOR != null) { setMouseOverCallback(new SetCursorCallback(MoveWidget.DEFAULT_CURSOR)); } }
protected static void applyBlendColor(final boolean enabled, final BlendState state, final BlendStateRecord record, final ContextCapabilities caps) { if (enabled) { final boolean applyConstant = state.getDestinationFunctionRGB().usesConstantColor() || state.getSourceFunctionRGB().usesConstantColor() || ((state.getDestinationFunctionAlpha().usesConstantColor() || state.getSourceFunctionAlpha() .usesConstantColor())); if (applyConstant) { final ReadOnlyColorRGBA constant = state.getConstantColor(); if (!record.isValid() || (!record.blendColor.equals(constant))) { GL14C.glBlendColor(constant.getRed(), constant.getGreen(), constant.getBlue(), constant.getAlpha()); record.blendColor.set(constant); } } } }
void setUseBlend(final boolean blend) { _useBlend = blend; if (!_useBlend) { blendState.setBlendEnabled(false); blendState.setReference(_blendDisabledTestRef); zBuffState.setWritable(true); } else { blendState.setBlendEnabled(true); blendState.setReference(_blendEnabledTestRef); zBuffState.setWritable(false); } } }
public static RenderState createState(final StateType type) { switch (type) { case Blend: return new BlendState(); case Clip: return new ClipState();
public void setBlendEquation(final BlendEquation blendEquation) { setBlendEquationRGB(blendEquation); setBlendEquationAlpha(blendEquation); }
tRenderer.getCamera().setLeft(cam.getLeft()); blend.setEnabled(false); final TextureState ts = (TextureState) fullScreenQuad.getWorldRenderState(RenderState.StateType.Texture); blend.setEnabled(true);
private void updateBlendState(final boolean additive) { BlendState blend = (BlendState) getEdittedParticles().getLocalRenderState(StateType.Blend); if (blend == null) { blend = new BlendState(); blend.setBlendEnabled(true); blend.setSourceFunction(BlendState.SourceFunction.SourceAlpha); blend.setTestEnabled(true); blend.setTestFunction(BlendState.TestFunction.GreaterThan); getEdittedParticles().setRenderState(blend); } blend.setDestinationFunction( additive ? BlendState.DestinationFunction.One : BlendState.DestinationFunction.OneMinusSourceAlpha); }
/** * @return a blend state that does alpha blending and writes the max alpha value (source or destination) back to the * color buffer. */ private static BlendState createBlendRGBMaxAlphaBlend() { final BlendState state = new BlendState(); state.setBlendEnabled(true); state.setSourceFunctionRGB(SourceFunction.SourceAlpha); state.setDestinationFunctionRGB(DestinationFunction.OneMinusSourceAlpha); state.setBlendEquationRGB(BlendEquation.Add); state.setSourceFunctionAlpha(SourceFunction.SourceAlpha); state.setDestinationFunctionAlpha(DestinationFunction.DestinationAlpha); state.setBlendEquationAlpha(BlendEquation.Max); return state; }