Normand Briere
2019-05-13 f924d3e00db476c06f55f3d5aaef307e17575340
BoundaryRep.java
....@@ -172,16 +172,16 @@
172172 bufV = other.bufV;
173173 bufF = other.bufF;
174174
175
- positions = (float[]) GrafreeD.clone(other.positions);
176
- normals = (float[]) GrafreeD.clone(other.normals);
177
- colors = (float[]) GrafreeD.clone(other.colors);
178
- uvmap = (float[]) GrafreeD.clone(other.uvmap);
179
- triangles = (int[]) GrafreeD.clone(other.triangles);
175
+ positions = (float[]) Grafreed.clone(other.positions);
176
+ normals = (float[]) Grafreed.clone(other.normals);
177
+ colors = (float[]) Grafreed.clone(other.colors);
178
+ uvmap = (float[]) Grafreed.clone(other.uvmap);
179
+ triangles = (int[]) Grafreed.clone(other.triangles);
180180
181
- indices = (int[]) GrafreeD.clone(other.indices);
181
+ indices = (int[]) Grafreed.clone(other.indices);
182182
183
- vertices = (Vector<Vertex>) GrafreeD.clone(other.vertices);
184
- faces = (Vector<Face>) GrafreeD.clone(other.faces);
183
+ vertices = (Vector<Vertex>) Grafreed.clone(other.vertices);
184
+ faces = (Vector<Face>) Grafreed.clone(other.faces);
185185 }
186186 else
187187 {
....@@ -500,7 +500,7 @@
500500 static Vertex vertextemp = new Vertex(true);
501501 static Vertex vertextemp2 = new Vertex(true);
502502
503
- static double SEUIL = 0.1f; // 0.1 for rag doll; 0.07;
503
+ static double SEUIL = 0.05f; // 0.1 for rag doll; 0.07;
504504
505505 // Compute weight of point w/r to this
506506 float ComputeWeight(Vertex v, double[][] toRoot, int k)
....@@ -1518,7 +1518,7 @@
15181518 InitFaceIndices();
15191519 }
15201520
1521
- BoundaryRep rep = (BoundaryRep) GrafreeD.clone(this);
1521
+ BoundaryRep rep = (BoundaryRep) Grafreed.clone(this);
15221522 //float[] v = new float[100];
15231523
15241524 for (int loops=1; --loops>=0;)
....@@ -1548,7 +1548,7 @@
15481548 InitFaceIndices();
15491549 }
15501550
1551
- BoundaryRep rep = (BoundaryRep) GrafreeD.clone(this);
1551
+ BoundaryRep rep = (BoundaryRep) Grafreed.clone(this);
15521552 //float[] v = new float[100];
15531553
15541554 for (int loops=10; --loops>=0;)
....@@ -2670,7 +2670,7 @@
26702670
26712671 if (Globals.framecount - lastsoundtime > 30) // 0.25 secs
26722672 {
2673
- GrafreeD.wav.play((Math.random()+0.5)/Math.max(tmp.length2(),0.2)); //, 1);
2673
+ Grafreed.wav.play((Math.random()+0.5)/Math.max(tmp.length2(),0.2)); //, 1);
26742674
26752675 lastsoundtime = Globals.framecount;
26762676 }
....@@ -3247,12 +3247,21 @@
32473247 max = ay;
32483248 }
32493249
3250
+ if (max == 0)
3251
+ {
3252
+ uvmap[i2] = 0.5f;
3253
+ uvmap[i2+1] = 0.5f;
3254
+ continue;
3255
+ }
3256
+
32503257 x /= max;
32513258 y /= max;
32523259
32533260 double angle = Math.acos(Math.abs(z*2));
32543261
32553262 double k = angle / Math.PI * 2;
3263
+
3264
+ assert(k >= 0);
32563265
32573266 // k == 0 => uv = 0 (center)
32583267 // k == 1 => uv = -1,1 (border)
....@@ -3268,7 +3277,8 @@
32683277 t = Math.pow(t, 3);
32693278
32703279 // Interpolate between k/length2 (center) and k (border)
3271
- k = k / length2 * (1 - t) + k * t;
3280
+ if (length2 > 0)
3281
+ k *= (1 - t) / length2 + t;
32723282
32733283 double u = k*x;
32743284 double v = k*y;
....@@ -3393,7 +3403,7 @@
33933403 k /= x*x + y*y;
33943404 }
33953405 else
3396
- GrafreeD.Assert(z == 1);
3406
+ Grafreed.Assert(z == 1);
33973407
33983408 if (k < 0)
33993409 k = 0;
....@@ -3892,6 +3902,11 @@
38923902 tsa.getNormals(0, normals);
38933903 tsa.getTextureCoordinates(0, 0, uvmap);
38943904 // tsa.getColors(0, colors);
3905
+
3906
+ for (int i=colors.length; --i>=0;)
3907
+ {
3908
+ colors[i] = 1;
3909
+ }
38953910
38963911 int stripcount = tsa.getNumStrips();
38973912 triangles = new int[stripcount];
....@@ -6344,6 +6359,7 @@
63446359
63456360 void InitWeights()
63466361 {
6362
+ new Exception().printStackTrace();
63476363 System.exit(0);
63486364 int n = 0;
63496365 int b = 0;
....@@ -8217,7 +8233,7 @@
82178233 if (!trimmed)
82188234 return;
82198235
8220
- GrafreeD.linkUV = false;
8236
+ Grafreed.linkUV = false;
82218237
82228238 try
82238239 {