Package com.ardor3d.renderer.state.record

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


public abstract class LwjglFogStateUtil {

    public static void apply(final FogState state) {
        // ask for the current state record
        final RenderContext context = ContextManager.getCurrentContext();
        final FogStateRecord record = (FogStateRecord) context.getStateRecord(StateType.Fog);
        context.setCurrentState(StateType.Fog, state);

        if (state.isEnabled()) {
            enableFog(true, record);

            if (record.isValid()) {
                if (record.fogStart != state.getStart()) {
                    GL11.glFogf(GL11.GL_FOG_START, state.getStart());
                    record.fogStart = state.getStart();
                }
                if (record.fogEnd != state.getEnd()) {
                    GL11.glFogf(GL11.GL_FOG_END, state.getEnd());
                    record.fogEnd = state.getEnd();
                }
                if (record.density != state.getDensity()) {
                    GL11.glFogf(GL11.GL_FOG_DENSITY, state.getDensity());
                    record.density = state.getDensity();
                }
            } else {
                GL11.glFogf(GL11.GL_FOG_START, state.getStart());
                record.fogStart = state.getStart();
                GL11.glFogf(GL11.GL_FOG_END, state.getEnd());
                record.fogEnd = state.getEnd();
                GL11.glFogf(GL11.GL_FOG_DENSITY, state.getDensity());
                record.density = state.getDensity();
            }

            final ReadOnlyColorRGBA fogColor = state.getColor();
            applyFogColor(fogColor, record);
            applyFogMode(state.getDensityFunction(), record);
            applyFogHint(state.getQuality(), record);
            applyFogSource(state.getSource(), record, context.getCapabilities());
        } else {
            enableFog(false, record);
        }

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


        source = capsule.readEnum("source", CoordinateSource.class, CoordinateSource.Depth);
    }

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

        final GL gl = GLContext.getCurrentGL();

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

        if (state.isEnabled()) {
            enableFog(true, record);

            if (record.isValid()) {
                if (record.fogStart != state.getStart()) {
                    gl.getGL2ES1().glFogf(GL2ES1.GL_FOG_START, state.getStart());
                    record.fogStart = state.getStart();
                }
                if (record.fogEnd != state.getEnd()) {
                    gl.getGL2ES1().glFogf(GL2ES1.GL_FOG_END, state.getEnd());
                    record.fogEnd = state.getEnd();
                }
                if (record.density != state.getDensity()) {
                    gl.getGL2ES1().glFogf(GL2ES1.GL_FOG_DENSITY, state.getDensity());
                    record.density = state.getDensity();
                }
            } else {
                gl.getGL2ES1().glFogf(GL2ES1.GL_FOG_START, state.getStart());
                record.fogStart = state.getStart();
                gl.getGL2ES1().glFogf(GL2ES1.GL_FOG_END, state.getEnd());
                record.fogEnd = state.getEnd();
                gl.getGL2ES1().glFogf(GL2ES1.GL_FOG_DENSITY, state.getDensity());
                record.density = state.getDensity();
            }

            final ReadOnlyColorRGBA fogColor = state.getColor();
            applyFogColor(fogColor, record);
            applyFogMode(state.getDensityFunction(), record);
            applyFogHint(state.getQuality(), record);
            applyFogSource(state.getSource(), record, caps);
        } else {
            enableFog(false, record);
        }

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

TOP

Related Classes of com.ardor3d.renderer.state.record.FogStateRecord

Copyright © 2018 www.massapicom. 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.