com.jme3.asset.plugins.FileLocator Java Examples

The following examples show how to use com.jme3.asset.plugins.FileLocator. 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: TestIssue970.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void simpleInitApp() {
    assetManager.registerLocator(".", FileLocator.class);

    CollisionShape shape = new SphereCollisionShape(1f);
    RigidBodyControl rbc = new RigidBodyControl(shape, 1f);
    setParameters(rbc);
    verifyParameters(rbc);
    RigidBodyControl rbcCopy = (RigidBodyControl) saveThenLoad(rbc);
    verifyParameters(rbcCopy);

    stop();
}
 
Example #2
Source File: ShaderCheck.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private static void initAssetManager(){
    assetManager = JmeSystem.newAssetManager();
    assetManager.registerLocator(".", FileLocator.class);
    assetManager.registerLocator("/", ClasspathLocator.class);
    assetManager.registerLoader(J3MLoader.class, "j3m");
    assetManager.registerLoader(J3MLoader.class, "j3md");
    assetManager.registerLoader(GLSLLoader.class, "vert", "frag","geom","tsctrl","tseval","glsllib","glsl");
}
 
Example #3
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 #4
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();
}
 
Example #5
Source File: MaterialManager.java    From OpenRTS with MIT License 4 votes vote down vote up
private static void initBaseMaterials() {
	ColorRGBA lotColorBase = new ColorRGBA(200f / 255f, 200f / 255f, 200f / 255f, 255f / 255f);
	ColorRGBA concreteColor = new ColorRGBA(90f / 255f, 100f / 255f, 255f / 255f, 255f / 255f);
	ColorRGBA redConcreteColor = ColorRGBA.Red;
	ColorRGBA blueConcreteColor = ColorRGBA.Blue;
	ColorRGBA yellowConcreteColor = ColorRGBA.Yellow;
	ColorRGBA cyanConcreteColor = new ColorRGBA(0, 1, 1, 0.4f);
	ColorRGBA blackConcreteColor = ColorRGBA.Black;
	ColorRGBA greenConcreteColor = ColorRGBA.Green;
	ColorRGBA floorColor = ColorRGBA.Gray;
	ColorRGBA windowsColor = ColorRGBA.White;
	ColorRGBA itemColor = ColorRGBA.LightGray;
	ColorRGBA roadsColor = ColorRGBA.LightGray;
	ColorRGBA terrainColor = new ColorRGBA(0f / 255f, 50f / 255f, 14f / 255f, 255f / 255f);

	am.registerLocator("assets/", FileLocator.class);

	contourMaterial = new Material(am, "Common/MatDefs/Misc/Unshaded.j3md");
	contourMaterial.setColor("Color", blackConcreteColor);

	blockContourMaterial = new Material(am, "Common/MatDefs/Misc/Unshaded.j3md");
	blockContourMaterial.setColor("Color", redConcreteColor);

	lotContourMaterial = new Material(am, "Common/MatDefs/Misc/Unshaded.j3md");
	lotContourMaterial.setColor("Color", blueConcreteColor);

	lotMaterial1 = new Material(am, "Common/MatDefs/Misc/Unshaded.j3md");
	lotMaterial1.setColor("Color", lotColorBase);

	lotMaterial2 = new Material(am, "Common/MatDefs/Misc/Unshaded.j3md");
	lotMaterial2.setColor("Color", lotColorBase);

	lotMaterial3 = new Material(am, "Common/MatDefs/Misc/Unshaded.j3md");
	lotMaterial3.setColor("Color", lotColorBase);

	// debug material
	debugMaterial = new Material(am, "Common/MatDefs/Misc/Unshaded.j3md");
	debugMaterial.setColor("Color", redConcreteColor);
	// debug texture material
	// debugTextureMaterial = new Material(assetManager, "Common/MatDefs/Misc/SimpleTextured.j3md");
	// debugTextureMaterial = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
	// debugTextureMaterial.setTexture("DiffuseMap", assetManager.loadTexture("Textures/UVTest.jpg"));
	// debugTextureMaterial.setFloat("Shininess", 128f); // [0,128]

	// Red Material
	redMaterial = new Material(am, "Common/MatDefs/Misc/Unshaded.j3md");
	redMaterial.setColor("Color", redConcreteColor);
	redMaterial.setColor("GlowColor", redConcreteColor);

	// Concrete Material
	yellowMaterial = new Material(am, "Common/MatDefs/Misc/Unshaded.j3md");
	yellowMaterial.setColor("Color", yellowConcreteColor);

	// Concrete Material
	cyanMaterial = new Material(am, "Common/MatDefs/Misc/Unshaded.j3md");
	cyanMaterial.setColor("Color", cyanConcreteColor);
	cyanMaterial.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);

	// Concrete Material
	blackMaterial = new Material(am, "Common/MatDefs/Misc/Unshaded.j3md");
	blackMaterial.setColor("Color", blackConcreteColor);

	// Concrete Material
	greenMaterial = new Material(am, "Common/MatDefs/Misc/Unshaded.j3md");
	greenMaterial.setColor("Color", greenConcreteColor);
	greenMaterial.setColor("GlowColor", greenConcreteColor);

	// Item Material
	itemMaterial = new Material(am, "Common/MatDefs/Light/Lighting.j3md");
	itemMaterial.setColor("Diffuse", itemColor);
	itemMaterial.setBoolean("UseMaterialColors", true);

	// gradient blue
	for (int i = 0; i < 4; i++) {
		gradientMaterial.add(new Material(am, "Common/MatDefs/Misc/Unshaded.j3md"));
		gradientMaterial.get(i).setColor("Color", new ColorRGBA(i * 30 / 255f, i * 30 / 255f, i * 85 / 255f, 1));
	}
}