From a434119e65146fe53d612c28e1ee7af532d1b70a Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Sun, 28 Jul 2019 15:25:44 -0400 Subject: [PATCH] Skyboxes --- GroupEditor.java | 238 +++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 196 insertions(+), 42 deletions(-) diff --git a/GroupEditor.java b/GroupEditor.java index f4c7c39..696071e 100644 --- a/GroupEditor.java +++ b/GroupEditor.java @@ -23,6 +23,31 @@ DragGestureListener, DragSourceListener, DropTargetListener, ItemListener // ListSelectionListener { + + public void AddSkyboxButton(String f, String s, cGridBag row3) + { + cButton skyboxButton; + final String path = "cubemaps/" + f + "-skyboxes/" + s; + row3.add(skyboxButton = GetButton(path + "/" + s + ".jpg", !Grafreed.NIMBUSLAF)); + skyboxButton.setToolTipText(s); + skyboxButton.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + ChangeSkybox(path); + } + }); + } + + public void ChangeSkybox(String name) + { + cameraView.envyoff = false; + cameraView.skyboxname = name; + cameraView.skyboxext = "jpg"; + cameraView.repaint(); + } + //ObjEditor objEditor; public void closeUI2() { @@ -608,7 +633,7 @@ */ cGridBag copyOptionsPanel = new cGridBag(); - copyOptionsPanel.preferredHeight = 1; + copyOptionsPanel.preferredHeight = 2; //this.AddOptions(oe.toolbarPanel, oe.aConstraints); @@ -688,25 +713,25 @@ oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); snapobjectButton.addActionListener(this); snapobjectButton.setToolTipText("Snap Object"); + + oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + fourButton.addActionListener(this); + fourButton.setToolTipText("Show control panel only"); } //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL)); - oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); - fourButton.addActionListener(this); - fourButton.setToolTipText("Show left panel only"); - - oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); - twoButton.setToolTipText("Show right view only"); + oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + twoButton.setToolTipText("Show 3D view only"); twoButton.addActionListener(this); this.fullscreenLayout = twoButton; - oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); - sixButton.setToolTipText("Show left and right"); + oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + threeButton.setToolTipText("Show controls and 3D view"); + threeButton.addActionListener(this); + oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + sixButton.setToolTipText("Show 3D view and controls"); sixButton.addActionListener(this); -// oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); -// threeButton.setToolTipText("2-column layout right"); -// threeButton.addActionListener(this); // oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); // sevenButton.setToolTipText("3-column layout"); // sevenButton.addActionListener(this); @@ -722,28 +747,30 @@ //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints); //clearButton.addActionListener(this); + cGridBag row1 = new cGridBag(); + // INSERT - oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); gridButton.setToolTipText("Create grid"); gridButton.addActionListener(this); - oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); boxButton.setToolTipText("Create box"); boxButton.addActionListener(this); - oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); sphereButton.setToolTipText("Create sphere"); sphereButton.addActionListener(this); - oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); coneButton.setToolTipText("Create cone"); coneButton.addActionListener(this); - oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); torusButton.setToolTipText("Create torus"); torusButton.addActionListener(this); - oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); superButton.setToolTipText("Create superellipsoid"); superButton.addActionListener(this); @@ -754,50 +781,144 @@ kleinButton.addActionListener(this); } - oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); particlesButton.setToolTipText("Create particle system"); particlesButton.addActionListener(this); - oe.toolboxPanel.Return(); + oe.toolboxPanel.add(row1); - oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + cGridBag row2 = new cGridBag(); + + row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); groupButton.setToolTipText("Create group"); groupButton.addActionListener(this); - oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); compositeButton.setToolTipText("Create composite"); compositeButton.addActionListener(this); - oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); switchButton.setToolTipText("Create item switcher"); switchButton.addActionListener(this); - oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); loopButton.setToolTipText("Create loop"); loopButton.addActionListener(this); - oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); textureButton.setToolTipText("Create texture"); textureButton.addActionListener(this); - oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); overlayButton.setToolTipText("Create overlay"); overlayButton.addActionListener(this); - oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); + row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints); lightButton.setToolTipText("Create light"); lightButton.addActionListener(this); - for (int i=6; --i>=0;) + oe.toolboxPanel.add(row2); + + // ENVYMAPS + cGridBag row3 = new cGridBag(); + row3.preferredHeight = 20; + + AddSkyboxButton("default", "rgb", row3); + AddSkyboxButton("default", "cornell", row3); + AddSkyboxButton("default", "uffizi", row3); + AddSkyboxButton("default", "CloudyHills", row3); + AddSkyboxButton("default", "skycube", row3); + + oe.toolboxPanel.add(row3); + + cGridBag row4 = new cGridBag(); + row4.preferredHeight = 20; + + AddSkyboxButton("bridge", "Bridge2", row4); + AddSkyboxButton("urban", "GamlaStan2", row4); + AddSkyboxButton("urban", "Parliament", row4); + AddSkyboxButton("urban", "Roundabout", row4); + + oe.toolboxPanel.add(row4); + + cGridBag row5 = new cGridBag(); + row5.preferredHeight = 20; + + AddSkyboxButton("urban", "SaintLazarusChurch", row5); + AddSkyboxButton("urban", "SaintLazarusChurch2", row5); + AddSkyboxButton("urban", "SaintLazarusChurch3", row5); + AddSkyboxButton("urban", "UnionSquare", row5); + + oe.toolboxPanel.add(row5); + + cGridBag row6 = new cGridBag(); + row6.preferredHeight = 20; + + AddSkyboxButton("park", "BerzeliiPark", row6); + AddSkyboxButton("park", "Buddha", row6); + AddSkyboxButton("park", "CNTower2", row6); + //AddSkyboxButton("park", "Fatbursparken", row6); + AddSkyboxButton("park", "NiagaraFalls1", row6); + + oe.toolboxPanel.add(row6); + + cGridBag row7 = new cGridBag(); + row7.preferredHeight = 20; + + AddSkyboxButton("park", "NiagaraFalls3", row7); + AddSkyboxButton("park", "Park", row7); + //AddSkyboxButton("park", "Park2", row6); + //AddSkyboxButton("park", "Path", row6); + AddSkyboxButton("park", "Pond", row7); + AddSkyboxButton("park", "Skansen", row7); + + oe.toolboxPanel.add(row7); + + cGridBag row8 = new cGridBag(); + row8.preferredHeight = 20; + + AddSkyboxButton("park", "Skansen2", row8); + AddSkyboxButton("park", "Skansen3", row8); + AddSkyboxButton("park", "Skansen4", row8); + AddSkyboxButton("park", "Skansen5", row8); + + oe.toolboxPanel.add(row8); + + cGridBag row9 = new cGridBag(); + row9.preferredHeight = 20; + + AddSkyboxButton("park", "Stairs", row9); + //AddSkyboxButton("park", "Tantolunden", row6); + //AddSkyboxButton("park", "Tantolunden3", row6); + AddSkyboxButton("park", "Tantolunden4", row9); + + oe.toolboxPanel.add(row9); +/* +BerzeliiPark +Buddha +CNTower2 +Fatbursparken +NiagaraFalls1 +NiagaraFalls3 +Park +Park2 +Path +Pond +Skansen +Skansen2 +Skansen3 +Skansen4 +Skansen5 +Stairs +Tantolunden +Tantolunden3 +Tantolunden4 + */ + + for (int i=1; --i>=0;) { - oe.toolboxPanel.Return(); - oe.toolboxPanel.add(new cGridBag()); - oe.toolboxPanel.add(new cGridBag()); - oe.toolboxPanel.add(new cGridBag()); - oe.toolboxPanel.add(new cGridBag()); - oe.toolboxPanel.add(new cGridBag()); - oe.toolboxPanel.add(new cGridBag()); - oe.toolboxPanel.add(new cGridBag()); + //oe.toolboxPanel.Return(); + oe.toolboxPanel.add(new cGridBag()); } // EDIT panel @@ -858,8 +979,8 @@ versionSlider = (cNumberSlider)sliderPane.getComponent(1); sliderPane.preferredHeight = 1; -// mainPanel.setDividerLocation(0.5); //1.0); -// mainPanel.setResizeWeight(0.5); +// mainPanel.setDividerLocation(0.1); //1.0); + mainPanel.setResizeWeight(0.4); //jList.addListSelectionListener(this); oe.jTree.addTreeSelectionListener(this); @@ -867,7 +988,7 @@ //jTree.setEditable(true); oe.jTree.setDragEnabled(true); //jTree.setPreferredSize(new Dimension(10,10)); - jSP.setPreferredSize(new Dimension(100,200)); + //jSP.setPreferredSize(new Dimension(100,200)); oe.jTree.setCellRenderer(new cTreeModel.Renderer()); @@ -2139,6 +2260,23 @@ { makeSomething(new Light()); } else +// if (source == skybox1Button || +// source == skybox2Button || +// source == skybox3Button || +// source == skybox4Button || +// source == skybox5Button || +// source == skybox6Button || +// source == skybox7Button || +// source == skybox11Button || +// source == skybox12Button || +// source == skybox13Button || +// source == skybox14Button || +// source == skybox15Button || +// source == skybox16Button || +// source == skybox17Button) +// { +// ChangeSkybox(source); +// } else if (source == csgItem) { group(new CSG()); @@ -2224,7 +2362,7 @@ if (source == computeAOItem) { Globals.drawMode = CameraPane.OCCLUSION; - Globals.theRenderer.repaint(); + cameraView.repaint(); } else if (source == recompileItem) { @@ -3300,8 +3438,8 @@ // centralPanel.setVisible(true); // XYZPanel.setVisible(true); bigThree.ClearUI(); + bigThree.add(scenePanel); bigThree.add(centralPanel); - bigThree.add(XYZPanel); bigThree.FlushUI(); cameraView.requestFocusInWindow(); @@ -3381,8 +3519,8 @@ // centralPanel.setVisible(true); // XYZPanel.setVisible(false); bigThree.ClearUI(); - bigThree.add(scenePanel); bigThree.add(centralPanel); + bigThree.add(scenePanel); bigThree.FlushUI(); cameraView.requestFocusInWindow(); @@ -5676,6 +5814,22 @@ cButton loopButton; cButton textureButton; + cButton skybox1Button; + cButton skybox2Button; + cButton skybox3Button; + cButton skybox4Button; + cButton skybox5Button; + cButton skybox6Button; + cButton skybox7Button; + + cButton skybox11Button; + cButton skybox12Button; + cButton skybox13Button; + cButton skybox14Button; + cButton skybox15Button; + cButton skybox16Button; + cButton skybox17Button; + cButton gridButton; cButton boxButton; cButton sphereButton; -- Gitblit v1.6.2