.. | .. |
---|
7 | 7 | |
---|
8 | 8 | class BoundaryRep implements java.io.Serializable |
---|
9 | 9 | { |
---|
10 | | - static final long serialVersionUID = -4852664309425035321L; |
---|
| 10 | + static final long serialVersionUID = // VERY old 2008 -5762968998168738314L; |
---|
| 11 | + -4852664309425035321L; |
---|
11 | 12 | |
---|
12 | 13 | transient int displaylist = 0; |
---|
13 | 14 | |
---|
.. | .. |
---|
530 | 531 | static Vertex vertextemp = new Vertex(true); |
---|
531 | 532 | static Vertex vertextemp2 = new Vertex(true); |
---|
532 | 533 | |
---|
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; |
---|
534 | 535 | |
---|
535 | 536 | // Compute weight of point w/r to this |
---|
536 | 537 | float ComputeWeight(Vertex v, double[][] toRoot, int k) |
---|
.. | .. |
---|
686 | 687 | |
---|
687 | 688 | void RecomputeBasis(BoundaryRep other, double[][] toRoot, Vertex v) |
---|
688 | 689 | { |
---|
| 690 | + CameraPane.CreateSelectedPoint(); |
---|
689 | 691 | CameraPane.selectedpoint. |
---|
690 | 692 | getAverage(cStatic.point1, true); |
---|
691 | 693 | |
---|
.. | .. |
---|
1003 | 1005 | |
---|
1004 | 1006 | v.closestsupport = -1; |
---|
1005 | 1007 | |
---|
| 1008 | + CameraPane.CreateSelectedPoint(); |
---|
1006 | 1009 | CameraPane.selectedpoint. |
---|
1007 | 1010 | getAverage(cStatic.point1, true); |
---|
1008 | 1011 | |
---|
.. | .. |
---|
1261 | 1264 | for (int wi = v0.weights.length; --wi>=0;) |
---|
1262 | 1265 | v[wi] = 0; |
---|
1263 | 1266 | |
---|
| 1267 | + CameraPane.CreateSelectedPoint(); |
---|
1264 | 1268 | CameraPane.selectedpoint. |
---|
1265 | 1269 | getAverage(cStatic.point1, true); |
---|
1266 | 1270 | |
---|
.. | .. |
---|
1398 | 1402 | v0.x = v0.y = v0.z = 0; |
---|
1399 | 1403 | v0.norm.x = v0.norm.y = v0.norm.z = 0; |
---|
1400 | 1404 | |
---|
| 1405 | + CameraPane.CreateSelectedPoint(); |
---|
1401 | 1406 | CameraPane.selectedpoint. |
---|
1402 | 1407 | getAverage(cStatic.point1, true); |
---|
1403 | 1408 | |
---|
.. | .. |
---|
1997 | 2002 | if (v.vertexlinks == null) |
---|
1998 | 2003 | continue; |
---|
1999 | 2004 | |
---|
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) |
---|
2001 | 2009 | { |
---|
2002 | 2010 | //testweight += v.weights[j-1]; |
---|
2003 | 2011 | continue; |
---|
.. | .. |
---|
3767 | 3775 | |
---|
3768 | 3776 | //tempRep.Unstripify(); |
---|
3769 | 3777 | |
---|
3770 | | - tempRep.GenerateNormals2(crease); |
---|
| 3778 | + tempRep.GenerateNormals(crease); |
---|
3771 | 3779 | |
---|
3772 | 3780 | boolean keepnormal = Vertex.normalmode; |
---|
3773 | 3781 | boolean epsequal = Grafreed.epsequal; |
---|
.. | .. |
---|
3829 | 3837 | //if (n.dot(v.norm) < 0) |
---|
3830 | 3838 | if (n == null) |
---|
3831 | 3839 | continue; |
---|
| 3840 | + |
---|
| 3841 | + if (v.norm == null) |
---|
| 3842 | + v.norm = new cVector(); |
---|
3832 | 3843 | |
---|
3833 | 3844 | LA.vecCopy(n, v.norm); |
---|
3834 | 3845 | |
---|
.. | .. |
---|
4001 | 4012 | NormalGenerator ng; |
---|
4002 | 4013 | |
---|
4003 | 4014 | 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); |
---|
4005 | 4016 | else |
---|
4006 | 4017 | ng = new NormalGenerator(Math.PI); // (Math.PI / 3); // /4); |
---|
4007 | 4018 | |
---|
.. | .. |
---|
4019 | 4030 | //System.out.println("NEW = " + positions.length); |
---|
4020 | 4031 | uvmap = new float[ta.getVertexCount() * 2]; |
---|
4021 | 4032 | |
---|
4022 | | - colors = new float[ta.getVertexCount()]; // * 3]; |
---|
4023 | | - |
---|
4024 | 4033 | ta.getCoordinates(0, positions); |
---|
4025 | 4034 | ta.getNormals(0, normals); |
---|
4026 | 4035 | // ta.getColors(0, colors); |
---|
.. | .. |
---|
4028 | 4037 | |
---|
4029 | 4038 | System.out.println("UV = " + uvmap[2] + ", " + uvmap[3] + ";"); |
---|
4030 | 4039 | |
---|
| 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 | + |
---|
4031 | 4048 | triangles = new int[ta.getVertexCount()]; |
---|
4032 | 4049 | |
---|
4033 | 4050 | for (int i = 0; i < triangles.length; i++) |
---|
.. | .. |
---|
4065 | 4082 | positions = new float[3 * ga.getVertexCount()]; |
---|
4066 | 4083 | normals = new float[3 * ga.getVertexCount()]; |
---|
4067 | 4084 | uvmap = new float[2 * ga.getVertexCount()]; |
---|
4068 | | - colors = new float[1 * ga.getVertexCount()]; |
---|
4069 | 4085 | |
---|
4070 | 4086 | tsa.getCoordinates(0, positions); |
---|
4071 | 4087 | tsa.getNormals(0, normals); |
---|
4072 | 4088 | tsa.getTextureCoordinates(0, 0, uvmap); |
---|
4073 | 4089 | // 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 | +// } |
---|
4079 | 4097 | |
---|
4080 | 4098 | int stripcount = tsa.getNumStrips(); |
---|
4081 | 4099 | triangles = new int[stripcount]; |
---|
.. | .. |
---|
4084 | 4102 | stripified = true; |
---|
4085 | 4103 | } catch (ClassCastException e) |
---|
4086 | 4104 | { |
---|
| 4105 | + // ??? aug 2019 |
---|
4087 | 4106 | TriangleArray ta = (TriangleArray) ga; |
---|
4088 | 4107 | |
---|
4089 | 4108 | positions = new float[3 * ga.getVertexCount()]; |
---|
.. | .. |
---|
4155 | 4174 | |
---|
4156 | 4175 | void MergeNormals() |
---|
4157 | 4176 | { |
---|
| 4177 | + assert(!trimmed); |
---|
| 4178 | + |
---|
4158 | 4179 | boolean smooth = Grafreed.smoothmode; |
---|
4159 | 4180 | boolean link = Grafreed.linkUV; |
---|
4160 | 4181 | Grafreed.smoothmode = true; |
---|