Java Code Examples for com.jme3.asset.AssetManager#registerLoader()

The following examples show how to use com.jme3.asset.AssetManager#registerLoader() . 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: TestAbsoluteLocators.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public static void main(String[] args){
    AssetManager am = JmeSystem.newAssetManager();

    am.registerLoader(AWTLoader.class, "jpg");
    am.registerLoader(WAVLoader.class, "wav");

    // register absolute locator
    am.registerLocator("/",  ClasspathLocator.class);

    // find a sound
    AudioData audio = am.loadAudio("Sound/Effects/Gun.wav");

    // find a texture
    Texture tex = am.loadTexture("Textures/Terrain/Pond/Pond.jpg");

    if (audio == null)
        throw new RuntimeException("Cannot find audio!");
    else
        System.out.println("Audio loaded from Sounds/Effects/Gun.wav");

    if (tex == null)
        throw new RuntimeException("Cannot find texture!");
    else
        System.out.println("Texture loaded from Textures/Terrain/Pond/Pond.jpg");

    System.out.println("Success!");
}
 
Example 2
Source File: TestAbsoluteLocators.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static void main(String[] args){
    AssetManager am = new DesktopAssetManager();

    am.registerLoader(AWTLoader.class.getName(), "jpg");
    am.registerLoader(WAVLoader.class.getName(), "wav");

    // register absolute locator
    am.registerLocator("/",  ClasspathLocator.class.getName());

    // find a sound
    AudioData audio = am.loadAudio("Sound/Effects/Gun.wav");

    // find a texture
    Texture tex = am.loadTexture("Textures/Terrain/Pond/Pond.jpg");

    if (audio == null)
        throw new RuntimeException("Cannot find audio!");
    else
        System.out.println("Audio loaded from Sounds/Effects/Gun.wav");

    if (tex == null)
        throw new RuntimeException("Cannot find texture!");
    else
        System.out.println("Texture loaded from Textures/Terrain/Pond/Pond.jpg");

    System.out.println("Success!");
}
 
Example 3
Source File: TestCustomLoader.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public static void main(String[] args){
    AssetManager assetManager = JmeSystem.newAssetManager();
    assetManager.registerLocator("/", ClasspathLocator.class);
    assetManager.registerLoader(TextLoader.class, "fnt");
    System.out.println(assetManager.loadAsset("Interface/Fonts/Console.fnt"));
}
 
Example 4
Source File: BlenderAssetManagerConfigurator.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void prepareManager(AssetManager manager) {
    manager.registerLoader(com.jme3.scene.plugins.blender.BlenderModelLoader.class, "blend");
}