From ec9d13e42c9c8674739acefb0769a9273a1048c9 Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Mon, 22 Apr 2019 20:14:09 -0400 Subject: [PATCH] Refactoring GelGL. --- GroupEditor.java | 90 +++++++++++++++++++++++++++----------------- 1 files changed, 55 insertions(+), 35 deletions(-) diff --git a/GroupEditor.java b/GroupEditor.java index d3c66a5..02ade54 100644 --- a/GroupEditor.java +++ b/GroupEditor.java @@ -437,7 +437,7 @@ oe.aConstraints.gridwidth = 1; oe.aConstraints.gridx = 0; - oe.toolbarPanel.add(liveCB = new cCheckBox("Live", CameraPane.isLIVE()), oe.aConstraints); + oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE()), oe.aConstraints); liveCB.addItemListener(this); oe.aConstraints.gridx += 1; @@ -449,7 +449,7 @@ // localCB.addItemListener(this); oe.aConstraints.gridx += 1; - oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", CameraPane.CROWD), oe.aConstraints); + oe.toolbarPanel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD), oe.aConstraints); crowdCB.addItemListener(this); oe.aConstraints.gridx += 1; @@ -520,6 +520,9 @@ oe.toolbarPanel.add(flashSelectionButton = new cButton(" ? ")); //, oe.aConstraints); flashSelectionButton.addActionListener(this); + + oe.toolbarPanel.add(new cButton(" ", false)); + oe.aConstraints.gridx += 1; oe.aConstraints.weighty = 0; oe.aConstraints.gridwidth = 1; @@ -646,14 +649,14 @@ void EditObject(Object3D obj) { - cRadio dummyButton = new cRadio(obj.name); - dummyButton.SetObject(obj); - dummyButton.layout = sevenButton; - dummyButton.SetCamera(cameraView.renderCamera, false); - dummyButton.addActionListener(this); - radioPanel.add(dummyButton); - buttonGroup.add(dummyButton); - dummyButton.doClick(); + cRadio radioButton = new cRadio(obj.name); + radioButton.SetObject(obj); + radioButton.layout = sevenButton; + radioButton.SetCamera(cameraView.renderCamera, false); + radioButton.addActionListener(this); + radioPanel.add(radioButton); + buttonGroup.add(radioButton); + radioButton.doClick(); } void SetupViews(ObjEditor oe) { @@ -715,8 +718,7 @@ dropAttributes |= Object3D.TEXTURE; else dropAttributes &= ~Object3D.TEXTURE; - } - else if(e.getSource() == liveCB) + } else if(e.getSource() == liveCB) { cameraView.ToggleLive(); } @@ -1118,6 +1120,8 @@ resetParentItem.addActionListener(this); repairParentItem = menu.add(new MenuItem("Repair Parent")); repairParentItem.addActionListener(this); + repairShadowItem = menu.add(new MenuItem("Repair Shadow")); + repairShadowItem.addActionListener(this); menu.add(invariantsItem = new MenuItem("Invariants")); invariantsItem.addActionListener(this); menu.add(recompileItem = new MenuItem("Recompile")); @@ -1778,8 +1782,8 @@ } else if (event.getSource() == computeAOItem) { - CameraPane.drawMode = CameraPane.OCCLUSION; - CameraPane.theRenderer.repaint(); + Globals.drawMode = CameraPane.OCCLUSION; + Globals.theRenderer.repaint(); } else if (event.getSource() == recompileItem) { @@ -2090,7 +2094,7 @@ if (content instanceof cGroup && ((cGroup)content).transientlink ) content = ((cGroup)content).get(0); - CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR)); + Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR)); for (int i=0; i<group.selection.size(); i++) { boolean random = CameraPane.RANDOM; @@ -2099,7 +2103,7 @@ // group.selection.get(i).setMasterThis(content); // should be identity CameraPane.RANDOM = random; } - CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR)); + Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR)); refreshContents(); } } else @@ -2543,6 +2547,20 @@ refreshContents(); } else + if (event.getSource() == repairShadowItem) + { + for (Enumeration e = group.selection.elements(); e.hasMoreElements();) + { + Object3D obj = (Object3D)e.nextElement(); + obj.RepairShadow(); +// for (int i=0; i<obj.size(); i++) +// { +// obj.get(i).parent = obj; +// } + } + + refreshContents(); + } else if (event.getSource() == sortbysizeItem) { for (Enumeration e = group.selection.elements(); e.hasMoreElements();) @@ -2639,7 +2657,7 @@ //gridPanel.setDividerLocation(1.0); //bigPanel.setDividerLocation(0.0); bigThree.remove(scenePanel); - bigThree.remove(cameraPanel); + bigThree.remove(centralPanel); bigThree.remove(XYZPanel); aWindowConstraints.gridx = 0; aWindowConstraints.gridy = 0; @@ -2654,7 +2672,7 @@ // aConstraints.gridheight = 3; aWindowConstraints.gridx = 1; aWindowConstraints.fill = GridBagConstraints.BOTH; - bigThree.add(cameraPanel, aWindowConstraints); + bigThree.add(centralPanel, aWindowConstraints); aWindowConstraints.weightx = 0; aWindowConstraints.gridx = 4; aWindowConstraints.gridwidth = 1; @@ -2667,7 +2685,7 @@ { radio.layout = threeButton; bigThree.remove(scenePanel); - bigThree.remove(cameraPanel); + bigThree.remove(centralPanel); bigThree.remove(XYZPanel); aWindowConstraints.gridx = 0; aWindowConstraints.gridy = 0; @@ -2682,7 +2700,7 @@ // aConstraints.gridheight = 3; aWindowConstraints.gridx = 1; aWindowConstraints.fill = GridBagConstraints.BOTH; - bigThree.add(cameraPanel, aWindowConstraints); + bigThree.add(centralPanel, aWindowConstraints); aWindowConstraints.weightx = 0; aWindowConstraints.gridx = 4; aWindowConstraints.gridwidth = 1; @@ -2695,7 +2713,7 @@ { radio.layout = fourButton; bigThree.remove(scenePanel); - bigThree.remove(cameraPanel); + bigThree.remove(centralPanel); bigThree.remove(XYZPanel); aWindowConstraints.gridx = 0; aWindowConstraints.gridy = 0; @@ -2723,7 +2741,7 @@ { radio.layout = sixButton; bigThree.remove(scenePanel); - bigThree.remove(cameraPanel); + bigThree.remove(centralPanel); bigThree.remove(XYZPanel); aWindowConstraints.gridx = 0; aWindowConstraints.gridy = 0; @@ -2738,7 +2756,7 @@ // aWindowConstraints.gridheight = 3; aWindowConstraints.gridx = 1; aWindowConstraints.fill = GridBagConstraints.BOTH; - bigThree.add(cameraPanel, aWindowConstraints); + bigThree.add(centralPanel, aWindowConstraints); aWindowConstraints.weightx = 0; aWindowConstraints.gridx = 4; aWindowConstraints.gridwidth = 1; @@ -2751,7 +2769,7 @@ { radio.layout = sevenButton; bigThree.remove(scenePanel); - bigThree.remove(cameraPanel); + bigThree.remove(centralPanel); bigThree.remove(XYZPanel); aWindowConstraints.gridx = 0; aWindowConstraints.gridy = 0; @@ -2766,7 +2784,7 @@ // aWindowConstraints.gridheight = 3; aWindowConstraints.gridx = 1; aWindowConstraints.fill = GridBagConstraints.BOTH; - bigThree.add(cameraPanel, aWindowConstraints); + bigThree.add(centralPanel, aWindowConstraints); aWindowConstraints.weightx = 0; aWindowConstraints.gridx = 4; aWindowConstraints.gridwidth = 1; @@ -2893,7 +2911,7 @@ } copy = group; - //CameraPane.theRenderer.object = group; + //Globals.theRenderer.object = group; if(!useclient) { cameraView.renderCamera = radio.camera; @@ -2902,7 +2920,8 @@ cameraView.cameras[cameraView.cameracount] = radio.camera; cameraView.targetLookAt.set(radio.camera.lookAt); cameraView.object = group; - cameraView.lighttouched = true; + //cameraView.lighttouched = true; + Globals.lighttouched = true; topView.object = group; frontView.object = group; sideView.object = group; @@ -2938,7 +2957,7 @@ if (useclient) { cameraView.object = client; - cameraView.lighttouched = true; + Globals.lighttouched = true; //topView.object = client; //frontView.object = client; //sideView.object = client; @@ -2946,7 +2965,7 @@ else { cameraView.object = group; - cameraView.lighttouched = true; + Globals.lighttouched = true; //topView.object = group; //frontView.object = group; //sideView.object = group; @@ -3454,7 +3473,7 @@ String pigment = Object3D.GetPigment(tex); //String bump = Object3D.GetBump(tex); - com.sun.opengl.util.texture.TextureData texturedata = CameraPane.theRenderer.GetTextureData(pigment, false, node.texres); + com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres); double s = v.s; @@ -3755,7 +3774,7 @@ group.selection.RelinkToSupport(); // july 2014 System.out.println("DONE."); refreshContents(); - CameraPane.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR)); + Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.DEFAULT_CURSOR)); } void ReduceMesh(boolean reduction34) @@ -4040,16 +4059,16 @@ objEditor.SetText(); // jan 2014 - if (flashIt && !CameraPane.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera)) + if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera)) CameraPane.flash = true; if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera) // a camera { CameraPane.camerachangeframe = 0; // don't refuse it - CameraPane.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent()); - // CameraPane.theRenderer.renderCamera = CameraPane.theRenderer.manipCamera; - // CameraPane.theRenderer.eyeCamera = CameraPane.theRenderer.manipCamera; + Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent()); + // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera; + // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera; } refreshContents(); @@ -5007,6 +5026,7 @@ private MenuItem resetParentItem; private MenuItem repairParentItem; + private MenuItem repairShadowItem; private MenuItem sortbysizeItem; private MenuItem sortbynameItem; -- Gitblit v1.6.2