Package com.jme3.scene

Examples of com.jme3.scene.Spatial


    chaseCam.setDefaultDistance(5f);

    // CameraControl cc = new CameraControl(cam, ControlDirection.SpatialToCamera);
    // cc.setSpatial(player);

    Spatial asteroid = assetManager.loadModel("spaceobject/asteroid/dusty/Asteroid.mesh.xml");
    asteroid.setLocalTranslation(10.0f, -5.0f, -2.0f);
    Material mat_asteroid = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat_asteroid.setTexture("ColorMap",
        assetManager.loadTexture("spaceobject/asteroid/dusty/asteroidtextur_512.jpg"));
    asteroid.setMaterial(mat_asteroid);

    rootNode.attachChild(asteroid);

    // You must add a light to make the model visible
    DirectionalLight sun = new DirectionalLight();
View Full Code Here


    setUpKeys();
    setUpLight();

    rootNode.attachChild(SkyBoxFactory.createSimpleSkyBox(assetManager));

    Spatial asteroid = assetManager.loadModel("spaceobject/asteroid/dusty/Asteroid.mesh.xml");
    asteroid.setLocalTranslation(0f, 0f, 20f);
    Material mat_asteroid = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat_asteroid.setTexture("ColorMap",
        assetManager.loadTexture("spaceobject/asteroid/dusty/asteroidtextur_512.jpg"));
    asteroid.setMaterial(mat_asteroid);

    rootNode.attachChild(asteroid);

    CapsuleCollisionShape capsuleShape = new CapsuleCollisionShape(1.5f, 6f, 1);
    vehicleControl = new RigidBodyControl(capsuleShape, 1f);
View Full Code Here

    Texture north = assetManager.loadTexture("skybox/milkyway/front.png");
    Texture south = assetManager.loadTexture("skybox/milkyway/back.png");
    Texture up = assetManager.loadTexture("skybox/milkyway/top.png");
    Texture down = assetManager.loadTexture("skybox/milkyway/bottom.png");

    Spatial skySpatial = SkyFactory.createSky(assetManager, west, east,
        north, south, up, down);

    return skySpatial;
  }
View Full Code Here

    fpp.addFilter(bloom);
    viewPort.addProcessor(fpp);

    // Skybox
    rootNode.attachChild(SkyBoxFactory.createSimpleSkyBox(assetManager));
    Spatial tree = assetManager.loadModel("stuff/trees/fir/Tree.mesh.xml");
    tree.scale(0.05f, 0.05f, 0.05f);
    rootNode.attachChild(tree);

    Spatial leaves = assetManager
        .loadModel("stuff/trees/fir/Leaves.mesh.xml");
    leaves.scale(0.05f, 0.05f, 0.05f);
    rootNode.attachChild(leaves);

    Spatial sign = assetManager.loadModel("stuff/signs/Sign.mesh.xml");
    sign.setLocalTranslation(0.3f, 0.1f, 0f);

    // Spatial tree =
    // assetManager.loadModel("stuff/trees/fir/Tree.mesh.xml");
    // tree.scale(0.05f, 0.05f, 0.05f);
    // rootNode.attachChild(tree);
    //
    // Spatial leaves =
    // assetManager.loadModel("stuff/trees/fir/Leaves.mesh.xml");
    // leaves.scale(0.05f, 0.05f, 0.05f);
    // rootNode.attachChild(leaves);
    //
    // Spatial sign = assetManager.loadModel("stuff/signs/Sign.mesh.xml");
    // sign.setLocalTranslation(0.3f, 0.1f, 0f);
    // Material mat_asteroid = new Material(assetManager,
    // "Common/MatDefs/Misc/Unshaded.j3md");
    // mat_asteroid.setTexture("ColorMap",
    // assetManager.loadTexture("stuff/signs/sign.jpg"));
    // sign.setMaterial(mat_asteroid);
    // sign.scale(0.02f, 0.02f, 0.02f);
    //
    // rootNode.attachChild(sign);
    //
    Node ship = new Node("Carrier");
    Spatial cube = assetManager
        .loadModel("spaceobject/station/platform/Platform.mesh.xml");

    Material mat_asteroid = new Material(assetManager,
        "Common/MatDefs/Light/Lighting.j3md");
    mat_asteroid.setTexture("DiffuseMap", assetManager
        .loadTexture("spaceobject/station/platform/hull.jpg"));
    cube.setMaterial(mat_asteroid);
    ship.attachChild(cube);

    Spatial wall = assetManager
        .loadModel("spaceobject/station/platform/Towers.mesh.xml");
    Material mat_wall = new Material(assetManager,
        "Common/MatDefs/Light/Lighting.j3md");
    mat_wall.setTexture("DiffuseMap", assetManager
        .loadTexture("spaceobject/station/platform/city2.jpg"));
    mat_wall.setTexture("GlowMap", assetManager
        .loadTexture("spaceobject/station/platform/city2_glow.jpg"));
    wall.setMaterial(mat_wall);
    ship.attachChild(wall);

    // Spatial flight =
    // assetManager.loadModel("spaceobject/station/cube/Flight.mesh.xml");
    // flight.setMaterial(mat_wall);
View Full Code Here

  private void addObject(AbstractControlledObject<?, ?> co) {
    if (co == null || co.getSceneObject() == null || !(co.getSceneObject() instanceof Spatial))
      return;

    Spatial s = (Spatial) co.getSceneObject();

    if (s.getWorldBound() == null || s.getName().equalsIgnoreCase("Sky")
        || s.getName().equalsIgnoreCase("PlayerShip"))
      return;

    BoundingVolume bv = s.getWorldBound();
    Node n = new DebugNode(cam, co, bv);
    nodes.put(co, n);
    GlobalObjectStore.<ITimedTaskExecutor>getObject(ITimedTaskExecutor.class).AddTimedCallback(new AddNodeCallback(n, this), 0);
    //this.attachChild(n);
    log.info("Spatial about to be added to debug: " + co);
View Full Code Here

  public void setLogicThreadCallback(ILogicThreadCallback logicThreadCallback) {
    this.logicThreadCallback = logicThreadCallback;
  }

  private static Spatial createSimpleAsteroid() {
    Spatial asteroid = GlobalObjectStore.<AssetManager>getObject(AssetManager.class).loadModel("spaceobject/asteroid/dusty/Asteroid.mesh.xml");
    Material material = new Material(GlobalObjectStore.<AssetManager>getObject(AssetManager.class), "Common/MatDefs/Misc/Unshaded.j3md");
    asteroid.setMaterial(material);
    material.setTexture("ColorMap", GlobalObjectStore.<AssetManager>getObject(AssetManager.class).loadTexture("spaceobject/asteroid/dusty/asteroidtextur_512.jpg"));

    asteroid.setLocalTranslation(0f, 0f, 20f);
   
    SimpleBoundingVolumeFactory.createBestBoundingVolume(asteroid);

    return asteroid;
  }
View Full Code Here

    Vector3f waterLocation = new Vector3f(0, -6, 0);
    waterProcessor.setPlane(new Plane(Vector3f.UNIT_Y, waterLocation.dot(Vector3f.UNIT_Y)));

    Node ship = new Node("Carrier");

    Spatial center = assetManager.loadModel("spaceobject/gates/stargate/center.mesh.xml");
    center.setShadowMode(ShadowMode.Receive);
    center.setMaterial(waterProcessor.getMaterial());
   
   
    Spatial gate = assetManager.loadModel("spaceobject/gates/stargate/gate.mesh.xml");
   
    Material mat_wall = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
    mat_wall.setTexture("DiffuseMap", assetManager.loadTexture("spaceobject/gates/stargate/gate_blue.png"));
    mat_wall.setTexture("GlowMap", assetManager.loadTexture("spaceobject/gates/stargate/gate_blue_glow.png"));
   
   
   
    gate.setMaterial(mat_wall);
   
   
   
   
    ship.attachChild(center);
View Full Code Here

  private void initializeScenery() {
    // Skybox
    rootNode.attachChild(SkyBoxFactory.createSimpleSkyBox(assetManager));
    // Asteroid
    Spatial asteroid = assetManager.loadModel("spaceobject/asteroid/dusty/Asteroid.mesh.xml");
    asteroid.setLocalTranslation(10.0f, -5.0f, -2.0f);
    Material mat_asteroid = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat_asteroid.setTexture("ColorMap",
        assetManager.loadTexture("spaceobject/asteroid/dusty/asteroidtextur_512.jpg"));
    asteroid.setMaterial(mat_asteroid);

    rootNode.attachChild(asteroid);

    // Light
    DirectionalLight sun = new DirectionalLight();
View Full Code Here

   
    inputManager.setCursorVisible(true);

    rootNode.attachChild(SkyBoxFactory.createSimpleSkyBox(assetManager));
   
    Spatial platform = assetManager
        .loadModel("spaceobject/station/platform/Platform.mesh.xml");

    Material mat_platform = new Material(assetManager,
        "Common/MatDefs/Misc/Unshaded.j3md");
    mat_platform.setTexture("ColorMap", assetManager
        .loadTexture("spaceobject/station/platform/hull.jpg"));
    platform.setMaterial(mat_platform);
//    platform.setLocalTranslation(-0.8f, -1f, 5.5f);
//    Quaternion rotate = new Quaternion();
//    rotate.fromAngleAxis(-FastMath.PI / 2, new Vector3f(1, 0, 0));
//    platform.setLocalRotation(rotate);
//    platform.scale(0.2f);
View Full Code Here

    sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f));
    rootNode.addLight(sun);
  }
 
  private void loadCharacter(String id){
    Spatial character = assetManager.loadModel("character/" + id + "/Mesh.mesh.xml");
    character.setName(id);
    character.setLocalTranslation(0f, 0f, 5f);
    Material mat_character = new Material(assetManager,"Common/MatDefs/Light/Lighting.j3md");
    mat_character.setTexture("DiffuseMap", assetManager.loadTexture("character/male/male.png"));
    character.setMaterial(mat_character);
//    Quaternion rotate = new Quaternion();
//    rotate.fromAngleAxis(-FastMath.PI / 2, new Vector3f(1, 0, 0));
//    character.setLocalRotation(rotate);
    getRootNode().attachChild(character);
  }
View Full Code Here

TOP

Related Classes of com.jme3.scene.Spatial

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.