Examples of StencilStateRecord


Examples of com.ardor3d.renderer.state.record.StencilStateRecord

    public static void apply(final StencilState state) {
        // ask for the current state record
        final RenderContext context = ContextManager.getCurrentContext();
        final ContextCapabilities caps = context.getCapabilities();
        final StencilStateRecord record = (StencilStateRecord) context.getStateRecord(StateType.Stencil);
        context.setCurrentState(StateType.Stencil, state);

        setEnabled(state.isEnabled(), caps.isTwoSidedStencilSupported() ? state.isUseTwoSided() : false, record, caps);
        if (state.isEnabled()) {
            if (state.isUseTwoSided() && caps.isTwoSidedStencilSupported()) {
                EXTStencilTwoSide.glActiveStencilFaceEXT(GL11.GL_BACK);
                applyMask(state.getStencilWriteMaskBack(), record, 2);
                applyFunc(getGLStencilFunction(state.getStencilFunctionBack()), state.getStencilReferenceBack(),
                        state.getStencilFuncMaskBack(), record, 2);
                applyOp(getGLStencilOp(state.getStencilOpFailBack(), caps),
                        getGLStencilOp(state.getStencilOpZFailBack(), caps),
                        getGLStencilOp(state.getStencilOpZPassBack(), caps), record, 2);

                EXTStencilTwoSide.glActiveStencilFaceEXT(GL11.GL_FRONT);
                applyMask(state.getStencilWriteMaskFront(), record, 1);
                applyFunc(getGLStencilFunction(state.getStencilFunctionFront()), state.getStencilReferenceFront(),
                        state.getStencilFuncMaskFront(), record, 1);
                applyOp(getGLStencilOp(state.getStencilOpFailFront(), caps),
                        getGLStencilOp(state.getStencilOpZFailFront(), caps),
                        getGLStencilOp(state.getStencilOpZPassFront(), caps), record, 1);
            } else {
                applyMask(state.getStencilWriteMaskFront(), record, 0);
                applyFunc(getGLStencilFunction(state.getStencilFunctionFront()), state.getStencilReferenceFront(),
                        state.getStencilFuncMaskFront(), record, 0);
                applyOp(getGLStencilOp(state.getStencilOpFailFront(), caps),
                        getGLStencilOp(state.getStencilOpZFailFront(), caps),
                        getGLStencilOp(state.getStencilOpZPassFront(), caps), record, 0);
            }
        }

        if (!record.isValid()) {
            record.validate();
        }
    }
View Full Code Here

Examples of com.ardor3d.renderer.state.record.StencilStateRecord

        _stencilOpZPassBack = capsule.readEnum("stencilOpZPassBack", StencilOperation.class, StencilOperation.Keep);
    }

    @Override
    public StateRecord createStateRecord(final ContextCapabilities caps) {
        return new StencilStateRecord();
    }
View Full Code Here

Examples of com.ardor3d.renderer.state.record.StencilStateRecord

        final GL gl = GLContext.getCurrentGL();

        // ask for the current state record
        final RenderContext context = ContextManager.getCurrentContext();
        final ContextCapabilities caps = context.getCapabilities();
        final StencilStateRecord record = (StencilStateRecord) context.getStateRecord(StateType.Stencil);
        context.setCurrentState(StateType.Stencil, state);

        setEnabled(state.isEnabled(), caps.isTwoSidedStencilSupported() ? state.isUseTwoSided() : false, record, caps);
        if (state.isEnabled()) {
            if (state.isUseTwoSided() && caps.isTwoSidedStencilSupported()) {
                gl.getGL2().glActiveStencilFaceEXT(GL.GL_BACK);
                applyMask(state.getStencilWriteMaskBack(), record, 2);
                applyFunc(getGLStencilFunction(state.getStencilFunctionBack()), state.getStencilReferenceBack(),
                        state.getStencilFuncMaskBack(), record, 2);
                applyOp(getGLStencilOp(state.getStencilOpFailBack(), caps),
                        getGLStencilOp(state.getStencilOpZFailBack(), caps),
                        getGLStencilOp(state.getStencilOpZPassBack(), caps), record, 2);

                gl.getGL2().glActiveStencilFaceEXT(GL.GL_FRONT);
                applyMask(state.getStencilWriteMaskFront(), record, 1);
                applyFunc(getGLStencilFunction(state.getStencilFunctionFront()), state.getStencilReferenceFront(),
                        state.getStencilFuncMaskFront(), record, 1);
                applyOp(getGLStencilOp(state.getStencilOpFailFront(), caps),
                        getGLStencilOp(state.getStencilOpZFailFront(), caps),
                        getGLStencilOp(state.getStencilOpZPassFront(), caps), record, 1);
            } else {
                applyMask(state.getStencilWriteMaskFront(), record, 0);
                applyFunc(getGLStencilFunction(state.getStencilFunctionFront()), state.getStencilReferenceFront(),
                        state.getStencilFuncMaskFront(), record, 0);
                applyOp(getGLStencilOp(state.getStencilOpFailFront(), caps),
                        getGLStencilOp(state.getStencilOpZFailFront(), caps),
                        getGLStencilOp(state.getStencilOpZPassFront(), caps), record, 0);
            }
        }

        if (!record.isValid()) {
            record.validate();
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.