AttributeEditor.java | ●●●●● patch | view | raw | blame | history | |
Camera.java | ●●●●● patch | view | raw | blame | history | |
CameraPane.java | ●●●●● patch | view | raw | blame | history | |
Globals.java | ●●●●● patch | view | raw | blame | history | |
ObjEditor.java | ●●●●● patch | view | raw | blame | history | |
Object3D.java | ●●●●● patch | view | raw | blame | history |
AttributeEditor.java
.. .. @@ -41,20 +41,24 @@ 41 41 super.SetupUI2(oe); // Shows composite UI !! 42 42 //super.SetupName(oe); 43 43 44 - oe.aConstraints.weighty = 0;45 -46 - oe.aConstraints.gridwidth = 1;47 - oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;48 - oe.aConstraints.gridwidth = 1;49 - oe.aConstraints.anchor = GridBagConstraints.WEST;50 - oe.ctrlPanel.add(cleardepth = new JCheckBox("Clear Depth", attribute.cleardepth), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 2);51 - oe.aConstraints.gridx += 1;44 +// oe.aConstraints.weighty = 0;45 +//46 +// oe.aConstraints.gridwidth = 1;47 +// oe.aConstraints.fill = GridBagConstraints.HORIZONTAL;48 +// oe.aConstraints.gridwidth = 1;49 +// oe.aConstraints.anchor = GridBagConstraints.WEST;50 + oe.ctrlPanel.add(cleardepth = new JCheckBox("Clear Depth", attribute.cleardepth)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 2);51 +52 + oe.ctrlPanel.Return();53 +// oe.aConstraints.gridx += 1;52 54 // oe.ctrlPanel.add(passtest = new JCheckBox("Write depth", attribute.passtest), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 2); 53 55 // oe.aConstraints.gridx += 1; 54 - oe.ctrlPanel.add(passtest = new JCheckBox("Pass Test", attribute.passtest), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 2);55 - oe.aConstraints.gridx += 1;56 - oe.ctrlPanel.add(backfacecull = new JCheckBox("Backface Cull", attribute.backfacecull), oe.aConstraints, oe.ctrlPanel.getComponentCount() - 2);57 - oe.aConstraints.gridx += 1;56 + oe.ctrlPanel.add(passtest = new JCheckBox("Pass Test", attribute.passtest)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 2);57 + oe.ctrlPanel.Return();58 +// oe.aConstraints.gridx += 1;59 + oe.ctrlPanel.add(backfacecull = new JCheckBox("Backface Cull", attribute.backfacecull)); //, oe.aConstraints, oe.ctrlPanel.getComponentCount() - 2);60 + oe.ctrlPanel.Return();61 +// oe.aConstraints.gridx += 1;58 62 59 63 cleardepth.addItemListener(this); 60 64 passtest.addItemListener(this); Camera.java
.. .. @@ -3,7 +3,6 @@ 3 3 // Decompiler options: packimports(3) 4 4 // Source File Name: Camera.java 5 5 6 -7 6 class Camera extends Object3D 8 7 { 9 8 static final long serialVersionUID = 4754289789178680517L; CameraPane.java
.. .. @@ -150,6 +150,8 @@ 150 150 defaultcaps.setAccumAlphaBits(16); 151 151 } 152 152 153 + private File defaultDirectory = javax.swing.filechooser.FileSystemView.getFileSystemView().getDefaultDirectory();154 +153 155 void SetAsGLRenderer(boolean b) 154 156 { 155 157 isRenderer = b; .. .. @@ -462,7 +464,7 @@ 462 464 if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0) 463 465 { 464 466 //gl.glBegin(gl.GL_TRIANGLES); 465 - boolean hasnorm = pv.norm != null; // && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0);467 + boolean hasnorm = pv.norm != null && (pv.norm.x != 0 || pv.norm.y != 0 || pv.norm.z != 0);466 468 if (!hasnorm) 467 469 { 468 470 // System.out.println("FUCK!!"); .. .. @@ -2374,7 +2376,7 @@ 2374 2376 { 2375 2377 return currentGL; 2376 2378 } 2377 -2379 +2378 2380 /**/ 2379 2381 class CacheTexture 2380 2382 { .. .. @@ -8067,6 +8069,26 @@ 8067 8069 return; // true; 8068 8070 } 8069 8071 8072 + java.util.HashSet<String> missingTextures = new java.util.HashSet<String>();8073 +8074 + private boolean FileExists(String tex)8075 + {8076 + if (missingTextures.contains(tex))8077 + {8078 + return false;8079 + }8080 +8081 + boolean fileExists = new File(tex).exists();8082 +8083 + if (!fileExists)8084 + {8085 + // If file exists, the "new File()" is not executed sgain8086 + missingTextures.add(tex);8087 + }8088 +8089 + return fileExists;8090 + }8091 +8070 8092 CacheTexture GetCacheTexture(String tex, boolean bump, int resolution) throws Exception 8071 8093 { 8072 8094 CacheTexture/*com.sun.opengl.util.texture.Texture*/ texture = null; .. .. @@ -8075,15 +8097,17 @@ 8075 8097 { 8076 8098 String texname = tex; 8077 8099 8100 + String fallbackTextureName = defaultDirectory + "/Textures/" + texname;8101 +8078 8102 // String[] split = tex.split("Textures"); 8079 8103 // if (split.length > 1) 8080 8104 // texname = "/Users/nbriere/Textures" + split[split.length-1]; 8081 8105 // else 8082 8106 // if (!texname.startsWith("/")) 8083 8107 // texname = "/Users/nbriere/Textures/" + texname; 8084 - if (!new File(tex).exists())8108 + if (!FileExists(tex))8085 8109 { 8086 - texname = javax.swing.filechooser.FileSystemView.getFileSystemView().getDefaultDirectory() + "/Textures/" + texname;8110 + texname = fallbackTextureName;8087 8111 } 8088 8112 8089 8113 if (CACHETEXTURE) .. .. @@ -8153,7 +8177,7 @@ 8153 8177 } 8154 8178 8155 8179 cachename = texname.substring(0, texname.length()-4)+ext+".jpg"; 8156 - if (!new File(cachename).exists())8180 + if (!FileExists(cachename))8157 8181 cachename = texname; 8158 8182 else 8159 8183 processbump = false; // don't process bump map again .. .. @@ -8175,7 +8199,7 @@ 8175 8199 } 8176 8200 8177 8201 cachename = texname.substring(0, texname.length()-4)+ext+".png"; 8178 - if (!new File(cachename).exists())8202 + if (!FileExists(cachename))8179 8203 cachename = texname; 8180 8204 else 8181 8205 processbump = false; // don't process bump map again .. .. @@ -9310,8 +9334,8 @@ 9310 9334 assert (parentcam != renderCamera); 9311 9335 9312 9336 if (renderCamera != lightCamera) 9313 - for (int count = parentcam.GetTransformCount(); --count>=0;)9314 - LA.matConcat(matrix, parentcam.toParent, matrix);9337 + //for (int count = parentcam.GetTransformCount(); --count>=0;)9338 + LA.matConcat(matrix, parentcam.GlobalTransformInv(), matrix);9315 9339 9316 9340 // LA.matConcat(renderCamera.toScreen, renderCamera.toParent, matrix); 9317 9341 .. .. @@ -9326,8 +9350,8 @@ 9326 9350 LA.matCopy(renderCamera.fromScreen, matrix); 9327 9351 9328 9352 if (renderCamera != lightCamera) 9329 - for (int count = parentcam.GetTransformCount(); --count>=0;)9330 - LA.matConcat(parentcam.fromParent, matrix, matrix);9353 + //for (int count = parentcam.GetTransformCount(); --count>=0;)9354 + LA.matConcat(parentcam.GlobalTransform(), matrix, matrix);9331 9355 9332 9356 // LA.matConcat(renderCamera.fromParent, renderCamera.fromScreen, matrix); 9333 9357 .. .. @@ -10525,8 +10549,8 @@ 10525 10549 10526 10550 // if (parentcam != renderCamera) // not a light 10527 10551 if (cam != lightCamera) 10528 - for (int count = parentcam.GetTransformCount(); --count>=0;)10529 - LA.matConcat(matrix, parentcam.toParent, matrix);10552 + //for (int count = parentcam.GetTransformCount(); --count>=0;)10553 + LA.matConcat(matrix, parentcam.GlobalTransformInv(), matrix);10530 10554 10531 10555 for (int j = 0; j < 4; j++) 10532 10556 { .. .. @@ -10540,8 +10564,8 @@ 10540 10564 10541 10565 // if (parentcam != renderCamera) // not a light 10542 10566 if (cam != lightCamera) 10543 - for (int count = parentcam.GetTransformCount(); --count>=0;)10544 - LA.matConcat(parentcam.fromParent, matrix, matrix);10567 + //for (int count = parentcam.GetTransformCount(); --count>=0;)10568 + LA.matConcat(parentcam.GlobalTransform(), matrix, matrix);10545 10569 10546 10570 //LA.matConcat(cam.fromScreen, parentcam.fromParent, matrix); 10547 10571 .. .. @@ -10934,8 +10958,8 @@ 10934 10958 System.err.println("parentcam != renderCamera"); 10935 10959 10936 10960 // if (cam != lightCamera) 10937 - for (int count = parentcam.GetTransformCount(); --count>=0;)10938 - LA.xformDir(lightposition, parentcam.toParent, lightposition); // may 201310961 + //for (int count = parentcam.GetTransformCount(); --count>=0;)10962 + LA.xformDir(lightposition, parentcam.GlobalTransformInv(), lightposition); // may 201310939 10963 } 10940 10964 10941 10965 LA.xformDir(lightposition, cam.toScreen, lightposition); .. .. @@ -10956,8 +10980,8 @@ 10956 10980 if (true) // TODO 10957 10981 { 10958 10982 if (cam != lightCamera) 10959 - for (int count = parentcam.GetTransformCount(); --count>=0;)10960 - LA.xformDir(light0, parentcam.toParent, light0); // may 201310983 + //for (int count = parentcam.GetTransformCount(); --count>=0;)10984 + LA.xformDir(light0, parentcam.GlobalTransformInv(), light0); // may 201310961 10985 } 10962 10986 10963 10987 LA.xformPos(light0, cam.toScreen, light0); .. .. @@ -11869,8 +11893,8 @@ 11869 11893 //obj.TransformToWorld(light, light); 11870 11894 for (int i = tp.size(); --i >= 0;) 11871 11895 { 11872 - for (int count = tp.get(i).GetTransformCount(); --count>=0;)11873 - LA.xformPos(light, tp.get(i).toParent, light);11896 + //for (int count = tp.get(i).GetTransformCount(); --count>=0;)11897 + LA.xformPos(light, tp.get(i).GlobalTransformInv(), light);11874 11898 } 11875 11899 11876 11900 .. .. @@ -11887,8 +11911,8 @@ 11887 11911 parentcam = cameras[0]; 11888 11912 } 11889 11913 11890 - for (int count = parentcam.GetTransformCount(); --count>=0;)11891 - LA.xformPos(light, parentcam.toParent, light); // may 201311914 + //for (int count = parentcam.GetTransformCount(); --count>=0;)11915 + LA.xformPos(light, parentcam.GlobalTransformInv(), light); // may 201311892 11916 11893 11917 LA.xformPos(light, renderCamera.toScreen, light); 11894 11918 .. .. @@ -13812,6 +13836,7 @@ 13812 13836 //System.out.println("mouseDragged: " + e); 13813 13837 if (isRenderer) 13814 13838 movingcamera = true; 13839 +13815 13840 //if (drawing) 13816 13841 //return; 13817 13842 if ((e.getModifiersEx() & CTRL) != 0 .. .. @@ -15911,7 +15936,7 @@ 15911 15936 Object3D object; 15912 15937 static Object3D trackedobject; 15913 15938 Camera renderCamera; // Light or Eye (or Occlusion) 15914 - /*static*/ Camera manipCamera; // Light or Eye15939 + /*static*/ Camera manipCamera; // Light or Eye. Can be Light when Eye, not Eye when Light15915 15940 /*static*/ Camera eyeCamera; 15916 15941 /*static*/ Camera lightCamera; 15917 15942 int cameracount; Globals.java
.. .. @@ -7,6 +7,8 @@ 7 7 8 8 private static boolean LIVE = false; 9 9 public static boolean RENDERSHADOW = true; 10 +11 + // Hold on calculation when moving camera10 12 public static boolean FREEZEONMOVE = false; // true; 11 13 12 14 static boolean CROWD = false; ObjEditor.java
.. .. @@ -278,7 +278,7 @@ 278 278 frame.setMenuBar(menuBar = new MenuBar()); 279 279 menuBar.add(fileMenu = new Menu("File")); 280 280 fileMenu.add(newItem = new MenuItem("New")); 281 - fileMenu.add(loadItem = new MenuItem("Load..."));281 + fileMenu.add(loadItem = new MenuItem("Open..."));282 282 283 283 //oe.menuBar.add(menu = new Menu("Include")); 284 284 Menu menu = new Menu("Import"); .. .. @@ -2072,19 +2072,19 @@ 2072 2072 2073 2073 void LoadObjFile(String fullname) 2074 2074 { 2075 - /*2075 + System.out.println("Loading " + fullname);2076 + /**/2076 2077 //lastFilename = fullname; 2077 2078 if(loadObjThread == null) 2078 2079 { 2079 - loadObjThread = new LoadOBJThread();2080 - loadObjThread.start();2080 + loadObjThread = new LoadOBJThread();2081 + loadObjThread.start();2081 2082 } 2082 2083 2083 2084 loadObjThread.add(fullname); 2084 - */2085 + /**/2085 2086 2086 - System.out.println("Loading " + fullname);2087 - makeSomething(new FileObject(fullname, true), true);2087 + //makeSomething(new FileObject(fullname, true), true);2088 2088 } 2089 2089 2090 2090 void LoadGFDFile(String fullname) .. .. @@ -3214,7 +3214,7 @@ 3214 3214 objEditor.refreshContents(); 3215 3215 } 3216 3216 3217 - static public byte[] Compress(Object o)3217 + static public byte[] Compress(Object3D o)3218 3218 { 3219 3219 try 3220 3220 { .. .. @@ -3222,8 +3222,13 @@ 3222 3222 java.util.zip.GZIPOutputStream zstream = new java.util.zip.GZIPOutputStream(baos); 3223 3223 ObjectOutputStream out = new ObjectOutputStream(zstream); 3224 3224 3225 + Object3D parent = o.parent;3226 + o.parent = null;3227 +3225 3228 out.writeObject(o); 3226 3229 3230 + o.parent = parent;3231 +3227 3232 out.flush(); 3228 3233 3229 3234 zstream.close(); Object3D.java
.. .. @@ -174,7 +174,7 @@ 174 174 { 175 175 Object3D o = hashtable.get(GetUUID()); 176 176 177 - assert(this.bRep == o.bRep);177 + Grafreed.Assert(this.bRep == o.bRep);178 178 if (this.bRep != null) 179 179 assert(this.bRep.support == o.transientrep); 180 180 .. .. @@ -563,12 +563,14 @@ 563 563 toParent = LA.newMatrix(); 564 564 fromParent = LA.newMatrix(); 565 565 } 566 +566 567 if (toParentMarked == null) 567 568 { 568 569 if (maxcount != 1) 569 570 { 570 571 new Exception().printStackTrace(); 571 572 } 573 +572 574 toParentMarked = LA.newMatrix(); 573 575 fromParentMarked = LA.newMatrix(); 574 576 } .. .. @@ -5572,12 +5574,23 @@ 5572 5574 boolean NeedSupport() 5573 5575 { 5574 5576 return 5575 - CameraPane.SUPPORT && (!CameraPane.movingcamera || !Globals.FREEZEONMOVE) && link2master && /*live &&*/ support != null5577 + CameraPane.SUPPORT && (!CameraPane.movingcamera || (!Globals.FREEZEONMOVE && Globals.isLIVE())) && link2master && /*live &&*/ support != null5576 5578 // PROBLEM with CROWD!! 5577 5579 && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || Globals.CROWD); 5578 5580 } 5579 5581 5580 5582 static boolean DEBUG_SELECTION = false; 5583 +5584 + boolean IsLive()5585 + {5586 + if (live)5587 + return true;5588 +5589 + if (parent == null)5590 + return false;5591 +5592 + return parent.IsLive();5593 + }5581 5594 5582 5595 void Draw(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) 5583 5596 { .. .. @@ -5640,7 +5653,7 @@ 5640 5653 support = support; 5641 5654 5642 5655 //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch); 5643 - boolean usecalllists = false; // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);5656 + boolean usecalllists = IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);5644 5657 5645 5658 if (!usecalllists && bRep != null && bRep.displaylist > 0) 5646 5659 {