Package org.terasology.rendering.logic

Examples of org.terasology.rendering.logic.LightFadeComponent


        byte newLuminance = getLuminance(newItem);
        if (oldLuminance != newLuminance) {
            if (newLuminance == 0) {
                // Fade out
                if (entity.hasComponent(LightComponent.class)) {
                    LightFadeComponent fade = entity.getComponent(LightFadeComponent.class);
                    if (fade == null) {
                        fade = new LightFadeComponent();
                        fade.targetAmbientIntensity = 0.0f;
                        fade.targetDiffuseIntensity = 0.0f;
                        fade.removeLightAfterFadeComplete = true;
                        entity.addComponent(fade);
                    } else {
                        fade.targetAmbientIntensity = 0.0f;
                        fade.targetDiffuseIntensity = 0.0f;
                        fade.removeLightAfterFadeComplete = true;
                        entity.saveComponent(fade);
                    }
                }
            } else if (oldLuminance == 0) {
                // Fade in
                LightComponent light = entity.getComponent(LightComponent.class);
                if (light == null) {
                    light = new LightComponent();
                    light.lightColorAmbient.set(1.0f, 0.6f, 0.6f);
                    light.lightColorDiffuse.set(1.0f, 0.6f, 0.6f);
                    light.lightDiffuseIntensity = 0.0f;
                    light.lightAmbientIntensity = 0.0f;
                    entity.addComponent(light);
                }

                LightFadeComponent fade = entity.getComponent(LightFadeComponent.class);
                if (fade == null) {
                    fade = new LightFadeComponent();
                    fade.targetAmbientIntensity = 1.0f;
                    fade.targetDiffuseIntensity = 1.0f;
                    fade.removeLightAfterFadeComplete = false;
                    entity.addComponent(fade);
                } else {
View Full Code Here

TOP

Related Classes of org.terasology.rendering.logic.LightFadeComponent

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.