From b3ae4e889872ca0b9ca76f1d17b2f0b961226729 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Mon, 05 Aug 2019 21:48:55 -0400
Subject: [PATCH] Fix physics UI

---
 GenericJoint.java |   34 +++++++++++++++++++++++-----------
 1 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/GenericJoint.java b/GenericJoint.java
index 90f9509..4c7c0e0 100644
--- a/GenericJoint.java
+++ b/GenericJoint.java
@@ -330,12 +330,14 @@
             e.printStackTrace();
         }
             
-            display.GetGL().glPushMatrix();
+            //display.GetGL().glPushMatrix();
+            display.PushMatrix(LA.Identity, 1);
             Vector3f v = ragdolls.get(0).bodies[0].worldTransform.origin;
      //       display.GetGL().glTranslatef(-v.x,0,-v.z);
         
         super.DrawNode(display, root, selected);
-            display.GetGL().glPopMatrix();
+            //display.GetGL().glPopMatrix();
+            display.PopMatrix(LA.Identity);
         
 //        assert(bRep != null);
         
@@ -379,7 +381,7 @@
         try
         {
             //font = FontRender.createFont("Dialog", 11, false, true);
-            font = new FontRender.GLFont(gl, GrafreeD.class.getResourceAsStream("DejaVu_Sans_11.fnt"));
+            font = new FontRender.GLFont(gl, Grafreed.class.getResourceAsStream("DejaVu_Sans_11.fnt"));
         } catch (java.io.IOException e)
         {
             e.printStackTrace();
@@ -453,7 +455,7 @@
     
     public void renderme(iCameraPane display)
     {
-        GL gl = display!=null?display.GetGL():null;
+        GL gl = display!=null?display.GetGL0():null;
 
         // gl0 = gl;
         if (GetDynamicsWorld() != null)
@@ -555,7 +557,8 @@
                 bRep.startvertices = new int[numObjects];
             bRep.averagepoints = new float[(bRep.startvertices.length-1) * 3];
             bRep.extremepoints = new float[(bRep.startvertices.length-1) * 3];
-            bRep.supportsizes = new float[(bRep.startvertices.length-1)];
+            bRep.supportminsize = new float[(bRep.startvertices.length-1)];
+            bRep.supportmaxsize = new float[(bRep.startvertices.length-1)];
                 buildrep = true;
                 
                 initialmatrices = new ObjectArrayList<Transform>();
@@ -798,7 +801,7 @@
 
     public void drawCube(iCameraPane display, float extent)
     {
-        GL gl = display.GetGL();
+        GL gl = display.GetGL0();
 
         extent = extent * 0.5f;
 
@@ -871,6 +874,7 @@
 
         if (shape.getShapeType() == BroadphaseNativeType.COMPOUND_SHAPE_PROXYTYPE)
         {
+                new Exception().printStackTrace();
             System.exit(0);
             CompoundShape compoundShape = (CompoundShape) shape;
             Transform childTrans = transformsPool.get();
@@ -901,6 +905,7 @@
                 {
                     case BOX_SHAPE_PROXYTYPE:
                     {
+                new Exception().printStackTrace();
             System.exit(0);
                         BoxShape boxShape = (BoxShape) shape;
                         Vector3f halfExtent = boxShape.getHalfExtentsWithMargin(vectorsPool.get());
@@ -912,6 +917,7 @@
                     }
                     case SPHERE_SHAPE_PROXYTYPE:
                     {
+                new Exception().printStackTrace();
             System.exit(0);
                         SphereShape sphereShape = (SphereShape) shape;
                         float radius = sphereShape.getMargin(); // radius doesn't include the margin, so draw with margin
@@ -958,6 +964,7 @@
 
                     case STATIC_PLANE_PROXYTYPE:
                     {
+                new Exception().printStackTrace();
             System.exit(0);
                         StaticPlaneShape staticPlaneShape = (StaticPlaneShape) shape;
                         float planeConst = staticPlaneShape.getPlaneConstant();
@@ -1004,6 +1011,7 @@
 
                     case CYLINDER_SHAPE_PROXYTYPE:
                     {
+                new Exception().printStackTrace();
             System.exit(0);
                         CylinderShape cylinder = (CylinderShape) shape;
                         int upAxis = cylinder.getUpAxis();
@@ -1218,11 +1226,12 @@
                                 }
                                 else
                                 {
-                                    if (bRep.averagepoints == null || bRep.extremepoints == null || bRep.supportsizes == null)
+                                    if (bRep.averagepoints == null || bRep.extremepoints == null || bRep.supportminsize == null || bRep.supportmaxsize == null)
                                     {
                                         bRep.averagepoints = new float[(bRep.startvertices.length-1) * 3];
                                         bRep.extremepoints = new float[(bRep.startvertices.length-1) * 3];
-                                        bRep.supportsizes = new float[(bRep.startvertices.length-1)];
+                                        bRep.supportminsize = new float[(bRep.startvertices.length-1)];
+                                        bRep.supportmaxsize = new float[(bRep.startvertices.length-1)];
                                     }
                                     
                                     float averagex = 0;
@@ -1292,7 +1301,8 @@
                                         }
                                     }
                                     
-                                    bRep.supportsizes[currentobject-1] = (float)Math.sqrt(mindist2);
+                                    bRep.supportminsize[currentobject-1] = (float)Math.sqrt(mindist2);
+                                    bRep.supportmaxsize[currentobject-1] = (float)Math.sqrt(maxdist2);
                                 }
 
 //                                if (hull.numTriangles() > 0)
@@ -1356,6 +1366,7 @@
                 // for polyhedral shapes
                 if (shape.isPolyhedral())
                 {
+                new Exception().printStackTrace();
             System.exit(0);
                     PolyhedralConvexShape polyshape = (PolyhedralConvexShape) shape;
 
@@ -1425,6 +1436,7 @@
             if (shape.isConcave())//>getShapeType() == TRIANGLE_MESH_SHAPE_PROXYTYPE||shape->getShapeType() == GIMPACT_SHAPE_PROXYTYPE)
             //		if (shape->getShapeType() == TRIANGLE_MESH_SHAPE_PROXYTYPE)
             {
+                new Exception().printStackTrace();
             System.exit(0);
                 ConcaveShape concaveMesh = (ConcaveShape) shape;
                 //btVector3 aabbMax(btScalar(1e30),btScalar(1e30),btScalar(1e30));
@@ -1524,7 +1536,7 @@
 
     public void drawSphere(iCameraPane display, float radius, int slices, int stacks)
     {
-        GL gl = display.GetGL();
+        GL gl = display.GetGL0();
 
         sphereKey.radius = radius;
         Integer glList = sphereDisplayLists.get(sphereKey);
@@ -1596,7 +1608,7 @@
 
     public void drawCylinder(iCameraPane display, float radius, float halfHeight, int upAxis)
     {
-        GL gl = display.GetGL();
+        GL gl = display.GetGL0();
 
         gl.glPushMatrix();
         switch (upAxis)

--
Gitblit v1.6.2