93 |
93 |
|
94 |
94 |
for( ObjectShape shape : shapes )
|
95 |
95 |
{
|
96 |
|
int numShape = shape.mVertIndices.length;
|
|
96 |
int numShape = shape.mNumFaces;
|
97 |
97 |
if( numShape>ret ) ret = numShape;
|
98 |
98 |
}
|
99 |
99 |
|
... | ... | |
140 |
140 |
|
141 |
141 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
142 |
142 |
|
143 |
|
private static boolean indexContains(int[] indices, int index)
|
|
143 |
private static boolean indicesContain(int[][] indices, int index)
|
|
144 |
{
|
|
145 |
for( int[] ind : indices )
|
|
146 |
for( int i : ind )
|
|
147 |
if( i==index ) return true;
|
|
148 |
|
|
149 |
return false;
|
|
150 |
}
|
|
151 |
|
|
152 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
153 |
|
|
154 |
private static boolean indicesContain(int[] indices, int index)
|
144 |
155 |
{
|
145 |
156 |
for( int j : indices )
|
146 |
157 |
if( j==index ) return true;
|
... | ... | |
153 |
164 |
private static int[] computeCubitFaceColors(ObjectShape shape, float[] move, Static4D quat, Static3D[] faceAxis, float[] dist3D, float size)
|
154 |
165 |
{
|
155 |
166 |
float[][] vertices = shape.getVertices();
|
156 |
|
int[][] indices = shape.getVertIndices();
|
157 |
167 |
int numVert = vertices.length;
|
158 |
|
int numFaces = faceAxis.length;
|
159 |
|
int numIndices = indices.length;
|
160 |
|
int[] cubitFaceColor = new int[numIndices];
|
161 |
|
for(int face=0; face<numIndices; face++) cubitFaceColor[face] = 0xffffffff;
|
|
168 |
int numPuzzleFaces = faceAxis.length;
|
|
169 |
int numCubitFaces = shape.mNumFaces;
|
|
170 |
int[] cubitFaceColor = new int[numCubitFaces];
|
|
171 |
for(int face=0; face<numCubitFaces; face++) cubitFaceColor[face] = 0xffffffff;
|
162 |
172 |
|
163 |
173 |
for(int vert=0; vert<numVert; vert++)
|
164 |
174 |
{
|
165 |
175 |
computeVertex(mTmp1,vertices[vert],move,quat);
|
166 |
176 |
int vertBelongsBitmap = 0x00000000;
|
167 |
177 |
|
168 |
|
for(int face=0; face<numFaces; face++)
|
|
178 |
for(int face=0; face<numPuzzleFaces; face++)
|
169 |
179 |
if( vertInFace(mTmp1,faceAxis[face],dist3D[face]*size) ) vertBelongsBitmap |= (1<<face);
|
170 |
180 |
|
171 |
|
for(int index=0; index<numIndices; index++)
|
172 |
|
if( cubitFaceColor[index]!=0 && indexContains(indices[index],vert) ) cubitFaceColor[index] &= vertBelongsBitmap;
|
|
181 |
if( shape.mFacesMultigon )
|
|
182 |
{
|
|
183 |
for(int index=0; index<numCubitFaces; index++)
|
|
184 |
if( cubitFaceColor[index]!=0 && indicesContain(shape.mMultigonIndices[index],vert) ) cubitFaceColor[index] &= vertBelongsBitmap;
|
|
185 |
}
|
|
186 |
else
|
|
187 |
{
|
|
188 |
for(int index=0; index<numCubitFaces; index++)
|
|
189 |
if( cubitFaceColor[index]!=0 && indicesContain(shape.mVertIndices[index],vert) ) cubitFaceColor[index] &= vertBelongsBitmap;
|
|
190 |
}
|
173 |
191 |
}
|
174 |
192 |
|
175 |
193 |
return cubitFaceColor;
|
Fixes for creation of puzzles which include cubits with 'multigon' faces.