From 0cdf3fb57ddea3226f094ba45c836c7e9b123e3a Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Tue, 13 Aug 2019 10:33:05 -0400 Subject: [PATCH] No background --- ObjEditor.java | 14 ++++--- BoundaryRep.java | 24 ++++++++---- CameraPane.java | 21 +++++++--- Globals.java | 1 GroupEditor.java | 43 +++++++++++++++------ Grafreed.java | 2 + 6 files changed, 72 insertions(+), 33 deletions(-) diff --git a/BoundaryRep.java b/BoundaryRep.java index 79ff6fe..44b0ba9 100644 --- a/BoundaryRep.java +++ b/BoundaryRep.java @@ -4022,8 +4022,6 @@ //System.out.println("NEW = " + positions.length); uvmap = new float[ta.getVertexCount() * 2]; - colors = new float[ta.getVertexCount()]; // * 3]; - ta.getCoordinates(0, positions); ta.getNormals(0, normals); // ta.getColors(0, colors); @@ -4031,6 +4029,14 @@ System.out.println("UV = " + uvmap[2] + ", " + uvmap[3] + ";"); + colors = null; +// colors = new float[ta.getVertexCount()]; // * 3]; +// +// for (int i=colors.length; --i>=0;) +// { +// colors[i] = 1; +// } + triangles = new int[ta.getVertexCount()]; for (int i = 0; i < triangles.length; i++) @@ -4068,17 +4074,18 @@ positions = new float[3 * ga.getVertexCount()]; normals = new float[3 * ga.getVertexCount()]; uvmap = new float[2 * ga.getVertexCount()]; - colors = new float[1 * ga.getVertexCount()]; tsa.getCoordinates(0, positions); tsa.getNormals(0, normals); tsa.getTextureCoordinates(0, 0, uvmap); // tsa.getColors(0, colors); - - for (int i=colors.length; --i>=0;) - { - colors[i] = 1; - } + + colors = null; +// colors = new float[1 * ga.getVertexCount()]; +// for (int i=colors.length; --i>=0;) +// { +// colors[i] = 1; +// } int stripcount = tsa.getNumStrips(); triangles = new int[stripcount]; @@ -4087,6 +4094,7 @@ stripified = true; } catch (ClassCastException e) { + // ??? aug 2019 TriangleArray ta = (TriangleArray) ga; positions = new float[3 * ga.getVertexCount()]; diff --git a/CameraPane.java b/CameraPane.java index 9cebb20..df28651 100644 --- a/CameraPane.java +++ b/CameraPane.java @@ -173,7 +173,7 @@ static boolean doublesided = false; // true; // reversed normals are awful for conformance boolean anisotropy = true; boolean softshadow = true; // slower but better false; - boolean opacityhalo = false; + boolean opacityhalo = false; // reverse the halo effect (e.g. glass) boolean macromode = false; @@ -17533,10 +17533,14 @@ gl.glFlush(); /**/ - gl.glReadPixels(0, 0, OCCLUSION_SIZE, OCCLUSION_SIZE, GL.GL_DEPTH_COMPONENT, GL.GL_FLOAT, occlusionsizebuffer); + gl.glReadPixels(0, 0, OCCLUSION_SIZE, OCCLUSION_SIZE, GL.GL_DEPTH_COMPONENT, GL.GL_FLOAT, occlusiondepthbuffer); - float[] pixels = occlusionsizebuffer.array(); + float[] depths = occlusiondepthbuffer.array(); + gl.glReadPixels(0, 0, OCCLUSION_SIZE, OCCLUSION_SIZE, GL.GL_BGRA, GL.GL_UNSIGNED_INT_8_8_8_8_REV, occlusioncolorbuffer); + + int[] pixels = selectsizebuffer.array(); + double r = 0, g = 0, b = 0; double count = 0; @@ -17547,7 +17551,7 @@ double FACTOR = 1; - for (int i = 0; i < pixels.length; i++) + for (int i = 0; i < depths.length; i++) { int x = i / OCCLUSION_SIZE - OCCLUSION_SIZE / 2; int y = i % OCCLUSION_SIZE - OCCLUSION_SIZE / 2; @@ -17630,7 +17634,7 @@ double scale = ray.z; // 1; // cos - float depth = pixels[newindex]; + float depth = depths[newindex]; /* int newindex2 = (x + 1) * OCCLUSION_SIZE + y; @@ -17827,11 +17831,14 @@ static IntBuffer AAbuffer; // = IntBuffer.allocate(MAX_SIZE*MAX_SIZE); static IntBuffer bigAAbuffer; static java.nio.FloatBuffer histogram = BufferUtil.newFloatBuffer(HISTOGRAM_SIZE * 3); - static IntBuffer texturesizebuffer = IntBuffer.allocate(TEX_SIZE * TEX_SIZE); + //static IntBuffer texturesizebuffer = IntBuffer.allocate(TEX_SIZE * TEX_SIZE); static IntBuffer selectsizebuffer = IntBuffer.allocate(SELECT_SIZE * SELECT_SIZE); static java.nio.FloatBuffer pointselectsizebuffer = java.nio.FloatBuffer.allocate(SELECT_SIZE * SELECT_SIZE); //static IntBuffer occlusionsizebuffer = IntBuffer.allocate(OCCLUSION_SIZE * OCCLUSION_SIZE); - static java.nio.FloatBuffer occlusionsizebuffer = java.nio.FloatBuffer.allocate(OCCLUSION_SIZE * OCCLUSION_SIZE); + static java.nio.FloatBuffer occlusiondepthbuffer = java.nio.FloatBuffer.allocate(OCCLUSION_SIZE * OCCLUSION_SIZE); + + static IntBuffer occlusioncolorbuffer = IntBuffer.allocate(OCCLUSION_SIZE * OCCLUSION_SIZE); + static BufferedImage bufimage = new BufferedImage(TEX_SIZE, TEX_SIZE, BufferedImage.TYPE_INT_RGB); static BufferedImage textest = new cBufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB); static java.util.Vector<BufferedImage> billboards = new java.util.Vector<BufferedImage>(); diff --git a/Globals.java b/Globals.java index 2d50e5c..cc0475f 100644 --- a/Globals.java +++ b/Globals.java @@ -1,6 +1,7 @@ public class Globals { + public static boolean TOOLTIPS = false; public static boolean ADVANCED = false; public static boolean DEBUG = false; diff --git a/Grafreed.java b/Grafreed.java index 1726670..8eda659 100644 --- a/Grafreed.java +++ b/Grafreed.java @@ -935,6 +935,8 @@ //mon.stop(); //System.out.println(mon); //timeflow.app.TimeflowAppLauncher.GetTimeFlow(); + + javax.swing.ToolTipManager.sharedInstance().setEnabled(Globals.TOOLTIPS); } static Object3D materials; diff --git a/GroupEditor.java b/GroupEditor.java index e09d28f..4faf49e 100644 --- a/GroupEditor.java +++ b/GroupEditor.java @@ -31,7 +31,7 @@ final String path = "cubemaps/" + f + "-skyboxes/" + s; row.add(skyboxButton = GetButton(path + "/preview.jpg", !Grafreed.NIMBUSLAF)); //row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF)); - skyboxButton.setToolTipText(s); + skyboxButton.setToolTipText(s.equals("") ? "No background" : s); skyboxButton.addActionListener(new ActionListener() { @Override @@ -73,7 +73,7 @@ cGridBag row5 = new cGridBag(); cGridBag row6 = new cGridBag(); - AddSkyboxButton("default", "rgb", row0); + AddSkyboxButton("default", "", row0); //AddSkyboxButton("default", "cornell", row0); AddSkyboxButton("penguins", "dust", row0); AddSkyboxButton("penguins", "tropic", row0); @@ -330,10 +330,19 @@ public void ChangeSkybox(String skybox) { - //cameraView.envyoff = false; - group.skyboxname = skybox; - group.skyboxext = "jpg"; - cameraView.repaint(); + if (skybox.endsWith("/")) + { + group.skyboxname = null; + group.skyboxext = null; + cameraView.repaint(); + } + else + { + //cameraView.envyoff = false; + group.skyboxname = skybox; + group.skyboxext = "jpg"; + cameraView.repaint(); + } } public void CreateSkyboxPanel(cGridBag skyboxPanel) @@ -1459,11 +1468,11 @@ { assert(obj instanceof Composite); - if (obj.versionlist == null) - { - obj.versionlist = new Object3D[100]; - obj.versionindex = -1; - } +// if (obj.versionlist == null) +// { +// obj.versionlist = new Object3D[100]; +// obj.versionindex = -1; +// } cRadio radioButton = new cRadio(obj.name); @@ -4067,7 +4076,17 @@ */ radio.layout.doClick(); - SetUndoStates(); + assert(copy instanceof Composite); + + if (copy.versionlist == null) + { + copy.versionlist = new Object3D[100]; + copy.versionindex = -1; + + Save(true); + } + + SetVersionStates(); ClearUnpinned(); diff --git a/ObjEditor.java b/ObjEditor.java index 35727f1..c2908ed 100644 --- a/ObjEditor.java +++ b/ObjEditor.java @@ -4129,7 +4129,7 @@ { //Save(true); Replace(); - SetUndoStates(); + SetVersionStates(); } private boolean Equal(byte[] compress, byte[] name) @@ -4159,7 +4159,7 @@ CopyChanged(); - SetUndoStates(); + SetVersionStates(); } public boolean Save(boolean user) @@ -4205,7 +4205,7 @@ // copy.versionlist[i] = null; // } - SetUndoStates(); + SetVersionStates(); // test save if (false) @@ -4265,7 +4265,7 @@ { Object3D obj = (Object3D)Grafreed.clone(copy.versionlist[copy.versionindex]); - SetUndoStates(); + SetVersionStates(); boolean temp = CameraPane.SWITCH; CameraPane.SWITCH = false; @@ -4332,7 +4332,7 @@ return count; } - void SetUndoStates() + void SetVersionStates() { //if (true) // return; @@ -5111,7 +5111,7 @@ } if (previousVersionButton != null && copy.versionlist != null) - SetUndoStates(); + SetVersionStates(); } static TweenManager tweenManager = new TweenManager(); @@ -5596,6 +5596,8 @@ void save() { + Replace(); + if (lastname == null) { return; -- Gitblit v1.6.2