Package com.jme3.scene.shape

Examples of com.jme3.scene.shape.Sphere


    mat_tl.setColor("Color", new ColorRGBA(1f, 0f, 1f, 1f)); // purple
    cube_leak.setMaterial(mat_tl);
    rootNode.attachChild(cube_leak);

    /** A bumpy rock with a shiny light effect */
    Sphere rock = new Sphere(32, 32, 2f);
    Geometry shiny_rock = new Geometry("Shiny rock", rock);
    rock.setTextureMode(Sphere.TextureMode.Projected); // better quality on spheres
    TangentBinormalGenerator.generate(rock); // for lighting effect
    Material mat_lit = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
    mat_lit.setTexture("DiffuseMap", assetManager.loadTexture("Textures/Terrain/Pond/Pond.jpg"));
    mat_lit.setTexture("NormalMap", assetManager.loadTexture("Textures/Terrain/Pond/Pond_normal.png"));
    mat_lit.setBoolean("UseMaterialColors", true);
View Full Code Here


    Material mat = assetManager.loadMaterial("Textures/BumpMapTest/SimpleBump.j3m");
    sphere.setMaterial(mat);
    TangentBinormalGenerator.generate(sphere);
    rootNode.attachChild(sphere);

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

    pl = new PointLight();
    pl.setColor(ColorRGBA.White);
View Full Code Here

        Node fighter = new Node(name);
        ControlledSpaceObject cso = new ControlledSpaceObject(so, fighter);
        cso.setDebugDisplay(name);
        cso.setGameThreadCallback(new SpatialUpdater(cso));

        Geometry gSphere = new Geometry("Sphere", new Sphere(10,10,0.25f));
        Geometry gDirection =  new Geometry("Direction-Line", new Line(new Vector3f(0,0,0), new Vector3f(0,0,2)));
       
        gSphere.setMaterial(main);
        gDirection.setMaterial(scnd);
View Full Code Here

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

    Sphere sphere = new Sphere(10, 10, PILL_RADIUS);
    sphere.setTextureMode(Sphere.TextureMode.Projected);
    TangentBinormalGenerator.generate(sphere);
    Geometry bluePill = new Geometry("pill", sphere);
    bluePill.setMaterial(matTarget);

    return bluePill;
View Full Code Here

      rootNode.attachChild(boxGeometry);
      space.add(boxGeometry);
    }

    // immovable sphere with mesh collision shape
    Sphere sphere = new Sphere(8, 8, 1);
    Geometry sphereGeometry = new Geometry("Sphere", sphere);
    sphereGeometry.setMaterial(material);
    sphereGeometry.setLocalTranslation(4, -4, 2);
    sphereGeometry.addControl(new RigidBodyControl(new MeshCollisionShape(sphere), 0));
    rootNode.attachChild(sphereGeometry);
View Full Code Here

    rootNode.attachChild(floorGeometry);
    space.add(floorGeometry);

    // movable spheres
    for (int i = 0; i < 5; i++) {
      Sphere sphere = new Sphere(16, 16, .5f);
      Geometry ballGeometry = new Geometry("Soccer ball", sphere);
      ballGeometry.setMaterial(material);
      ballGeometry.setLocalTranslation(i, 2, -3);
      // RigidBodyControl automatically uses Sphere collision shapes when attached to single geometry with sphere mesh
      ballGeometry.addControl(new RigidBodyControl(.001f));
View Full Code Here

   */
  public static Geometry createPhysicsTestSphere(AssetManager assetManager) {

    Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    material.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg"));
    Sphere sphere = new Sphere(8, 8, 0.25f);
    Geometry boxGeometry = new Geometry("Sphere", sphere);
    boxGeometry.setMaterial(material);
    // RigidBodyControl automatically uses sphere collision shapes when attached to single geometry with sphere mesh
    boxGeometry.addControl(new RigidBodyControl(2));
    return boxGeometry;
View Full Code Here

    ActionListener actionListener = new ActionListener() {

      @Override
      public void onAction(String name, boolean keyPressed, float tpf) {

        Sphere bullet = new Sphere(32, 32, 0.4f, true, false);
        bullet.setTextureMode(TextureMode.Projected);
        Material mat2 = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
        TextureKey key2 = new TextureKey("Textures/Terrain/Rock/Rock.PNG");
        key2.setGenerateMips(true);
        Texture tex2 = app.getAssetManager().loadTexture(key2);
        mat2.setTexture("ColorMap", tex2);
View Full Code Here

  public void simpleInitApp() {

    bulletAppState = new BulletAppState();
    stateManager.attach(bulletAppState);
    bulletAppState.getPhysicsSpace().enableDebug(assetManager);
    bullet = new Sphere(32, 32, 0.4f, true, false);
    bullet.setTextureMode(TextureMode.Projected);
    bulletCollisionShape = new SphereCollisionShape(0.4f);

    PhysicsTestHelper.createPhysicsTestWorld(rootNode, assetManager, bulletAppState.getPhysicsSpace());
    PhysicsTestHelper.createBallShooter(this, rootNode, bulletAppState.getPhysicsSpace());
View Full Code Here

            sm = app.getStateManager();
            cam = app.getCamera();

            DebugMaterials.setAssetManager(am);

            Sphere s = new Sphere(4, 4, 1);
            camPosGeom = new Geometry("Camera position", s);
            camPosGeom.setMaterial(new Material(am, Materials.UNSHADED));
            debugNode.attachChild(camPosGeom);

            simpleApp.getRootNode().attachChild(debugNode);
            setEnabled(true);
        }

        if (!sm.hasState(sm.getState(FlyCamAppState.class))) {
            flyCam = new DebugCam(cam);
            flyCam.registerWithInput(im);
            flyCam.setDragToRotate(true);
        } else flyCam = simpleApp.getFlyByCamera();

        // Initialize advanced application stuff
        if (app instanceof AdvancedApplication) {
            scenegraph = ((AdvancedApplication) app).getScenegraph();
            scenegraph.addScenegraphListener(this);
        }

        // Initialize GUI stuff
        gui = new DebugGUI(simpleApp, this);
        gui.getNifty().fromXml("interface/debugInterface.xml", "DebugInfo", this);
        gui.getNifty().setIgnoreKeyboardEvents(true);
        // gui.getNifty().setDebugOptionPanelColors(true);

        guiFont = am.loadFont("Interface/Fonts/Default.fnt");

        // Initialize debug stuff
        coordNode = createCoordinationNode(256, 1);
        debugNode.attachChild(coordNode);
        debugNode.updateModelBound();

        mouse = sm.getState(DebugMouse.class);
        if (mouse == null) {
            mouse = new DebugMouse();
            Material mat = new Material(app.getAssetManager(), Materials.UNSHADED);
            mat.setColor("Color", ColorRGBA.Orange);
            mouse.setMaterial(mat);

            sm.attach(mouse);
            debugNode.attachChild(mouse.getPointer());
        }

        directionalLight = new DirectionalLight();
        directionalLight.setName("Debug light");
        directionalLight.setColor(ColorRGBA.White);
        directionalLight.setDirection(new Vector3f(.5f, -1f, -.1f).normalizeLocal());
        simpleApp.getRootNode().addLight(directionalLight);

        ambientLight = new AmbientLight();
        ambientLight.setColor(ColorRGBA.Gray);
        simpleApp.getRootNode().addLight(ambientLight);

        screenshotState = new ScreenshotAppState();
        screenshotState.setFilePath("d:/");
        sm.attach(screenshotState);

        // Initialize voxel world stuff
        if (sm.getState(VoxelState.class) != null) {
            voxelState = sm.getState(VoxelState.class);
            Sphere s = new Sphere(32, 32, voxelState.getCalcBound().getRadius());
            s.setMode(Mode.Lines);
            worldCalcBoundGeom = new Geometry("Voxel world calculation bound", s);
            worldCalcBoundGeom.setMaterial(new Material(am, Materials.UNSHADED));
            // debugNode.attachChild(worldCalcBoundGeom);
            addState(voxelState);
        }
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.