Normand Briere
2019-08-13 0cdf3fb57ddea3226f094ba45c836c7e9b123e3a
No background
6 files modified
105 ■■■■■ changed files
BoundaryRep.java 24 ●●●●● patch | view | raw | blame | history
CameraPane.java 21 ●●●●● patch | view | raw | blame | history
Globals.java 1 ●●●● patch | view | raw | blame | history
Grafreed.java 2 ●●●●● patch | view | raw | blame | history
GroupEditor.java 43 ●●●● patch | view | raw | blame | history
ObjEditor.java 14 ●●●●● patch | view | raw | blame | history
BoundaryRep.java
....@@ -4022,8 +4022,6 @@
40224022 //System.out.println("NEW = " + positions.length);
40234023 uvmap = new float[ta.getVertexCount() * 2];
40244024
4025
- colors = new float[ta.getVertexCount()]; // * 3];
4026
-
40274025 ta.getCoordinates(0, positions);
40284026 ta.getNormals(0, normals);
40294027 // ta.getColors(0, colors);
....@@ -4031,6 +4029,14 @@
40314029
40324030 System.out.println("UV = " + uvmap[2] + ", " + uvmap[3] + ";");
40334031
4032
+ colors = null;
4033
+// colors = new float[ta.getVertexCount()]; // * 3];
4034
+//
4035
+// for (int i=colors.length; --i>=0;)
4036
+// {
4037
+// colors[i] = 1;
4038
+// }
4039
+
40344040 triangles = new int[ta.getVertexCount()];
40354041
40364042 for (int i = 0; i < triangles.length; i++)
....@@ -4068,17 +4074,18 @@
40684074 positions = new float[3 * ga.getVertexCount()];
40694075 normals = new float[3 * ga.getVertexCount()];
40704076 uvmap = new float[2 * ga.getVertexCount()];
4071
- colors = new float[1 * ga.getVertexCount()];
40724077
40734078 tsa.getCoordinates(0, positions);
40744079 tsa.getNormals(0, normals);
40754080 tsa.getTextureCoordinates(0, 0, uvmap);
40764081 // tsa.getColors(0, colors);
4077
-
4078
- for (int i=colors.length; --i>=0;)
4079
- {
4080
- colors[i] = 1;
4081
- }
4082
+
4083
+ colors = null;
4084
+// colors = new float[1 * ga.getVertexCount()];
4085
+// for (int i=colors.length; --i>=0;)
4086
+// {
4087
+// colors[i] = 1;
4088
+// }
40824089
40834090 int stripcount = tsa.getNumStrips();
40844091 triangles = new int[stripcount];
....@@ -4087,6 +4094,7 @@
40874094 stripified = true;
40884095 } catch (ClassCastException e)
40894096 {
4097
+ // ??? aug 2019
40904098 TriangleArray ta = (TriangleArray) ga;
40914099
40924100 positions = new float[3 * ga.getVertexCount()];
CameraPane.java
....@@ -173,7 +173,7 @@
173173 static boolean doublesided = false; // true; // reversed normals are awful for conformance
174174 boolean anisotropy = true;
175175 boolean softshadow = true; // slower but better false;
176
- boolean opacityhalo = false;
176
+ boolean opacityhalo = false; // reverse the halo effect (e.g. glass)
177177
178178 boolean macromode = false;
179179
....@@ -17533,10 +17533,14 @@
1753317533 gl.glFlush();
1753417534
1753517535 /**/
17536
- gl.glReadPixels(0, 0, OCCLUSION_SIZE, OCCLUSION_SIZE, GL.GL_DEPTH_COMPONENT, GL.GL_FLOAT, occlusionsizebuffer);
17536
+ gl.glReadPixels(0, 0, OCCLUSION_SIZE, OCCLUSION_SIZE, GL.GL_DEPTH_COMPONENT, GL.GL_FLOAT, occlusiondepthbuffer);
1753717537
17538
- float[] pixels = occlusionsizebuffer.array();
17538
+ float[] depths = occlusiondepthbuffer.array();
1753917539
17540
+ gl.glReadPixels(0, 0, OCCLUSION_SIZE, OCCLUSION_SIZE, GL.GL_BGRA, GL.GL_UNSIGNED_INT_8_8_8_8_REV, occlusioncolorbuffer);
17541
+
17542
+ int[] pixels = selectsizebuffer.array();
17543
+
1754017544 double r = 0, g = 0, b = 0;
1754117545
1754217546 double count = 0;
....@@ -17547,7 +17551,7 @@
1754717551
1754817552 double FACTOR = 1;
1754917553
17550
- for (int i = 0; i < pixels.length; i++)
17554
+ for (int i = 0; i < depths.length; i++)
1755117555 {
1755217556 int x = i / OCCLUSION_SIZE - OCCLUSION_SIZE / 2;
1755317557 int y = i % OCCLUSION_SIZE - OCCLUSION_SIZE / 2;
....@@ -17630,7 +17634,7 @@
1763017634
1763117635 double scale = ray.z; // 1; // cos
1763217636
17633
- float depth = pixels[newindex];
17637
+ float depth = depths[newindex];
1763417638
1763517639 /*
1763617640 int newindex2 = (x + 1) * OCCLUSION_SIZE + y;
....@@ -17827,11 +17831,14 @@
1782717831 static IntBuffer AAbuffer; // = IntBuffer.allocate(MAX_SIZE*MAX_SIZE);
1782817832 static IntBuffer bigAAbuffer;
1782917833 static java.nio.FloatBuffer histogram = BufferUtil.newFloatBuffer(HISTOGRAM_SIZE * 3);
17830
- static IntBuffer texturesizebuffer = IntBuffer.allocate(TEX_SIZE * TEX_SIZE);
17834
+ //static IntBuffer texturesizebuffer = IntBuffer.allocate(TEX_SIZE * TEX_SIZE);
1783117835 static IntBuffer selectsizebuffer = IntBuffer.allocate(SELECT_SIZE * SELECT_SIZE);
1783217836 static java.nio.FloatBuffer pointselectsizebuffer = java.nio.FloatBuffer.allocate(SELECT_SIZE * SELECT_SIZE);
1783317837 //static IntBuffer occlusionsizebuffer = IntBuffer.allocate(OCCLUSION_SIZE * OCCLUSION_SIZE);
17834
- static java.nio.FloatBuffer occlusionsizebuffer = java.nio.FloatBuffer.allocate(OCCLUSION_SIZE * OCCLUSION_SIZE);
17838
+ static java.nio.FloatBuffer occlusiondepthbuffer = java.nio.FloatBuffer.allocate(OCCLUSION_SIZE * OCCLUSION_SIZE);
17839
+
17840
+ static IntBuffer occlusioncolorbuffer = IntBuffer.allocate(OCCLUSION_SIZE * OCCLUSION_SIZE);
17841
+
1783517842 static BufferedImage bufimage = new BufferedImage(TEX_SIZE, TEX_SIZE, BufferedImage.TYPE_INT_RGB);
1783617843 static BufferedImage textest = new cBufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB);
1783717844 static java.util.Vector<BufferedImage> billboards = new java.util.Vector<BufferedImage>();
Globals.java
....@@ -1,6 +1,7 @@
11
22 public class Globals
33 {
4
+ public static boolean TOOLTIPS = false;
45 public static boolean ADVANCED = false;
56 public static boolean DEBUG = false;
67
Grafreed.java
....@@ -935,6 +935,8 @@
935935 //mon.stop();
936936 //System.out.println(mon);
937937 //timeflow.app.TimeflowAppLauncher.GetTimeFlow();
938
+
939
+ javax.swing.ToolTipManager.sharedInstance().setEnabled(Globals.TOOLTIPS);
938940 }
939941
940942 static Object3D materials;
GroupEditor.java
....@@ -31,7 +31,7 @@
3131 final String path = "cubemaps/" + f + "-skyboxes/" + s;
3232 row.add(skyboxButton = GetButton(path + "/preview.jpg", !Grafreed.NIMBUSLAF));
3333 //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF));
34
- skyboxButton.setToolTipText(s);
34
+ skyboxButton.setToolTipText(s.equals("") ? "No background" : s);
3535 skyboxButton.addActionListener(new ActionListener()
3636 {
3737 @Override
....@@ -73,7 +73,7 @@
7373 cGridBag row5 = new cGridBag();
7474 cGridBag row6 = new cGridBag();
7575
76
- AddSkyboxButton("default", "rgb", row0);
76
+ AddSkyboxButton("default", "", row0);
7777 //AddSkyboxButton("default", "cornell", row0);
7878 AddSkyboxButton("penguins", "dust", row0);
7979 AddSkyboxButton("penguins", "tropic", row0);
....@@ -330,10 +330,19 @@
330330
331331 public void ChangeSkybox(String skybox)
332332 {
333
- //cameraView.envyoff = false;
334
- group.skyboxname = skybox;
335
- group.skyboxext = "jpg";
336
- cameraView.repaint();
333
+ if (skybox.endsWith("/"))
334
+ {
335
+ group.skyboxname = null;
336
+ group.skyboxext = null;
337
+ cameraView.repaint();
338
+ }
339
+ else
340
+ {
341
+ //cameraView.envyoff = false;
342
+ group.skyboxname = skybox;
343
+ group.skyboxext = "jpg";
344
+ cameraView.repaint();
345
+ }
337346 }
338347
339348 public void CreateSkyboxPanel(cGridBag skyboxPanel)
....@@ -1459,11 +1468,11 @@
14591468 {
14601469 assert(obj instanceof Composite);
14611470
1462
- if (obj.versionlist == null)
1463
- {
1464
- obj.versionlist = new Object3D[100];
1465
- obj.versionindex = -1;
1466
- }
1471
+// if (obj.versionlist == null)
1472
+// {
1473
+// obj.versionlist = new Object3D[100];
1474
+// obj.versionindex = -1;
1475
+// }
14671476
14681477 cRadio radioButton = new cRadio(obj.name);
14691478
....@@ -4067,7 +4076,17 @@
40674076 */
40684077 radio.layout.doClick();
40694078
4070
- SetUndoStates();
4079
+ assert(copy instanceof Composite);
4080
+
4081
+ if (copy.versionlist == null)
4082
+ {
4083
+ copy.versionlist = new Object3D[100];
4084
+ copy.versionindex = -1;
4085
+
4086
+ Save(true);
4087
+ }
4088
+
4089
+ SetVersionStates();
40714090
40724091 ClearUnpinned();
40734092
ObjEditor.java
....@@ -4129,7 +4129,7 @@
41294129 {
41304130 //Save(true);
41314131 Replace();
4132
- SetUndoStates();
4132
+ SetVersionStates();
41334133 }
41344134
41354135 private boolean Equal(byte[] compress, byte[] name)
....@@ -4159,7 +4159,7 @@
41594159
41604160 CopyChanged();
41614161
4162
- SetUndoStates();
4162
+ SetVersionStates();
41634163 }
41644164
41654165 public boolean Save(boolean user)
....@@ -4205,7 +4205,7 @@
42054205 // copy.versionlist[i] = null;
42064206 // }
42074207
4208
- SetUndoStates();
4208
+ SetVersionStates();
42094209
42104210 // test save
42114211 if (false)
....@@ -4265,7 +4265,7 @@
42654265 {
42664266 Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]);
42674267
4268
- SetUndoStates();
4268
+ SetVersionStates();
42694269
42704270 boolean temp = CameraPane.SWITCH;
42714271 CameraPane.SWITCH = false;
....@@ -4332,7 +4332,7 @@
43324332 return count;
43334333 }
43344334
4335
- void SetUndoStates()
4335
+ void SetVersionStates()
43364336 {
43374337 //if (true)
43384338 // return;
....@@ -5111,7 +5111,7 @@
51115111 }
51125112
51135113 if (previousVersionButton != null && copy.versionlist != null)
5114
- SetUndoStates();
5114
+ SetVersionStates();
51155115 }
51165116
51175117 static TweenManager tweenManager = new TweenManager();
....@@ -5596,6 +5596,8 @@
55965596
55975597 void save()
55985598 {
5599
+ Replace();
5600
+
55995601 if (lastname == null)
56005602 {
56015603 return;