Examples of Sphere


Examples of ca.eandb.jmist.math.Sphere

  @Override
  public Sphere boundingSphere() {
    if (bbox == null) {
      computeBoundingBox();
    }
    return new Sphere(bbox.center(), 0.5 * bbox.diagonal());
  }
View Full Code Here

Examples of ca.grimoire.jnoise.modules.generation.Sphere

    if (!hasAmplitude)
      throw new BuilderException ("Sphere requires amplitude.");
    if (frequency < 0.0)
      throw new BuilderException ("Sphere requires non-negative frequency.");

    return new Sphere (frequency, amplitude);
  }
View Full Code Here

Examples of com.ardor3d.scenegraph.shape.Sphere

    protected void initExample() {

        _canvas.setTitle("RenderEffects Example");

        // Create a new sphere that rotates
        final Sphere sphere = new Sphere("Sphere", new Vector3(0, 0, 0), 32, 32, 5);
        sphere.setModelBound(new BoundingBox());
        sphere.setTranslation(new Vector3(0, 0, -15));
        sphere.addController(new SpatialController<Spatial>() {
            private final Vector3 _axis = new Vector3(1, 1, 0.5f).normalizeLocal();
            private final Matrix3 _rotate = new Matrix3();
            private double _angle = 0;

            public void update(final double time, final Spatial caller) {
                // update our rotation
                _angle = _angle + (_timer.getTimePerFrame() * 25);
                if (_angle > 180) {
                    _angle = -180;
                }

                _rotate.fromAngleNormalAxis(_angle * MathUtils.DEG_TO_RAD, _axis);
                sphere.setRotation(_rotate);
            }
        });
        _root.attachChild(sphere);

        // Add a texture to the sphere.
        final TextureState ts = new TextureState();
        ts.setTexture(TextureManager.load("images/ardor3d_white_256.jpg", Texture.MinificationFilter.Trilinear, true));
        sphere.setRenderState(ts);

        // Setup our manager
        effectManager = new EffectManager(_settings, TextureStoreFormat.RGBA8);
        effectManager.setSceneCamera(_canvas.getCanvasRenderer().getCamera());

View Full Code Here

Examples of com.jme.scene.shape.Sphere

     * resize affordance
     */
    private Node createSphereNode(String name) {
        // Create the new node and sphere primitive
        Node sphereNode = new Node();
        Sphere sphere = new Sphere(name, 30, 30, radius);
        sphereNode.attachChild(sphere);

        // 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);
        alphaState.setTestEnabled(true);
        alphaState.setTestFunction(BlendState.TestFunction.GreaterThan);
        alphaState.setEnabled(true);
        sphere.setRenderState(alphaState);

        // Remove the back faces of the object so transparency works properly
        CullState cullState = (CullState)rm.createRendererState(StateType.Cull);
        cullState.setCullFace(CullState.Face.Back);
        sphereNode.setRenderState(cullState);

        // Set the bound so this node can be pickable
        sphere.setModelBound(new BoundingSphere());
        sphere.updateModelBound();
        return sphereNode;
    }
View Full Code Here

Examples of com.jme.scene.shape.Sphere

        // Draw some geometry that mimics the bounds, either a sphere or a
        // box. Add to the scene graph of this Entity.
        if (bounds instanceof BoundingSphere) {
            float radius = ((BoundingSphere) bounds).radius;
            Vector3f center = ((BoundingSphere) bounds).getCenter();
            Sphere sphere = new Sphere("Sphere", center, 30, 30, radius);
            rootNode.attachChild(sphere);
        } else if (bounds instanceof BoundingBox) {
            float xExtent = ((BoundingBox)bounds).xExtent;
            float yExtent = ((BoundingBox)bounds).yExtent;
            float zExtent = ((BoundingBox)bounds).zExtent;
View Full Code Here

Examples of com.jme.scene.shape.Sphere

        translatorClip.resume();
    }

    private void attachInnerOrb(Entity entity) {
        innerOrbNode = new Node("Inner orb node");
        innerOrb = new Sphere("Inner Orb", 8, 8, INNER_RADIUS);
        innerOrb.setModelBound(new BoundingSphere());
        innerOrb.updateModelBound();
        innerOrb.setRenderState(DEFAULT_MATERIALSTATE);
        innerOrb.setRenderState(DEFAULT_SHADESTATE);
View Full Code Here

Examples of com.jme.scene.shape.Sphere

        innerOrbNode.attachChild(innerOrb);
        orbNode.attachChild(innerOrbNode);
    }

    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);
        bs.setSourceFunction(BlendState.SourceFunction.SourceAlpha);
        bs.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha);
        outerOrb.setRenderState(bs);

        CullState cs = (CullState) ClientContextJME.getWorldManager().getRenderManager().createRendererState(StateType.Cull);
        cs.setEnabled(true);
        cs.setCullFace(CullState.Face.Back);
        outerOrb.setRenderState(cs);

         orbNode.attachChild(outerOrb);
    }
View Full Code Here

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

Examples of com.jme3.scene.shape.Sphere

        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

Examples of com.jme3.scene.shape.Sphere

      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
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.