Examples of DirectionalLight


Examples of box2dLight.DirectionalLight

    clearLights();
   
    groundBody.setActive(false);
    sunDirection = MathUtils.random(0f, 360f);
   
    DirectionalLight light = new DirectionalLight(
        rayHandler, 4 * RAYS_PER_BALL, null, sunDirection);
    lights.add(light);
  }
View Full Code Here

Examples of com.ardor3d.light.DirectionalLight

        buf.setEnabled(true);
        buf.setFunction(ZBufferState.TestFunction.LessThanOrEqualTo);
        nodes.getRootNode().setRenderState(buf);

        // ---- LIGHTS
        /** Set up a basic, default light. */
        final DirectionalLight light = new DirectionalLight();
        light.setDirection(-0.37352666, -0.50444174, -0.7784704);
        light.setDiffuse(ColorRGBA.WHITE);
        //light.setAmbient(new ColorRGBA(0.5f, 0.5f, 0.5f, 1.0f));
        light.setEnabled(true);

        /** Attach the light to a lightState and the lightState to rootNode. */
        _lightState = new LightState();
        _lightState.setEnabled(true);
        _lightState.attach(light);
View Full Code Here

Examples of com.ardor3d.light.DirectionalLight

        //final RenderPass rootPass = new RenderPass();
        //rootPass.add(rootNode);

        //lightState.detachAll();
        final DirectionalLight light = new DirectionalLight();
        light.setDirection(lightPosition.normalize(null).negateLocal());

        // final PointLight light = new PointLight();
        light.setEnabled(true);
        //lightState.attach(light);
       
       
        //final Light light = _lightState.get(0);
        //if (light instanceof PointLight) {
View Full Code Here

Examples of com.badlogic.gdx.graphics.g3d.environment.DirectionalLight

    materialMask = renderable.material.getMask() | optionalAttributes;
    vertexMask = renderable.mesh.getVertexAttributes().getMask();

    this.directionalLights = new DirectionalLight[lighting && config.numDirectionalLights > 0 ? config.numDirectionalLights : 0];
    for (int i = 0; i < directionalLights.length; i++)
      directionalLights[i] = new DirectionalLight();
    this.pointLights = new PointLight[lighting && config.numPointLights > 0 ? config.numPointLights : 0];
    for (int i = 0; i < pointLights.length; i++)
      pointLights[i] = new PointLight();

    if (!ignoreUnimplemented && (implementedFlags & materialMask) != materialMask)
View Full Code Here

Examples of com.jme.light.DirectionalLight

    }
   

    public LightNode toLightNode() {
        LightNode node = new LightNode();
        DirectionalLight light = new DirectionalLight();
        light.setAmbient(ambient);
        light.setDiffuse(diffuse);
        light.setSpecular(specular);
        light.setShadowCaster(castShadows);
        light.setDirection(direction);
       
        node.setLight(light);
        node.setLocalTranslation(translation);
       
        return node;
View Full Code Here

Examples of com.jme.light.DirectionalLight

    public void showLight(final LightNode lightNode, final String name) {
  if (rootNode != null) {
      dispose();
  }
       
        DirectionalLight directionalLight = (DirectionalLight)lightNode.getLight();

        rootNode = new Node("Light Viewer Node");
        RenderManager rm = ClientContextJME.getWorldManager().getRenderManager();
        RenderComponent rc = rm.createRenderComponent(rootNode);
        this.addComponent(RenderComponent.class, rc);
       
        // Set the Z-buffer state on the root node
        ZBufferState zbuf = (ZBufferState)rm.createRendererState(StateType.ZBuffer);
        zbuf.setEnabled(true);
        zbuf.setFunction(ZBufferState.TestFunction.LessThanOrEqualTo);
       
        rootNode.setRenderState(zbuf);

        // Set the wireframe state on the root node
//        WireframeState wf = (WireframeState)rm.createRendererState(StateType.Wireframe);
//        wf.setEnabled(true);
//        rootNode.setRenderState(wf);
        MaterialState ms = (MaterialState)rm.createRendererState(StateType.Material);
        ms.setAmbient(new ColorRGBA(0.25f, 0, 0.5f, 0.40f));
        ms.setDiffuse(new ColorRGBA(0.25f, 0, 0.5f, 0.40f));
        ms.setMaterialFace(MaterialState.MaterialFace.FrontAndBack);;
        //ms.setSpecular(new ColorRGBA(1f, 1, 1f, 1f));
       
        ms.setEnabled(true);
        rootNode.setRenderState(ms);
       
        BlendState bs = (BlendState)rm.createRendererState(StateType.Blend);
        bs.setEnabled(true);
        bs.setBlendEnabled(true);
        bs.setSourceFunction(BlendState.SourceFunction.SourceAlpha);
        bs.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha);
        bs.setTestEnabled(true);
        bs.setTestFunction(BlendState.TestFunction.GreaterThan);
        rootNode.setRenderState(bs);

        CellTransform transform = cell.getWorldTransform();
        // Draw an arrow that mimics the light position --direction still under
        //construction.
        TextLabel2D label = new TextLabel2D(name,
                                            Color.black, Color.white, 1.0f, true, Font.getFont("SANS_SERIF"));
       
        Vector3f direction = directionalLight.getDirection();
        Vector3f position = lightNode.getLocalTranslation();
        Vector3f labelPosition = new Vector3f(position.x, position.y + 3, position.z);
       
        Arrow arrow = new Arrow("Arrow", 3, 0.5f);
        Node rotatedOnX = new Node("Rotated For Arrow");
View Full Code Here

Examples of com.jme.light.DirectionalLight

            }
          
        }
       
        private LightNode buildLightFromState(SharedDirectionLight state) {
            DirectionalLight light = new DirectionalLight();
            LightNode lightNode = new LightNode();
           
            light.setAmbient(state.getAmbient());
            light.setDiffuse(state.getDiffuse());
            light.setSpecular(state.getSpecular());
            light.setDirection(state.getDirection());
            light.setShadowCaster(state.isCastShadows());
            lightNode.setLight(light);
            lightNode.setLocalTranslation(state.getTranslation());
           
            return lightNode;
        }
View Full Code Here

Examples of com.jme.light.DirectionalLight

       
        this.lightNode = lightNode;
        this.cell = cell;
        this.name = name;
        this.editor = editor;
        DirectionalLight light = (DirectionalLight)lightNode.getLight();
        initializeButtonIcons(light.getAmbient(),
                              light.getDiffuse(),
                              light.getSpecular());
       
        initializeSpinners(lightNode.getLocalTranslation().x,
                           lightNode.getLocalTranslation().y,
                           lightNode.getLocalTranslation().z,
                           light.getDirection().x,
                           light.getDirection().y,
                           light.getDirection().z);
        castShadowsBox.setSelected(lightNode.getLight().isShadowCaster());
       
        originalAmbient = light.getAmbient();
        originalDiffuse = light.getDiffuse();
        originalSpecular = light.getSpecular();
        originalCast = light.isShadowCaster();
        originalPosition = lightNode.getLocalTranslation();
        originalDirection = light.getDirection();
       
        ambient = originalAmbient;
        diffuse = originalDiffuse;
        specular = originalSpecular;
        castShadows = originalCast;
View Full Code Here

Examples of com.jme.light.DirectionalLight

                   
    }
   
    public LightNode reconstructLight() {
        LightNode node = new LightNode();
        DirectionalLight light = new DirectionalLight();
       
        light.setAmbient(ambient);
        light.setDiffuse(diffuse);
        light.setSpecular(specular);
        light.setShadowCaster(castShadows);
        light.setDirection(direction);
       
        node.setLight(light);
        node.setLocalTranslation(position);
       
        return node;
View Full Code Here

Examples of com.jme.light.DirectionalLight

        editor.setPanelDirty(DefaultEnvironmentProperties.class, isDirty());
       
        SceneWorker.addWorker(new WorkCommit() {

            public void commit() {
                DirectionalLight dl = (DirectionalLight)lightNode.getLight();
               
               
                dl.setAmbient(ambient);
                dl.setDiffuse(diffuse);
                dl.setSpecular(specular);
                dl.setShadowCaster(castShadows);
                dl.setDirection(direction);
                lightNode.setLocalTranslation(position);
                showLight();
            }
        });
    }
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.