Normand Briere
2019-06-09 3ae9b1de47e51e7c150412f2bb14383cb6a5f8f8
CameraPane.java
....@@ -56,8 +56,6 @@
5656 static int CURRENTANTIALIAS = 0; // 1;
5757 /*static*/ boolean RENDERSHADOW = true;
5858 /*static*/ int RENDERPROGRAM = 2; // 0 == none, 1 == fast, 2 == normal
59
- static boolean ANIMATION = false;
60
- static String filename;
6159
6260 boolean DISPLAYTEXT = false;
6361 //boolean REDUCETEXTURE = true;
....@@ -92,6 +90,8 @@
9290
9391 static int tickcount = 0; // slow pose issue
9492
93
+static boolean BUTTONLESSWHEEL = false;
94
+static boolean ZOOMBOXMODE = false;
9595 static boolean BOXMODE = false;
9696 static boolean IMAGEFLIP = false;
9797 static boolean SMOOTHFOCUS = false;
....@@ -106,7 +106,7 @@
106106 static boolean OEIL = true;
107107 static boolean OEILONCE = false; // do oeilon then oeiloff
108108 static boolean LOOKAT = true;
109
-static boolean RANDOM = true; // false;
109
+static boolean SWITCH = true; // false;
110110 static boolean HANDLES = false; // selection doesn't work!!
111111 static boolean PAINTMODE = false;
112112
....@@ -149,12 +149,11 @@
149149 defaultcaps.setAccumBlueBits(16);
150150 defaultcaps.setAccumAlphaBits(16);
151151 }
152
- static CameraPane theRenderer;
153
-
152
+
154153 void SetAsGLRenderer(boolean b)
155154 {
156155 isRenderer = b;
157
- theRenderer = this;
156
+ Globals.theRenderer = this;
158157 }
159158
160159 CameraPane(Object3D o, Camera cam, boolean withcontext)
....@@ -191,6 +190,45 @@
191190 }
192191
193192 /// INTERFACE
193
+
194
+ public javax.media.opengl.GL GetGL0()
195
+ {
196
+ return null;
197
+ }
198
+
199
+ public int GenList()
200
+ {
201
+ javax.media.opengl.GL gl = GetGL();
202
+ return gl.glGenLists(1);
203
+ }
204
+
205
+ public void NewList(int id)
206
+ {
207
+ javax.media.opengl.GL gl = GetGL();
208
+ gl.glNewList(id, gl.GL_COMPILE); //_AND_EXECUTE);
209
+ }
210
+
211
+ public void CallList(int id)
212
+ {
213
+ javax.media.opengl.GL gl = GetGL();
214
+ gl.glCallList(id);
215
+ }
216
+
217
+ public void EndList()
218
+ {
219
+ javax.media.opengl.GL gl = GetGL();
220
+ gl.glEndList();
221
+ }
222
+
223
+ public boolean IsBoxMode()
224
+ {
225
+ return BOXMODE;
226
+ }
227
+
228
+ public boolean IsZoomBoxMode()
229
+ {
230
+ return ZOOMBOXMODE;
231
+ }
194232
195233 public void ClearDepth()
196234 {
....@@ -231,9 +269,14 @@
231269 return this.ambientOcclusion;
232270 }
233271
272
+ public boolean IsDebugSelection()
273
+ {
274
+ return DEBUG_SELECTION;
275
+ }
276
+
234277 public boolean IsFrozen()
235278 {
236
- boolean selectmode = this.DrawMode() == SELECTION || CameraPane.DEBUG_SELECTION;
279
+ boolean selectmode = this.DrawMode() == SELECTION || this.IsDebugSelection();
237280
238281 return !selectmode && cameracount == 0; // != 0;
239282 }
....@@ -254,9 +297,19 @@
254297 return lightCamera;
255298 }
256299
300
+ public Camera ManipCamera()
301
+ {
302
+ return manipCamera;
303
+ }
304
+
257305 public Camera RenderCamera()
258306 {
259307 return renderCamera;
308
+ }
309
+
310
+ public Camera[] Cameras()
311
+ {
312
+ return cameras;
260313 }
261314
262315 public void PushMaterial(Object3D obj, boolean selected)
....@@ -403,7 +456,7 @@
403456
404457 javax.media.opengl.GL gl = display.GetGL();
405458
406
- boolean selectmode = display.DrawMode() == display.SELECTION || CameraPane.DEBUG_SELECTION;
459
+ boolean selectmode = display.DrawMode() == display.SELECTION || display.IsDebugSelection();
407460
408461 //System.out.println("p = " + pv + "; q = " + qv + "; r = " + rv);
409462 if (!selectmode) // display.drawMode != display.SELECTION) // && display.drawMode != display.SHADOW) // (attributes & FILL) != 0)
....@@ -566,7 +619,810 @@
566619 }
567620 }
568621
622
+ /**
623
+ * <code>draw</code> renders a <code>TriMesh</code> object including
624
+ * it's normals, colors, textures and vertices.
625
+ *
626
+ * @see Renderer#draw(TriMesh)
627
+ * @param tris
628
+ * the mesh to render.
629
+ */
630
+ public void DrawParticles(TriMesh geo, Object3D shape, boolean selected, boolean rotate) // TriMesh tris)
631
+ {
632
+ CameraPane display = this;
633
+
634
+ float r = display.modelParams0[0];
635
+ float g = display.modelParams0[1];
636
+ float b = display.modelParams0[2];
637
+ float opacity = display.modelParams5[1];
638
+
639
+ //final GL gl = GLU.getCurrentGL();
640
+ GL gl = display.GetGL(); // getGL();
641
+
642
+ FloatBuffer vertBuf = geo.vertBuf;
643
+
644
+ int v = vertBuf.capacity();
645
+
646
+ int count = 0;
647
+
648
+ boolean cf = gl.glIsEnabled(gl.GL_CULL_FACE);
649
+ gl.glEnable(gl.GL_CULL_FACE);
650
+ // gl.glScalef(1.0f/1024,1.0f/1024,1.0f/1024);
651
+ for (int i=0; i<v/3; i++)
652
+ {
653
+ int index3 = i*3;
654
+
655
+ if (geo.sizeBuf.get(index3+1) == 0)
656
+ continue;
657
+
658
+ count++;
659
+
660
+ int index4 = i*4;
661
+
662
+ float tx = vertBuf.get(index3);
663
+ float ty = vertBuf.get(index3+1);
664
+ float tz = vertBuf.get(index3+2);
665
+
666
+ // if (tx == 0 && ty == 0 && tz == 0)
667
+ // continue;
668
+
669
+ gl.glMatrixMode(gl.GL_TEXTURE);
670
+ gl.glPushMatrix();
671
+
672
+ float[] texmat = geo.texmat;
673
+ texmat[12] = texmat[13] = texmat[14] = i;
674
+
675
+ gl.glMultMatrixf(texmat, 0);
676
+
677
+ gl.glMatrixMode(gl.GL_MODELVIEW);
678
+ gl.glPushMatrix();
679
+
680
+ gl.glTranslatef(tx,ty,tz);
681
+
682
+ if (rotate)
683
+ gl.glRotatef(i, 0, 1, 0);
684
+
685
+ float size = geo.sizeBuf.get(index3) / 100;
686
+ gl.glScalef(size,size,size);
687
+
688
+ float cr = geo.colorBuf.get(index4);
689
+ float cg = geo.colorBuf.get(index4+1);
690
+ float cb = geo.colorBuf.get(index4+2);
691
+ float ca = geo.colorBuf.get(index4+3);
692
+
693
+ display.modelParams0[0] = r * cr;
694
+ display.modelParams0[1] = g * cg;
695
+ display.modelParams0[2] = b * cb;
696
+
697
+ display.modelParams5[1] = opacity * ca;
698
+
699
+ gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 0, display.modelParams0, 0);
700
+ gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 5, display.modelParams5, 0);
701
+
702
+ RandomNode.globalseed = (int)geo.sizeBuf.get(index3+2); // i;
703
+ RandomNode.globalseed2 = RandomNode.globalseed;
704
+
705
+// gl.glColor4f(cr,cg,cb,ca);
706
+ // gl.glScalef(1024/16,1024/16,1024/16);
707
+ shape.Draw/*Node*/(display,null,selected,false); // blocked
708
+ // gl.glScalef(16.0f/1024,16.0f/1024,16.0f/1024);
709
+ //gl.glTranslatef(-tx,-ty,-tz);
710
+ gl.glPopMatrix();
711
+
712
+ gl.glMatrixMode(gl.GL_TEXTURE);
713
+ gl.glPopMatrix();
714
+ }
715
+ // gl.glScalef(1024,1024,1024);
716
+ if (!cf)
717
+ gl.glDisable(gl.GL_CULL_FACE);
718
+
719
+ display.modelParams0[0] = r;
720
+ display.modelParams0[1] = g;
721
+ display.modelParams0[2] = b;
722
+
723
+ display.modelParams5[1] = opacity;
724
+
725
+ gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 0, display.modelParams0, 0);
726
+ gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 5, display.modelParams5, 0);
727
+
728
+ gl.glMatrixMode(gl.GL_MODELVIEW);
729
+
730
+// System.err.println("total = " + v/3 + "; displayed = " + count);
731
+ if (true)
732
+ return;
733
+
734
+//// if (!tris.predraw(this))
735
+//// {
736
+//// return;
737
+//// }
738
+//// if (Debug.stats)
739
+//// {
740
+//// StatCollector.addStat(StatType.STAT_TRIANGLE_COUNT, tris.getTriangleCount());
741
+//// StatCollector.addStat(StatType.STAT_VERTEX_COUNT, tris.getVertexCount());
742
+//// StatCollector.addStat(StatType.STAT_GEOM_COUNT, 1);
743
+//// }
744
+////
745
+//// if (tris.getDisplayListID() != -1)
746
+//// {
747
+//// renderDisplayList(tris);
748
+//// return;
749
+//// }
750
+////
751
+//// if (!generatingDisplayList)
752
+//// {
753
+//// applyStates(tris.states, tris);
754
+//// }
755
+//// if (Debug.stats)
756
+//// {
757
+//// StatCollector.startStat(StatType.STAT_RENDER_TIMER);
758
+//// }
759
+//// boolean transformed = doTransforms(tris);
760
+//
761
+// int glMode = GL.GL_TRIANGLES;
762
+// switch (getMode())
763
+// {
764
+// case Triangles:
765
+// glMode = GL.GL_TRIANGLES;
766
+// break;
767
+// case Strip:
768
+// glMode = GL.GL_TRIANGLE_STRIP;
769
+// break;
770
+// case Fan:
771
+// glMode = GL.GL_TRIANGLE_FAN;
772
+// break;
773
+// }
774
+//
775
+// if (!predrawGeometry(gl))
776
+// {
777
+// // make sure only the necessary indices are sent through on old
778
+// // cards.
779
+// IntBuffer indices = this.getIndexBuffer();
780
+// if (indices == null)
781
+// {
782
+// logger.severe("missing indices on geometry object: " + this.toString());
783
+// } else
784
+// {
785
+// indices.rewind();
786
+// indices.limit(this.getMaxIndex());
787
+//
788
+// gl.glDrawElements(glMode, indices.limit(), GL.GL_UNSIGNED_INT, indices); // TODO Check <count> and assumed <type> of GL_UNSIGNED_INT
789
+//
790
+// indices.clear();
791
+// }
792
+// } else
793
+// {
794
+// gl.glDrawElements(glMode, this.getIndexBuffer().limit(),
795
+// GL.GL_UNSIGNED_INT, 0);
796
+// }
797
+//
798
+//// postdrawGeometry(tris);
799
+//// if (transformed)
800
+//// {
801
+//// undoTransforms(tris);
802
+//// }
803
+////
804
+//// if (Debug.stats)
805
+//// {
806
+//// StatCollector.endStat(StatType.STAT_RENDER_TIMER);
807
+//// }
808
+//// tris.postdraw(this);
809
+ }
810
+
811
+ static Camera localcamera = new Camera();
812
+ static cVector from = new cVector();
813
+ static cVector to = new cVector();
814
+
815
+ public void PrepOcclusion(BoundaryRep br, double[][] transform)
816
+ {
817
+ CameraPane cp = this;
818
+
819
+ Camera keep = cp.RenderCamera();
820
+ cp.renderCamera = localcamera;
821
+
822
+ if (br.trimmed)
823
+ {
824
+ float[] colors = new float[br.positions.length / 3];
825
+
826
+ int i3 = 0;
827
+ for (int i = 0; i < br.positions.length / 3; i++, i3 += 3)
828
+ {
829
+ if (br.normals[i3] == 0 && br.normals[i3+1] == 0 && br.normals[i3+2] == 0)
830
+ continue;
831
+
832
+ from.set(br.positions[i3], br.positions[i3 + 1], br.positions[i3 + 2]);
833
+ to.set(br.positions[i3] + br.normals[i3],
834
+ br.positions[i3 + 1] + br.normals[i3 + 1],
835
+ br.positions[i3 + 2] + br.normals[i3 + 2]);
836
+ LA.xformPos(from, transform, from);
837
+ LA.xformPos(to, transform, to); // RIGID ONLY
838
+ localcamera.setAim(from, to);
839
+
840
+ CameraPane.occlusionbuffer.display();
841
+
842
+ if (CameraPane.DEBUG_OCCLUSION)
843
+ cp.display(); // debug
844
+
845
+ colors[i] = cp.vertexOcclusion.r;
846
+ //colors[i3 + 1] = cp.vertexOcclusion.g;
847
+ //colors[i3 + 2] = cp.vertexOcclusion.b;
848
+
849
+ if ((i % 100) == 0 && i != 0)
850
+ {
851
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
852
+ //System.out.println("Color = " + cp.vertexOcclusion.r + ", " + cp.vertexOcclusion.g + ", " + cp.vertexOcclusion.b + "; " + (int)(100.0*i/(positions.length/3)) + "% done");
853
+ System.out.println((int) (100.0 * i / (br.positions.length / 3)) + "% (" + i + " of " + (br.positions.length / 3) + ")");
854
+ }
855
+ }
856
+
857
+ br.colors = colors;
858
+ }
859
+ else
860
+ {
861
+ for (int i = 0; i < br.VertexCount(); i++)
862
+ {
863
+ Vertex v = br.GetVertex(i);
864
+
865
+ if (v.norm == null || v.norm.x == 0 && v.norm.y == 0 && v.norm.z == 0)
866
+ continue;
867
+
868
+ from.set(v.x, v.y, v.z);
869
+ to.set(v.x+v.norm.x, v.y+v.norm.y, v.z+v.norm.z);
870
+ LA.xformPos(from, transform, from);
871
+ LA.xformPos(to, transform, to); // RIGID ONLY
872
+ localcamera.setAim(from, to);
873
+
874
+ CameraPane.occlusionbuffer.display();
875
+
876
+ if (CameraPane.DEBUG_OCCLUSION)
877
+ cp.display(); // debug
878
+
879
+ v.AO = cp.vertexOcclusion.r;
880
+
881
+ if ((i % 100) == 0 && i != 0)
882
+ {
883
+ Globals.theRenderer.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
884
+ //System.out.println("Color = " + cp.vertexOcclusion.r + ", " + cp.vertexOcclusion.g + ", " + cp.vertexOcclusion.b + "; " + (int)(100.0*i/(positions.length/3)) + "% done");
885
+ System.out.println((int) (100.0 * i / br.VertexCount()) + "% (" + i + " of " + br.VertexCount() + ")");
886
+ }
887
+ }
888
+ }
889
+
890
+ //System.out.println("done.");
891
+
892
+ cp.renderCamera = keep;
893
+ }
894
+
895
+ void DrawPointFLow(PointFlow pointFlow, Object3D /*Composite*/ root, boolean selected, boolean blocked)
896
+ {
897
+ CameraPane display = this;
898
+ pointFlow.CreateHT();
899
+
900
+ float r = display.modelParams0[0];
901
+ float g = display.modelParams0[1];
902
+ float b = display.modelParams0[2];
903
+ float opacity = display.modelParams5[1];
904
+
905
+ //final GL gl = GLU.getCurrentGL();
906
+ GL gl = display.GetGL(); // getGL();
907
+
908
+ int s = pointFlow.points.size();
909
+
910
+ boolean cf = gl.glIsEnabled(gl.GL_CULL_FACE);
911
+ gl.glEnable(gl.GL_CULL_FACE);
912
+
913
+ for (int i=s; --i>=0;)
914
+ //for (int i=0; i<s; i++)
915
+ {
916
+ cVector v = pointFlow.points.get(i);
917
+
918
+ double mindist = Double.MAX_VALUE;
919
+
920
+ double size = pointFlow.minimumSize;
921
+
922
+ double distancenext = 0;
923
+
924
+ if (i > 0)
925
+ {
926
+ cVector w = pointFlow.points.get(i-1);
927
+
928
+ double dist = w.distance(v);
929
+
930
+ distancenext = dist;
931
+
932
+ if (mindist > dist)
933
+ {
934
+ mindist = dist;
935
+ size = mindist*pointFlow.resizefactor;
936
+ }
937
+ }
938
+
939
+ if (i < s-1)
940
+ {
941
+ cVector w = pointFlow.points.get(i+1);
942
+
943
+ double dist = w.distance(v);
944
+
945
+ if (mindist > dist)
946
+ {
947
+ mindist = dist;
948
+ size = mindist*pointFlow.resizefactor;
949
+ }
950
+ }
951
+
952
+ if (size < pointFlow.minimumSize)
953
+ size = pointFlow.minimumSize;
954
+ if (size > pointFlow.maximumSize)
955
+ size = pointFlow.maximumSize;
956
+
957
+ double tx = v.x;
958
+ double ty = v.y;
959
+ double tz = v.z;
960
+
961
+ // if (tx == 0 && ty == 0 && tz == 0)
962
+ // continue;
963
+
964
+ gl.glMatrixMode(gl.GL_TEXTURE);
965
+ gl.glPushMatrix();
966
+ pointFlow.texmat[12] = pointFlow.texmat[13] = pointFlow.texmat[14] = i;
967
+
968
+ gl.glMultMatrixf(pointFlow.texmat, 0);
969
+
970
+ gl.glMatrixMode(gl.GL_MODELVIEW);
971
+ gl.glPushMatrix();
972
+
973
+ gl.glTranslated(tx,ty,tz);
974
+
975
+ gl.glScaled(size,size,size);
976
+
977
+// float cr = colorBuf.get(index4);
978
+// float cg = colorBuf.get(index4+1);
979
+// float cb = colorBuf.get(index4+2);
980
+// float ca = colorBuf.get(index4+3);
981
+//
982
+// display.modelParams0[0] = r * cr;
983
+// display.modelParams0[1] = g * cg;
984
+// display.modelParams0[2] = b * cb;
985
+//
986
+// display.modelParams5[1] = opacity * ca;
987
+//
988
+// gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 0, display.modelParams0, 0);
989
+// gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 5, display.modelParams5, 0);
990
+//
991
+// RandomNode.globalseed = (int)sizeBuf.get(index3+2); // i;
992
+// RandomNode.globalseed2 = RandomNode.globalseed;
993
+//
994
+//// gl.glColor4f(cr,cg,cb,ca);
995
+// // gl.glScalef(1024/16,1024/16,1024/16);
996
+ pointFlow.geo.Draw/*Node*/(display,null,selected, blocked);
997
+
998
+ gl.glPopMatrix();
999
+
1000
+ double step = size/4; //
1001
+
1002
+ if (i == 0 || size == 0 || distancenext > 8*size || distancenext < step)
1003
+ continue;
1004
+
1005
+ int nbsteps = (int)(distancenext/step);
1006
+
1007
+ step = distancenext/nbsteps;
1008
+
1009
+ cVector next = pointFlow.points.get(i-1);
1010
+
1011
+ tmp.set(next);
1012
+ tmp.sub(v);
1013
+ tmp.normalize();
1014
+ tmp.mul(step);
1015
+
1016
+ // calculate next size
1017
+ mindist = Double.MAX_VALUE;
1018
+
1019
+ double nextsize = pointFlow.minimumSize;
1020
+
1021
+ if (i > 1)
1022
+ {
1023
+ cVector w = pointFlow.points.get(i-2);
1024
+
1025
+ double dist = w.distance(next);
1026
+
1027
+ if (mindist > dist)
1028
+ {
1029
+ mindist = dist;
1030
+ nextsize = mindist*pointFlow.resizefactor;
1031
+ }
1032
+ }
1033
+
1034
+ double dist = v.distance(next);
1035
+
1036
+ if (mindist > dist)
1037
+ {
1038
+ mindist = dist;
1039
+ nextsize = mindist*pointFlow.resizefactor;
1040
+ }
1041
+
1042
+ if (nextsize < pointFlow.minimumSize)
1043
+ nextsize = pointFlow.minimumSize;
1044
+ if (nextsize > pointFlow.maximumSize)
1045
+ nextsize = pointFlow.maximumSize;
1046
+ //
1047
+
1048
+ double count = 0;
1049
+
1050
+ while (distancenext > 0.000000001) // step
1051
+ {
1052
+ gl.glPushMatrix();
1053
+
1054
+ gl.glTranslated(tx + tmp.x*count, ty + tmp.y*count, tz + tmp.z*count);
1055
+
1056
+ double K = count/nbsteps;
1057
+
1058
+ double intersize = K*nextsize + (1-K)*size;
1059
+
1060
+ gl.glScaled(intersize,intersize,intersize);
1061
+
1062
+ pointFlow.geo.Draw/*Node*/(display,null,selected,blocked);
1063
+
1064
+ count++;
1065
+
1066
+ distancenext -= step;
1067
+
1068
+ gl.glPopMatrix();
1069
+ }
1070
+
1071
+ if (count != nbsteps)
1072
+ assert(count == nbsteps);
1073
+
1074
+ // gl.glScalef(16.0f/1024,16.0f/1024,16.0f/1024);
1075
+ //gl.glTranslatef(-tx,-ty,-tz);
1076
+
1077
+ gl.glMatrixMode(gl.GL_TEXTURE);
1078
+ gl.glPopMatrix();
1079
+ }
1080
+
1081
+ if (!cf)
1082
+ gl.glDisable(gl.GL_CULL_FACE);
1083
+
1084
+// display.modelParams0[0] = r;
1085
+// display.modelParams0[1] = g;
1086
+// display.modelParams0[2] = b;
1087
+//
1088
+// display.modelParams5[1] = opacity;
1089
+//
1090
+// gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 0, display.modelParams0, 0);
1091
+// gl.glProgramEnvParameter4fvARB(gl.GL_FRAGMENT_PROGRAM_ARB, 5, display.modelParams5, 0);
1092
+
1093
+ gl.glMatrixMode(gl.GL_MODELVIEW);
1094
+ }
1095
+
1096
+ public void DrawBox(cVector min, cVector max)
1097
+ {
1098
+ javax.media.opengl.GL gl = GetGL();
1099
+ gl.glBegin(gl.GL_LINES);
1100
+
1101
+ gl.glVertex3d(min.x, min.y, min.z);
1102
+ gl.glVertex3d(min.x, min.y, max.z);
1103
+ gl.glVertex3d(min.x, min.y, min.z);
1104
+ gl.glVertex3d(min.x, max.y, min.z);
1105
+ gl.glVertex3d(min.x, min.y, min.z);
1106
+ gl.glVertex3d(max.x, min.y, min.z);
1107
+
1108
+ gl.glVertex3d(max.x, max.y, max.z);
1109
+ gl.glVertex3d(min.x, max.y, max.z);
1110
+ gl.glVertex3d(max.x, max.y, max.z);
1111
+ gl.glVertex3d(max.x, min.y, max.z);
1112
+ gl.glVertex3d(max.x, max.y, max.z);
1113
+ gl.glVertex3d(max.x, max.y, min.z);
1114
+
1115
+ gl.glEnd();
1116
+ }
1117
+
1118
+ public void DrawGeometry(BoundaryRep bRep, boolean flipV, boolean selectmode)
1119
+ {
1120
+ int[] strips = bRep.getRawIndices();
1121
+
1122
+ javax.media.opengl.GL gl = GetGL();
1123
+
1124
+ // TRIANGLE STRIP ARRAY
1125
+ if (bRep.trimmed)
1126
+ {
1127
+ float[] v = bRep.getRawVertices();
1128
+ float[] n = bRep.getRawNormals();
1129
+ float[] c = bRep.getRawColors();
1130
+ float[] uv = bRep.getRawUVMap();
1131
+
1132
+ int count2 = 0;
1133
+ int count3 = 0;
1134
+
1135
+ if (n.length > 0)
1136
+ {
1137
+ for (int i = 0; i < strips.length; i++)
1138
+ {
1139
+ gl.glBegin(gl.GL_TRIANGLE_STRIP);
1140
+
1141
+ /*
1142
+ boolean locked = false;
1143
+ float eps = 0.1f;
1144
+ boolean wrap = CameraPane.UVWRAP; // true; // UV WRAP TEXTURE ISSUE: true = artifacts, false = nice
1145
+
1146
+ int dot = 0;
1147
+
1148
+ if ((dot&1) == 0)
1149
+ dot |= (Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps) ? 3 : 1;
1150
+
1151
+ if (wrap || (dot&2) != 0) // Math.abs(qv.s - pv.s) < eps && Math.abs(qv.t - pv.t) < eps)
1152
+ gl.glTexCoord2f((float) qv.s, (float) qv.t);
1153
+ else
1154
+ {
1155
+ locked = true;
1156
+ gl.glTexCoord2f((float) pv.s, (float) pv.t);
1157
+ }
1158
+ //System.out.println("vertexq = " + qv.x + ", " + qv.y + ", " + qv.z);
1159
+ gl.glVertex3f((float) qv.x, (float) qv.y, (float) qv.z);
1160
+ if (hasnorm)
1161
+ {
1162
+ //System.out.println("normalr = " + rv.norm.x + ", " + rv.norm.y + ", " + rv.norm.z);
1163
+ gl.glNormal3f((float) rv.norm.x, (float) rv.norm.y, (float) rv.norm.z);
1164
+ }
1165
+
1166
+ if ((dot&4) == 0)
1167
+ dot |= (Math.abs(rv.s - pv.s) < eps && Math.abs(rv.t - pv.t) < eps) ? 12 : 4;
1168
+
1169
+ if (wrap || !locked && (dot&8) != 0)
1170
+ gl.glTexCoord2f((float) rv.s, (float) rv.t);
1171
+ else
1172
+ gl.glTexCoord2f((float) pv.s, (float) pv.t);
1173
+
1174
+ f.dot = dot;
1175
+ */
1176
+
1177
+ if (!selectmode)
1178
+ {
1179
+ if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
1180
+ {
1181
+ gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
1182
+ } else
1183
+ {
1184
+ gl.glNormal3f(0, 0, 1);
1185
+ }
1186
+
1187
+ if (c != null)
1188
+ //System.out.println("glcolor = " + c[count3] + ", " + c[count3+1] + ", " + c[count3+2]);
1189
+ {
1190
+ gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
1191
+ }
1192
+ }
1193
+ if (flipV)
1194
+ gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
1195
+ else
1196
+ gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
1197
+ //System.out.println("vertex1 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]);
1198
+ gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
1199
+
1200
+ count2 += 2;
1201
+ count3 += 3;
1202
+ if (!selectmode)
1203
+ {
1204
+ if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
1205
+ {
1206
+ gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
1207
+ } else
1208
+ {
1209
+ gl.glNormal3f(0, 0, 1);
1210
+ }
1211
+ if (c != null)
1212
+ {
1213
+ gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
1214
+ }
1215
+ }
1216
+ if (flipV)
1217
+ gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
1218
+ else
1219
+ gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
1220
+ //System.out.println("vertex2 = " + v[count3] + ", " + v[count3+1] + ", " + v[count3+2]);
1221
+ gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
1222
+
1223
+ count2 += 2;
1224
+ count3 += 3;
1225
+ for (int j = 0; j < strips[i] - 2; j++)
1226
+ {
1227
+ //gl.glTexCoord2d(...);
1228
+ if (!selectmode)
1229
+ {
1230
+ if (n[count3] != 0 || n[count3 + 1] != 0 || n[count3 + 2] != 0)
1231
+ {
1232
+ gl.glNormal3f(n[count3], n[count3 + 1], n[count3 + 2]);
1233
+ } else
1234
+ {
1235
+ gl.glNormal3f(0, 0, 1);
1236
+ }
1237
+ if (c != null)
1238
+ {
1239
+ gl.glColor4f(c[count3/3], c[count3/3 /* + 1*/], c[count3/3 /* + 2*/], 1);
1240
+ }
1241
+ }
1242
+
1243
+ if (flipV)
1244
+ gl.glTexCoord2f(uv[count2], 1-uv[count2 + 1]);
1245
+ else
1246
+ gl.glTexCoord2f(uv[count2], uv[count2 + 1]);
1247
+ //System.out.println("coord3 = " + uv[count2] + ", " + uv[count2+1]);
1248
+ gl.glVertex3f(v[count3], v[count3 + 1], v[count3 + 2]);
1249
+ count2 += 2;
1250
+ count3 += 3;
1251
+ }
1252
+
1253
+ gl.glEnd();
1254
+ }
1255
+ }
1256
+
1257
+ assert count3 == v.length;
1258
+ }
1259
+ else // !trimmed
1260
+ {
1261
+ int count = 0;
1262
+ for (int i = 0; i < strips.length; i++)
1263
+ {
1264
+ gl.glBegin(gl.GL_TRIANGLE_STRIP);
1265
+
1266
+ Vertex p = bRep.GetVertex(bRep.indices[count++]);
1267
+ Vertex q = bRep.GetVertex(bRep.indices[count++]);
1268
+
1269
+ drawVertex(gl, p, flipV, selectmode);
1270
+ drawVertex(gl, q, flipV, selectmode);
1271
+
1272
+ for (int j = 0; j < strips[i] - 2; j++)
1273
+ {
1274
+ Vertex r = bRep.GetVertex(bRep.indices[count++]);
1275
+
1276
+ // if (j%2 == 0)
1277
+ // drawFace(p, q, r, display, null);
1278
+ // else
1279
+ // drawFace(p, r, q, display, null);
1280
+
1281
+ // p = q;
1282
+ // q = r;
1283
+ drawVertex(gl, r, flipV, selectmode);
1284
+ }
1285
+
1286
+ gl.glEnd();
1287
+ }
1288
+ }
1289
+ }
1290
+
1291
+ static cSpring.Point3D temp = new cSpring.Point3D();
1292
+ static cSpring.Point3D temp2 = new cSpring.Point3D();
1293
+ static cSpring.Point3D temp3 = new cSpring.Point3D();
1294
+
1295
+ public void DrawDynamicMesh(cMesh mesh)
1296
+ {
1297
+ GL gl = GetGL(); // getGL();
1298
+
1299
+ cSpring.PhysicsController3D Phys = mesh.Phys;
1300
+
1301
+ gl.glDisable(gl.GL_LIGHTING);
1302
+
1303
+ gl.glLineWidth(1);
1304
+ gl.glColor3f(1,1,1);
1305
+ gl.glBegin(gl.GL_LINES);
1306
+ double scale = 0;
1307
+ int count = 0;
1308
+ for (int s=0; s<Phys.allSprings.size(); s++)
1309
+ {
1310
+ cSpring.Spring spring = Phys.allSprings.get(s);
1311
+ if(s == 0)
1312
+ {
1313
+ //System.out.println(" spring : " + spring.a.position + "; " + spring.b.position);
1314
+ }
1315
+ if (mesh.showsprings)
1316
+ {
1317
+ temp.set(spring.a.position);
1318
+ temp.add(spring.b.position);
1319
+ temp.mul(0.5);
1320
+ temp2.set(spring.a.position);
1321
+ temp2.sub(spring.b.position);
1322
+ temp2.mul(spring.restLength/2);
1323
+ temp.sub(temp2);
1324
+ gl.glVertex3f((float)temp.x, (float)temp.y, (float)temp.z);
1325
+ temp.add(temp2);
1326
+ temp.add(temp2);
1327
+ gl.glVertex3f((float)temp.x, (float)temp.y, (float)temp.z);
1328
+ }
1329
+
1330
+ if (spring.isHandle)
1331
+ continue;
1332
+
1333
+ //if (scale < spring.restLength)
1334
+ scale += spring.restLength;
1335
+ count++;
1336
+ }
1337
+ gl.glEnd();
1338
+
1339
+ if (count == 0)
1340
+ scale = 0.01;
1341
+ else
1342
+ scale /= count * 3;
1343
+
1344
+ //scale = 0.25;
1345
+
1346
+ if (mesh.ShowInfo())
1347
+ {
1348
+ gl.glLineWidth(4);
1349
+ for (int s=0; s<Phys.allNodes.size(); s++)
1350
+ {
1351
+ cSpring.DynamicNode node = Phys.allNodes.get(s);
1352
+ if (node.mass == 0)
1353
+ continue;
1354
+
1355
+ int i = node.springs==null?-1:node.springs.size();
1356
+ gl.glColor3f((i>>2)&1,(i>>1)&1,i&1);
1357
+ //temp.set(node.springForce.x, node.springForce.y, node.springForce.z);
1358
+ //temp.normalize();
1359
+ //gl.glColor3d((temp.x+1)/2, (temp.y+1)/2, (temp.z+1)/2);
1360
+ gl.glBegin(gl.GL_LINES);
1361
+ gl.glVertex3d(node.position.x, node.position.y, node.position.z);
1362
+ //gl.glVertex3d(node.position.x + node.normal.x*scale, node.position.y + node.normal.y*scale, node.position.z + node.normal.z*scale);
1363
+ gl.glVertex3d(node.position.x + mesh.bRep.GetVertex(s).norm.x*scale,
1364
+ node.position.y + mesh.bRep.GetVertex(s).norm.y*scale,
1365
+ node.position.z + mesh.bRep.GetVertex(s).norm.z*scale);
1366
+ gl.glEnd();
1367
+ }
1368
+
1369
+ gl.glLineWidth(8);
1370
+ for (int s=0; s<Phys.allNodes.size(); s++)
1371
+ {
1372
+ cSpring.DynamicNode node = Phys.allNodes.get(s);
1373
+
1374
+ if (node.springs != null)
1375
+ {
1376
+ for (int i=0; i<node.springs.size(); i+=1)
1377
+ {
1378
+ cSpring.DynamicNode f = node.springs.get(i).GetOther(node);
1379
+
1380
+ int c = i+1;
1381
+ // c = node.springs.get(i).nbcopies;
1382
+
1383
+ gl.glColor3f((c>>2)&1,(c>>1)&1,c&1);
1384
+ gl.glBegin(gl.GL_LINES);
1385
+ gl.glVertex3d(node.position.x, node.position.y, node.position.z);
1386
+ gl.glVertex3d(f.position.x/3+node.position.x*2/3, f.position.y/3+node.position.y*2/3, f.position.z/3+node.position.z*2/3);
1387
+ gl.glEnd();
1388
+ }
1389
+ }
1390
+ }
1391
+
1392
+ gl.glLineWidth(1);
1393
+ }
1394
+
1395
+ gl.glEnable(gl.GL_LIGHTING);
1396
+ }
1397
+
5691398 /// INTERFACE
1399
+
1400
+ public void StartTriangles()
1401
+ {
1402
+ javax.media.opengl.GL gl = GetGL();
1403
+ gl.glBegin(gl.GL_TRIANGLES);
1404
+ }
1405
+
1406
+ public void EndTriangles()
1407
+ {
1408
+ GetGL().glEnd();
1409
+ }
1410
+
1411
+ void drawVertex(javax.media.opengl.GL gl, Vertex pv, boolean flipV, boolean selectmode)
1412
+ {
1413
+ if (!selectmode)
1414
+ {
1415
+ gl.glNormal3f((float) pv.norm.x, (float) pv.norm.y, (float) pv.norm.z);
1416
+ gl.glColor4f(pv.AO, pv.AO, pv.AO, 1);
1417
+
1418
+ if (flipV)
1419
+ gl.glTexCoord2f((float) pv.s, 1-(float) pv.t);
1420
+ else
1421
+ gl.glTexCoord2f((float) pv.s, (float) pv.t);
1422
+ }
1423
+
1424
+ gl.glVertex3f((float) pv.x, (float) pv.y, (float) pv.z);
1425
+ }
5701426
5711427 void SetColor(Object3D obj, Vertex p0)
5721428 {
....@@ -761,18 +1617,18 @@
7611617 //col.getColorComponents(ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB), CameraPane.modelParams0);
7621618 if (!material.multiply)
7631619 {
764
- display.color = color;
1620
+ display.color = material.color;
7651621 display.saturation = material.modulation;
7661622 }
7671623 else
7681624 {
769
- display.color *= color*2;
1625
+ display.color *= material.color*2;
7701626 display.saturation *= material.modulation*2;
7711627 }
7721628
7731629 cColor.HSBtoRGB(display.color, display.saturation, 1, display.modelParams0);
7741630
775
- float[] colorV = GrafreeD.colorV;
1631
+ float[] colorV = Grafreed.colorV;
7761632
7771633 /**/
7781634 if (display.DrawMode() == display.DEFAULT) // && display.RENDERPROGRAM == 0)
....@@ -1129,7 +1985,7 @@
11291985
11301986 static int camerachangeframe;
11311987
1132
- boolean SetCamera(Camera cam)
1988
+ public boolean SetCamera(Camera cam)
11331989 {
11341990 // may 2014 if (cam == cameras[0] || cam == cameras[1])
11351991 // return false;
....@@ -1257,33 +2113,6 @@
12572113 mainDL ^= true;
12582114 }
12592115
1260
- void ToggleTexture()
1261
- {
1262
- textureon ^= true;
1263
- }
1264
-
1265
- void ToggleLive()
1266
- {
1267
- Globals.setLIVE(Globals.isLIVE() ^ true);
1268
-
1269
- System.err.println("LIVE = " + Globals.isLIVE());
1270
-
1271
- if (!Globals.isLIVE()) // save sound
1272
- GrafreeD.savesound = true; // wav.save();
1273
- // else
1274
- repaint(); // start loop // may 2013
1275
- }
1276
-
1277
- void ToggleSupport()
1278
- {
1279
- SUPPORT ^= true;
1280
- }
1281
-
1282
- void ToggleAbort()
1283
- {
1284
- ABORTMODE ^= true;
1285
- }
1286
-
12872116 void ToggleFullScreen()
12882117 {
12892118 FULLSCREEN ^= true;
....@@ -1294,72 +2123,94 @@
12942123 Globals.CROWD ^= true;
12952124 }
12962125
1297
- void ToggleInertia()
1298
- {
1299
- INERTIA ^= true;
1300
- }
1301
-
13022126 void ToggleLocal()
13032127 {
13042128 LOCALTRANSFORM ^= true;
13052129 }
13062130
1307
- void ToggleFast()
2131
+ public void ToggleTexture()
2132
+ {
2133
+ textureon ^= true;
2134
+ }
2135
+
2136
+ public void ToggleLive()
2137
+ {
2138
+ Globals.setLIVE(Globals.isLIVE() ^ true);
2139
+
2140
+ System.err.println("LIVE = " + Globals.isLIVE());
2141
+
2142
+ if (!Globals.isLIVE()) // save sound
2143
+ Grafreed.savesound = true; // wav.save();
2144
+ // else
2145
+ repaint(); // start loop // may 2013
2146
+ }
2147
+
2148
+ public void ToggleSupport()
2149
+ {
2150
+ SUPPORT ^= true;
2151
+ }
2152
+
2153
+ public void ToggleAbort()
2154
+ {
2155
+ ABORTMODE ^= true;
2156
+ }
2157
+
2158
+ public void ToggleInertia()
2159
+ {
2160
+ INERTIA ^= true;
2161
+ }
2162
+
2163
+ public void ToggleFast()
13082164 {
13092165 FAST ^= true;
13102166 }
13112167
1312
- void ToggleSlowPose()
2168
+ public void ToggleSlowPose()
13132169 {
13142170 SLOWPOSE ^= true;
13152171 }
13162172
1317
- void ToggleFootContact()
1318
- {
1319
- FOOTCONTACT ^= true;
1320
- }
1321
-
1322
- void ToggleBoxMode()
2173
+ public void ToggleBoxMode()
13232174 {
13242175 BOXMODE ^= true;
13252176 }
13262177
1327
- void ToggleSmoothFocus()
2178
+ public void ToggleZoomBoxMode()
2179
+ {
2180
+ ZOOMBOXMODE ^= true;
2181
+ }
2182
+
2183
+ public void ToggleSmoothFocus()
13282184 {
13292185 SMOOTHFOCUS ^= true;
13302186 }
13312187
1332
- void ToggleImageFlip()
2188
+ public void ToggleImageFlip()
13332189 {
13342190 IMAGEFLIP ^= true;
13352191 }
13362192
1337
- void ToggleSpeakerMocap()
2193
+ public void ToggleSpeakerMocap()
13382194 {
13392195 SPEAKERMOCAP ^= true;
13402196 }
13412197
1342
- void ToggleSpeakerCamera()
2198
+ public void ToggleSpeakerCamera()
13432199 {
13442200 SPEAKERCAMERA ^= true;
13452201 }
13462202
1347
- void ToggleSpeakerFocus()
2203
+ public void ToggleSpeakerFocus()
13482204 {
13492205 SPEAKERFOCUS ^= true;
13502206 }
13512207
1352
- void ToggleDebug()
1353
- {
1354
- DEBUG ^= true;
1355
- }
1356
-
1357
- void ToggleFrustum()
2208
+ public void ToggleFrustum()
13582209 {
13592210 FRUSTUM ^= true;
13602211 }
13612212
1362
- void ToggleTrack()
2213
+ public void ToggleTrack()
13632214 {
13642215 TRACK ^= true;
13652216 if (TRACK)
....@@ -1378,25 +2229,35 @@
13782229 repaint();
13792230 }
13802231
1381
- void ToggleTrackOnce()
2232
+ public void ToggleTrackOnce()
13822233 {
13832234 TRACKONCE ^= true;
13842235 }
13852236
1386
- void ToggleShadowTrack()
2237
+ public void ToggleShadowTrack()
13872238 {
13882239 SHADOWTRACK ^= true;
13892240 repaint();
13902241 }
13912242
1392
- void ToggleOeil()
2243
+ public void ToggleOeil()
13932244 {
13942245 OEIL ^= true;
13952246 }
13962247
1397
- void ToggleOeilOnce()
2248
+ public void ToggleOeilOnce()
13982249 {
13992250 OEILONCE ^= true;
2251
+ }
2252
+
2253
+ void ToggleFootContact()
2254
+ {
2255
+ FOOTCONTACT ^= true;
2256
+ }
2257
+
2258
+ void ToggleDebug()
2259
+ {
2260
+ DEBUG ^= true;
14002261 }
14012262
14022263 void ToggleLookAt()
....@@ -1406,7 +2267,7 @@
14062267
14072268 void ToggleRandom()
14082269 {
1409
- RANDOM ^= true;
2270
+ SWITCH ^= true;
14102271 }
14112272
14122273 void ToggleHandles()
....@@ -3345,6 +4206,7 @@
33454206
33464207 com.sun.opengl.util.texture.Texture CompressTexture2(String name)
33474208 {
4209
+ new Exception().printStackTrace();
33484210 System.exit(0);
33494211 com.sun.opengl.util.texture.Texture texture = null;
33504212
....@@ -7160,7 +8022,7 @@
71608022 }
71618023 }
71628024
7163
- /*boolean*/ public void BindTextures(cTexture tex, int resolution) // INTERFACE
8025
+ /*boolean*/ public void BindTextures(cTexture tex, int resolution) throws Exception // INTERFACE
71648026 {
71658027 if (// DrawMode() != 0 || /*tex == null ||*/
71668028 ambientOcclusion ) // || !textureon)
....@@ -7205,7 +8067,7 @@
72058067 return; // true;
72068068 }
72078069
7208
- CacheTexture GetCacheTexture(String tex, boolean bump, int resolution)
8070
+ CacheTexture GetCacheTexture(String tex, boolean bump, int resolution) throws Exception
72098071 {
72108072 CacheTexture/*com.sun.opengl.util.texture.Texture*/ texture = null;
72118073
....@@ -7213,12 +8075,16 @@
72138075 {
72148076 String texname = tex;
72158077
7216
- String[] split = tex.split("Textures");
7217
- if (split.length > 1)
7218
- texname = "/Users/nbriere/Textures" + split[split.length-1];
7219
- else
7220
- if (!texname.startsWith("/"))
7221
- texname = "/Users/nbriere/Textures/" + texname;
8078
+// String[] split = tex.split("Textures");
8079
+// if (split.length > 1)
8080
+// texname = "/Users/nbriere/Textures" + split[split.length-1];
8081
+// else
8082
+// if (!texname.startsWith("/"))
8083
+// texname = "/Users/nbriere/Textures/" + texname;
8084
+ if (!new File(tex).exists())
8085
+ {
8086
+ texname = javax.swing.filechooser.FileSystemView.getFileSystemView().getDefaultDirectory() + "/Textures/" + texname;
8087
+ }
72228088
72238089 if (CACHETEXTURE)
72248090 texture = textures.get(texname); // TEXTURE CACHE
....@@ -7318,7 +8184,9 @@
73188184 texturedata = GetFileTexture(cachename, processbump, resolution);
73198185
73208186
7321
- if (texturedata != null)
8187
+ if (texturedata == null)
8188
+ throw new Exception();
8189
+
73228190 texture = new CacheTexture(com.sun.opengl.util.texture.TextureIO.newTexture(texturedata),resolution);
73238191 //texture = GetTexture(tex, bump);
73248192 }
....@@ -7440,7 +8308,7 @@
74408308 return texture;
74418309 }
74428310
7443
- com.sun.opengl.util.texture.Texture GetTexture(String tex, boolean bump, int resolution)
8311
+ com.sun.opengl.util.texture.Texture GetTexture(String tex, boolean bump, int resolution) throws Exception
74448312 {
74458313 CacheTexture texture = GetCacheTexture(tex, bump, resolution);
74468314
....@@ -7458,14 +8326,14 @@
74588326 return texture!=null?texture.texture:null;
74598327 }
74608328
7461
- com.sun.opengl.util.texture.TextureData GetTextureData(String tex, boolean bump, int resolution)
8329
+ public com.sun.opengl.util.texture.TextureData GetTextureData(String tex, boolean bump, int resolution) throws Exception
74628330 {
74638331 CacheTexture texture = GetCacheTexture(tex, bump, resolution);
74648332
74658333 return texture!=null?texture.texturedata:null;
74668334 }
74678335
7468
- boolean BindTexture(String tex, boolean bump, int resolution)
8336
+ boolean BindTexture(String tex, boolean bump, int resolution) throws Exception
74698337 {
74708338 if (/*tex == null ||*/ ambientOcclusion ) // || !textureon)
74718339 {
....@@ -8531,7 +9399,7 @@
85319399 //gl.glFlush();
85329400 gl.glAccum(gl.GL_ACCUM, 1.0f / ACSIZE);
85339401
8534
- if (ANIMATION && ABORTED)
9402
+ if (Globals.ANIMATION && ABORTED)
85359403 {
85369404 System.err.println(" ABORTED FRAME");
85379405 break;
....@@ -8561,7 +9429,7 @@
85619429 setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
85629430
85639431 // save image
8564
- if (ANIMATION && !ABORTED)
9432
+ if (Globals.ANIMATION && !ABORTED)
85659433 {
85669434 VPwidth = viewport[2];
85679435 VPheight = viewport[3];
....@@ -8672,11 +9540,11 @@
86729540
86739541 // imagecount++;
86749542
8675
- String fullname = filename + (i%100000)/10000 + "" + (i%10000)/1000 + "" + (i%1000)/100 + "" + (i%100)/10 + "" + (i%10) + "." + ext;
9543
+ String fullname = Globals.filename + (i%100000)/10000 + "" + (i%10000)/1000 + "" + (i%1000)/100 + "" + (i%100)/10 + "" + (i%10) + "." + ext;
86769544
86779545 if (!BOXMODE)
86789546 {
8679
- System.out.println("image: " + fullname + " (wav cursor=" + (GrafreeD.wav.cursor / 735 / 4) + ")");
9547
+ System.out.println("image: " + fullname + " (wav cursor=" + (Grafreed.wav.cursor / 735 / 4) + ")");
86809548 }
86819549
86829550 if (!BOXMODE)
....@@ -8714,7 +9582,7 @@
87149582 ABORTED = false;
87159583 }
87169584 else
8717
- GrafreeD.wav.cursor += 735 * ACSIZE;
9585
+ Grafreed.wav.cursor += 735 * ACSIZE;
87189586
87199587 if (false)
87209588 {
....@@ -9377,11 +10245,11 @@
937710245
937810246 public void display(GLAutoDrawable drawable)
937910247 {
9380
- if (GrafreeD.savesound && GrafreeD.hassound)
10248
+ if (Grafreed.savesound && Grafreed.hassound)
938110249 {
9382
- GrafreeD.wav.save();
9383
- GrafreeD.savesound = false;
9384
- GrafreeD.hassound = false;
10250
+ Grafreed.wav.save();
10251
+ Grafreed.savesound = false;
10252
+ Grafreed.hassound = false;
938510253 }
938610254 // if (DEBUG_SELECTION)
938710255 // {
....@@ -9511,7 +10379,7 @@
951110379 Object3D theobject = object;
951210380 Object3D theparent = object.parent;
951310381 object.parent = null;
9514
- object = (Object3D)GrafreeD.clone(object);
10382
+ object = (Object3D)Grafreed.clone(object);
951510383 object.Stripify();
951610384 if (theobject.selection == null || theobject.selection.Size() == 0)
951710385 theobject.PreprocessOcclusion(this);
....@@ -9932,7 +10800,16 @@
993210800 // Bump noise
993310801 gl.glActiveTexture(GL.GL_TEXTURE6);
993410802 //gl.glBindTexture(GL.GL_TEXTURE_2D, bump_noise);
9935
- BindTexture(NOISE_TEXTURE, false, 2);
10803
+
10804
+ try
10805
+ {
10806
+ BindTexture(NOISE_TEXTURE, false, 2);
10807
+ }
10808
+ catch (Exception e)
10809
+ {
10810
+ System.err.println("FAILED: " + NOISE_TEXTURE);
10811
+ }
10812
+
993610813
993710814 gl.glActiveTexture(GL.GL_TEXTURE0);
993810815 gl.glEnable(GL.GL_TEXTURE_2D);
....@@ -10146,7 +11023,7 @@
1014611023 fragmentMode |= (lightslot - 64) << 2; // 1; // first bit is available for aniso
1014711024 //System.out.println("fragmentMode = " + fragmentMode);
1014811025
10149
- if (DrawMode() == DEFAULT || DrawMode() == SELECTION || DEBUG_SELECTION)
11026
+ if (DrawMode() == DEFAULT || DrawMode() == SELECTION || IsDebugSelection())
1015011027 {
1015111028 /*
1015211029 if (CULLFACE || (ambientOcclusion && OCCLUSION_CULLING))
....@@ -10396,8 +11273,14 @@
1039611273 {
1039711274 renderpass++;
1039811275 // System.out.println("Draw object... ");
11276
+ STEP = 1;
1039911277 if (FAST) // in case there is no script
10400
- STEP = 16;
11278
+ STEP = 8;
11279
+
11280
+ if (CURRENTANTIALIAS == 0 || ACSIZE == 1)
11281
+ {
11282
+ STEP *= 4;
11283
+ }
1040111284
1040211285 //object.FullInvariants();
1040311286
....@@ -10411,8 +11294,8 @@
1041111294 e.printStackTrace();
1041211295 }
1041311296
10414
- if (GrafreeD.RENDERME > 0)
10415
- GrafreeD.RENDERME--; // mechante magouille
11297
+ if (Grafreed.RENDERME > 0)
11298
+ Grafreed.RENDERME--; // mechante magouille
1041611299
1041711300 Globals.ONESTEP = false;
1041811301 }
....@@ -10447,7 +11330,7 @@
1044711330 callist = gl.glGenLists(1);
1044811331 }
1044911332
10450
- boolean selectmode = DrawMode() == SELECTION || CameraPane.DEBUG_SELECTION;
11333
+ boolean selectmode = DrawMode() == SELECTION || IsDebugSelection();
1045111334
1045211335 boolean active = !selectmode; // DrawMode() != SELECTION; // mouseDown;
1045311336
....@@ -10482,7 +11365,14 @@
1048211365
1048311366 usedtextures.clear();
1048411367
10485
- BindTextures(DEFAULT_TEXTURES, 2);
11368
+ try
11369
+ {
11370
+ BindTextures(DEFAULT_TEXTURES, 2);
11371
+ }
11372
+ catch (Exception e)
11373
+ {
11374
+ System.err.println("FAILED: " + DEFAULT_TEXTURES);
11375
+ }
1048611376 }
1048711377 //System.out.println("--> " + stackdepth);
1048811378 // GrafreeD.traceon();
....@@ -10573,7 +11463,14 @@
1057311463 if (checker != null && DrawMode() == DEFAULT)
1057411464 {
1057511465 //BindTexture(IMMORTAL_TEXTURE);
10576
- BindTextures(checker.GetTextures(), checker.texres);
11466
+ try
11467
+ {
11468
+ BindTextures(checker.GetTextures(), checker.texres);
11469
+ }
11470
+ catch (Exception e)
11471
+ {
11472
+ System.err.println("FAILED: " + checker.GetTextures());
11473
+ }
1057711474 // NEAREST
1057811475 GetGL().glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); // GL.GL_LINEAR);
1057911476 DrawChecker(gl);
....@@ -11605,8 +12502,8 @@
1160512502
1160612503 // display shadow only (bump == 0)
1160712504 "SUB temp.x, half.x, shadow.x;" +
11608
- "MOV temp.y, -params6.x;" +
11609
- "SLT temp.z, temp.y, zero.x;" +
12505
+ "MOV temp.y, -params5.z;" + // params6.x;" +
12506
+ "SLT temp.z, temp.y, -one2048th.x;" +
1161012507 "SUB temp.y, one.x, temp.z;" +
1161112508 "MUL temp.x, temp.x, temp.y;" +
1161212509 "KIL temp.x;" +
....@@ -11735,8 +12632,10 @@
1173512632 "MAX ndotl.x, ndotl.x, -ndotl.x;" +
1173612633
1173712634 "SUB temp.x, one.x, ndotl.x;" +
11738
- "ADD temp.x, temp.x, options2.z;" + // lightsheen
11739
- "ADD temp.y, one.y, options2.y;" + // sursurface
12635
+ // Tuning for default skin
12636
+ //"ADD temp.x, temp.x, options2.z;" + // lightsheen
12637
+ "MAD temp.x, options2.z, half.y, temp.x;" + // lightsheen
12638
+ "ADD temp.y, one.y, options2.y;" + // subsurface
1174012639 "MUL temp.x, temp.x, temp.y;" +
1174112640
1174212641 "MUL saturation, saturation, temp.xxxx;" +
....@@ -11935,7 +12834,7 @@
1193512834 //once = true;
1193612835 }
1193712836
11938
- System.out.print("Program #" + mode + "; length = " + program.length());
12837
+ System.out.print("Program #" + mode + "; instructions = " + program.split(";").length + "; length = " + program.length());
1193912838 System.out.println(" - " + (mode >> 3) + " lights; " + ((mode & 2) == 2 ? "anisoUV " : "") + ((mode & 4) == 4 ? "SoftShadow " : ""));
1194012839 loadProgram(gl, GL.GL_FRAGMENT_PROGRAM_ARB, program);
1194112840
....@@ -12068,12 +12967,16 @@
1206812967
1206912968 "ADD " + depth + ".z, " + depth + ".z, temp.x;" +
1207012969 //"SUB " + depth + ".z, " + depth + ".z, temp.x;" + // back face shadowing!
12970
+
12971
+ // Compare fragment depth in light space with shadowmap.
1207112972 "SUB temp.x, fragment.texcoord[1].z, " + depth + ".z;" +
1207212973 "SGE temp.y, temp.x, zero.x;" +
12073
- "SUB " + shadow + ".y, one.x, temp.y;" +
12974
+ "SUB " + shadow + ".y, one.x, temp.y;" + // Specular is fully occluded
12975
+
12976
+ // Reverse comparison
1207412977 "SUB temp.x, one.x, temp.x;" +
1207512978 "MUL " + shadow + ".x, temp.x, temp.y;" +
12076
- "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // specular is fully occluded
12979
+ "SUB " + shadow + ".x, one.x, " + shadow + ".x;" + // diffuse
1207712980 "POW " + shadow + ".x, " + shadow + ".x, params5.z;" + // fake depth
1207812981
1207912982 "SLT " + shadow + ".z, fragment.texcoord[1].z, " + depth + ".z;" +
....@@ -12087,6 +12990,10 @@
1208712990 // No shadow for backface
1208812991 "DP3 temp.x, normal, lightd;" +
1208912992 "SLT temp.x, temp.x, zero.x;" + // shadoweps
12993
+ "LRP " + shadow + ", temp.x, one, " + shadow + ";" +
12994
+
12995
+ // No shadow when out of frustrum
12996
+ "SGE temp.x, " + depth + ".z, one.z;" +
1209012997 "LRP " + shadow + ", temp.x, one, " + shadow + ";" +
1209112998 "";
1209212999 }
....@@ -12645,7 +13552,7 @@
1264513552 public void mousePressed(MouseEvent e)
1264613553 {
1264713554 //System.out.println("mousePressed: " + e);
12648
- clickStart(e.getX(), e.getY(), e.getModifiersEx());
13555
+ clickStart(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1264913556 }
1265013557
1265113558 static long prevtime = 0;
....@@ -12672,6 +13579,7 @@
1267213579
1267313580 //System.err.println("Dtime = " + Dtime + "; units = " + e.getUnitsToScroll() + "; ratio (units/ms) = " + ratio);
1267413581
13582
+ if (BUTTONLESSWHEEL)
1267513583 if (Math.abs(ratio) < 0.1 || Math.abs(Dtime) == 0) // < 30)
1267613584 {
1267713585 return;
....@@ -12680,7 +13588,7 @@
1268013588 boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK);
1268113589
1268213590 // TIMER
12683
- if (!wheeltimer.isRunning() && e.getModifiersEx() == 0 && !capsLocked) // VR
13591
+ if (ZOOMBOXMODE && !wheeltimer.isRunning() && e.getModifiersEx() == 0 && !capsLocked) // VR
1268413592 {
1268513593 keepboxmode = BOXMODE;
1268613594 keepsupport = SUPPORT;
....@@ -12720,8 +13628,8 @@
1272013628 // mode |= META;
1272113629 //}
1272213630
12723
- SetMouseMode(WHEEL | e.getModifiersEx());
12724
- drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0);
13631
+ SetMouseMode(e.getModifiers(), WHEEL | e.getModifiersEx());
13632
+ drag(anchorX, anchorY + e.getUnitsToScroll()*8, 0, 0);
1272513633 anchorX = ax;
1272613634 anchorY = ay;
1272713635 prevX = px;
....@@ -12781,6 +13689,10 @@
1278113689 // wasliveok = true;
1278213690 // waslive = false;
1278313691
13692
+ // May 2019 Forget it:
13693
+ if (true)
13694
+ return;
13695
+
1278413696 // source == timer
1278513697 if (mouseDown)
1278613698 {
....@@ -12819,7 +13731,7 @@
1281913731
1282013732 javax.swing.Timer timer = new javax.swing.Timer(350, this);
1282113733
12822
- void clickStart(int x, int y, int modifiers)
13734
+ void clickStart(int x, int y, int modifiers, int modifiersex)
1282313735 {
1282413736 if (!wasliveok)
1282513737 return;
....@@ -12836,7 +13748,7 @@
1283613748 // touched = true; // main DL
1283713749 if (isRenderer)
1283813750 {
12839
- SetMouseMode(modifiers);
13751
+ SetMouseMode(modifiers, modifiersex);
1284013752 }
1284113753
1284213754 selectX = anchorX = x;
....@@ -12849,7 +13761,7 @@
1284913761 clicked = true;
1285013762 hold = false;
1285113763
12852
- if (((modifiers & ~1024) & ~0) == 0) // Single or multiple selection
13764
+ if (((modifiersex & ~1024) & ~0) == 0) // Single or multiple selection
1285313765 // june 2013 means CTRL_CLICK: if (((modifiers & ~1024) & ~128) == 0) // Single or multiple selection
1285413766 {
1285513767 // System.out.println("RESTART II " + modifiers);
....@@ -12880,7 +13792,7 @@
1288013792 info.camera = renderCamera;
1288113793 info.x = x;
1288213794 info.y = y;
12883
- info.modifiers = modifiers;
13795
+ info.modifiers = modifiersex;
1288413796 editObj = object.doEditClick(info, 0);
1288513797 if (!editObj)
1288613798 {
....@@ -12897,11 +13809,11 @@
1289713809
1289813810 public void mouseDragged(MouseEvent e)
1289913811 {
13812
+ //System.out.println("mouseDragged: " + e);
1290013813 if (isRenderer)
1290113814 movingcamera = true;
1290213815 //if (drawing)
1290313816 //return;
12904
- //System.out.println("mouseDragged: " + e);
1290513817 if ((e.getModifiersEx() & CTRL) != 0
1290613818 || (e.getModifiersEx() & COMMAND) != 0) // || IsFrozen())
1290713819 {
....@@ -12909,7 +13821,7 @@
1290913821 clickEnd(e.getX(), e.getY(), e.getModifiersEx());
1291013822 }
1291113823 else
12912
- drag(e.getX(), e.getY(), e.getModifiersEx());
13824
+ drag(e.getX(), e.getY(), e.getModifiers(), e.getModifiersEx());
1291313825
1291413826 //try { Thread.sleep(1); } catch (Exception ex) {}
1291513827 }
....@@ -12921,6 +13833,11 @@
1292113833 cVector tmp = new cVector();
1292213834 cVector tmp2 = new cVector();
1292313835 boolean isMoving;
13836
+
13837
+ public cVector TargetLookAt()
13838
+ {
13839
+ return targetLookAt;
13840
+ }
1292413841
1292513842 class PingThread extends Thread
1292613843 {
....@@ -13077,6 +13994,7 @@
1307713994
1307813995 public void run()
1307913996 {
13997
+ new Exception().printStackTrace();
1308013998 System.exit(0);
1308113999 for (;;)
1308214000 {
....@@ -13140,7 +14058,7 @@
1314014058 {
1314114059 Globals.lighttouched = true;
1314214060 }
13143
- drag(X, (mouseMode != 0) ? Y : anchorY, MODIFIERS);
14061
+ drag(X, (mouseMode != 0) ? Y : anchorY, 0, MODIFIERS);
1314414062 }
1314514063 //else
1314614064 }
....@@ -13240,7 +14158,7 @@
1324014158 int X, Y;
1324114159 boolean SX, SY;
1324214160
13243
- void drag(int x, int y, int modifiers)
14161
+ void drag(int x, int y, int modifiers, int modifiersex)
1324414162 {
1324514163 if (IsFrozen())
1324614164 {
....@@ -13249,17 +14167,17 @@
1324914167
1325014168 drag = true; // NEW
1325114169
13252
- boolean continuous = (modifiers & COMMAND) == COMMAND;
14170
+ boolean continuous = (modifiersex & COMMAND) == COMMAND;
1325314171
1325414172 X = x;
1325514173 Y = y;
1325614174 // floating state for animation
13257
- MODIFIERS = modifiers;
13258
- modifiers &= ~1024;
14175
+ MODIFIERS = modifiersex;
14176
+ modifiersex &= ~1024;
1325914177 if (false) // modifiers != 0)
1326014178 {
1326114179 //new Exception().printStackTrace();
13262
- System.out.println("mouseDragged: " + modifiers);
14180
+ System.out.println("mouseDragged: " + modifiersex);
1326314181 System.out.println("SHIFT = " + SHIFT);
1326414182 System.out.println("CONTROL = " + COMMAND);
1326514183 System.out.println("META = " + META);
....@@ -13279,7 +14197,7 @@
1327914197 info.camera = renderCamera;
1328014198 info.x = x;
1328114199 info.y = y;
13282
- object.editWindow.copy.doEditDrag(info);
14200
+ object.editWindow.copy.doEditDrag(info, (modifiers & MouseEvent.BUTTON3_MASK) != 0);
1328314201 } else
1328414202 {
1328514203 if (x < startX)
....@@ -13431,7 +14349,6 @@
1343114349 public void mouseMoved(MouseEvent e)
1343214350 {
1343314351 //System.out.println("mouseMoved: " + e);
13434
-
1343514352 if (isRenderer)
1343614353 return;
1343714354
....@@ -13479,9 +14396,9 @@
1347914396 boolean control = ((modifiers & CTRL) != 0); // june 2013: for point selection
1348014397 boolean command = ((modifiers & COMMAND) != 0); // june 2013: for multiple selection
1348114398
13482
- if (control || command || IsFrozen())
14399
+// No delay if (control || command || IsFrozen())
1348314400 timeout = true;
13484
- else
14401
+// ?? May 2019 else
1348514402 // timer.setDelay((modifiers & 128) != 0?0:350);
1348614403 mouseDown = false;
1348714404 if (!control && !command) // june 2013
....@@ -13591,7 +14508,7 @@
1359114508 System.out.println("keyReleased: " + e);
1359214509 }
1359314510
13594
- void SetMouseMode(int modifiers)
14511
+ void SetMouseMode(int modifiers, int modifiersex)
1359514512 {
1359614513 //System.out.println("SetMouseMode = " + modifiers);
1359714514 //modifiers &= ~1024;
....@@ -13603,25 +14520,25 @@
1360314520 //if (modifiers == 0) // || (modifiers == (1024 | CONTROL)))
1360414521 // return;
1360514522 //System.out.println("SetMode = " + modifiers);
13606
- if ((modifiers & WHEEL) == WHEEL)
14523
+ if ((modifiersex & WHEEL) == WHEEL)
1360714524 {
1360814525 mouseMode |= ZOOM;
1360914526 }
1361014527
1361114528 boolean capsLocked = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK);
13612
- if (capsLocked || (modifiers & META) == META)
14529
+ if (capsLocked) // || (modifiers & META) == META)
1361314530 {
1361414531 mouseMode |= VR; // BACKFORTH;
1361514532 }
13616
- if ((modifiers & CTRLCLICK) == CTRLCLICK)
14533
+ if ((modifiersex & CTRLCLICK) == CTRLCLICK)
1361714534 {
1361814535 mouseMode |= SELECT;
1361914536 }
13620
- if ((modifiers & COMMAND) == COMMAND)
14537
+ if ((modifiersex & COMMAND) == COMMAND)
1362114538 {
1362214539 mouseMode |= SELECT;
1362314540 }
13624
- if ((modifiers & SHIFT) == SHIFT || forcetranslate)
14541
+ if ((modifiersex & SHIFT) == SHIFT || forcetranslate || (modifiers & MouseEvent.BUTTON3_MASK) != 0)
1362514542 {
1362614543 mouseMode &= ~VR;
1362714544 mouseMode |= TRANSLATE;
....@@ -13650,10 +14567,10 @@
1365014567
1365114568 if (isRenderer) //
1365214569 {
13653
- SetMouseMode(modifiers);
14570
+ SetMouseMode(0, modifiers);
1365414571 }
1365514572
13656
- theRenderer.keyPressed(key);
14573
+ Globals.theRenderer.keyPressed(key);
1365714574 }
1365814575
1365914576 int kompactbit = 4; // power bit
....@@ -13665,7 +14582,7 @@
1366514582 float SATPOW = 1; // 2; // 0.5f;
1366614583 float BRIPOW = 1; // 0.5f; // 0.5f;
1366714584
13668
- void keyPressed(int key)
14585
+ public void keyPressed(int key)
1366914586 {
1367014587 if (key >= '0' && key <= '5')
1367114588 clampbit = (key-'0');
....@@ -13986,7 +14903,7 @@
1398614903 //RESIZETEXTURE ^= true;
1398714904 //break;
1398814905 case 'z':
13989
- RENDERSHADOW ^= true;
14906
+ Globals.RENDERSHADOW ^= true;
1399014907 Globals.lighttouched = true;
1399114908 repaint();
1399214909 break;
....@@ -14102,6 +15019,7 @@
1410215019 }
1410315020 //System.out.println("shaper_fovy = " + manipCamera.shaper_fovy);
1410415021 }
15022
+
1410515023 static double OCCLUSIONBOOST = 1; // 0.5;
1410615024
1410715025 void keyReleased(int key, int modifiers)
....@@ -14109,11 +15027,11 @@
1410915027 //mode = ROTATE;
1411015028 if ((MODIFIERS & COMMAND) == 0) // VR??
1411115029 {
14112
- SetMouseMode(modifiers);
15030
+ SetMouseMode(0, modifiers);
1411315031 }
1411415032 }
1411515033
14116
- protected void processKeyEvent(KeyEvent e)
15034
+ public void processKeyEvent(KeyEvent e)
1411715035 {
1411815036 switch (e.getID())
1411915037 {
....@@ -14243,8 +15161,9 @@
1424315161
1424415162 protected void processMouseMotionEvent(MouseEvent e)
1424515163 {
14246
- //System.out.println("processMouseMotionEvent: " + mouseMode);
14247
- if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0)
15164
+ //System.out.println("processMouseMotionEvent: " + mouseMode + " " + e.getModifiers() + " " + e.getModifiersEx() + " " + e.getButton());
15165
+ //if (e.getButton() == MouseEvent.NOBUTTON && (mouseMode & SELECT) == 0)
15166
+ if ((e.getModifiers() & MouseEvent.BUTTON1_MASK) == 0 && (e.getModifiers() & MouseEvent.BUTTON3_MASK) == 0 && (mouseMode & SELECT) == 0)
1424815167 {
1424915168 mouseMoved(e);
1425015169 } else
....@@ -14274,6 +15193,7 @@
1427415193
1427515194 void SelectParent()
1427615195 {
15196
+ new Exception().printStackTrace();
1427715197 System.exit(0);
1427815198 Composite group = (Composite) object;
1427915199 java.util.Vector selectees = new java.util.Vector(group.selection);
....@@ -14297,6 +15217,7 @@
1429715217
1429815218 void SelectChildren()
1429915219 {
15220
+ new Exception().printStackTrace();
1430015221 System.exit(0);
1430115222 /*
1430215223 Composite group = (Composite) object;
....@@ -14679,6 +15600,7 @@
1467915600 public boolean mouseDown(Event evt, int x, int y)
1468015601 {
1468115602 System.out.println("mouseDown: " + evt);
15603
+ System.exit(0);
1468215604 /*
1468315605 locked = true;
1468415606 drag = false;
....@@ -14722,7 +15644,7 @@
1472215644 {
1472315645 keyPressed(0, modifiers);
1472415646 }
14725
- clickStart(x, y, modifiers);
15647
+ // clickStart(x, y, modifiers);
1472615648 return true;
1472715649 }
1472815650
....@@ -14840,7 +15762,7 @@
1484015762 {
1484115763 keyReleased(0, 0);
1484215764 }
14843
- drag(x, y, modifiers);
15765
+ drag(x, y, 0, modifiers);
1484415766 return true;
1484515767 }
1484615768
....@@ -15410,6 +16332,7 @@
1541016332 {
1541116333 if (!selection)
1541216334 {
16335
+ new Exception().printStackTrace();
1541316336 System.exit(0);
1541416337 return;
1541516338 }
....@@ -15537,16 +16460,16 @@
1553716460 System.out.println("; fromto " + sel + " " + Trunk(previousselectedpoint.toParent[3][0]) + " " + Trunk(previousselectedpoint.toParent[3][2]) + " " + Trunk(selectedpoint.toParent[3][0]) + " " + Trunk(selectedpoint.toParent[3][2]));
1553816461 }
1553916462
15540
- previousselectedpoint = (Sphere) GrafreeD.clone(selectedpoint);
16463
+ previousselectedpoint = (Sphere) Grafreed.clone(selectedpoint);
1554116464 }
1554216465 }
1554316466
1554416467 if (!movingcamera && !PAINTMODE)
1554516468 object.editWindow.ScreenFitPoint(); // fev 2014
1554616469
15547
- if (PAINTMODE && GrafreeD.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
16470
+ if (PAINTMODE && Grafreed.clipboard.size() == 1) // object.editWindow.copy.selection.Size() > 0)
1554816471 {
15549
- Object3D paintobj = GrafreeD.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
16472
+ Object3D paintobj = Grafreed.clipboard.get(0); // object.editWindow.copy.selection.elementAt(0);
1555016473
1555116474 Object3D group = new Object3D("inst" + paintcount++);
1555216475
....@@ -15702,7 +16625,7 @@
1570216625 gl.glDisable(gl.GL_CULL_FACE);
1570316626 }
1570416627
15705
- if (!RENDERSHADOW)
16628
+ if (!Globals.RENDERSHADOW)
1570616629 gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
1570716630
1570816631 // SB gl.glPolygonOffset(2.5f, 10);
....@@ -15712,7 +16635,7 @@
1571216635 //gl.glColorMask(false, false, false, false);
1571316636
1571416637 //render_scene_from_light_view(gl, drawable, 0, 0);
15715
- if (RENDERSHADOW && Globals.lighttouched && !movingcamera) // && !parent.IsFreezed())
16638
+ if (Globals.RENDERSHADOW && Globals.lighttouched && (!movingcamera || !Globals.FREEZEONMOVE)) // && !parent.IsFreezed())
1571616639 {
1571716640 gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
1571816641
....@@ -15772,7 +16695,6 @@
1577216695
1577316696 class AntialiasBuffer implements GLEventListener
1577416697 {
15775
-
1577616698 CameraPane parent = null;
1577716699
1577816700 AntialiasBuffer(CameraPane p)
....@@ -16165,7 +17087,7 @@
1616517087 }
1616617088 }
1616717089
16168
- static void DrawPoints(CameraPane cpane)
17090
+ static void DrawPoints(iCameraPane cpane)
1616917091 {
1617017092 for (int i=0; i<8; i++) // first and last are red
1617117093 {
....@@ -16197,10 +17119,11 @@
1619717119 static IntBuffer textbuffer = null; // IntBuffer.allocate(TEXT_WIDTH*8*8 * TEXT_HEIGHT);
1619817120 // Depth buffer format
1619917121 //private int depth_format;
16200
- static public void NextIndex(Object3D o, GL gl)
17122
+
17123
+ public void NextIndex()
1620117124 {
1620217125 indexcount+=16;
16203
- gl.glColor3d(((indexcount >>> 16) & 255) / 255.0, ((indexcount >>> 8) & 255) / 255.0, ((indexcount) & 255) / 255.0);
17126
+ GetGL().glColor3d(((indexcount >>> 16) & 255) / 255.0, ((indexcount >>> 8) & 255) / 255.0, ((indexcount) & 255) / 255.0);
1620417127 //objects[indexcount] = o;
1620517128 //System.out.println("indexcount = " + indexcount);
1620617129 }