From 57c5b6cd8d12ffdaa3e0b099451e3c031012750a Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Thu, 03 Oct 2019 20:34:32 -0400 Subject: [PATCH] Fix lighttouched --- ObjEditor.java | 149 +++++++++++++++++++------------------ Cone.java | 4 BoundaryRep.java | 4 CameraPane.java | 2 PhysicsNode.java | 4 SwitchNode.java | 4 Globals.java | 2 SwitchEditor.java | 2 GroupEditor.java | 13 ++- Mocap.java | 2 Object3D.java | 9 + 11 files changed, 105 insertions(+), 90 deletions(-) diff --git a/BoundaryRep.java b/BoundaryRep.java index 6fecd44..09c35f0 100644 --- a/BoundaryRep.java +++ b/BoundaryRep.java @@ -2004,8 +2004,8 @@ // Warning: faster but dangerous if (v.weights != null && v.weights[j] - == 0) - //< 0.001 * v.totalweight) + == 0) + // < 0.001 * v.totalweight) { //testweight += v.weights[j-1]; continue; diff --git a/CameraPane.java b/CameraPane.java index 48170cc..b60cf14 100644 --- a/CameraPane.java +++ b/CameraPane.java @@ -124,7 +124,7 @@ static boolean LOCALTRANSFORM = false; static boolean FULLSCREEN = false; static boolean SUPPORT = true; -static boolean INERTIA = true; +static boolean INERTIA = false; // true; static boolean FAST = false; static boolean SLOWPOSE = false; static boolean FOOTCONTACT = true; diff --git a/Cone.java b/Cone.java index d0d4c5c..3396bc6 100644 --- a/Cone.java +++ b/Cone.java @@ -17,7 +17,7 @@ retile(); base = LA.newVector(0, 0, 0); // -1); apex = LA.newVector(0, 1, 0); // 1); - baseRadius = apexRadius = 0.5; // 0.125; + baseRadius = apexRadius = 0.6369; // == 0.5 * 4/3.14 // 0.5; // 0.125; //fromStandard = new double[4][4]; //toStandard = new double[4][4]; //LA.matIdentity(fromStandard); @@ -196,7 +196,7 @@ double uStretch() { - return 3; // Actually 3.14 (I think) + return 4; // 3; // Actually 3.14 (I think) } double vFlip(double v) diff --git a/Globals.java b/Globals.java index 698e125..1d17d2d 100644 --- a/Globals.java +++ b/Globals.java @@ -19,7 +19,7 @@ // Option to set saturation to 1 when choosing a color first public static boolean AUTOSATURATE = true; public static boolean MINSHADER = false; - public static boolean COMPUTESHADOWWHENLIVE = true; + public static boolean COMPUTESHADOWWHENLIVE = false; // true; public static boolean RENDERSHADOW = true; public static boolean REPLACEONMAKE = false; // false; diff --git a/GroupEditor.java b/GroupEditor.java index 949d4b1..008fb31 100644 --- a/GroupEditor.java +++ b/GroupEditor.java @@ -1082,7 +1082,7 @@ // }); oe.toolbarPanel.add(fullScreenButton = GetButton("icons/fullscreen.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); - fullScreenButton.setToolTipText("Full-screen window"); + fullScreenButton.setToolTipText("Full-screen window (ESC to exit)"); fullScreenButton.addActionListener(this); oe.toolbarPanel.add(collapseButton = GetButton("icons/collapse.png", !Globals.NIMBUSLAF)); //, oe.aConstraints); @@ -1411,10 +1411,10 @@ panel.Return(); - if (Globals.ADVANCED) + //if (Globals.ADVANCED) { panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints); - crowdCB.setToolTipText("Used for crowds"); + crowdCB.setToolTipText("Use for crowds"); crowdCB.addItemListener(this); } @@ -1444,11 +1444,11 @@ panel.Return(); } + panel.Return(); + panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints); smoothfocusCB.addItemListener(this); - panel.Return(); - //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints); // debugCB.addItemListener(this); @@ -1460,9 +1460,12 @@ oeilCB.setToolTipText("Move camera when tracking"); oeilCB.addItemListener(this); + if (Globals.ADVANCED) + { panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints); shadowCB.setToolTipText("When live compute shadows"); shadowCB.addItemListener(this); + } panel.Return(); panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints); diff --git a/Mocap.java b/Mocap.java index cbbed79..4656cc7 100644 --- a/Mocap.java +++ b/Mocap.java @@ -3924,6 +3924,8 @@ restarted = true; //System.err.println("restarted = true"); Step(); + + Globals.lighttouched = true; } else { diff --git a/ObjEditor.java b/ObjEditor.java index 8d2ff7b..05fa7cb 100644 --- a/ObjEditor.java +++ b/ObjEditor.java @@ -833,6 +833,11 @@ ScriptNode sn = (ScriptNode) sel; si.SendInfo(" Script name: " + sn.filename, "regular"); } + if (sel instanceof SwitchNode) + { + SwitchNode sn = (SwitchNode) sel; + si.SendInfo(" Switch Object: " + sn.switchobject, "regular"); + } si.SendInfo((debug ? " Path: " : " ") + sel.GetPath(), "regular"); @@ -1864,6 +1869,52 @@ cButton fullsceneButton; + fullscenePanel.add(fullsceneButton = GetButton("fullscenes/tom.png", !Globals.NIMBUSLAF)); + fullsceneButton.setToolTipText("Tom!"); + fullsceneButton.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/tom.gfd", new iCallBack() + { + + public void Callback(Object obj) + { + LoadIt(obj); + } + + public void DragGesture() + { + } + }); + } + }); + + fullscenePanel.add(fullsceneButton = GetButton("fullscenes/adameve.png", !Globals.NIMBUSLAF)); + fullsceneButton.setToolTipText("Adam and Eve!"); + fullsceneButton.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/adameve.gfd", new iCallBack() + { + + public void Callback(Object obj) + { + LoadIt(obj); + } + + public void DragGesture() + { + } + }); + } + }); + + fullscenePanel.Return(); + fullscenePanel.add(fullsceneButton = GetButton("fullscenes/alsace.png", !Globals.NIMBUSLAF)); fullsceneButton.setToolTipText("Alsace!"); fullsceneButton.addActionListener(new ActionListener() @@ -2093,86 +2144,17 @@ }); fullscenePanel.Return(); - - fullscenePanel.add(fullsceneButton = GetButton("fullscenes/tom.png", !Globals.NIMBUSLAF)); - fullsceneButton.setToolTipText("Tom!"); - fullsceneButton.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/tom.gfd", new iCallBack() - { - - public void Callback(Object obj) - { - LoadIt(obj); - } - - public void DragGesture() - { - } - }); - } - }); - - fullscenePanel.add(fullsceneButton = GetButton("fullscenes/adameve.png", !Globals.NIMBUSLAF)); - fullsceneButton.setToolTipText("Adam and Eve!"); - fullsceneButton.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - ReadGFD("https://www.noaofarc.ca/akeeba/categories/Applications/adameve.gfd", new iCallBack() - { - - public void Callback(Object obj) - { - LoadIt(obj); - } - - public void DragGesture() - { - } - }); - } - }); - - fullscenePanel.Return(); - - fullscenePanel.add(new cGridBag()); - fullscenePanel.add(new cGridBag()); - + sceneTabbedPane.add(optionsPanel); scenePanel.add(sceneTabbedPane); + cButton creditButton; + cGridBag creditsPanel = new cGridBag().setVertical(true); creditsPanel.setName("Credits"); - cLabel ogaLabel = new cLabel(" Skyboxes courtesy of OpenGameArt!", !Globals.NIMBUSLAF); - creditsPanel.add(ogaLabel); - - cButton creditButton; - creditsPanel.add(creditButton = GetButton("icons/sara-logo.png", !Globals.NIMBUSLAF)); - creditButton.setToolTipText("https://opengameart.org"); - - creditButton.addMouseListener(new MouseAdapter() - { - public void mouseClicked(MouseEvent e) - { - try - { - Desktop.getDesktop().browse(new java.net.URI("https://opengameart.org/")); - } catch (Exception e1) -// } catch (java.io.IOException | java.net.URISyntaxException e1) - { - e1.printStackTrace(); - } - } - }); - - ogaLabel = new cLabel(" Download 3D models! (.3ds and .obj only)", !Globals.NIMBUSLAF); + cLabel ogaLabel = new cLabel(" Download 3D models! (.3ds and .obj only)", !Globals.NIMBUSLAF); creditsPanel.add(ogaLabel); creditsPanel.add(creditButton = GetButton("icons/3delicious.png", !Globals.NIMBUSLAF)); @@ -2229,6 +2211,27 @@ } }); + ogaLabel = new cLabel(" Skyboxes courtesy of OpenGameArt!", !Globals.NIMBUSLAF); + creditsPanel.add(ogaLabel); + + creditsPanel.add(creditButton = GetButton("icons/sara-logo.png", !Globals.NIMBUSLAF)); + creditButton.setToolTipText("https://opengameart.org"); + + creditButton.addMouseListener(new MouseAdapter() + { + public void mouseClicked(MouseEvent e) + { + try + { + Desktop.getDesktop().browse(new java.net.URI("https://opengameart.org/")); + } catch (Exception e1) +// } catch (java.io.IOException | java.net.URISyntaxException e1) + { + e1.printStackTrace(); + } + } + }); + for (int i=6; --i>=0;) { creditsPanel.add(new cGridBag()); diff --git a/Object3D.java b/Object3D.java index abd4fbd..4c48f08 100644 --- a/Object3D.java +++ b/Object3D.java @@ -41,7 +41,7 @@ java.util.Hashtable<java.util.UUID, Object3D> versiontable; // = new java.util.Hashtable<java.util.UUID, Object3D>(); - int tabIndex; + transient int tabIndex; // Tabs can change between sessions. ScriptNode scriptnode; @@ -1142,6 +1142,8 @@ (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE) && currentframe != Globals.framecount) { + Globals.lighttouched = true; + currentframe = Globals.framecount; // System.err.println("transformcount = " + transformcount); @@ -6301,7 +6303,7 @@ if (!selectmode && //display.DrawMode() != display.SELECTION && //(touched || (bRep != null && bRep.displaylist <= 0))) - (Globals.isLIVE() && Globals.COMPUTESHADOWWHENLIVE || touched && Globals.COMPUTESHADOWWHENLIVE)) // || (bRep != null && bRep.displaylist <= 0))) + (Globals.isLIVE() || touched) && Globals.COMPUTESHADOWWHENLIVE) // || (bRep != null && bRep.displaylist <= 0))) { Globals.lighttouched = true; } // all panes... @@ -6856,7 +6858,8 @@ //javax.media.opengl.GL gl = display.GetGL(); - if (CameraPane.BOXMODE && !Link2Support()) //selected) // || CameraPane.movingcamera) + if (CameraPane.BOXMODE && //!Link2Support()) // + !selected) // || CameraPane.movingcamera) { int fc = bRep.FaceCount(); int vc = bRep.VertexCount(); diff --git a/PhysicsNode.java b/PhysicsNode.java index 423ac33..5d1d131 100644 --- a/PhysicsNode.java +++ b/PhysicsNode.java @@ -113,8 +113,10 @@ void drawSelf(iCameraPane display, Object3D /*Composite*/ root, boolean selected, boolean blocked) { - if (Globals.isLIVE() && live && display.DrawMode() == display.SHADOW) // SHADOW + if (Globals.isLIVE() && live && (Globals.DrawMode() == iCameraPane.SHADOW || !Globals.RENDERSHADOW || !Globals.COMPUTESHADOWWHENLIVE)) // SHADOW { + Globals.lighttouched = true; + float ms = getDeltaTimeMicroseconds(); float minFPS = 1000000f / 60f; if (ms > minFPS) diff --git a/SwitchEditor.java b/SwitchEditor.java index 3940f44..320e81d 100644 --- a/SwitchEditor.java +++ b/SwitchEditor.java @@ -214,6 +214,8 @@ switchnode.speed = speedField.getInteger(); // biparam.minUDivs, 99); //biparam.name = nameField.getText(); + Globals.lighttouched = true; + // june 2013 super.applySelf(); if (switchnode.speed != s) System.out.println("Damp = " + switchnode.speed); diff --git a/SwitchNode.java b/SwitchNode.java index 0494a66..af3dfd0 100644 --- a/SwitchNode.java +++ b/SwitchNode.java @@ -57,7 +57,7 @@ parent = super.parent; } - if (live && Globals.isLIVE() && display.DrawMode() == display.SHADOW) + if (live && Globals.isLIVE() && (display.DrawMode() == display.SHADOW || !Globals.RENDERSHADOW)) { if (countspeed <= 0) { @@ -106,7 +106,7 @@ bRep = (BoundaryRep)Grafreed.clone(switchobject.get(0).bRep); } - if (CameraPane.SUPPORT && display.DrawMode() == display.SHADOW) + if (CameraPane.SUPPORT && (display.DrawMode() == display.SHADOW || !Globals.RENDERSHADOW)) { Update(); } -- Gitblit v1.6.2