Java Code Examples for com.jme3.asset.AssetInfo#getManager()
The following examples show how to use
com.jme3.asset.AssetInfo#getManager() .
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: PMDLoaderGLSLSkinning2.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
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; }
Example 2
Source File: PMDLoaderGLSLSkinning2.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
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; }
Example 3
Source File: J3MLoader.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
public Object load(AssetInfo info) throws IOException { this.owner = info.getManager(); InputStream in = info.openStream(); try { key = info.getKey(); loadFromRoot(BlockLanguageParser.parse(in)); } finally { if (in != null){ in.close(); } } if (material != null){ if (!(info.getKey() instanceof MaterialKey)){ throw new IOException("Material instances must be loaded via MaterialKey"); } // material implementation return material; }else{ // material definition return materialDef; } }
Example 4
Source File: GLSLLoader.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
/** * * @param owner * @param in * @param extension * @param key * @return * @throws java.io.IOException */ public Object load(AssetInfo info) throws IOException { // The input stream provided is for the vertex shader, // to retrieve the fragment shader, use the content manager this.owner = info.getManager(); if (info.getKey().getExtension().equals("glsllib")){ // NOTE: Loopback, GLSLLIB is loaded by this loader // and needs data as InputStream return info.openStream(); }else{ // GLSLLoader wants result as String for // fragment shader DependencyNode rootNode = loadNode(info.openStream(), "[main]"); String code = resolveDependencies(rootNode); dependCache.clear(); return code; } }
Example 5
Source File: SceneLoader.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
@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; }
Example 6
Source File: XMLImporter.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public Object load(AssetInfo info) throws IOException { assetManager = info.getManager(); InputStream in = info.openStream(); try { return load(in); } finally { if (in != null) in.close(); } }
Example 7
Source File: XMLImporter.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
public Object load(AssetInfo info) throws IOException{ assetManager = info.getManager(); InputStream in = info.openStream(); Savable obj = load(in); in.close(); return obj; }
Example 8
Source File: SkeletonLoader.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
public Object load(AssetInfo info) throws IOException { assetManager = info.getManager(); InputStream in = null; try { in = info.openStream(); return load(in); } finally { if (in != null){ in.close(); } } }
Example 9
Source File: MTLLoader.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
@SuppressWarnings("empty-statement") public Object load(AssetInfo info) throws IOException{ reset(); this.assetManager = info.getManager(); folderName = info.getKey().getFolder(); matList = new MaterialList(); InputStream in = null; try { in = info.openStream(); scan = new Scanner(in); scan.useLocale(Locale.US); while (readLine()); } finally { if (in != null){ in.close(); } } if (matName != null){ // still have a material in the vars createMaterial(); resetMaterial(); } MaterialList list = matList; return list; }
Example 10
Source File: FbxLoader.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public Object load(AssetInfo assetInfo) throws IOException { this.assetManager = assetInfo.getManager(); AssetKey<?> assetKey = assetInfo.getKey(); if (!(assetKey instanceof ModelKey)) { throw new AssetLoadException("Invalid asset key"); } InputStream stream = assetInfo.openStream(); 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()); } reset(); // Load the data from the stream. loadData(stream); // Bind poses are needed to compute world transforms. applyBindPoses(); // Need world transforms for skeleton creation. updateWorldTransforms(); // Need skeletons for meshs to be created in scene graph construction. // Mesh bone indices require skeletons to determine bone index. constructSkeletons(); // Create the jME3 scene graph from the FBX scene graph. // Also creates SkeletonControls based on the constructed skeletons. Spatial scene = constructSceneGraph(); // Load animations into AnimControls constructAnimations(); return scene; } finally { releaseObjects(); if (stream != null) { stream.close(); } } }