Package com.jme.scene.state

Examples of com.jme.scene.state.MaterialState


        return ret;
    }

    public Node createTeapotEntity(String name,
            ColorRGBA color) {
        MaterialState matState = null;
       
        // The center teapot
        Node ret = new Node();
        Teapot teapot = new Teapot();
        teapot.resetData();
        teapot.setLocalScale(0.2f);
        ret.attachChild(teapot);

        matState = (MaterialState) ClientContextJME.getWorldManager().getRenderManager().createRendererState(RenderState.RS_MATERIAL);
        matState.setDiffuse(color);
        ret.setRenderState(matState);

        ret.setModelBound(new BoundingSphere());
        ret.updateModelBound();
View Full Code Here


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

        // Create the main node and set the material state on the node so the
        // color shows up. Attach the tube to the node.
        Node n = new Node();
        RenderManager rm = ClientContextJME.getWorldManager().getRenderManager();
        MaterialState matState3 = (MaterialState)
                rm.createRendererState(RenderState.StateType.Material);
        matState3.setDiffuse(color);
        n.setRenderState(matState3);
        n.attachChild(t);

        // Set the bound on the tube and update it
        t.setModelBound(new BoundingSphere());
View Full Code Here

        ZBufferState buf = (ZBufferState) renderManager.createRendererState(
                RenderState.RS_ZBUFFER);
        buf.setEnabled(true);
        buf.setFunction(ZBufferState.TestFunction.LessThanOrEqualTo);

        MaterialState matState =
                (MaterialState) renderManager.createRendererState(
                RenderState.RS_MATERIAL);
//        matState.setDiffuse(color);
        rootBG.setRenderState(matState);
        rootBG.setRenderState(buf);
View Full Code Here

        // Create the main node and set the material state on the node so the
        // color shows up
        Node n = new Node();
        RenderManager rm = ClientContextJME.getWorldManager().getRenderManager();
        MaterialState matState3 = (MaterialState)rm.createRendererState(StateType.Material);
        matState3.setDiffuse(color);
        n.setRenderState(matState3);

        // Create a sub-node to hold the first arrow. We must translate it up,
        // so that the end is at (0, 0, 0) in the local coordinate space of
        // the node we return
View Full Code Here

        // Set the color to black and the transparency
        RenderManager rm = ClientContextJME.getWorldManager().getRenderManager();
        sphere.setSolidColor(new ColorRGBA(0.0f, 0.0f, 0.0f, 0.5f));
        sphereNode.setRenderState(zbuf);
        MaterialState matState = (MaterialState)rm.createRendererState(StateType.Material);
        sphereNode.setRenderState(matState);
        matState.setDiffuse(new ColorRGBA(0.0f, 0.0f, 0.0f, 0.5f));
        matState.setAmbient(new ColorRGBA(0.0f, 0.0f, 0.0f, 0.5f));
        matState.setShininess(128.0f);
        matState.setEmissive(new ColorRGBA(0.0f, 0.0f, 0.0f, 0.5f));
        matState.setEnabled(true);

        BlendState alphaState = (BlendState)rm.createRendererState(StateType.Blend);
        alphaState.setBlendEnabled(true);
        alphaState.setSourceFunction(BlendState.SourceFunction.SourceAlpha);
        alphaState.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha);
View Full Code Here

    /**
     * Specify a new lit ambient-and-diffuse color for all sides of this box.
     */
    public void setColor (ColorRGBA color) {
  MaterialState ms = (MaterialState) faces[0].getRenderState(RenderState.RS_MATERIAL);
  if (ms == null) {
      ms = DisplaySystem.getDisplaySystem().getRenderer().createMaterialState();
      for (int i = 0; i < 6; i++) {
    faces[i].setRenderState(ms);
      }
  }
  ms.setAmbient(new ColorRGBA(color));
  ms.setDiffuse(new ColorRGBA(color));
    }
View Full Code Here

    private void attachOuterOrb(Entity entity) {
        final Sphere outerOrb = new Sphere("Outer Orb", 16, 16, OUTER_RADIUS);
        outerOrb.setModelBound(new BoundingSphere());
        outerOrb.updateModelBound();
        ColorRGBA orbColour = new ColorRGBA(0f, 0f, 1f, 0.2f);
        MaterialState matState = (MaterialState) ClientContextJME.getWorldManager().getRenderManager().createRendererState(StateType.Material);
        matState.setDiffuse(orbColour);
        outerOrb.setRenderState(matState);

        BlendState bs = (BlendState) ClientContextJME.getWorldManager().getRenderManager().createRendererState(StateType.Blend);
        bs.setEnabled(true);
        bs.setBlendEnabled(true);
View Full Code Here

    turret.computeOrigin();
   
    this.generatePhysicsGeometry(true);
    setActive(true);

    MaterialState material = DisplaySystem.getDisplaySystem().getRenderer()
        .createMaterialState(); // use a factory method to generate a new material
    material.setDiffuse(color); // set it's diffuse color (when light hits it) to red
    setRenderState(material);
   
    //this.setMass(35000);
  }
View Full Code Here

     
      setLocalTranslation(pos); //move the sphere to the location provided.
      setModelBound(new BoundingSphere()); //create a bounding sphere for the sphere
      updateModelBound(); //automatically resize the bounding sphere
     
      MaterialState material = DisplaySystem.getDisplaySystem().getRenderer().createMaterialState(); //use a factory method to generate a new material
      material.setDiffuse(color); //set it's diffuse color (when light hits it) to red
      //material.setEmissive(color); //set it's emmissive color (light it gives off) to red
      setRenderState(material); //apply the material we've created to the sphere
    }
View Full Code Here

TOP

Related Classes of com.jme.scene.state.MaterialState

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.