From 21ac57b36a9e3b909853c7d64ac29b7ad72490a3 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Mon, 02 Sep 2019 16:52:19 -0400
Subject: [PATCH] Figure panel.

---
 TriMesh.java |  199 +++----------------------------------------------
 1 files changed, 15 insertions(+), 184 deletions(-)

diff --git a/TriMesh.java b/TriMesh.java
index efb3206..6068a2e 100755
--- a/TriMesh.java
+++ b/TriMesh.java
@@ -70,13 +70,28 @@
  */
 public class TriMesh extends Geometry implements Serializable
 {
+    /**
+     * <code>draw</code> renders a <code>TriMesh</code> object including
+     * it's normals, colors, textures and vertices.
+     *
+     * @see Renderer#draw(TriMesh)
+     * @param tris
+     *            the mesh to render.
+     */
+    void DrawParticles(iCameraPane display, Object3D geo, boolean selected, boolean rotate) // TriMesh tris)
+    {
+            display.DrawParticles(this, geo, selected, rotate);
+    }
+
     static final long serialVersionUID = 0;
 
     boolean IsStatic()
     {
         return false;
     }
+    
     private static final Logger logger = Logger.getLogger(TriMesh.class.getName());
+    
     //   private static final long serialVersionUID = 2L;
     public enum Mode
     {
@@ -270,190 +285,6 @@
 
     float[] texmat = { 1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1 };
     
-    // super.DrawNode(...);
-    /**
-     * <code>draw</code> renders a <code>TriMesh</code> object including
-     * it's normals, colors, textures and vertices.
-     *
-     * @see Renderer#draw(TriMesh)
-     * @param tris
-     *            the mesh to render.
-     */
-    void DrawParticles(CameraPane display, Object3D geo, boolean selected, boolean rotate) // TriMesh tris)
-    {
-        float r = display.modelParams0[0];
-        float g = display.modelParams0[1];
-        float b = display.modelParams0[2];
-        float opacity = display.modelParams5[1];        
-        
-        //final GL gl = GLU.getCurrentGL();
-        GL gl = display.GetGL(); // getGL();
-
-        int v = vertBuf.capacity();
-
-        int count = 0;
-        
-        boolean cf = gl.glIsEnabled(gl.GL_CULL_FACE);
-        gl.glEnable(gl.GL_CULL_FACE);
-   //     gl.glScalef(1.0f/1024,1.0f/1024,1.0f/1024);
-        for (int i=0; i<v/3; i++)
-        {
-            int index3 = i*3;
-            
-            if (sizeBuf.get(index3+1) == 0)
-                continue;
-            
-            count++;
-            
-            int index4 = i*4;
-            
-            float tx = vertBuf.get(index3);
-            float ty = vertBuf.get(index3+1);
-            float tz = vertBuf.get(index3+2);
-            
-        //    if (tx == 0 && ty == 0 && tz == 0)
-        //        continue;
-            
-        gl.glMatrixMode(gl.GL_TEXTURE);
-        gl.glPushMatrix();
-        texmat[12] = texmat[13] = texmat[14] = i;
-        
-        gl.glMultMatrixf(texmat, 0);
-        
-            gl.glMatrixMode(gl.GL_MODELVIEW);
-            gl.glPushMatrix();
-            
-            gl.glTranslatef(tx,ty,tz);
-
-            if (rotate)
-                gl.glRotatef(i, 0, 1, 0);
-            
-            float size = sizeBuf.get(index3) / 100;
-            gl.glScalef(size,size,size);
-            
-            float cr = colorBuf.get(index4);
-            float cg = colorBuf.get(index4+1);
-            float cb = colorBuf.get(index4+2);
-            float ca = colorBuf.get(index4+3);
-            
-            display.modelParams0[0] = r * cr;
-            display.modelParams0[1] = g * cg;
-            display.modelParams0[2] = b * cb;
-            
-            display.modelParams5[1] = opacity * ca;
-            
-        gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 0, display.modelParams0, 0);
-        gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 5, display.modelParams5, 0);
-        
-        RandomNode.globalseed = (int)sizeBuf.get(index3+2); // i;
-        RandomNode.globalseed2 = RandomNode.globalseed;
-        
-//            gl.glColor4f(cr,cg,cb,ca);
-   //         gl.glScalef(1024/16,1024/16,1024/16);
-            geo.Draw/*Node*/(display,null,selected,false); // blocked
-   //         gl.glScalef(16.0f/1024,16.0f/1024,16.0f/1024);
-            //gl.glTranslatef(-tx,-ty,-tz);
-            gl.glPopMatrix();
-            
-        gl.glMatrixMode(gl.GL_TEXTURE);
-        gl.glPopMatrix();
-        }
-   //     gl.glScalef(1024,1024,1024);
-        if (!cf)
-            gl.glDisable(gl.GL_CULL_FACE);
-        
-        display.modelParams0[0] = r;
-        display.modelParams0[1] = g;
-        display.modelParams0[2] = b;
-            
-        display.modelParams5[1] = opacity;
-            
-        gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 0, display.modelParams0, 0);
-        gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 5, display.modelParams5, 0);
-        
-        gl.glMatrixMode(gl.GL_MODELVIEW);
-        
-//        System.err.println("total = " + v/3 + "; displayed = " + count);
-        if (true)
-        return;
-        
-////        if (!tris.predraw(this))
-////        {
-////            return;
-////        }
-////        if (Debug.stats)
-////        {
-////            StatCollector.addStat(StatType.STAT_TRIANGLE_COUNT, tris.getTriangleCount());
-////            StatCollector.addStat(StatType.STAT_VERTEX_COUNT, tris.getVertexCount());
-////            StatCollector.addStat(StatType.STAT_GEOM_COUNT, 1);
-////        }
-////
-////        if (tris.getDisplayListID() != -1)
-////        {
-////            renderDisplayList(tris);
-////            return;
-////        }
-////
-////        if (!generatingDisplayList)
-////        {
-////            applyStates(tris.states, tris);
-////        }
-////        if (Debug.stats)
-////        {
-////            StatCollector.startStat(StatType.STAT_RENDER_TIMER);
-////        }
-////        boolean transformed = doTransforms(tris);
-//
-//        int glMode = GL.GL_TRIANGLES;
-//        switch (getMode())
-//        {
-//            case Triangles:
-//                glMode = GL.GL_TRIANGLES;
-//                break;
-//            case Strip:
-//                glMode = GL.GL_TRIANGLE_STRIP;
-//                break;
-//            case Fan:
-//                glMode = GL.GL_TRIANGLE_FAN;
-//                break;
-//        }
-//
-//        if (!predrawGeometry(gl))
-//        {
-//            // make sure only the necessary indices are sent through on old
-//            // cards.
-//            IntBuffer indices = this.getIndexBuffer();
-//            if (indices == null)
-//            {
-//                logger.severe("missing indices on geometry object: " + this.toString());
-//            } else
-//            {
-//                indices.rewind();
-//                indices.limit(this.getMaxIndex());
-//
-//                gl.glDrawElements(glMode, indices.limit(), GL.GL_UNSIGNED_INT, indices); // TODO Check <count> and assumed <type> of GL_UNSIGNED_INT
-//
-//                indices.clear();
-//            }
-//        } else
-//        {
-//            gl.glDrawElements(glMode, this.getIndexBuffer().limit(),
-//                    GL.GL_UNSIGNED_INT, 0);
-//        }
-//
-////        postdrawGeometry(tris);
-////        if (transformed)
-////        {
-////            undoTransforms(tris);
-////        }
-////
-////        if (Debug.stats)
-////        {
-////            StatCollector.endStat(StatType.STAT_RENDER_TIMER);
-////        }
-////        tris.postdraw(this);
-    }
-
     final boolean supportsVBO = false;
     private FloatBuffer prevVerts;
     

--
Gitblit v1.6.2