当前位置: 首页>>代码示例>>Java>>正文


Java ZipLocator类代码示例

本文整理汇总了Java中com.jme3.asset.plugins.ZipLocator的典型用法代码示例。如果您正苦于以下问题:Java ZipLocator类的具体用法?Java ZipLocator怎么用?Java ZipLocator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ZipLocator类属于com.jme3.asset.plugins包,在下文中一共展示了ZipLocator类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: simpleInitApp

import com.jme3.asset.plugins.ZipLocator; //导入依赖的package包/类
public void simpleInitApp() {
    this.flyCam.setMoveSpeed(10);
    Node mainScene=new Node();
    cam.setLocation(new Vector3f(-27.0f, 1.0f, 75.0f));
    cam.setRotation(new Quaternion(0.03f, 0.9f, 0f, 0.4f));

    // load sky
    mainScene.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", false));

    // create the geometry and attach it
    // load the level from zip or http zip
    if (useHttp) {
        assetManager.registerLocator("http://jmonkeyengine.googlecode.com/files/wildhouse.zip", HttpZipLocator.class.getName());
    } else {
        assetManager.registerLocator("wildhouse.zip", ZipLocator.class.getName());
    }
    Spatial scene = assetManager.loadModel("main.scene");

    DirectionalLight sun = new DirectionalLight();
    Vector3f lightDir=new Vector3f(-0.37352666f, -0.50444174f, -0.7784704f);
    sun.setDirection(lightDir);
    sun.setColor(ColorRGBA.White.clone().multLocal(2));
    scene.addLight(sun);


    mainScene.attachChild(scene);
    rootNode.attachChild(mainScene);

    fpp=new FilterPostProcessor(assetManager);
    //fpp.setNumSamples(4);
    fog=new FogFilter();
    fog.setFogColor(new ColorRGBA(0.9f, 0.9f, 0.9f, 1.0f));
    fog.setFogDistance(155);
    fog.setFogDensity(2.0f);
    fpp.addFilter(fog);
    viewPort.addProcessor(fpp);
    initInputs();
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:39,代码来源:TestFog.java

示例2: simpleInitApp

import com.jme3.asset.plugins.ZipLocator; //导入依赖的package包/类
public void simpleInitApp() {
    this.flyCam.setMoveSpeed(10);

    // load sky
    rootNode.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", false));

    File file = new File("wildhouse.zip");
    if (!file.exists()) {
        useHttp = true;
    }
    // create the geometry and attach it
    // load the level from zip or http zip
    if (useHttp) {
        assetManager.registerLocator("http://jmonkeyengine.googlecode.com/files/wildhouse.zip", HttpZipLocator.class.getName());
    } else {
        assetManager.registerLocator("wildhouse.zip", ZipLocator.class.getName());
    }
    Spatial scene = assetManager.loadModel("main.scene");

    AmbientLight al = new AmbientLight();
    scene.addLight(al);

    DirectionalLight sun = new DirectionalLight();
    sun.setDirection(new Vector3f(0.69077975f, -0.6277887f, -0.35875428f).normalizeLocal());
    sun.setColor(ColorRGBA.White.clone().multLocal(2));
    scene.addLight(sun);

    rootNode.attachChild(scene);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:30,代码来源:TestSceneLoading.java

示例3: ConstructLevel

import com.jme3.asset.plugins.ZipLocator; //导入依赖的package包/类
private void ConstructLevel(){
    assetManager.registerLocator("town.zip", ZipLocator.class);
    gameLevel = assetManager.loadModel("main.scene"); // be sure to give new names to new scenes
    gameLevel.setLocalTranslation(0, -5.2f, 0); // move the level down by 5.2 units
    gameLevel.setLocalScale(2f);
    // Wrap the scene in a rigidbody collision object.
    CollisionShape sceneShape = CollisionShapeFactory.createMeshShape((Node) gameLevel);
    landscape = new RigidBodyControl(sceneShape, 0);
    gameLevel.addControl(landscape);
    bulletAppState.getPhysicsSpace().addAll(gameLevel);
    // Now attach it.
    shootables.attachChild(gameLevel); // should we add the shootables to the bulletAppState?
}
 
开发者ID:devinbost,项目名称:jMathGame3d,代码行数:14,代码来源:HelloJME3.java

示例4: loadLevel

import com.jme3.asset.plugins.ZipLocator; //导入依赖的package包/类
/**
 * Loads a level from zip file placed in Map/ folder.
 *
 * @param name The name of the zip file without zip extension.
 */
public Level loadLevel(String name) {
    String file = "Maps/" + name + ".zip";
    assetManager.registerLocator(file, ZipLocator.class);
    Terrain terrain = loadTerrain();
    Level level = new Level(name, terrain);
    assetManager.unregisterLocator(file, ZipLocator.class);
    return level;
}
 
开发者ID:farina-game,项目名称:farina,代码行数:14,代码来源:LevelLoader.java

示例5: simpleInitApp

import com.jme3.asset.plugins.ZipLocator; //导入依赖的package包/类
public void simpleInitApp() {
  /** Set up Physics */
  bulletAppState = new BulletAppState();
  stateManager.attach(bulletAppState);

  // We re-use the flyby camera for rotation, while positioning is handled by physics
  viewPort.setBackgroundColor(new ColorRGBA(0.7f,0.8f,1f,1f));
  flyCam.setMoveSpeed(100);
  setUpKeys();
  setUpLight();

  // We load the scene from the zip file and adjust its size.
  assetManager.registerLocator("town.zip", ZipLocator.class.getName());
  sceneModel = assetManager.loadModel("main.scene");
  sceneModel.setLocalScale(2f);

  // We set up collision detection for the scene by creating a
  // compound collision shape and a static physics node with mass zero.
  CollisionShape sceneShape =
    CollisionShapeFactory.createMeshShape((Node) sceneModel);
  landscape = new RigidBodyControl(sceneShape, 0);
  sceneModel.addControl(landscape);
  
  // We set up collision detection for the player by creating
  // a capsule collision shape and a physics character node.
  // The physics character node offers extra settings for
  // size, stepheight, jumping, falling, and gravity.
  // We also put the player in its starting position.
  CapsuleCollisionShape capsuleShape = new CapsuleCollisionShape(1.5f, 6f, 1);
  player = new CharacterControl(capsuleShape, 0.05f);
  player.setJumpSpeed(20);
  player.setFallSpeed(30);
  player.setGravity(30);
  player.setPhysicsLocation(new Vector3f(0, 10, 0));

  // We attach the scene and the player to the rootnode and the physics space,
  // to make them appear in the game world.
  rootNode.attachChild(sceneModel);
  bulletAppState.getPhysicsSpace().add(landscape);
  bulletAppState.getPhysicsSpace().add(player);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:42,代码来源:HelloCollision.java

示例6: simpleInitApp

import com.jme3.asset.plugins.ZipLocator; //导入依赖的package包/类
public void simpleInitApp() {
    bulletAppState = new BulletAppState();
    stateManager.attach(bulletAppState);
    flyCam.setMoveSpeed(100);
    setupKeys();

    this.cam.setFrustumFar(2000);

    DirectionalLight dl = new DirectionalLight();
    dl.setColor(ColorRGBA.White.clone().multLocal(2));
    dl.setDirection(new Vector3f(-1, -1, -1).normalize());
    rootNode.addLight(dl);

    AmbientLight am = new AmbientLight();
    am.setColor(ColorRGBA.White.mult(2));
    rootNode.addLight(am);

    // load the level from zip or http zip
    if (useHttp) {
        assetManager.registerLocator("http://jmonkeyengine.googlecode.com/files/quake3level.zip", HttpZipLocator.class.getName());
    } else {
        assetManager.registerLocator("quake3level.zip", ZipLocator.class.getName());
    }

    // create the geometry and attach it
    MaterialList matList = (MaterialList) assetManager.loadAsset("Scene.material");
    OgreMeshKey key = new OgreMeshKey("main.meshxml", matList);
    gameLevel = (Node) assetManager.loadAsset(key);
    gameLevel.setLocalScale(0.1f);

    // add a physics control, it will generate a MeshCollisionShape based on the gameLevel
    gameLevel.addControl(new RigidBodyControl(0));

    player = new PhysicsCharacter(new SphereCollisionShape(5), .01f);
    player.setJumpSpeed(20);
    player.setFallSpeed(30);
    player.setGravity(30);

    player.setPhysicsLocation(new Vector3f(60, 10, -60));

    rootNode.attachChild(gameLevel);

    getPhysicsSpace().addAll(gameLevel);
    getPhysicsSpace().add(player);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:46,代码来源:TestQ3.java

示例7: simpleInitApp

import com.jme3.asset.plugins.ZipLocator; //导入依赖的package包/类
public void simpleInitApp() {
    this.flyCam.setMoveSpeed(10);
    cam.setLocation(new Vector3f(-27.0f, 1.0f, 75.0f));
  //  cam.setRotation(new Quaternion(0.03f, 0.9f, 0f, 0.4f));

    // load sky
    rootNode.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", false));

    File file = new File("wildhouse.zip");
    
    if (file.exists()) {
        useHttp = false;
    }
    // create the geometry and attach it
    // load the level from zip or http zip
    if (useHttp) {
        assetManager.registerLocator("http://jmonkeyengine.googlecode.com/files/wildhouse.zip", HttpZipLocator.class.getName());
    } else {
        assetManager.registerLocator("wildhouse.zip", ZipLocator.class.getName());
    }
    Spatial scene = assetManager.loadModel("main.scene");
    rootNode.attachChild(scene);

    DirectionalLight sun = new DirectionalLight();
    Vector3f lightDir = new Vector3f(-0.37352666f, -0.50444174f, -0.7784704f);
    sun.setDirection(lightDir);
    sun.setColor(ColorRGBA.White.clone().multLocal(2));
    scene.addLight(sun);

    FilterPostProcessor fpp = new FilterPostProcessor(assetManager);        
    final WaterFilter water = new WaterFilter(rootNode, lightDir);
    water.setWaterHeight(-20);
    water.setUseFoam(false);
    water.setUseRipples(false);
    water.setDeepWaterColor(ColorRGBA.Brown);
    water.setWaterColor(ColorRGBA.Brown.mult(2.0f));
    water.setWaterTransparency(0.2f);
    water.setMaxAmplitude(0.3f);
    water.setWaveScale(0.008f);
    water.setSpeed(0.7f);
    water.setShoreHardness(1.0f);
    water.setRefractionConstant(0.2f);
    water.setShininess(0.3f);
    water.setSunScale(1.0f);
    water.setColorExtinction(new Vector3f(10.0f, 20.0f, 30.0f));
    fpp.addFilter(water);
    viewPort.addProcessor(fpp);

    inputManager.addListener(new ActionListener() {

        public void onAction(String name, boolean isPressed, float tpf) {
          if(isPressed){
              if(water.isUseHQShoreline()){
                  water.setUseHQShoreline(false);
              }else{
                  water.setUseHQShoreline(true);
              }
          }
        }
    }, "HQ");

    inputManager.addMapping("HQ", new KeyTrigger(keyInput.KEY_SPACE));
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:64,代码来源:TestPostWaterLake.java

示例8: simpleInitApp

import com.jme3.asset.plugins.ZipLocator; //导入依赖的package包/类
public void simpleInitApp() {
        this.flyCam.setMoveSpeed(10);
        Node mainScene=new Node();
        cam.setLocation(new Vector3f(-27.0f, 1.0f, 75.0f));
        cam.setRotation(new Quaternion(0.03f, 0.9f, 0f, 0.4f));

        // load sky
        mainScene.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", false));

        
        File file = new File("wildhouse.zip");
        if (file.exists()) {
            useHttp = false;
        }
        // create the geometry and attach it
        // load the level from zip or http zip
        if (useHttp) {
            assetManager.registerLocator("http://jmonkeyengine.googlecode.com/files/wildhouse.zip", HttpZipLocator.class.getName());
        } else {
            assetManager.registerLocator("wildhouse.zip", ZipLocator.class.getName());
        }
        Spatial scene = assetManager.loadModel("main.scene");

        DirectionalLight sun = new DirectionalLight();
        Vector3f lightDir=new Vector3f(-0.37352666f, -0.50444174f, -0.7784704f);
        sun.setDirection(lightDir);
        sun.setColor(ColorRGBA.White.clone().multLocal(2));
        scene.addLight(sun);

        Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        mat.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg"));
           //add lightPos Geometry
        Sphere lite=new Sphere(8, 8, 3.0f);
        Geometry lightSphere=new Geometry("lightsphere", lite);
        lightSphere.setMaterial(mat);
        Vector3f lightPos=lightDir.multLocal(-400);
        lightSphere.setLocalTranslation(lightPos);
        rootNode.attachChild(lightSphere);


        SimpleWaterProcessor waterProcessor = new SimpleWaterProcessor(assetManager);
        waterProcessor.setReflectionScene(mainScene);
        waterProcessor.setDebug(false);
        waterProcessor.setLightPosition(lightPos);
        waterProcessor.setRefractionClippingOffset(1.0f);


        //setting the water plane
        Vector3f waterLocation=new Vector3f(0,-20,0);
        waterProcessor.setPlane(new Plane(Vector3f.UNIT_Y, waterLocation.dot(Vector3f.UNIT_Y)));
        WaterUI waterUi=new WaterUI(inputManager, waterProcessor);
        waterProcessor.setWaterColor(ColorRGBA.Brown);
        waterProcessor.setDebug(true);
        //lower render size for higher performance
//        waterProcessor.setRenderSize(128,128);
        //raise depth to see through water
//        waterProcessor.setWaterDepth(20);
        //lower the distortion scale if the waves appear too strong
//        waterProcessor.setDistortionScale(0.1f);
        //lower the speed of the waves if they are too fast
//        waterProcessor.setWaveSpeed(0.01f);

        Quad quad = new Quad(400,400);

        //the texture coordinates define the general size of the waves
        quad.scaleTextureCoordinates(new Vector2f(6f,6f));

        Geometry water=new Geometry("water", quad);
        water.setShadowMode(ShadowMode.Receive);
        water.setLocalRotation(new Quaternion().fromAngleAxis(-FastMath.HALF_PI, Vector3f.UNIT_X));
        water.setMaterial(waterProcessor.getMaterial());
        water.setLocalTranslation(-200, -20, 250);

        rootNode.attachChild(water);

        viewPort.addProcessor(waterProcessor);

        mainScene.attachChild(scene);
        rootNode.attachChild(mainScene);
    }
 
开发者ID:mleoking,项目名称:PhET,代码行数:81,代码来源:TestSceneWater.java

示例9: main

import com.jme3.asset.plugins.ZipLocator; //导入依赖的package包/类
public static void main(String[] args){
    AssetManager am = new DesktopAssetManager();

    am.registerLocator("http://www.jmonkeyengine.com/wp-content/uploads/2010/09/",
                       UrlLocator.class);

    am.registerLocator("town.zip", ZipLocator.class);
    am.registerLocator("http://jmonkeyengine.googlecode.com/files/wildhouse.zip",
                       HttpZipLocator.class);
    
    
    am.registerLocator("/", ClasspathLocator.class);
    
    

    // Try loading from Core-Data source package
    AssetInfo a = am.locateAsset(new AssetKey<Object>("Interface/Fonts/Default.fnt"));

    // Try loading from town scene zip file
    AssetInfo b = am.locateAsset(new ModelKey("casaamarela.jpg"));

    // Try loading from wildhouse online scene zip file
    AssetInfo c = am.locateAsset(new ModelKey("glasstile2.png"));

    // Try loading directly from HTTP
    AssetInfo d = am.locateAsset(new TextureKey("planet-2.jpg"));

    if (a == null)
        System.out.println("Failed to load from classpath");
    else
        System.out.println("Found classpath font: " + a.toString());

    if (b == null)
        System.out.println("Failed to load from town.zip");
    else
        System.out.println("Found zip image: " + b.toString());

    if (c == null)
        System.out.println("Failed to load from wildhouse.zip on googlecode.com");
    else
        System.out.println("Found online zip image: " + c.toString());

    if (d == null)
        System.out.println("Failed to load from HTTP");
    else
        System.out.println("Found HTTP showcase image: " + d.toString());
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:48,代码来源:TestManyLocators.java

示例10: simpleInitApp

import com.jme3.asset.plugins.ZipLocator; //导入依赖的package包/类
public void simpleInitApp() {
    this.flyCam.setMoveSpeed(10);
    Node mainScene=new Node();
    cam.setLocation(new Vector3f(-27.0f, 1.0f, 75.0f));
    cam.setRotation(new Quaternion(0.03f, 0.9f, 0f, 0.4f));

    // load sky
    mainScene.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", false));

    // create the geometry and attach it
    // load the level from zip or http zip
    if (useHttp) {
        assetManager.registerLocator("http://jmonkeyengine.googlecode.com/files/wildhouse.zip", HttpZipLocator.class);
    } else {
        assetManager.registerLocator("wildhouse.zip", ZipLocator.class);
    }
    Spatial scene = assetManager.loadModel("main.scene");

    DirectionalLight sun = new DirectionalLight();
    Vector3f lightDir=new Vector3f(-0.37352666f, -0.50444174f, -0.7784704f);
    sun.setDirection(lightDir);
    sun.setColor(ColorRGBA.White.clone().multLocal(2));
    scene.addLight(sun);


    mainScene.attachChild(scene);
    rootNode.attachChild(mainScene);

    fpp=new FilterPostProcessor(assetManager);
    //fpp.setNumSamples(4);
    int numSamples = getContext().getSettings().getSamples();
    if( numSamples > 0 ) {
        fpp.setNumSamples(numSamples); 
    }
    fog=new FogFilter();
    fog.setFogColor(new ColorRGBA(0.9f, 0.9f, 0.9f, 1.0f));
    fog.setFogDistance(155);
    fog.setFogDensity(2.0f);
    fpp.addFilter(fog);
    viewPort.addProcessor(fpp);
    initInputs();
}
 
开发者ID:shamanDevel,项目名称:ProceduralTerrain,代码行数:43,代码来源:TestFog.java

示例11: simpleInitApp

import com.jme3.asset.plugins.ZipLocator; //导入依赖的package包/类
public void simpleInitApp() {
  /** Set up Physics */
  bulletAppState = new BulletAppState();
  stateManager.attach(bulletAppState);
  //bulletAppState.getPhysicsSpace().enableDebug(assetManager);

  // We re-use the flyby camera for rotation, while positioning is handled by physics
  viewPort.setBackgroundColor(new ColorRGBA(0.7f, 0.8f, 1f, 1f));
  flyCam.setMoveSpeed(100);
  setUpKeys();
  setUpLight();

  // We load the scene from the zip file and adjust its size.
  assetManager.registerLocator("town.zip", ZipLocator.class.getName());
  sceneModel = assetManager.loadModel("main.scene");
  sceneModel.setLocalScale(2f);

  // We set up collision detection for the scene by creating a
  // compound collision shape and a static RigidBodyControl with mass zero.
  CollisionShape sceneShape =
          CollisionShapeFactory.createMeshShape((Node) sceneModel);
  landscape = new RigidBodyControl(sceneShape, 0);
  sceneModel.addControl(landscape);

  // We set up collision detection for the player by creating
  // a capsule collision shape and a CharacterControl.
  // The CharacterControl offers extra settings for
  // size, stepheight, jumping, falling, and gravity.
  // We also put the player in its starting position.
  CapsuleCollisionShape capsuleShape = new CapsuleCollisionShape(1.5f, 6f, 1);
  player = new CharacterControl(capsuleShape, 0.05f);
  player.setJumpSpeed(20);
  player.setFallSpeed(30);
  player.setGravity(30);
  player.setPhysicsLocation(new Vector3f(0, 10, 0));

  // We attach the scene and the player to the rootnode and the physics space,
  // to make them appear in the game world.
  rootNode.attachChild(sceneModel);
  bulletAppState.getPhysicsSpace().add(landscape);
  bulletAppState.getPhysicsSpace().add(player);
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:43,代码来源:HelloCollision.java

示例12: attachToGame

import com.jme3.asset.plugins.ZipLocator; //导入依赖的package包/类
/**
 * Adds this World from the core JMonkey SimpleApplication state, and initialises core components of the World.
 *
 * @param appManager
 * @param assetManager
 * @param cam
 * @param type
 * @param viewPort
 */
@SuppressWarnings("deprecation")
public void attachToGame(AppStateManager appManager, AssetManager assetManager, Listener audioListener, Camera cam, WorldType type, ViewPort viewPort){
    this.assetManager = assetManager;
    this.camera = cam;
    this.worldType = type;
    appManager.attach(bulletAppState);
    physics = bulletAppState.getPhysicsSpace();
    physics.setGravity(new Vector3f(0, -100, 0));
    if(PHYSICS_DEBUG)
        physics.enableDebug(assetManager);
    physics.addCollisionListener(new ActorCollisionManager());
    physics.addCollisionListener(new TriggerCollisionListener());
    assetManager.registerLocator("assets/Models/WorldObjects.zip", ZipLocator.class);
    assetManager.registerLocator("assets/Models/NewAsses.zip", ZipLocator.class);
    assetManager.registerLocator("assets/Scenes/terrain.zip", ZipLocator.class);

    if(otherPlayers == null)
        otherPlayers = new ArrayList<Player>();

    if(loadedEntities != null){
        addEntities(loadedEntities);
        loadedEntities = null;
    } else{

        if(type != WorldType.CLIENT){
            initializeWorldObjectsFromFile(MAPFILE);
            initializePathGraph();
        }
        if(type == WorldType.SP){
            player = new Player();
            otherPlayers.add(player);
            addEntity(player, spawnPoint);
            player.setCamera(camera);
            player.setAudioListener(audioListener);
        }
    }

    vem = new VisualEffectsManager(assetManager, root, viewPort);
    timeManager = new TimeManager(this, vem);
    vem.removeLightScattering();     //Uncomment this if you have a powerful computer mr markers
    if(SHADOWS){
        root.setShadowMode(ShadowMode.CastAndReceive);
    } else{
        vem.removeShadows();
    }

    if(USE_SUPERFAST_RENDERING){
        vem.removeFog();
        vem.removeLightScattering();
        vem.removeShadows();
        vem.removeWater();
    }

    setupAudio();

}
 
开发者ID:GSam,项目名称:Game-Project,代码行数:66,代码来源:World.java


注:本文中的com.jme3.asset.plugins.ZipLocator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。