Package com.jme3.scene.shape

Examples of com.jme3.scene.shape.Sphere


  private Material mat;
  private Geometry atmo;

  @Override
  public void simpleInitApp() {
    Sphere atmoSphere = new Sphere(48, 48, radius, false, true);
    mat = new Material(assetManager, "MatDefs/SimpleAtmoshere.j3md");
   
    mat.setFloat("radius", radius);
    atmo = new Geometry("atmo_Planet", atmoSphere);
   
    Vector3f pos = new Vector3f(5,0,0);
    atmo.setLocalTranslation(pos);
    mat.setVector3("v3Center", pos);
   
   
    atmo.setMaterial(mat);
      rootNode.attachChild(atmo);
     
      Sphere planetSphere = new Sphere(48, 48, radius * 0.8f);
      Material planteMat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
      planteMat.setColor("Color", ColorRGBA.Green);
      Geometry planet = new Geometry("geo_Planet", planetSphere);
      planet.setLocalTranslation(pos);
      planet.setMaterial(planteMat);
View Full Code Here


        mat.setColor("m_Specular", ColorRGBA.Red);
       
        teapot.setMaterial(mat);
        rootNode.attachChild(teapot);

        lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f));
        lightMdl.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m"));
        lightMdl.getMesh().setStatic();
        rootNode.attachChild(lightMdl);

        pl = new PointLight();
View Full Code Here

      this.attachChild(marker);
    }
  }
 
  private void genPlanet() {
    Sphere planetSphere = new Sphere(48, 48, size, false, false);
    //Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
      Texture tex = assetManager.loadTexture("Textures/"+texture);
      planetSphere.setTextureMode(Sphere.TextureMode.Projected); // better quality on spheres
      TangentBinormalGenerator.generate(planetSphere);           // for lighting effect
      mat.setTexture("DiffuseMap", tex);
      mat.setFloat("Shininess", 0.0001f);
      planet = new Geometry("geo_"+name, planetSphere);
      planet.setMaterial(mat);
      planet.setShadowMode(ShadowMode.CastAndReceive);
      this.attachChild(planet);
     
      Sphere planetAtmosphere = new Sphere(48, 48, size*1.1f, false, true);
      Material matAtmosphere = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
      matAtmosphere.setColor("Color", new ColorRGBA(0,0,1,0.1f));
      matAtmosphere.getAdditionalRenderState().setBlendMode(BlendMode.AlphaAdditive);
      atmosphere = new Geometry("geo_"+name+"_atmosphere", planetAtmosphere);
      atmosphere.setMaterial(matAtmosphere);
View Full Code Here

    light.setPosition(this.getLocalTranslation());
    return light;
  }
 
  private void genSunClickGeo() {
    Sphere s = new Sphere(16, 16, size);
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
    mat.setColor("Color", ColorRGBA.Yellow);
    mat.getAdditionalRenderState().setFaceCullMode(FaceCullMode.FrontAndBack);
      sun = new Geometry("geo_"+name, s);
      sun.setMaterial(mat);
View Full Code Here

        viewPort.setBackgroundColor(ColorRGBA.DarkGray);

        Spatial bumpy = (Spatial) assetManager.loadModel("Models/MonkeyHead/MonkeyHead.mesh.xml");
        rootNode.attachChild(bumpy);

        lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f));
        lightMdl.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m"));
        rootNode.attachChild(lightMdl);

        // flourescent main light
        pl = new PointLight();
View Full Code Here

    public static Spatial createSky(AssetManager assetManager, Texture texture,
            Vector3f normalScale, boolean sphereMap, int sphereRadius) {
        if (texture == null) {
            throw new IllegalArgumentException("texture cannot be null");
        }
        final Sphere sphereMesh = new Sphere(10, 10, sphereRadius, false, true);

        Geometry sky = new Geometry("Sky", sphereMesh);
        sky.setQueueBucket(Bucket.Sky);
        sky.setCullHint(Spatial.CullHint.Never);
        sky.setModelBound(new BoundingSphere(Float.POSITIVE_INFINITY, Vector3f.ZERO));
View Full Code Here

     * scene graph
     */
    public static Spatial createSky(AssetManager assetManager, Texture west,
            Texture east, Texture north, Texture south, Texture up,
            Texture down, Vector3f normalScale, float sphereRadius) {
        final Sphere sphereMesh = new Sphere(10, 10, sphereRadius, false, true);
        Geometry sky = new Geometry("Sky", sphereMesh);
        sky.setQueueBucket(Bucket.Sky);
        sky.setCullHint(Spatial.CullHint.Never);
        sky.setModelBound(new BoundingSphere(Float.POSITIVE_INFINITY, Vector3f.ZERO));

View Full Code Here

    matTarget.setBoolean("UseMaterialColors", true);
    matTarget.setColor("Specular", ColorRGBA.White);
    matTarget.setColor("Diffuse", ColorRGBA.Blue);
    matTarget.setFloat("Shininess", 128); // [1,128]

    Sphere sphereTarget = new Sphere(30, 30, TARGET_RADIUS);
    sphereTarget.setTextureMode(Sphere.TextureMode.Projected);
    TangentBinormalGenerator.generate(sphereTarget);
    bluePill = new Geometry("head", sphereTarget);
    bluePill.setMaterial(matTarget);

    // Create RedPill
    matTarget = new Material(app.getAssetManager(), "Common/MatDefs/Light/Lighting.j3md");
    matTarget.setBoolean("UseMaterialColors", true);
    matTarget.setColor("Specular", ColorRGBA.White);
    matTarget.setColor("Diffuse", ColorRGBA.Red);
    matTarget.setFloat("Shininess", 128); // [1,128]

    sphereTarget = new Sphere(30, 30, TARGET_RADIUS);
    sphereTarget.setTextureMode(Sphere.TextureMode.Projected);
    TangentBinormalGenerator.generate(sphereTarget);
    redPill = new Geometry("head", sphereTarget);
    redPill.setMaterial(matTarget);

    // Place pills
View Full Code Here

    matRoboticArm.setColor("Specular", new ColorRGBA(.7f, 1.0f, .7f, 1f));
    matRoboticArm.setFloat("Shininess", 50); // [1,128] lower is shinier

    // elongated box for arm sections
    Box box = new Box(new Vector3f(0, 0, SECTION_LENGTH), SECTION_CROSS_DIM, SECTION_CROSS_DIM, SECTION_LENGTH);
    Sphere sphereJoint = new Sphere(20, 20, JOINT_RADIUS);
    sphereJoint.setTextureMode(Sphere.TextureMode.Projected);
    TangentBinormalGenerator.generate(sphereJoint);
    for (int i = 0; i < numJoints; i++) {

      // Create pivots
      Node pivot = new Node("pivot");
      pivots[i] = pivot;

      // Create sections
      Geometry section = new Geometry("Box", box);
      section.setMaterial(matRoboticArm);
      sections[i] = section;

      // create joints
      Geometry sphere = new Geometry("joint", sphereJoint);
      sphere.setMaterial(matRoboticArm);
      joints[i] = sphere;

    }

    // Create Head
    headNode = new Node("headNode");
    Sphere sphereHead = new Sphere(20, 20, HEAD_RADIUS);
    sphereHead.setTextureMode(Sphere.TextureMode.Projected);
    TangentBinormalGenerator.generate(sphereHead);
    head = new Geometry("head", sphereHead);
    head.setMaterial(matRoboticArm);

    // Create eyes
    Sphere sphereEye = new Sphere(20, 20, EYE_RADIUS);
    leftEye = new Geometry("leftEye", sphereEye);
    leftEye.setMaterial(matRoboticArm);
    rightEye = new Geometry("rightEye", sphereEye);
    rightEye.setMaterial(matRoboticArm);
View Full Code Here

  }

  /** A red ball that marks the last spot that was "hit" by the "shot". */
  protected void initMark() {

    Sphere sphere = new Sphere(30, 30, 0.2f);
    mark = new Geometry("BOOM!", sphere);
    Material mark_mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mark_mat.setColor("Color", ColorRGBA.Red);
    mark.setMaterial(mark_mat);
  }
View Full Code Here

TOP

Related Classes of com.jme3.scene.shape.Sphere

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.