Main Menu

Google SketchUp 6

Started by Melssj5, September 30, 2008, 04:17:42 PM

Previous topic - Next topic

Melssj5

Hey, check this out. It seems to be quite easy to draw buildings for games and can export to 3ds and other formats in the payed version.

http://sketchup.google.com/
Nada por ahora

EgonOlsen

Caligari Truespace is now free, too. (http://www.caligari.com/) However, i've no idea if it's good or not. But it's Microsoft's counterpart to Sketchup, i thought it was worth mentioning it here.

paulscode

A while back, I came up with a way to get sketchup models into 3ds from the free version.  Check out the previous thread:

http://www.jpct.net/forum2/index.php/topic,1086.0.html

Achim

What about the other way around? I am looking for a way to export jpct objects into a standard 3D file format, like Collada, 3ds, or skp. Has this been requested before?

EgonOlsen

#4
No, never. I think i have written something in the past to export jPCT data into ASC-format. I'll try to find that code...

Edit: This is the method i was using to export an Object3D to ASC. It doesn't store texture coords, but that's not to hard to add. They can be obtained from the PolygonManager as well and are part of the vertex list, i.e. instead of X:... Y:... Z:.... you would write: X:... Y:... Z:.... U:.... V:....


private void write(String dir, String name, Object3D  obj) {

      List vertices=new ArrayList();
      List polys=new ArrayList();

      PolygonManager pm=obj.getPolygonManager();
      int max=pm.getMaxPolygonID();

      //System.out.println(max);

      for (int i=0; i<max; i++) {
         SimpleVector[] p=new SimpleVector[3];
         for (int pp=0; pp<3; pp++) {
            p[pp]=pm.getTransformedVertex(i, pp);
         }

         int[] vnum=new int[3];
         for (int pp=0; pp<3; pp++) {
            int pos=vertices.indexOf(p[pp]);
            if (pos==-1) {
               vertices.add(p[pp]);
               pos=vertices.size()-1;
            }
            vnum[pp]=pos;
         }
         polys.add(vnum);
      }
      try {
         File f=new File(dir);
         f.mkdirs();

         System.out.println("Writing to disk: "+name);
         OutputStream os=new FileOutputStream(dir+File.separatorChar+name);
         PrintWriter pw=new PrintWriter(os);

         pw.println("Named object: \""+name+"\"");
         pw.println("Tri-mesh, Vertices: "+vertices.size()+" Faces: "+polys.size()+"");
         pw.println("Vertex List:");

         for (int i=0; i<vertices.size(); i++) {
            SimpleVector v=(SimpleVector) vertices.get(i);
            pw.println("Vertex "+i+": X:"+v.x+"  Y:"+v.y+"  Z:"+v.z);
         }

         pw.println("Face list:");

         for (int i=0; i<polys.size(); i++) {
            int[] ps=(int[]) polys.get(i);
            pw.println("Face "+i+":  A:"+ps[0]+"  B:"+ps[1]+"  C:"+ps[2]+"  AB:1  BC:1  CA:1");
         }
         pw.close();
         os.close();
      } catch(Exception e) {
         e.printStackTrace(); // Who cares?
      }
   }


Does this help?