From c67da2e5d8655704601d6d06e8bc60aabe212253 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Sun, 23 Jun 2019 21:49:12 -0400
Subject: [PATCH] Compute shadow when live option.

---
 GroupEditor.java |   30 +++++++++++++++++++++++++++++-
 1 files changed, 29 insertions(+), 1 deletions(-)

diff --git a/GroupEditor.java b/GroupEditor.java
index 8646c14..33acfd4 100644
--- a/GroupEditor.java
+++ b/GroupEditor.java
@@ -808,11 +808,19 @@
 //                debugCB.addItemListener(this);
 
                 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
+                oeilCB.setToolTipText("Move camera when tracking target");
                                 oeilCB.addItemListener(this);
 
+                panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
+                shadowCB.setToolTipText("Compute shadows when live");
+                                shadowCB.addItemListener(this);
+
+            if (Globals.ADVANCED)
+            {
                 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
                 lookAtCB.setToolTipText("Look-at target");
                                 lookAtCB.addItemListener(this);
+            }
                 
         }
                                 
@@ -827,6 +835,14 @@
         void EditObject(Object3D obj)
         {
             cRadio radioButton = new cRadio(obj.name);
+            
+            // Patch to avoid bug with transparency.
+            radioButton.hadMaterial = obj.material != null;
+            if (!radioButton.hadMaterial)
+            {
+                obj.material = new cMaterial();
+            }
+            
             radioButton.SetObject(obj);
             radioButton.layout = sevenButton;
             radioButton.SetCamera(cameraView.renderCamera, false);
@@ -863,7 +879,9 @@
         JCheckBox speakerCameraCB;
         JCheckBox speakerFocusCB;
         JCheckBox debugCB;
+        
         JCheckBox oeilCB;
+        JCheckBox shadowCB;
         JCheckBox lookAtCB;
         
 //        static int COLOR = 1;
@@ -966,6 +984,10 @@
             else if(e.getSource() == oeilCB)
             {
                 cameraView.ToggleOeil();
+            }
+            else if(e.getSource() == shadowCB)
+            {
+                Globals.COMPUTESHADOWWHENLIVE ^= true;
             }
             else if(e.getSource() == lookAtCB)
             {
@@ -3126,8 +3148,14 @@
                     for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
                     {
                             ab = (cRadio)e.nextElement();
-                            if(ab.getModel().isSelected() && ab.GetObject() != client)
+                            if (ab.getModel().isSelected() && ab.GetObject() != client)
                             {
+                                // Patch to avoid bug with transparency.
+                                if (!ab.hadMaterial)
+                                {
+                                    ab.object.material = null;
+                                }
+                                
                                 buttonGroup.remove(ab);
                                 radioPanel.remove(ab);
                                 

--
Gitblit v1.6.2