Java Code Examples for com.jme3.system.JmeSystem#getStorageFolder()

The following examples show how to use com.jme3.system.JmeSystem#getStorageFolder() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProgramCache.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Creates a new program cache associated with the specified context and
 * devices.
 * The cached programs are built against the specified device and also
 * only the binaries linked to that device are stored.
 * @param context the OpenCL context
 * @param device the OpenCL device
 */
public ProgramCache(Context context, Device device) {
    this.context = context;
    this.device = device;
    if (JmeSystem.isLowPermissions()) {
        tmpFolder = null;
    } else {
        tmpFolder = JmeSystem.getStorageFolder();
    }
}
 
Example 2
Source File: TestAnimSerialization.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void simpleInitApp() {
    setTimer(new EraseTimer());
    //cam.setFrustumPerspective(90f, (float) cam.getWidth() / cam.getHeight(), 0.01f, 10f);
    viewPort.setBackgroundColor(ColorRGBA.DarkGray);
    rootNode.addLight(new DirectionalLight(new Vector3f(-1, -1, -1).normalizeLocal()));
    rootNode.addLight(new AmbientLight(ColorRGBA.DarkGray));

    Spatial model = assetManager.loadModel("Models/Jaime/Jaime.j3o");

    AnimMigrationUtils.migrate(model);

    File storageFolder = JmeSystem.getStorageFolder();
    file = new File(storageFolder.getPath() + File.separator + "newJaime.j3o");
    BinaryExporter be = new BinaryExporter();
    try {
        be.save(model, file);
    } catch (IOException e) {
        e.printStackTrace();
    }

    assetManager.registerLocator(storageFolder.getPath(), FileLocator.class);
    model = assetManager.loadModel("newJaime.j3o");

    rootNode.attachChild(model);

    debugAppState = new ArmatureDebugAppState();
    stateManager.attach(debugAppState);

    setupModel(model);

    flyCam.setEnabled(false);

    Node target = new Node("CamTarget");
    //target.setLocalTransform(model.getLocalTransform());
    target.move(0, 1, 0);
    ChaseCameraAppState chaseCam = new ChaseCameraAppState();
    chaseCam.setTarget(target);
    getStateManager().attach(chaseCam);
    chaseCam.setInvertHorizontalAxis(true);
    chaseCam.setInvertVerticalAxis(true);
    chaseCam.setZoomSpeed(0.5f);
    chaseCam.setMinVerticalRotation(-FastMath.HALF_PI);
    chaseCam.setRotationSpeed(3);
    chaseCam.setDefaultDistance(3);
    chaseCam.setMinDistance(0.01f);
    chaseCam.setZoomSpeed(0.01f);
    chaseCam.setDefaultVerticalRotation(0.3f);

    initInputs();
}
 
Example 3
Source File: TestAnimMorphSerialization.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void simpleInitApp() {
    setTimer(new EraseTimer());
    //cam.setFrustumPerspective(90f, (float) cam.getWidth() / cam.getHeight(), 0.01f, 10f);
    viewPort.setBackgroundColor(ColorRGBA.DarkGray);
    //rootNode.addLight(new DirectionalLight(new Vector3f(-1, -1, -1).normalizeLocal()));
    //rootNode.addLight(new AmbientLight(ColorRGBA.DarkGray));
    Node probeNode = (Node) assetManager.loadModel("Scenes/defaultProbe.j3o");
    rootNode.attachChild(probeNode);
    Spatial model = assetManager.loadModel("Models/gltf/zophrac/scene.gltf");

    File storageFolder = JmeSystem.getStorageFolder();
    file = new File(storageFolder.getPath() + File.separator + "zophrac.j3o");
    BinaryExporter be = new BinaryExporter();
    try {
        be.save(model, file);
    } catch (IOException e) {
        e.printStackTrace();
    }

    assetManager.registerLocator(storageFolder.getPath(), FileLocator.class);
    Spatial model2 = assetManager.loadModel("zophrac.j3o");
    model2.setLocalScale(0.1f);
    probeNode.attachChild(model2);

    debugAppState = new ArmatureDebugAppState();
    stateManager.attach(debugAppState);

    setupModel(model2);

    flyCam.setEnabled(false);

    Node target = new Node("CamTarget");
    //target.setLocalTransform(model.getLocalTransform());
    target.move(0, 0, 0);
    ChaseCameraAppState chaseCam = new ChaseCameraAppState();
    chaseCam.setTarget(target);
    getStateManager().attach(chaseCam);
    chaseCam.setInvertHorizontalAxis(true);
    chaseCam.setInvertVerticalAxis(true);
    chaseCam.setZoomSpeed(0.5f);
    chaseCam.setMinVerticalRotation(-FastMath.HALF_PI);
    chaseCam.setRotationSpeed(3);
    chaseCam.setDefaultDistance(3);
    chaseCam.setMinDistance(0.01f);
    chaseCam.setZoomSpeed(0.01f);
    chaseCam.setDefaultVerticalRotation(0.3f);

    initInputs();
}