private void startSkeleton(String name) { AssetKey assetKey = new AssetKey(folderName + name + ".xml"); try { animData = (AnimData) assetManager.loadAsset(assetKey); } catch (AssetNotFoundException ex) { logger.log(Level.WARNING, "Cannot locate {0} for model {1}", new Object[]{assetKey, key}); animData = null; } }
@Override public Object load(AssetInfo assetInfo) throws IOException { this.currentAssetInfo = assetInfo; this.assetManager = assetInfo.getManager(); AssetKey<?> assetKey = assetInfo.getKey(); if(assetKey instanceof SceneKey) animList = ((SceneKey) assetKey).getAnimations(); InputStream stream = assetInfo.openStream(); final Node sceneNode = this.sceneNode = new Node(sceneName + "-scene"); try { sceneFilename = assetKey.getName(); sceneFolderName = assetKey.getFolder(); String ext = assetKey.getExtension(); sceneName = sceneFilename.substring(0, sceneFilename.length() - ext.length() - 1); if(sceneFolderName != null && sceneFolderName.length() > 0) sceneName = sceneName.substring(sceneFolderName.length()); loadScene(stream); linkScene(); if(warnings.size() > 0) logger.log(Level.WARNING, "Model load finished with warnings:\n" + join(warnings, "\n")); } finally { releaseObjects(); if(stream != null) stream.close(); } return sceneNode; }
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final AudioKey other = (AudioKey) obj; if (!super.equals(other)) { return false; } if (this.stream != other.stream) { return false; } if (this.streamCache != other.streamCache) { return false; } return true; }
public AssetKey(String name){ this.name = reducePath(name); this.extension = getExtension(this.name); }
/** * Returns the asset key name of the asset from which this material was loaded. * * <p>This value will be <code>null</code> unless this material was loaded * from a .j3m file. * * @return Asset key name of the j3m file */ public String getAssetName() { return key != null ? key.getName() : null; }
/** * Returns the AssetLoader registered for the given extension * of the current thread. * @return AssetLoader registered with addLoader. */ public AssetLoader aquireLoader(AssetKey key){ // No need to synchronize() against map, its concurrent ImplThreadLocal local = extensionToLoaderMap.get(key.getExtension()); if (local == null){ throw new AssetLoadException("No loader registered for type \"" + key.getExtension() + "\""); } return (AssetLoader) local.get(); }
MaterialDef def = (MaterialDef) assetManager.loadAsset(new AssetKey(extendedMat)); if (def == null) { throw new MatParseException("Extended material " + extendedMat + " cannot be found.", materialStat); materialDef.setAssetName(key.getName()); }else{ throw new MatParseException("Cannot use colon in material name/path", materialStat);
/** * @return The folder in which the asset is located in. * E.g. if the {@link #getName() name} is "Models/MyModel/MyModel.j3o" * then "Models/MyModel/" is returned. */ public String getFolder(){ if (folder == null) folder = getFolder(name); return folder; }
private Object load3(AssetInfo ai) throws IOException { this.assetManager = ai.getManager(); folderName = ai.getKey().getFolder(); InputStream is = ai.openStream(); meshConverter = PMDFileUtil.readPMDCache1(is); is.close(); model = meshConverter.getModel(); PMDNode pmdNode = createNode(ai.getKey().getName()); // if (JmeSystem.getFullName().indexOf("Android") == -1) { // try { // String vendor = GL11.glGetString(GL11.GL_VENDOR); // if (vendor != null && vendor.toLowerCase().contains("intel")) { // pmdNode.setGlslSkinning(false); // } else { // pmdNode.setGlslSkinning(true); // } // } catch(Exception ex) { // pmdNode.setGlslSkinning(false); // } // } return pmdNode; }
@Override public int hashCode() { int hash = 7; hash = 67 * hash + (super.hashCode()); hash = 67 * hash + (this.stream ? 1 : 0); hash = 67 * hash + (this.streamCache ? 1 : 0); return hash; }
public KeyRef(AssetKey originalKey, ReferenceQueue<AssetKey> refQueue) { super(originalKey, refQueue); clonedKey = originalKey.clone(); } }
public AssetInfo locate(AssetManager manager, AssetKey key){ final ZipEntry2 entry = entries.get(key.getName()); if (entry == null) return null; return new AssetInfo(manager, key){ @Override public InputStream openStream() { try { return HttpZipLocator.this.openStream(entry); } catch (IOException ex) { logger.log(Level.WARNING, "Error retrieving "+entry.name, ex); return null; } } }; }
/** * Loads and return a cursor file of one of the following format: .ani, .cur and .ico. * @param info The {@link AssetInfo} describing the cursor file. * @return A JmeCursor representation of the LWJGL's Cursor. * @throws IOException if the file is not found. */ public JmeCursor load(AssetInfo info) throws IOException { isIco = false; isAni = false; isCur = false; isIco = ((AssetKey) info.getKey()).getExtension().equals("ico"); if (!isIco) { isCur = ((AssetKey) info.getKey()).getExtension().equals("cur"); if (!isCur) { isAni = ((AssetKey) info.getKey()).getExtension().equals("ani"); } } if (!isAni && !isIco && !isCur) { throw new IllegalArgumentException("Cursors supported are .ico, .cur or .ani"); } InputStream in = null; try { in = info.openStream(); return loadCursor(in); } finally { if (in != null) { in.close(); } } }
public void read(JmeImporter im) throws IOException { InputCapsule ic = im.getCapsule(this); name = reducePath(ic.readString("name", null)); extension = getExtension(name); }
public Object load(AssetInfo info) throws IOException { InputStream in = null; try { in = info.openStream(); BitmapFont font = load(info.getManager(), info.getKey().getFolder(), in); return font; } finally { if (in != null){ in.close(); } } }
private Object load2(AssetInfo ai) throws IOException { this.assetManager = ai.getManager(); model = new PMDModel(ai.openStream()); folderName = ai.getKey().getFolder(); meshConverter = new MeshConverter(model); meshConverter.convertMesh(); // PMNData pmdData = meshConverter.createPMNData(); // model.setVertexList(null); model.setFaceVertIndex(null); PMDNode pmdNode = createNode(ai.getKey().getName()); // if (JmeSystem.getFullName().indexOf("Android") == -1) { // try { // String vendor = GL11.glGetString(GL11.GL_VENDOR); // if (vendor != null && vendor.toLowerCase().contains("intel")) { // pmdNode.setGlslSkinning(false); // } else { // pmdNode.setGlslSkinning(true); // } // } catch(Exception ex) { // pmdNode.setGlslSkinning(false); // } // } return pmdNode; } private Object load3(AssetInfo ai) throws IOException {
@Override public int hashCode() { int hash = 5; hash = 71 * hash + (super.hashCode()); hash = 71 * hash + (this.matExts != null ? this.matExts.hashCode() : 0); return hash; }
public KeyRef(AssetKey originalKey, ReferenceQueue<AssetKey> refQueue) { super(originalKey, refQueue); clonedKey = originalKey.clone(); } }
key = info.getKey(); assetManager = info.getManager(); sceneName = key.getName(); String ext = key.getExtension(); folderName = key.getFolder(); sceneName = sceneName.substring(0, sceneName.length() - ext.length() - 1);
public Material(AssetManager contentMan, String defName) { this((MaterialDef) contentMan.loadAsset(new AssetKey(defName))); }