/** * @param green * The green to set. */ public void setGreen(final boolean green) { this.green = green; setNeedsRefresh(true); }
public static void apply(final ColorMaskState state) { // ask for the current state record final RenderContext context = ContextManager.getCurrentContext(); final ColorMaskStateRecord record = (ColorMaskStateRecord) context.getStateRecord(StateType.ColorMask); context.setCurrentState(StateType.ColorMask, state); if (state.isEnabled()) { if (!record.isValid() || !record.is(state.getRed(), state.getGreen(), state.getBlue(), state.getAlpha())) { GL11.glColorMask(state.getRed(), state.getGreen(), state.getBlue(), state.getAlpha()); record.set(state.getRed(), state.getGreen(), state.getBlue(), state.getAlpha()); } } else if (!record.isValid() || !record.is(true, true, true, true)) { GL11.glColorMask(true, true, true, true); record.set(true, true, true, true); } if (!record.isValid()) { record.validate(); } } }
_noTexture = new TextureState(); _noTexture.setEnabled(false); _colorDisabled = new ColorMaskState(); _colorDisabled.setAll(false); _cullFrontFace = new CullState(); _cullFrontFace.setEnabled(true);
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); } }
public static void apply(final JoglRenderer renderer, final ColorMaskState state) { final GL gl = GLContext.getCurrentGL(); // ask for the current state record final RenderContext context = ContextManager.getCurrentContext(); final ColorMaskStateRecord record = (ColorMaskStateRecord) context.getStateRecord(StateType.ColorMask); context.setCurrentState(StateType.ColorMask, state); if (state.isEnabled()) { if (!record.isValid() || !record.is(state.getRed(), state.getGreen(), state.getBlue(), state.getAlpha())) { gl.glColorMask(state.getRed(), state.getGreen(), state.getBlue(), state.getAlpha()); record.set(state.getRed(), state.getGreen(), state.getBlue(), state.getAlpha()); } } else if (!record.isValid() || !record.is(true, true, true, true)) { gl.glColorMask(true, true, true, true); record.set(true, true, true, true); } if (!record.isValid()) { record.validate(); } } }
_colorDisabled = new ColorMaskState(); _colorDisabled.setAll(false); _cullFrontFace = new CullState(); _cullFrontFace.setEnabled(true);
return new ClipState(); case ColorMask: return new ColorMaskState(); case Cull: return new CullState();
public static void apply(final ColorMaskState state) { // ask for the current state record final RenderContext context = ContextManager.getCurrentContext(); final ColorMaskStateRecord record = (ColorMaskStateRecord) context.getStateRecord(StateType.ColorMask); context.setCurrentState(StateType.ColorMask, state); if (state.isEnabled()) { if (!record.isValid() || !record.is(state.getRed(), state.getGreen(), state.getBlue(), state.getAlpha())) { GL11C.glColorMask(state.getRed(), state.getGreen(), state.getBlue(), state.getAlpha()); record.set(state.getRed(), state.getGreen(), state.getBlue(), state.getAlpha()); } } else if (!record.isValid() || !record.is(true, true, true, true)) { GL11C.glColorMask(true, true, true, true); record.set(true, true, true, true); } if (!record.isValid()) { record.validate(); } } }
public void setAll(final boolean on) { blue = on; green = on; red = on; alpha = on; setNeedsRefresh(true); }
/** * @param alpha * The alpha to set. */ public void setAlpha(final boolean alpha) { this.alpha = alpha; setNeedsRefresh(true); }
/** * @param blue * The blue to set. */ public void setBlue(final boolean blue) { this.blue = blue; setNeedsRefresh(true); }
/** * @param red * The red to set. */ public void setRed(final boolean red) { this.red = red; setNeedsRefresh(true); }
public void setAll(final boolean on) { blue = on; green = on; red = on; alpha = on; setNeedsRefresh(true); }
/** * @param red * The red to set. */ public void setRed(final boolean red) { this.red = red; setNeedsRefresh(true); }
/** * @param alpha * The alpha to set. */ public void setAlpha(final boolean alpha) { this.alpha = alpha; setNeedsRefresh(true); }
/** * @param blue * The blue to set. */ public void setBlue(final boolean blue) { this.blue = blue; setNeedsRefresh(true); }
/** * @param green * The green to set. */ public void setGreen(final boolean green) { this.green = green; setNeedsRefresh(true); }