當前位置: 首頁>>代碼示例>>Java>>正文


Java AssetManager.locateAsset方法代碼示例

本文整理匯總了Java中com.jme3.asset.AssetManager.locateAsset方法的典型用法代碼示例。如果您正苦於以下問題:Java AssetManager.locateAsset方法的具體用法?Java AssetManager.locateAsset怎麽用?Java AssetManager.locateAsset使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.jme3.asset.AssetManager的用法示例。


在下文中一共展示了AssetManager.locateAsset方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: read

import com.jme3.asset.AssetManager; //導入方法依賴的package包/類
@Override
public void read(JmeImporter e) throws IOException {
    super.read(e);
    InputCapsule capsule = e.getCapsule(this);
    BinaryImporter importer = BinaryImporter.getInstance();
    AssetManager loaderManager = e.getAssetManager();

    assetLoaderKeys = (ArrayList<ModelKey>) capsule.readSavableArrayList("assetLoaderKeyList", new ArrayList<ModelKey>());
    for (Iterator<ModelKey> it = assetLoaderKeys.iterator(); it.hasNext();) {
        ModelKey modelKey = it.next();
        AssetInfo info = loaderManager.locateAsset(modelKey);
        Spatial child = null;
        if (info != null) {
            child = (Spatial) importer.load(info);
        }
        if (child != null) {
            child.parent = this;
            children.add(child);
            assetChildren.put(modelKey, child);
        } else {
            Logger.getLogger(this.getClass().getName()).log(Level.WARNING, "Could not load linked child spatial: {0}", modelKey.getName());
        }
    }
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:25,代碼來源:AssetLinkNode.java

示例2: MiniMap

import com.jme3.asset.AssetManager; //導入方法依賴的package包/類
public MiniMap(AssetManager assetManager, int gridSize, int scaledWidth) {
    try {
        this.gridSize = gridSize;
        setScaledWidth(scaledWidth);
        AssetInfo img = assetManager.locateAsset(new AssetKey("Interface/maparrow.png"));
        InputStream in = img.openStream();
        try {
            pointer = ImageIO.read(in);
        } finally {
            in.close();
        }
    } catch (IOException ex) {
        throw new RuntimeException(ex);
    }
}
 
開發者ID:rockfireredmoon,項目名稱:iceclient,代碼行數:16,代碼來源:MiniMap.java

示例3: main

import com.jme3.asset.AssetManager; //導入方法依賴的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


注:本文中的com.jme3.asset.AssetManager.locateAsset方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。