From 0a52bd4800459cd9935f360d7ca9555b6bea2146 Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Fri, 19 Jul 2019 20:56:44 -0400 Subject: [PATCH] CSG + paint mode. --- CameraPane.java | 80 ++++++++++++++++++++++++++++++--------- 1 files changed, 61 insertions(+), 19 deletions(-) diff --git a/CameraPane.java b/CameraPane.java index 80b657b..52608e6 100644 --- a/CameraPane.java +++ b/CameraPane.java @@ -2298,10 +2298,17 @@ HANDLES ^= true; } + Object3D paintFolder; + void TogglePaint() { PAINTMODE ^= true; paintcount = 0; + + if (PAINTMODE) + { + paintFolder = GetFolder(); + } } void SwapCamera(int a, int b) @@ -8503,7 +8510,7 @@ return texture!=null?texture.texturedata:null; } - boolean BindTexture(String tex, boolean bump, int resolution) throws Exception + com.sun.opengl.util.texture.Texture BindTexture(String tex, boolean bump, int resolution) throws Exception { if (/*tex == null ||*/ ambientOcclusion ) // || !textureon) { @@ -8515,7 +8522,7 @@ com.sun.opengl.util.texture.Texture texture = GetTexture(tex, bump, resolution); if (texture == null) - return false; + return texture; /**/ if (textureon || tex.equals("DEFAULT_TEXTURE") || tex.equals("DEFAULT_TEXTURE_BUMP") || tex.equals("WHITE_NOISE")) // || tex.equals("IMMORTAL")) @@ -15708,6 +15715,7 @@ info.bounds.y += (height - desired) / 2; } } + info.g = gr; info.camera = renderCamera; /* @@ -15717,6 +15725,8 @@ */ if (!isRenderer) { + Grafreed.Assert(object != null); + Grafreed.Assert(object.selection != null); if (object.selection.Size() > 0) { int hitSomething = object.selection.get(0).hitSomething; @@ -16550,6 +16560,14 @@ } } + private Object3D GetFolder() + { + Object3D folder = object.GetWindow().copy; + if (object.GetWindow().copy.selection.Size() > 0) + folder = object.GetWindow().copy.selection.elementAt(0); + return folder; + } + class SelectBuffer implements GLEventListener { @@ -16629,6 +16647,17 @@ //gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); + if (PAINTMODE) + { + if (object.GetWindow().copy.selection.Size() > 0) + { + Object3D paintobj = object.GetWindow().copy.selection.elementAt(0); + + // Make what you paint not selectable. + paintobj.ResetSelectable(); + } + } + //int tmp = selection_view; //selection_view = -1; int temp = DrawMode(); @@ -16640,6 +16669,17 @@ // temp = DEFAULT; // patch for selection debug Globals.drawMode = temp; // WARNING + if (PAINTMODE) + { + if (object.GetWindow().copy.selection.Size() > 0) + { + Object3D paintobj = object.GetWindow().copy.selection.elementAt(0); + + // Revert. + paintobj.RestoreSelectable(); + } + } + //gl.glBindTexture(GL.GL_TEXTURE_2D, selection_view); // trying different ways of getting the depth info over @@ -16745,27 +16785,29 @@ if (!movingcamera && !PAINTMODE) object.GetWindow().ScreenFitPoint(); // fev 2014 - if (PAINTMODE && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0) + if (PAINTMODE) // && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0) { - Object3D paintobj = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0); - - Object3D group = new Object3D("inst" + paintcount++); - - group.CreateMaterial(); // use a void leaf to select instances - - group.add(paintobj); // link - - object.GetWindow().SnapObject(group); - - Object3D folder = object.GetWindow().copy; + //Object3D paintobj; // = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0); if (object.GetWindow().copy.selection.Size() > 0) - folder = object.GetWindow().copy.selection.elementAt(0); + { + Object3D paintobj = object.GetWindow().copy.selection.elementAt(0); - folder.add(group); - - object.GetWindow().ResetModel(); - object.GetWindow().refreshContents(); + Object3D inst = new Object3D("inst" + paintcount++); + + inst.CreateMaterial(); // use a void leaf to select instances + + inst.add(paintobj); // link + + object.GetWindow().SnapObject(inst); + + Object3D folder = paintFolder; // GetFolder(); + + folder.add(inst); + + object.GetWindow().ResetModel(); + object.GetWindow().refreshContents(); + } } else paintcount = 0; -- Gitblit v1.6.2