.. | .. |
---|
686 | 686 | |
---|
687 | 687 | void RecomputeBasis(BoundaryRep other, double[][] toRoot, Vertex v) |
---|
688 | 688 | { |
---|
| 689 | + CameraPane.CreateSelectedPoint(); |
---|
689 | 690 | CameraPane.selectedpoint. |
---|
690 | 691 | getAverage(cStatic.point1, true); |
---|
691 | 692 | |
---|
.. | .. |
---|
1003 | 1004 | |
---|
1004 | 1005 | v.closestsupport = -1; |
---|
1005 | 1006 | |
---|
| 1007 | + CameraPane.CreateSelectedPoint(); |
---|
1006 | 1008 | CameraPane.selectedpoint. |
---|
1007 | 1009 | getAverage(cStatic.point1, true); |
---|
1008 | 1010 | |
---|
.. | .. |
---|
1261 | 1263 | for (int wi = v0.weights.length; --wi>=0;) |
---|
1262 | 1264 | v[wi] = 0; |
---|
1263 | 1265 | |
---|
| 1266 | + CameraPane.CreateSelectedPoint(); |
---|
1264 | 1267 | CameraPane.selectedpoint. |
---|
1265 | 1268 | getAverage(cStatic.point1, true); |
---|
1266 | 1269 | |
---|
.. | .. |
---|
1398 | 1401 | v0.x = v0.y = v0.z = 0; |
---|
1399 | 1402 | v0.norm.x = v0.norm.y = v0.norm.z = 0; |
---|
1400 | 1403 | |
---|
| 1404 | + CameraPane.CreateSelectedPoint(); |
---|
1401 | 1405 | CameraPane.selectedpoint. |
---|
1402 | 1406 | getAverage(cStatic.point1, true); |
---|
1403 | 1407 | |
---|
.. | .. |
---|
1997 | 2001 | if (v.vertexlinks == null) |
---|
1998 | 2002 | continue; |
---|
1999 | 2003 | |
---|
2000 | | - if (v.weights != null && v.weights[j] < 0.001 * v.totalweight) // == 0) |
---|
| 2004 | + // Warning: faster but dangerous |
---|
| 2005 | + if (v.weights != null && v.weights[j] |
---|
| 2006 | + // == 0) |
---|
| 2007 | + < 0.0001 * v.totalweight) |
---|
2001 | 2008 | { |
---|
2002 | 2009 | //testweight += v.weights[j-1]; |
---|
2003 | 2010 | continue; |
---|
.. | .. |
---|
3857 | 3864 | Trim(true/*wastrim*/,true,crease,wasstrip,false); |
---|
3858 | 3865 | } |
---|
3859 | 3866 | |
---|
| 3867 | + void GenerateNormalsMesh() |
---|
| 3868 | + { |
---|
| 3869 | + if (stripified) |
---|
| 3870 | + { |
---|
| 3871 | + Unstripify(); |
---|
| 3872 | + } |
---|
| 3873 | + |
---|
| 3874 | + if (trimmed) |
---|
| 3875 | + { |
---|
| 3876 | + normals = null; |
---|
| 3877 | + } |
---|
| 3878 | + else |
---|
| 3879 | + { |
---|
| 3880 | + for (int i=VertexCount(); --i>=0;) |
---|
| 3881 | + { |
---|
| 3882 | + Vertex v = GetVertex(i); |
---|
| 3883 | + |
---|
| 3884 | + v.norm = null; |
---|
| 3885 | + } |
---|
| 3886 | + } |
---|
| 3887 | + } |
---|
| 3888 | + |
---|
3860 | 3889 | void GenNormalsJME() |
---|
3861 | 3890 | { |
---|
3862 | 3891 | assert(false); |
---|
.. | .. |
---|
3979 | 4008 | NormalGenerator ng; |
---|
3980 | 4009 | |
---|
3981 | 4010 | if (crease) |
---|
3982 | | - ng = new NormalGenerator(Math.PI/6); // default is 44 degrees (or Math.PI/3); // /4); |
---|
| 4011 | + ng = new NormalGenerator(Math.PI/4); // default is 44 degrees (or Math.PI/3); // /4); |
---|
3983 | 4012 | else |
---|
3984 | 4013 | ng = new NormalGenerator(Math.PI); // (Math.PI / 3); // /4); |
---|
3985 | 4014 | |
---|
.. | .. |
---|
3997 | 4026 | //System.out.println("NEW = " + positions.length); |
---|
3998 | 4027 | uvmap = new float[ta.getVertexCount() * 2]; |
---|
3999 | 4028 | |
---|
4000 | | - colors = new float[ta.getVertexCount()]; // * 3]; |
---|
4001 | | - |
---|
4002 | 4029 | ta.getCoordinates(0, positions); |
---|
4003 | 4030 | ta.getNormals(0, normals); |
---|
4004 | 4031 | // ta.getColors(0, colors); |
---|
.. | .. |
---|
4006 | 4033 | |
---|
4007 | 4034 | System.out.println("UV = " + uvmap[2] + ", " + uvmap[3] + ";"); |
---|
4008 | 4035 | |
---|
| 4036 | + colors = null; |
---|
| 4037 | +// colors = new float[ta.getVertexCount()]; // * 3]; |
---|
| 4038 | +// |
---|
| 4039 | +// for (int i=colors.length; --i>=0;) |
---|
| 4040 | +// { |
---|
| 4041 | +// colors[i] = 1; |
---|
| 4042 | +// } |
---|
| 4043 | + |
---|
4009 | 4044 | triangles = new int[ta.getVertexCount()]; |
---|
4010 | 4045 | |
---|
4011 | 4046 | for (int i = 0; i < triangles.length; i++) |
---|
.. | .. |
---|
4013 | 4048 | triangles[i] = i; |
---|
4014 | 4049 | } |
---|
4015 | 4050 | |
---|
4016 | | - Untrim(); |
---|
4017 | | - MergeNormals(); |
---|
| 4051 | +// Untrim(); |
---|
| 4052 | + if (!trimmed) |
---|
| 4053 | + MergeNormals(); |
---|
4018 | 4054 | } |
---|
4019 | 4055 | } |
---|
4020 | 4056 | |
---|
.. | .. |
---|
4042 | 4078 | positions = new float[3 * ga.getVertexCount()]; |
---|
4043 | 4079 | normals = new float[3 * ga.getVertexCount()]; |
---|
4044 | 4080 | uvmap = new float[2 * ga.getVertexCount()]; |
---|
4045 | | - colors = new float[1 * ga.getVertexCount()]; |
---|
4046 | 4081 | |
---|
4047 | 4082 | tsa.getCoordinates(0, positions); |
---|
4048 | 4083 | tsa.getNormals(0, normals); |
---|
4049 | 4084 | tsa.getTextureCoordinates(0, 0, uvmap); |
---|
4050 | 4085 | // tsa.getColors(0, colors); |
---|
4051 | | - |
---|
4052 | | - for (int i=colors.length; --i>=0;) |
---|
4053 | | - { |
---|
4054 | | - colors[i] = 1; |
---|
4055 | | - } |
---|
| 4086 | + |
---|
| 4087 | + colors = null; |
---|
| 4088 | +// colors = new float[1 * ga.getVertexCount()]; |
---|
| 4089 | +// for (int i=colors.length; --i>=0;) |
---|
| 4090 | +// { |
---|
| 4091 | +// colors[i] = 1; |
---|
| 4092 | +// } |
---|
4056 | 4093 | |
---|
4057 | 4094 | int stripcount = tsa.getNumStrips(); |
---|
4058 | 4095 | triangles = new int[stripcount]; |
---|
.. | .. |
---|
4061 | 4098 | stripified = true; |
---|
4062 | 4099 | } catch (ClassCastException e) |
---|
4063 | 4100 | { |
---|
| 4101 | + // ??? aug 2019 |
---|
4064 | 4102 | TriangleArray ta = (TriangleArray) ga; |
---|
4065 | 4103 | |
---|
4066 | 4104 | positions = new float[3 * ga.getVertexCount()]; |
---|
.. | .. |
---|
4076 | 4114 | triangles[0] = 3; |
---|
4077 | 4115 | } |
---|
4078 | 4116 | |
---|
4079 | | - Untrim(); |
---|
4080 | | - MergeNormals(); |
---|
| 4117 | + //Untrim(); |
---|
| 4118 | + if (!trimmed) |
---|
| 4119 | + MergeNormals(); |
---|
4081 | 4120 | } |
---|
4082 | 4121 | |
---|
4083 | 4122 | /* |
---|
.. | .. |
---|
4131 | 4170 | |
---|
4132 | 4171 | void MergeNormals() |
---|
4133 | 4172 | { |
---|
| 4173 | + assert(!trimmed); |
---|
| 4174 | + |
---|
4134 | 4175 | boolean smooth = Grafreed.smoothmode; |
---|
4135 | 4176 | boolean link = Grafreed.linkUV; |
---|
4136 | 4177 | Grafreed.smoothmode = true; |
---|
.. | .. |
---|
4942 | 4983 | v./*pos.*/y = positions[i3 + 1]; |
---|
4943 | 4984 | v./*pos.*/z = positions[i3 + 2]; |
---|
4944 | 4985 | |
---|
4945 | | - v.norm.x = normals[i3]; |
---|
4946 | | - v.norm.y = normals[i3 + 1]; |
---|
4947 | | - v.norm.z = normals[i3 + 2]; |
---|
| 4986 | + if (normals == null) |
---|
| 4987 | + { |
---|
| 4988 | + v.norm.x = 0; |
---|
| 4989 | + v.norm.y = 0; |
---|
| 4990 | + v.norm.z = 0; |
---|
| 4991 | + } |
---|
| 4992 | + else |
---|
| 4993 | + { |
---|
| 4994 | + v.norm.x = normals[i3]; |
---|
| 4995 | + v.norm.y = normals[i3 + 1]; |
---|
| 4996 | + v.norm.z = normals[i3 + 2]; |
---|
| 4997 | + } |
---|
4948 | 4998 | |
---|
4949 | 4999 | v.s = uvmap[i2]; |
---|
4950 | 5000 | v.t = uvmap[i2 + 1]; |
---|