From c49ad213b600f844e9070cb09390c3e6d3d13db4 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Thu, 01 Aug 2019 01:23:12 -0400
Subject: [PATCH] Avoid byte[] for versions.

---
 Object3D.java |   33 +++++++++++++++++++++------------
 1 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/Object3D.java b/Object3D.java
index b4b1eb5..a984e30 100644
--- a/Object3D.java
+++ b/Object3D.java
@@ -29,7 +29,10 @@
     Object3D saveskeleton;
     //
     
-    byte[] versions[];
+    String skyboxname;
+    String skyboxext;
+    
+    Object3D versions[];
     int versionindex = -1;    
         
     ScriptNode scriptnode;
@@ -1011,6 +1014,9 @@
         
         if (material == null || material.multiply)
             return true;
+        
+        if (projectedVertices != null && projectedVertices.length > 2 && projectedVertices[2].y >= 10000)
+            return false;
         
         // Transparent objects are dynamic because we have to sort the triangles.
         return material.opacity > 0.99;
@@ -5906,8 +5912,10 @@
         if (support != null)
             support = support;
         
-        //boolean usecalllists = IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
-        boolean usecalllists = false; //!IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
+        boolean usecalllists = !IsLive() && IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null || !link2master); // !(this instanceof cSpring) && !(this instanceof BezierPatch);
+        //boolean usecalllists = false; //!IsLive(); // IsStatic() && GetBRep() != null && (!CameraPane.SUPPORT || support == null) && !link2master; // !(this instanceof cSpring) && !(this instanceof BezierPatch);
+        
+        //usecalllists &= display.DrawMode() == display.DEFAULT; // Don't compute list in shadow pass.
         
         if (!usecalllists && bRep != null && bRep.displaylist > 0)
         {
@@ -5917,8 +5925,9 @@
    //     usecalllists &= !(parent instanceof RandomNode);
    //     usecalllists = false;
 
-        if (GetBRep() != null)
-            usecalllists = usecalllists;
+        if (display.DrawMode() == display.SHADOW)
+            //GetBRep() != null)
+            usecalllists = !!usecalllists;
         //System.out.println("draw " + this);
         //new Exception().printStackTrace();
 
@@ -5940,7 +5949,7 @@
             if (!(this instanceof Composite))
                 touched = false;
             //if (displaylist == -1 && usecalllists)
-            if ((bRep != null && bRep.displaylist <= 0) && usecalllists) // june 2013
+            if (bRep.displaylist <= 0 && usecalllists) // && display.DrawMode() == display.DEFAULT) // june 2013
             {
                 bRep.displaylist = display.GenList();
                 assert(bRep.displaylist != 0);
@@ -5951,7 +5960,7 @@
 
             //System.out.println("\tnew list " + list);
             //gl.glDrawBuffer(gl.GL_NONE);
-            if (usecalllists)
+            if (usecalllists && bRep.displaylist > 0)
             {
 //            System.err.println("new list " + bRep.displaylist + " for " + this);
                 display.NewList(bRep.displaylist);
@@ -5960,7 +5969,7 @@
             CallList(display, root, selected, blocked);
             
           //  compiled = true;
-            if (usecalllists)
+            if (usecalllists && bRep.displaylist > 0)
             {
 //            System.err.println("end list " + bRep.displaylist + " for " + this);
                 display.EndList();
@@ -7490,7 +7499,7 @@
             hitSomething = hitScale;
             
         double scale = 0.005f * clickInfo.camera.Distance();
-                double hScale = (double) (clickInfo.x /*- centerPt.x*/) / 32;
+                double hScale = (double) (clickInfo.x - centerPt.x) / 32;
                 double sign = 1;
                 if (hScale < 0)
                 {
@@ -7502,7 +7511,7 @@
                     //hScale = 0.01;
                 }
                 
-                double vScale = (double) (clickInfo.y /*- centerPt.y*/) / 32;
+                double vScale = (double) (clickInfo.y - centerPt.y) / 32;
                 sign = 1;
                 if (vScale < 0)
                 {
@@ -7717,7 +7726,7 @@
                 break;
 
             case hitScale: // scale
-                double hScale = (double) (clickInfo.x /*- centerPt.x*/) / 32;
+                double hScale = (double) (clickInfo.x - centerPt.x) / 32;
                 double sign = 1;
                 if (hScale < 0)
                 {
@@ -7729,7 +7738,7 @@
                     //hScale = 0.01;
                 }
                 
-                double vScale = (double) (clickInfo.y /*- centerPt.y*/) / 32;
+                double vScale = (double) (clickInfo.y - centerPt.y) / 32;
                 sign = 1;
                 if (vScale < 0)
                 {

--
Gitblit v1.6.2