Revision db758bd0
Added by Leszek Koltunski about 2 years ago
src/main/java/org/distorted/objectlib/helpers/FactoryBandaged3x3Cubit.java | ||
---|---|---|
914 | 914 |
|
915 | 915 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
916 | 916 |
|
917 |
private int[] generateCornerIndices(float[][] vertices, int[][] indices)
|
|
917 |
private int[] generateCornerIndices(float[][] vertices, boolean roundCorners)
|
|
918 | 918 |
{ |
919 | 919 |
int len = vertices.length; |
920 |
int val = roundCorners ? 0 : -1; |
|
920 | 921 |
int[] cornerIndices = new int[len]; |
921 |
for(int i=0; i<len; i++) cornerIndices[i] = 0;
|
|
922 |
for(int i=0; i<len; i++) cornerIndices[i] = val;
|
|
922 | 923 |
return cornerIndices; |
923 | 924 |
} |
924 | 925 |
|
... | ... | |
1155 | 1156 |
|
1156 | 1157 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
1157 | 1158 |
|
1158 |
public ObjectFaceShape createIrregularFaceShape(int variant, boolean iconMode) |
|
1159 |
public ObjectFaceShape createIrregularFaceShape(int variant, boolean iconMode, boolean roundCorners)
|
|
1159 | 1160 |
{ |
1160 | 1161 |
float height = iconMode ? 0.001f : 0.05f; |
1161 | 1162 |
int angle = 60; |
... | ... | |
1172 | 1173 |
{height/3,angle,R,S,numVertices,extraV,extraI} }; |
1173 | 1174 |
|
1174 | 1175 |
int[] bandIndices = generateBandIndices(mVertices[variant], mIndices[variant], mMove[variant]); |
1175 |
int[] cornerIndices = generateCornerIndices(mVertices[variant], mIndices[variant]);
|
|
1176 |
int[] cornerIndices = generateCornerIndices(mVertices[variant], roundCorners);
|
|
1176 | 1177 |
float[][] vertexVec = generateVectors(mVertices[variant], mIndices[variant], bandIndices); |
1177 | 1178 |
float[][] centers = generateCenters(mVertices[variant], vertexVec); |
1178 | 1179 |
int[] centerIndices = generateCenterIndices(vertexVec); |
... | ... | |
1182 | 1183 |
|
1183 | 1184 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
1184 | 1185 |
|
1185 |
public MeshBase createMesh(float[] pos, boolean iconMode) |
|
1186 |
public MeshBase createMesh(float[] pos, boolean iconMode, boolean roundCorners)
|
|
1186 | 1187 |
{ |
1187 | 1188 |
prepare(1); |
1188 | 1189 |
ObjectShape shape = createIrregularShape(0,pos); |
1189 |
ObjectFaceShape face = createIrregularFaceShape(0,iconMode); |
|
1190 |
ObjectFaceShape face = createIrregularFaceShape(0,iconMode,roundCorners);
|
|
1190 | 1191 |
int[][] indices = shape.getVertIndices(); |
1191 | 1192 |
int numComponents = indices.length; |
1192 | 1193 |
|
Also available in: Unified diff
On OpenGL ES 3.0, some drivers are veeeery slow linking a program which includes transform feedback - and such program is needed to apply vertex effects to meshes - which is needed to round corners of puzzle cubits.
Thus on 3.0 we switch off rounding corners of the meshes in the Creator mode, otherwise we'd need to wait about 24 seconds for the screen to appear!