.. | .. |
---|
172 | 172 | bufV = other.bufV; |
---|
173 | 173 | bufF = other.bufF; |
---|
174 | 174 | |
---|
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); |
---|
180 | 180 | |
---|
181 | | - indices = (int[]) GrafreeD.clone(other.indices); |
---|
| 181 | + indices = (int[]) Grafreed.clone(other.indices); |
---|
182 | 182 | |
---|
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); |
---|
185 | 185 | } |
---|
186 | 186 | else |
---|
187 | 187 | { |
---|
.. | .. |
---|
500 | 500 | static Vertex vertextemp = new Vertex(true); |
---|
501 | 501 | static Vertex vertextemp2 = new Vertex(true); |
---|
502 | 502 | |
---|
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; |
---|
504 | 504 | |
---|
505 | 505 | // Compute weight of point w/r to this |
---|
506 | 506 | float ComputeWeight(Vertex v, double[][] toRoot, int k) |
---|
.. | .. |
---|
1518 | 1518 | InitFaceIndices(); |
---|
1519 | 1519 | } |
---|
1520 | 1520 | |
---|
1521 | | - BoundaryRep rep = (BoundaryRep) GrafreeD.clone(this); |
---|
| 1521 | + BoundaryRep rep = (BoundaryRep) Grafreed.clone(this); |
---|
1522 | 1522 | //float[] v = new float[100]; |
---|
1523 | 1523 | |
---|
1524 | 1524 | for (int loops=1; --loops>=0;) |
---|
.. | .. |
---|
1548 | 1548 | InitFaceIndices(); |
---|
1549 | 1549 | } |
---|
1550 | 1550 | |
---|
1551 | | - BoundaryRep rep = (BoundaryRep) GrafreeD.clone(this); |
---|
| 1551 | + BoundaryRep rep = (BoundaryRep) Grafreed.clone(this); |
---|
1552 | 1552 | //float[] v = new float[100]; |
---|
1553 | 1553 | |
---|
1554 | 1554 | for (int loops=10; --loops>=0;) |
---|
.. | .. |
---|
2670 | 2670 | |
---|
2671 | 2671 | if (Globals.framecount - lastsoundtime > 30) // 0.25 secs |
---|
2672 | 2672 | { |
---|
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); |
---|
2674 | 2674 | |
---|
2675 | 2675 | lastsoundtime = Globals.framecount; |
---|
2676 | 2676 | } |
---|
.. | .. |
---|
3247 | 3247 | max = ay; |
---|
3248 | 3248 | } |
---|
3249 | 3249 | |
---|
| 3250 | + if (max == 0) |
---|
| 3251 | + { |
---|
| 3252 | + uvmap[i2] = 0.5f; |
---|
| 3253 | + uvmap[i2+1] = 0.5f; |
---|
| 3254 | + continue; |
---|
| 3255 | + } |
---|
| 3256 | + |
---|
3250 | 3257 | x /= max; |
---|
3251 | 3258 | y /= max; |
---|
3252 | 3259 | |
---|
3253 | 3260 | double angle = Math.acos(Math.abs(z*2)); |
---|
3254 | 3261 | |
---|
3255 | 3262 | double k = angle / Math.PI * 2; |
---|
| 3263 | + |
---|
| 3264 | + assert(k >= 0); |
---|
3256 | 3265 | |
---|
3257 | 3266 | // k == 0 => uv = 0 (center) |
---|
3258 | 3267 | // k == 1 => uv = -1,1 (border) |
---|
.. | .. |
---|
3268 | 3277 | t = Math.pow(t, 3); |
---|
3269 | 3278 | |
---|
3270 | 3279 | // 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; |
---|
3272 | 3282 | |
---|
3273 | 3283 | double u = k*x; |
---|
3274 | 3284 | double v = k*y; |
---|
.. | .. |
---|
3393 | 3403 | k /= x*x + y*y; |
---|
3394 | 3404 | } |
---|
3395 | 3405 | else |
---|
3396 | | - GrafreeD.Assert(z == 1); |
---|
| 3406 | + Grafreed.Assert(z == 1); |
---|
3397 | 3407 | |
---|
3398 | 3408 | if (k < 0) |
---|
3399 | 3409 | k = 0; |
---|
.. | .. |
---|
3892 | 3902 | tsa.getNormals(0, normals); |
---|
3893 | 3903 | tsa.getTextureCoordinates(0, 0, uvmap); |
---|
3894 | 3904 | // tsa.getColors(0, colors); |
---|
| 3905 | + |
---|
| 3906 | + for (int i=colors.length; --i>=0;) |
---|
| 3907 | + { |
---|
| 3908 | + colors[i] = 1; |
---|
| 3909 | + } |
---|
3895 | 3910 | |
---|
3896 | 3911 | int stripcount = tsa.getNumStrips(); |
---|
3897 | 3912 | triangles = new int[stripcount]; |
---|
.. | .. |
---|
6344 | 6359 | |
---|
6345 | 6360 | void InitWeights() |
---|
6346 | 6361 | { |
---|
| 6362 | + new Exception().printStackTrace(); |
---|
6347 | 6363 | System.exit(0); |
---|
6348 | 6364 | int n = 0; |
---|
6349 | 6365 | int b = 0; |
---|
.. | .. |
---|
8217 | 8233 | if (!trimmed) |
---|
8218 | 8234 | return; |
---|
8219 | 8235 | |
---|
8220 | | - GrafreeD.linkUV = false; |
---|
| 8236 | + Grafreed.linkUV = false; |
---|
8221 | 8237 | |
---|
8222 | 8238 | try |
---|
8223 | 8239 | { |
---|