Normand Briere
2019-09-18 f9325048496d7cdbcad233f8a6b84c88e79adcc2
BoundaryRep.java
....@@ -7,7 +7,8 @@
77
88 class BoundaryRep implements java.io.Serializable
99 {
10
- static final long serialVersionUID = -4852664309425035321L;
10
+ static final long serialVersionUID = // VERY old 2008 -5762968998168738314L;
11
+ -4852664309425035321L;
1112
1213 transient int displaylist = 0;
1314
....@@ -530,7 +531,7 @@
530531 static Vertex vertextemp = new Vertex(true);
531532 static Vertex vertextemp2 = new Vertex(true);
532533
533
- static double SEUIL = 0.05f; // 0.1 for rag doll; 0.07;
534
+ static double SEUIL = 0.025f; // 0.1 for rag doll; 0.07;
534535
535536 // Compute weight of point w/r to this
536537 float ComputeWeight(Vertex v, double[][] toRoot, int k)
....@@ -686,6 +687,7 @@
686687
687688 void RecomputeBasis(BoundaryRep other, double[][] toRoot, Vertex v)
688689 {
690
+ CameraPane.CreateSelectedPoint();
689691 CameraPane.selectedpoint.
690692 getAverage(cStatic.point1, true);
691693
....@@ -1003,6 +1005,7 @@
10031005
10041006 v.closestsupport = -1;
10051007
1008
+ CameraPane.CreateSelectedPoint();
10061009 CameraPane.selectedpoint.
10071010 getAverage(cStatic.point1, true);
10081011
....@@ -1261,6 +1264,7 @@
12611264 for (int wi = v0.weights.length; --wi>=0;)
12621265 v[wi] = 0;
12631266
1267
+ CameraPane.CreateSelectedPoint();
12641268 CameraPane.selectedpoint.
12651269 getAverage(cStatic.point1, true);
12661270
....@@ -1398,6 +1402,7 @@
13981402 v0.x = v0.y = v0.z = 0;
13991403 v0.norm.x = v0.norm.y = v0.norm.z = 0;
14001404
1405
+ CameraPane.CreateSelectedPoint();
14011406 CameraPane.selectedpoint.
14021407 getAverage(cStatic.point1, true);
14031408
....@@ -1997,7 +2002,10 @@
19972002 if (v.vertexlinks == null)
19982003 continue;
19992004
2000
- if (v.weights != null && v.weights[j] < 0.001 * v.totalweight) // == 0)
2005
+ // Warning: faster but dangerous
2006
+ if (v.weights != null && v.weights[j]
2007
+ == 0)
2008
+ //< 0.001 * v.totalweight)
20012009 {
20022010 //testweight += v.weights[j-1];
20032011 continue;
....@@ -3767,7 +3775,7 @@
37673775
37683776 //tempRep.Unstripify();
37693777
3770
- tempRep.GenerateNormals2(crease);
3778
+ tempRep.GenerateNormals(crease);
37713779
37723780 boolean keepnormal = Vertex.normalmode;
37733781 boolean epsequal = Grafreed.epsequal;
....@@ -3829,6 +3837,9 @@
38293837 //if (n.dot(v.norm) < 0)
38303838 if (n == null)
38313839 continue;
3840
+
3841
+ if (v.norm == null)
3842
+ v.norm = new cVector();
38323843
38333844 LA.vecCopy(n, v.norm);
38343845
....@@ -4001,7 +4012,7 @@
40014012 NormalGenerator ng;
40024013
40034014 if (crease)
4004
- ng = new NormalGenerator(Math.PI/6); // default is 44 degrees (or Math.PI/3); // /4);
4015
+ ng = new NormalGenerator(Math.PI/4); // default is 44 degrees (or Math.PI/3); // /4);
40054016 else
40064017 ng = new NormalGenerator(Math.PI); // (Math.PI / 3); // /4);
40074018
....@@ -4019,8 +4030,6 @@
40194030 //System.out.println("NEW = " + positions.length);
40204031 uvmap = new float[ta.getVertexCount() * 2];
40214032
4022
- colors = new float[ta.getVertexCount()]; // * 3];
4023
-
40244033 ta.getCoordinates(0, positions);
40254034 ta.getNormals(0, normals);
40264035 // ta.getColors(0, colors);
....@@ -4028,6 +4037,14 @@
40284037
40294038 System.out.println("UV = " + uvmap[2] + ", " + uvmap[3] + ";");
40304039
4040
+ colors = null;
4041
+// colors = new float[ta.getVertexCount()]; // * 3];
4042
+//
4043
+// for (int i=colors.length; --i>=0;)
4044
+// {
4045
+// colors[i] = 1;
4046
+// }
4047
+
40314048 triangles = new int[ta.getVertexCount()];
40324049
40334050 for (int i = 0; i < triangles.length; i++)
....@@ -4065,17 +4082,18 @@
40654082 positions = new float[3 * ga.getVertexCount()];
40664083 normals = new float[3 * ga.getVertexCount()];
40674084 uvmap = new float[2 * ga.getVertexCount()];
4068
- colors = new float[1 * ga.getVertexCount()];
40694085
40704086 tsa.getCoordinates(0, positions);
40714087 tsa.getNormals(0, normals);
40724088 tsa.getTextureCoordinates(0, 0, uvmap);
40734089 // tsa.getColors(0, colors);
4074
-
4075
- for (int i=colors.length; --i>=0;)
4076
- {
4077
- colors[i] = 1;
4078
- }
4090
+
4091
+ colors = null;
4092
+// colors = new float[1 * ga.getVertexCount()];
4093
+// for (int i=colors.length; --i>=0;)
4094
+// {
4095
+// colors[i] = 1;
4096
+// }
40794097
40804098 int stripcount = tsa.getNumStrips();
40814099 triangles = new int[stripcount];
....@@ -4084,6 +4102,7 @@
40844102 stripified = true;
40854103 } catch (ClassCastException e)
40864104 {
4105
+ // ??? aug 2019
40874106 TriangleArray ta = (TriangleArray) ga;
40884107
40894108 positions = new float[3 * ga.getVertexCount()];