Package mri.v3ds

Examples of mri.v3ds.Scene3ds


    //TODO implement
    if (textureCache != null)
      textureCache.clear();
    textureCache = new WeakHashMap<String, PImage>();
   
    Scene3ds scene = null;
   
    try{
      TextDecode3ds decode = new TextDecode3ds();
//      int level = Scene3ds.DECODE_USED_PARAMS_AND_CHUNKS; //Scene3ds.DECODE_ALL; DECODE_USED_PARAMS, DECODE_USED_PARAMS_AND_CHUNKS
      int level = Scene3ds.DECODE_ALL;

      //LOAD all meshes from file into scene object
      File file = new File(pathToModel);
      if (file.exists()){
        scene = new Scene3ds(file, decode, level );
      }else{
        InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(pathToModel);
        if (in == null){
          in = pa.getClass().getResourceAsStream(pathToModel);
        }
        if (in != null){
          scene = new Scene3ds(in, decode, level );
        }else{
          throw new FileNotFoundException("File not found: " + file.getAbsolutePath());
        }
      }
       
     
      if (debug)
        logger.debug("\n-> Loading model: " + file.getName() + " <-");
     

      if (debug){
        //Go through all MATERIALS
        logger.debug("\nNum Scene Materials: " + scene.materials() );
        for( int m=0; m < scene.materials(); m++ ){
          Material3ds mat = scene.material( m );
          logger.debug("  Material " + m + ": \" " + mat.name() + "\"");
        }
        logger.debug("");
      }


      ///////// Go through all MESHES //////////////////////////
      for( int i=0; i<scene.meshes(); i++ ) {
        Mesh3ds m = scene.mesh( i );
       
        if (debug){
          int texMapType = m.texMapType();
          logger.debug("Texture coordinates provided: " + m.texCoords());
          logger.debug("Texture mapping type: " + texMapType);
          logger.debug("Mesh:" + m.name() + " Pivot:" + m.pivot());
        }
       
        /*
        XYZTrack3ds pos     = m.positionTrack();
        RotationTrack3ds rot   = m.rotationTrack();
        XYZTrack3ds sc       = m.scaleTrack();
        //FIXME .track and key(i) werden nicht zur verf�gung gestellt?!? aber in javadoc
        */
       
        if (debug){
          logger.debug("->Processing mesh: "   + i + " of " + scene.meshes() + " Name: \"" + m.name() + "\"");
          logger.debug("  Num Faces: "       + m.faces());
          logger.debug("  Num Vertices: "     + m.vertices());
          logger.debug("  Num TextureCoordinates: " + m.texCoords());
          logger.debug("");
        }
View Full Code Here

TOP

Related Classes of mri.v3ds.Scene3ds

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.