From 623dc0fa8cbd9473830a1786f6d49fa808a09439 Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Sun, 05 May 2019 14:06:12 -0400 Subject: [PATCH] Rename Grafreed --- BoundaryRep.java | 44 ++++++++++++++++++++++++++++++-------------- 1 files changed, 30 insertions(+), 14 deletions(-) diff --git a/BoundaryRep.java b/BoundaryRep.java index 05b3429..7b31bc4 100644 --- a/BoundaryRep.java +++ b/BoundaryRep.java @@ -172,16 +172,16 @@ bufV = other.bufV; bufF = other.bufF; - positions = (float[]) GrafreeD.clone(other.positions); - normals = (float[]) GrafreeD.clone(other.normals); - colors = (float[]) GrafreeD.clone(other.colors); - uvmap = (float[]) GrafreeD.clone(other.uvmap); - triangles = (int[]) GrafreeD.clone(other.triangles); + positions = (float[]) Grafreed.clone(other.positions); + normals = (float[]) Grafreed.clone(other.normals); + colors = (float[]) Grafreed.clone(other.colors); + uvmap = (float[]) Grafreed.clone(other.uvmap); + triangles = (int[]) Grafreed.clone(other.triangles); - indices = (int[]) GrafreeD.clone(other.indices); + indices = (int[]) Grafreed.clone(other.indices); - vertices = (Vector<Vertex>) GrafreeD.clone(other.vertices); - faces = (Vector<Face>) GrafreeD.clone(other.faces); + vertices = (Vector<Vertex>) Grafreed.clone(other.vertices); + faces = (Vector<Face>) Grafreed.clone(other.faces); } else { @@ -1518,7 +1518,7 @@ InitFaceIndices(); } - BoundaryRep rep = (BoundaryRep) GrafreeD.clone(this); + BoundaryRep rep = (BoundaryRep) Grafreed.clone(this); //float[] v = new float[100]; for (int loops=1; --loops>=0;) @@ -1548,7 +1548,7 @@ InitFaceIndices(); } - BoundaryRep rep = (BoundaryRep) GrafreeD.clone(this); + BoundaryRep rep = (BoundaryRep) Grafreed.clone(this); //float[] v = new float[100]; for (int loops=10; --loops>=0;) @@ -2670,7 +2670,7 @@ if (Globals.framecount - lastsoundtime > 30) // 0.25 secs { - GrafreeD.wav.play((Math.random()+0.5)/Math.max(tmp.length2(),0.2)); //, 1); + Grafreed.wav.play((Math.random()+0.5)/Math.max(tmp.length2(),0.2)); //, 1); lastsoundtime = Globals.framecount; } @@ -3247,12 +3247,21 @@ max = ay; } + if (max == 0) + { + uvmap[i2] = 0.5f; + uvmap[i2+1] = 0.5f; + continue; + } + x /= max; y /= max; double angle = Math.acos(Math.abs(z*2)); double k = angle / Math.PI * 2; + + assert(k >= 0); // k == 0 => uv = 0 (center) // k == 1 => uv = -1,1 (border) @@ -3268,7 +3277,8 @@ t = Math.pow(t, 3); // Interpolate between k/length2 (center) and k (border) - k = k / length2 * (1 - t) + k * t; + if (length2 > 0) + k *= (1 - t) / length2 + t; double u = k*x; double v = k*y; @@ -3393,7 +3403,7 @@ k /= x*x + y*y; } else - GrafreeD.Assert(z == 1); + Grafreed.Assert(z == 1); if (k < 0) k = 0; @@ -3892,6 +3902,11 @@ tsa.getNormals(0, normals); tsa.getTextureCoordinates(0, 0, uvmap); // tsa.getColors(0, colors); + + for (int i=colors.length; --i>=0;) + { + colors[i] = 1; + } int stripcount = tsa.getNumStrips(); triangles = new int[stripcount]; @@ -6344,6 +6359,7 @@ void InitWeights() { + new Exception().printStackTrace(); System.exit(0); int n = 0; int b = 0; @@ -8217,7 +8233,7 @@ if (!trimmed) return; - GrafreeD.linkUV = false; + Grafreed.linkUV = false; try { -- Gitblit v1.6.2