jMonkeyEngine quick loading of 3D models

jMonkeyEngine Logo

Creating visualizations, games or other types of animation will meet with the need to load some kind of 3D models. It is no different in the case of an engine jMonkeyEngine, however, is a question as soon as possible to read such models? It is best to use the format provided by JME. Such a change of format will save a considerable amount of time needed to parse loaded models. Following is the code by which the model loaded in the format .obj, we now export to .dat:


URL model = Court.class.getClassLoader().getResource(
 "model/Court.obj");
 Spatial courtNode = null;
 try {
 FormatConverter converter = new ObjToJme();
 converter.setProperty("mtllib", model);
 ByteArrayOutputStream BO = new ByteArrayOutputStream();
 converter.convert(model.openStream(), BO);
 courtNode = (Spatial)BinaryImporter.getInstance().load(new ByteArrayInputStream(BO
 .toByteArray()));
 } catch (IOException e) { // Just in case anything happens
 logger.logp(Level.SEVERE, this.getClass().toString(),
 "simpleInitGame()", "Exception", e);
 System.exit(0);
 }

Memorized object we can now export:

export(courtNode,"model/Court");</pre>

Related prepared model:


courtNode = open("model/Court");
Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
  • MySpace
  • PDF

Related Posts

  1. No comments yet.

  1. No trackbacks yet.

*

Founder:

Zobacz sprawdzone|Zobacz} pozycjonowanie stron łódź na {seowlodzi.pl|!}Interesują Ciebie tanie i niezawodne zamienniki tuszy / tuszów HP, czy oryginalny tusz HP w najlepszej cenie Tusze do HP DeskJet F350 Sklep 2w2.pl Warszawa tania szybka dostawapłyty warstwowe płyty warstwowe płyty warstwowe