Examples of LightComponent


Examples of org.terasology.rendering.logic.LightComponent

                        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);
View Full Code Here

Examples of org.terasology.rendering.logic.LightComponent

            extents.scale(2.0f);
            extents.clampMin(0.5f);
            builder.getComponent(BoxShapeComponent.class).extents.set(extents);
        }
        if (blockFamily.getArchetypeBlock().getLuminance() > 0 && !builder.hasComponent(LightComponent.class)) {
            LightComponent lightComponent = builder.addComponent(new LightComponent());

            Vector3f randColor = new Vector3f(rand.nextFloat(), rand.nextFloat(), rand.nextFloat());
            lightComponent.lightColorDiffuse.set(randColor);
            lightComponent.lightColorAmbient.set(randColor);
        }
View Full Code Here

Examples of org.terasology.rendering.logic.LightComponent

            return EntityRef.NULL;
        }

        EntityBuilder builder = entityManager.newBuilder("engine:blockItemBase");
        if (blockFamily.getArchetypeBlock().getLuminance() > 0) {
            builder.addComponent(new LightComponent());
        }

        // Copy the components from block prefab into the block item
        Prefab prefab = Assets.getPrefab(blockFamily.getArchetypeBlock().getPrefab());
        if (prefab != null) {
View Full Code Here

Examples of org.terasology.rendering.logic.LightComponent

        program.enable();
        program.setCamera(camera);
        EntityManager entityManager = CoreRegistry.get(EntityManager.class);
        for (EntityRef entity : entityManager.getEntitiesWith(LightComponent.class, LocationComponent.class)) {
            LocationComponent locationComponent = entity.getComponent(LocationComponent.class);
            LightComponent lightComponent = entity.getComponent(LightComponent.class);

            final Vector3f worldPosition = locationComponent.getWorldPosition();
            renderLightComponent(lightComponent, worldPosition, program, camera, true);
        }
        DefaultRenderingProcess.getInstance().endRenderLightGeometryStencilPass();

        /*
         * LIGHT GEOMETRY PASS
         */
        DefaultRenderingProcess.getInstance().beginRenderLightGeometry();
        program = Assets.getMaterial("engine:prog.lightGeometryPass");
        for (EntityRef entity : entityManager.getEntitiesWith(LightComponent.class, LocationComponent.class)) {
            LocationComponent locationComponent = entity.getComponent(LocationComponent.class);
            LightComponent lightComponent = entity.getComponent(LightComponent.class);

            final Vector3f worldPosition = locationComponent.getWorldPosition();
            renderLightComponent(lightComponent, worldPosition, program, camera, false);
        }
        DefaultRenderingProcess.getInstance().endRenderLightGeometry();
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.