Examples of LightStateRecord


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

public abstract class LwjglLightStateUtil {

    public static void apply(final LightState state) {
        final RenderContext context = ContextManager.getCurrentContext();
        final LightStateRecord record = (LightStateRecord) context.getStateRecord(StateType.Light);
        context.setCurrentState(StateType.Light, state);

        if (state.isEnabled() && LightState.LIGHTS_ENABLED) {
            setLightEnabled(true, record);
            setTwoSided(state.getTwoSidedLighting(), record);
            setLocalViewer(state.getLocalViewer(), record);
            if (context.getCapabilities().isOpenGL1_2Supported()) {
                setSpecularControl(state.getSeparateSpecular(), record);
            }

            for (int i = 0, max = state.getNumberOfChildren(); i < max; i++) {
                final Light light = state.get(i);
                LightRecord lr = record.getLightRecord(i);
                // TODO: use the reference to get the lightrecord - rherlitz

                if (lr == null) {
                    lr = new LightRecord();
                    record.setLightRecord(lr, i);
                }

                if (light == null) {
                    setSingleLightEnabled(false, i, record, lr);
                } else {
                    if (light.isEnabled()) {
                        setLight(i, light, state, record, lr);
                    } else {
                        setSingleLightEnabled(false, i, record, lr);
                    }
                }
            }

            // disable lights at and above the max count in this state
            for (int i = state.getNumberOfChildren(); i < LightState.MAX_LIGHTS_ALLOWED; i++) {
                LightRecord lr = record.getLightRecord(i);

                if (lr == null) {
                    lr = new LightRecord();
                    record.setLightRecord(lr, i);
                }
                setSingleLightEnabled(false, i, record, lr);
            }

            if ((state.getLightMask() & LightState.MASK_GLOBALAMBIENT) == 0) {
                setModelAmbient(record, state.getGlobalAmbient());
            } else {
                setModelAmbient(record, ColorRGBA.BLACK_NO_ALPHA);
            }
        } else {
            setLightEnabled(false, record);
        }

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

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

        }
    }

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

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

public abstract class JoglLightStateUtil {

    public static void apply(final JoglRenderer renderer, final LightState state) {
        final RenderContext context = ContextManager.getCurrentContext();
        final ContextCapabilities caps = context.getCapabilities();
        final LightStateRecord record = (LightStateRecord) context.getStateRecord(StateType.Light);
        context.setCurrentState(StateType.Light, state);

        if (state.isEnabled() && LightState.LIGHTS_ENABLED) {
            setLightEnabled(true, record);
            setTwoSided(state.getTwoSidedLighting(), record);
            setLocalViewer(state.getLocalViewer(), record);
            if (caps.isOpenGL1_2Supported()) {
                setSpecularControl(state.getSeparateSpecular(), record);
            }

            for (int i = 0, max = state.getNumberOfChildren(); i < max; i++) {
                final Light light = state.get(i);
                LightRecord lr = record.getLightRecord(i);
                // TODO: use the reference to get the lightrecord - rherlitz

                if (lr == null) {
                    lr = new LightRecord();
                    record.setLightRecord(lr, i);
                }

                if (light == null) {
                    setSingleLightEnabled(false, i, record, lr);
                } else {
                    if (light.isEnabled()) {
                        setLight(i, light, record, state, lr);
                    } else {
                        setSingleLightEnabled(false, i, record, lr);
                    }
                }
            }

            // disable lights at and above the max count in this state
            for (int i = state.getNumberOfChildren(); i < LightState.MAX_LIGHTS_ALLOWED; i++) {
                LightRecord lr = record.getLightRecord(i);

                if (lr == null) {
                    lr = new LightRecord();
                    record.setLightRecord(lr, i);
                }
                setSingleLightEnabled(false, i, record, lr);
            }

            if ((state.getLightMask() & LightState.MASK_GLOBALAMBIENT) == 0) {
                setModelAmbient(record, state.getGlobalAmbient());
            } else {
                setModelAmbient(record, ColorRGBA.BLACK_NO_ALPHA);
            }
        } else {
            setLightEnabled(false, record);
        }

        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.