Revision 3e605536
Added by Leszek Koltunski about 4 years ago
| src/main/java/org/distorted/objects/TwistyBandagedAbstract.java | ||
|---|---|---|
| 21 | 21 |
|
| 22 | 22 |
import android.content.res.Resources; |
| 23 | 23 |
|
| 24 |
import org.distorted.helpers.FactoryCubit; |
|
| 25 | 24 |
import org.distorted.helpers.ObjectShape; |
| 26 | 25 |
import org.distorted.helpers.ObjectSticker; |
| 27 |
import org.distorted.library.effect.MatrixEffectQuaternion; |
|
| 28 | 26 |
import org.distorted.library.main.DistortedEffects; |
| 29 | 27 |
import org.distorted.library.main.DistortedTexture; |
| 30 |
import org.distorted.library.mesh.MeshBase; |
|
| 31 | 28 |
import org.distorted.library.mesh.MeshSquare; |
| 32 | 29 |
import org.distorted.library.type.Static3D; |
| 33 | 30 |
import org.distorted.library.type.Static4D; |
| ... | ... | |
| 188 | 185 |
return ( cubit>=0 && cubit< indices.length ) ? indices[cubit] : 0; |
| 189 | 186 |
} |
| 190 | 187 |
|
| 191 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 192 |
|
|
| 193 |
private Static4D getQuat(int cubit, int numLayers) |
|
| 194 |
{
|
|
| 195 |
return INIT_QUATS[getQuatIndex(cubit)]; |
|
| 196 |
} |
|
| 197 |
|
|
| 198 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 199 |
|
|
| 200 |
private int getNumCubitVariants(int numLayers) |
|
| 201 |
{
|
|
| 202 |
return mDimensions.length; |
|
| 203 |
} |
|
| 204 |
|
|
| 205 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 206 |
|
|
| 207 |
int getCubitVariant(int cubit, int numLayers) |
|
| 208 |
{
|
|
| 209 |
float[][] pos = getPositions(); |
|
| 210 |
|
|
| 211 |
if( cubit>=0 && cubit<pos.length ) |
|
| 212 |
{
|
|
| 213 |
int numPoints = pos[cubit].length/3; |
|
| 214 |
return numPoints==8 ? 4 : numPoints-1; |
|
| 215 |
} |
|
| 216 |
|
|
| 217 |
return 1; |
|
| 218 |
} |
|
| 219 |
|
|
| 220 | 188 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 221 | 189 |
|
| 222 | 190 |
ObjectShape getObjectShape(int cubit, int numLayers) |
| ... | ... | |
| 283 | 251 |
|
| 284 | 252 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 285 | 253 |
|
| 286 |
MeshBase createCubitMesh(int cubit, int numLayers)
|
|
| 254 |
Static4D getQuat(int cubit, int numLayers)
|
|
| 287 | 255 |
{
|
| 288 |
int variant = getCubitVariant(cubit,numLayers); |
|
| 256 |
return INIT_QUATS[getQuatIndex(cubit)]; |
|
| 257 |
} |
|
| 289 | 258 |
|
| 290 |
if( mMeshes==null ) |
|
| 291 |
{
|
|
| 292 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
| 293 |
factory.clear(); |
|
| 294 |
mMeshes = new MeshBase[getNumCubitVariants(numLayers)]; |
|
| 295 |
} |
|
| 259 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 260 |
|
|
| 261 |
int getNumCubitVariants(int numLayers) |
|
| 262 |
{
|
|
| 263 |
return mDimensions.length; |
|
| 264 |
} |
|
| 265 |
|
|
| 266 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 267 |
|
|
| 268 |
int getCubitVariant(int cubit, int numLayers) |
|
| 269 |
{
|
|
| 270 |
float[][] pos = getPositions(); |
|
| 296 | 271 |
|
| 297 |
if( mMeshes[variant]==null )
|
|
| 272 |
if( cubit>=0 && cubit<pos.length )
|
|
| 298 | 273 |
{
|
| 299 |
ObjectShape shape = getObjectShape(cubit,numLayers); |
|
| 300 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
| 301 |
factory.createNewFaceTransform(shape); |
|
| 302 |
mMeshes[variant] = factory.createRoundedSolid(shape); |
|
| 274 |
int numPoints = pos[cubit].length/3; |
|
| 275 |
return numPoints==8 ? 4 : numPoints-1; |
|
| 303 | 276 |
} |
| 304 | 277 |
|
| 305 |
MeshBase mesh = mMeshes[variant].copy(true); |
|
| 306 |
MatrixEffectQuaternion quat = new MatrixEffectQuaternion( getQuat(cubit,numLayers), new Static3D(0,0,0) ); |
|
| 307 |
mesh.apply(quat,0xffffffff,0); |
|
| 308 |
|
|
| 309 |
return mesh; |
|
| 278 |
return 1; |
|
| 310 | 279 |
} |
| 311 | 280 |
|
| 312 | 281 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| src/main/java/org/distorted/objects/TwistyCube.java | ||
|---|---|---|
| 21 | 21 |
|
| 22 | 22 |
import android.content.res.Resources; |
| 23 | 23 |
|
| 24 |
import org.distorted.helpers.FactoryCubit; |
|
| 25 | 24 |
import org.distorted.helpers.ObjectShape; |
| 26 | 25 |
import org.distorted.helpers.ObjectSticker; |
| 27 |
import org.distorted.library.effect.MatrixEffectQuaternion; |
|
| 28 | 26 |
import org.distorted.library.main.DistortedEffects; |
| 29 | 27 |
import org.distorted.library.main.DistortedTexture; |
| 30 |
import org.distorted.library.mesh.MeshBase; |
|
| 31 | 28 |
import org.distorted.library.mesh.MeshSquare; |
| 32 | 29 |
import org.distorted.library.type.Static3D; |
| 33 | 30 |
import org.distorted.library.type.Static4D; |
| ... | ... | |
| 139 | 136 |
super(size, size, quat, texture, mesh, effects, moves, ObjectList.CUBE, res, scrWidth); |
| 140 | 137 |
} |
| 141 | 138 |
|
| 142 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 143 |
|
|
| 144 |
private Static4D getQuat(int cubit, int numLayers) |
|
| 145 |
{
|
|
| 146 |
return QUATS[0]; |
|
| 147 |
} |
|
| 148 |
|
|
| 149 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 150 |
|
|
| 151 |
private int getNumCubitVariants(int numLayers) |
|
| 152 |
{
|
|
| 153 |
return 1; |
|
| 154 |
} |
|
| 155 |
|
|
| 156 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 157 |
|
|
| 158 |
int getCubitVariant(int cubit, int numLayers) |
|
| 159 |
{
|
|
| 160 |
return 0; |
|
| 161 |
} |
|
| 162 |
|
|
| 163 | 139 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 164 | 140 |
|
| 165 | 141 |
ObjectShape getObjectShape(int cubit, int numLayers) |
| ... | ... | |
| 187 | 163 |
|
| 188 | 164 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 189 | 165 |
|
| 190 |
MeshBase createCubitMesh(int cubit, int numLayers)
|
|
| 166 |
Static4D getQuat(int cubit, int numLayers)
|
|
| 191 | 167 |
{
|
| 192 |
int variant = getCubitVariant(cubit,numLayers); |
|
| 168 |
return QUATS[0]; |
|
| 169 |
} |
|
| 193 | 170 |
|
| 194 |
if( mMeshes==null ) |
|
| 195 |
{
|
|
| 196 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
| 197 |
factory.clear(); |
|
| 198 |
mMeshes = new MeshBase[getNumCubitVariants(numLayers)]; |
|
| 199 |
} |
|
| 171 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 200 | 172 |
|
| 201 |
if( mMeshes[variant]==null ) |
|
| 202 |
{
|
|
| 203 |
ObjectShape shape = getObjectShape(cubit,numLayers); |
|
| 204 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
| 205 |
factory.createNewFaceTransform(shape); |
|
| 206 |
mMeshes[variant] = factory.createRoundedSolid(shape); |
|
| 207 |
} |
|
| 173 |
int getNumCubitVariants(int numLayers) |
|
| 174 |
{
|
|
| 175 |
return 1; |
|
| 176 |
} |
|
| 208 | 177 |
|
| 209 |
MeshBase mesh = mMeshes[variant].copy(true); |
|
| 210 |
MatrixEffectQuaternion quat = new MatrixEffectQuaternion( getQuat(cubit,numLayers), new Static3D(0,0,0) ); |
|
| 211 |
mesh.apply(quat,0xffffffff,0); |
|
| 178 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 212 | 179 |
|
| 213 |
return mesh; |
|
| 180 |
int getCubitVariant(int cubit, int numLayers) |
|
| 181 |
{
|
|
| 182 |
return 0; |
|
| 214 | 183 |
} |
| 215 | 184 |
|
| 216 | 185 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| src/main/java/org/distorted/objects/TwistyDiamond.java | ||
|---|---|---|
| 21 | 21 |
|
| 22 | 22 |
import android.content.res.Resources; |
| 23 | 23 |
|
| 24 |
import org.distorted.helpers.FactoryCubit; |
|
| 25 | 24 |
import org.distorted.helpers.ObjectShape; |
| 26 | 25 |
import org.distorted.helpers.ObjectSticker; |
| 27 |
import org.distorted.library.effect.MatrixEffectQuaternion; |
|
| 28 | 26 |
import org.distorted.library.main.DistortedEffects; |
| 29 | 27 |
import org.distorted.library.main.DistortedTexture; |
| 30 |
import org.distorted.library.mesh.MeshBase; |
|
| 31 | 28 |
import org.distorted.library.mesh.MeshSquare; |
| 32 | 29 |
import org.distorted.library.type.Static3D; |
| 33 | 30 |
import org.distorted.library.type.Static4D; |
| ... | ... | |
| 377 | 374 |
return -1; |
| 378 | 375 |
} |
| 379 | 376 |
|
| 380 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 381 |
|
|
| 382 |
private Static4D getQuat(int cubit, int numLayers) |
|
| 383 |
{
|
|
| 384 |
int numO = getNumOctahedrons(numLayers); |
|
| 385 |
|
|
| 386 |
if( cubit<numO ) return QUATS[0]; |
|
| 387 |
|
|
| 388 |
switch( retFaceTetraBelongsTo(cubit-numO, numLayers) ) |
|
| 389 |
{
|
|
| 390 |
case 0: return QUATS[0]; // unit quat |
|
| 391 |
case 1: return new Static4D(0,-SQ2/2,0,SQ2/2); // 90 along Y |
|
| 392 |
case 2: return QUATS[1]; // 180 along Y |
|
| 393 |
case 3: return new Static4D(0,+SQ2/2,0,SQ2/2); // 90 along |
|
| 394 |
case 4: return new Static4D(0, 0,1, 0); // 180 along Z |
|
| 395 |
case 5: return new Static4D(SQ2/2, 0,SQ2/2,0); // |
|
| 396 |
case 6: return new Static4D( 1,0,0, 0); // 180 along X |
|
| 397 |
case 7: return new Static4D(-SQ2/2,0,SQ2/2,0); // |
|
| 398 |
} |
|
| 399 |
|
|
| 400 |
return null; |
|
| 401 |
} |
|
| 402 |
|
|
| 403 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 404 |
|
|
| 405 |
private int getNumCubitVariants(int numLayers) |
|
| 406 |
{
|
|
| 407 |
return 2; |
|
| 408 |
} |
|
| 409 |
|
|
| 410 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 411 |
|
|
| 412 |
int getCubitVariant(int cubit, int numLayers) |
|
| 413 |
{
|
|
| 414 |
return cubit<getNumOctahedrons(numLayers) ? 0 : 1; |
|
| 415 |
} |
|
| 416 |
|
|
| 417 | 377 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 418 | 378 |
|
| 419 | 379 |
ObjectShape getObjectShape(int cubit, int numLayers) |
| 420 | 380 |
{
|
| 421 | 381 |
int variant = getCubitVariant(cubit,numLayers); |
| 422 | 382 |
int N = numLayers>3 ? 5:6; |
| 423 |
int E = numLayers>3 ? 1:2;
|
|
| 383 |
int E = numLayers>3 ? 0:2;
|
|
| 424 | 384 |
|
| 425 | 385 |
if( variant==0 ) |
| 426 | 386 |
{
|
| ... | ... | |
| 446 | 406 |
|
| 447 | 407 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 448 | 408 |
|
| 449 |
MeshBase createCubitMesh(int cubit, int numLayers)
|
|
| 409 |
Static4D getQuat(int cubit, int numLayers)
|
|
| 450 | 410 |
{
|
| 451 |
int variant = getCubitVariant(cubit,numLayers);
|
|
| 411 |
int numO = getNumOctahedrons(numLayers);
|
|
| 452 | 412 |
|
| 453 |
if( mMeshes==null ) |
|
| 454 |
{
|
|
| 455 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
| 456 |
factory.clear(); |
|
| 457 |
mMeshes = new MeshBase[getNumCubitVariants(numLayers)]; |
|
| 458 |
} |
|
| 413 |
if( cubit<numO ) return QUATS[0]; |
|
| 459 | 414 |
|
| 460 |
if( mMeshes[variant]==null )
|
|
| 415 |
switch( retFaceTetraBelongsTo(cubit-numO, numLayers) )
|
|
| 461 | 416 |
{
|
| 462 |
ObjectShape shape = getObjectShape(cubit,numLayers); |
|
| 463 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
| 464 |
factory.createNewFaceTransform(shape); |
|
| 465 |
mMeshes[variant] = factory.createRoundedSolid(shape); |
|
| 417 |
case 0: return QUATS[0]; // unit quat |
|
| 418 |
case 1: return new Static4D(0,-SQ2/2,0,SQ2/2); // 90 along Y |
|
| 419 |
case 2: return QUATS[1]; // 180 along Y |
|
| 420 |
case 3: return new Static4D(0,+SQ2/2,0,SQ2/2); // 90 along |
|
| 421 |
case 4: return new Static4D(0, 0,1, 0); // 180 along Z |
|
| 422 |
case 5: return new Static4D(SQ2/2, 0,SQ2/2,0); // |
|
| 423 |
case 6: return new Static4D( 1,0,0, 0); // 180 along X |
|
| 424 |
case 7: return new Static4D(-SQ2/2,0,SQ2/2,0); // |
|
| 466 | 425 |
} |
| 467 | 426 |
|
| 468 |
MeshBase mesh = mMeshes[variant].copy(true); |
|
| 469 |
MatrixEffectQuaternion quat = new MatrixEffectQuaternion( getQuat(cubit,numLayers), new Static3D(0,0,0) ); |
|
| 470 |
mesh.apply(quat,0xffffffff,0); |
|
| 427 |
return null; |
|
| 428 |
} |
|
| 429 |
|
|
| 430 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 471 | 431 |
|
| 472 |
return mesh; |
|
| 432 |
int getNumCubitVariants(int numLayers) |
|
| 433 |
{
|
|
| 434 |
return 2; |
|
| 435 |
} |
|
| 436 |
|
|
| 437 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 438 |
|
|
| 439 |
int getCubitVariant(int cubit, int numLayers) |
|
| 440 |
{
|
|
| 441 |
return cubit<getNumOctahedrons(numLayers) ? 0 : 1; |
|
| 473 | 442 |
} |
| 474 | 443 |
|
| 475 | 444 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| src/main/java/org/distorted/objects/TwistyDino.java | ||
|---|---|---|
| 21 | 21 |
|
| 22 | 22 |
import android.content.res.Resources; |
| 23 | 23 |
|
| 24 |
import org.distorted.helpers.FactoryCubit; |
|
| 25 | 24 |
import org.distorted.helpers.ObjectShape; |
| 26 | 25 |
import org.distorted.helpers.ObjectSticker; |
| 27 |
import org.distorted.library.effect.MatrixEffectQuaternion; |
|
| 28 | 26 |
import org.distorted.library.main.DistortedEffects; |
| 29 | 27 |
import org.distorted.library.main.DistortedTexture; |
| 30 |
import org.distorted.library.mesh.MeshBase; |
|
| 31 | 28 |
import org.distorted.library.mesh.MeshSquare; |
| 32 | 29 |
import org.distorted.library.type.Static3D; |
| 33 | 30 |
import org.distorted.library.type.Static4D; |
| ... | ... | |
| 180 | 177 |
|
| 181 | 178 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 182 | 179 |
|
| 183 |
private Static4D getQuat(int cubit, int numLayers) |
|
| 184 |
{
|
|
| 185 |
return QUATS[cubit]; |
|
| 186 |
} |
|
| 187 |
|
|
| 188 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 189 |
|
|
| 190 |
private int getNumCubitVariants(int numLayers) |
|
| 180 |
ObjectShape getObjectShape(int cubit, int numLayers) |
|
| 191 | 181 |
{
|
| 192 |
return 1; |
|
| 182 |
float[][] bands = new float[][] { {0.035f,30,0.16f,0.8f,6,2,2}, {0.010f,30,0.16f,0.2f,6,2,2} };
|
|
| 183 |
int[] bandIndices = new int[] { 0,0,1,1 };
|
|
| 184 |
float[][] corners = new float[][] { {0.07f,0.40f}, {0.05f,0.30f} };
|
|
| 185 |
int[] cornerIndices = new int[] { 0,0,1,1 };
|
|
| 186 |
float[][] centers = new float[][] { {0.0f, -0.75f, -0.75f} };
|
|
| 187 |
int[] centerIndices = new int[] { 0,0,0,0 };
|
|
| 188 |
return new ObjectShape(VERTICES,VERT_INDEXES,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null); |
|
| 193 | 189 |
} |
| 194 | 190 |
|
| 195 | 191 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 196 | 192 |
|
| 197 |
int getCubitVariant(int cubit, int numLayers)
|
|
| 193 |
Static4D getQuat(int cubit, int numLayers)
|
|
| 198 | 194 |
{
|
| 199 |
return 0;
|
|
| 195 |
return QUATS[cubit];
|
|
| 200 | 196 |
} |
| 201 | 197 |
|
| 202 | 198 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 203 | 199 |
|
| 204 |
ObjectShape getObjectShape(int cubit, int numLayers)
|
|
| 200 |
int getNumCubitVariants(int numLayers)
|
|
| 205 | 201 |
{
|
| 206 |
float[][] bands= new float[][] { {0.035f,30,0.16f,0.8f,6,2,2}, {0.010f,30,0.16f,0.2f,6,2,2} };
|
|
| 207 |
int[] bandIndices = new int[] { 0,0,1,1 };
|
|
| 208 |
float[][] corners = new float[][] { {0.07f,0.40f}, {0.05f,0.30f} };
|
|
| 209 |
int[] cornerIndices = new int[] { 0,0,1,1 };
|
|
| 210 |
float[][] centers = new float[][] { {0.0f, -0.75f, -0.75f} };
|
|
| 211 |
int[] centerIndices = new int[] { 0,0,0,0 };
|
|
| 212 |
|
|
| 213 |
return new ObjectShape(VERTICES,VERT_INDEXES,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null); |
|
| 202 |
return 1; |
|
| 214 | 203 |
} |
| 215 | 204 |
|
| 216 | 205 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 217 | 206 |
|
| 218 |
MeshBase createCubitMesh(int cubit, int numLayers)
|
|
| 207 |
int getCubitVariant(int cubit, int numLayers)
|
|
| 219 | 208 |
{
|
| 220 |
int variant = getCubitVariant(cubit,numLayers); |
|
| 221 |
|
|
| 222 |
if( mMeshes==null ) |
|
| 223 |
{
|
|
| 224 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
| 225 |
factory.clear(); |
|
| 226 |
mMeshes = new MeshBase[getNumCubitVariants(numLayers)]; |
|
| 227 |
} |
|
| 228 |
|
|
| 229 |
if( mMeshes[variant]==null ) |
|
| 230 |
{
|
|
| 231 |
ObjectShape shape = getObjectShape(cubit,numLayers); |
|
| 232 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
| 233 |
factory.createNewFaceTransform(shape); |
|
| 234 |
mMeshes[variant] = factory.createRoundedSolid(shape); |
|
| 235 |
} |
|
| 236 |
|
|
| 237 |
MeshBase mesh = mMeshes[variant].copy(true); |
|
| 238 |
MatrixEffectQuaternion quat = new MatrixEffectQuaternion( getQuat(cubit,numLayers), new Static3D(0,0,0) ); |
|
| 239 |
mesh.apply(quat,0xffffffff,0); |
|
| 240 |
|
|
| 241 |
return mesh; |
|
| 209 |
return 0; |
|
| 242 | 210 |
} |
| 243 | 211 |
|
| 244 | 212 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| src/main/java/org/distorted/objects/TwistyHelicopter.java | ||
|---|---|---|
| 21 | 21 |
|
| 22 | 22 |
import android.content.res.Resources; |
| 23 | 23 |
|
| 24 |
import org.distorted.helpers.FactoryCubit; |
|
| 25 | 24 |
import org.distorted.helpers.ObjectShape; |
| 26 | 25 |
import org.distorted.helpers.ObjectSticker; |
| 27 |
import org.distorted.library.effect.MatrixEffectQuaternion; |
|
| 28 | 26 |
import org.distorted.library.main.DistortedEffects; |
| 29 | 27 |
import org.distorted.library.main.DistortedTexture; |
| 30 |
import org.distorted.library.mesh.MeshBase; |
|
| 31 | 28 |
import org.distorted.library.mesh.MeshSquare; |
| 32 | 29 |
import org.distorted.library.type.Static3D; |
| 33 | 30 |
import org.distorted.library.type.Static4D; |
| ... | ... | |
| 311 | 308 |
|
| 312 | 309 |
if( variant==0 ) |
| 313 | 310 |
{
|
| 314 |
float[][] bands= new float[][] { {0.028f,35,0.16f,0.7f,7,3,3}, {0.000f, 0,1.00f,0.0f,3,1,5} };
|
|
| 311 |
float[][] bands = new float[][] { {0.028f,35,0.16f,0.7f,7,3,3}, {0.000f, 0,1.00f,0.0f,3,1,5} };
|
|
| 315 | 312 |
int[] bandIndices = new int[] { 0,0,0,1,1,1 };
|
| 316 | 313 |
float[][] corners = new float[][] { {0.08f,0.15f}, {0.08f,0.20f} };
|
| 317 | 314 |
int[] cornerIndices = new int[] { 1,1,1,0,0 };
|
| ... | ... | |
| 321 | 318 |
} |
| 322 | 319 |
else |
| 323 | 320 |
{
|
| 324 |
float[][] bands= new float[][] { {0.028f,35,0.16f,0.7f,7,3,3}, {0.000f, 0,1.00f,0.0f,3,1,3} };
|
|
| 321 |
float[][] bands = new float[][] { {0.028f,35,0.16f,0.7f,7,3,3}, {0.000f, 0,1.00f,0.0f,3,1,3} };
|
|
| 325 | 322 |
int[] bandIndices = new int[] { 0,1,1,1 };
|
| 326 | 323 |
float[][] corners = new float[][] { {0.06f,0.15f}, {0.06f,0.20f} };
|
| 327 | 324 |
int[] cornerIndices = new int[] { 0,1,1,-1 };
|
| ... | ... | |
| 333 | 330 |
|
| 334 | 331 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 335 | 332 |
|
| 336 |
private Static4D getQuat(int cubit, int numLayers)
|
|
| 333 |
Static4D getQuat(int cubit, int numLayers) |
|
| 337 | 334 |
{
|
| 338 | 335 |
return QUATS[QUAT_INDICES[cubit]]; |
| 339 | 336 |
} |
| 340 | 337 |
|
| 341 | 338 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 342 | 339 |
|
| 343 |
private int getNumCubitVariants(int numLayers)
|
|
| 340 |
int getNumCubitVariants(int numLayers) |
|
| 344 | 341 |
{
|
| 345 | 342 |
return 2; |
| 346 | 343 |
} |
| ... | ... | |
| 352 | 349 |
return cubit<8 ? 0:1; |
| 353 | 350 |
} |
| 354 | 351 |
|
| 355 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 356 |
|
|
| 357 |
MeshBase createCubitMesh(int cubit, int numLayers) |
|
| 358 |
{
|
|
| 359 |
int variant = getCubitVariant(cubit,numLayers); |
|
| 360 |
|
|
| 361 |
if( mMeshes==null ) |
|
| 362 |
{
|
|
| 363 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
| 364 |
factory.clear(); |
|
| 365 |
mMeshes = new MeshBase[getNumCubitVariants(numLayers)]; |
|
| 366 |
} |
|
| 367 |
|
|
| 368 |
if( mMeshes[variant]==null ) |
|
| 369 |
{
|
|
| 370 |
ObjectShape shape = getObjectShape(cubit,numLayers); |
|
| 371 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
| 372 |
factory.createNewFaceTransform(shape); |
|
| 373 |
mMeshes[variant] = factory.createRoundedSolid(shape); |
|
| 374 |
} |
|
| 375 |
|
|
| 376 |
MeshBase mesh = mMeshes[variant].copy(true); |
|
| 377 |
MatrixEffectQuaternion quat = new MatrixEffectQuaternion( getQuat(cubit,numLayers), new Static3D(0,0,0) ); |
|
| 378 |
mesh.apply(quat,0xffffffff,0); |
|
| 379 |
|
|
| 380 |
return mesh; |
|
| 381 |
} |
|
| 382 |
|
|
| 383 | 352 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 384 | 353 |
|
| 385 | 354 |
int getFaceColor(int cubit, int cubitface, int size) |
| src/main/java/org/distorted/objects/TwistyIvy.java | ||
|---|---|---|
| 21 | 21 |
|
| 22 | 22 |
import android.content.res.Resources; |
| 23 | 23 |
|
| 24 |
import org.distorted.helpers.FactoryCubit; |
|
| 25 | 24 |
import org.distorted.helpers.ObjectShape; |
| 26 | 25 |
import org.distorted.helpers.ObjectSticker; |
| 27 |
import org.distorted.library.effect.MatrixEffectQuaternion; |
|
| 28 | 26 |
import org.distorted.library.main.DistortedEffects; |
| 29 | 27 |
import org.distorted.library.main.DistortedTexture; |
| 30 |
import org.distorted.library.mesh.MeshBase; |
|
| 31 | 28 |
import org.distorted.library.mesh.MeshSquare; |
| 32 | 29 |
import org.distorted.library.type.Static3D; |
| 33 | 30 |
import org.distorted.library.type.Static4D; |
| ... | ... | |
| 359 | 356 |
|
| 360 | 357 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 361 | 358 |
|
| 362 |
private Static4D getQuat(int cubit, int numLayers)
|
|
| 359 |
Static4D getQuat(int cubit, int numLayers) |
|
| 363 | 360 |
{
|
| 364 | 361 |
switch(cubit) |
| 365 | 362 |
{
|
| ... | ... | |
| 381 | 378 |
|
| 382 | 379 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 383 | 380 |
|
| 384 |
private int getNumCubitVariants(int numLayers)
|
|
| 381 |
int getNumCubitVariants(int numLayers) |
|
| 385 | 382 |
{
|
| 386 | 383 |
return 2; |
| 387 | 384 |
} |
| ... | ... | |
| 393 | 390 |
return cubit<4 ? 0:1; |
| 394 | 391 |
} |
| 395 | 392 |
|
| 396 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 397 |
|
|
| 398 |
MeshBase createCubitMesh(int cubit, int numLayers) |
|
| 399 |
{
|
|
| 400 |
int variant = getCubitVariant(cubit,numLayers); |
|
| 401 |
|
|
| 402 |
if( mMeshes==null ) |
|
| 403 |
{
|
|
| 404 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
| 405 |
factory.clear(); |
|
| 406 |
mMeshes = new MeshBase[getNumCubitVariants(numLayers)]; |
|
| 407 |
} |
|
| 408 |
|
|
| 409 |
if( mMeshes[variant]==null ) |
|
| 410 |
{
|
|
| 411 |
ObjectShape shape = getObjectShape(cubit,numLayers); |
|
| 412 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
| 413 |
factory.createNewFaceTransform(shape); |
|
| 414 |
mMeshes[variant] = factory.createRoundedSolid(shape); |
|
| 415 |
} |
|
| 416 |
|
|
| 417 |
MeshBase mesh = mMeshes[variant].copy(true); |
|
| 418 |
MatrixEffectQuaternion quat = new MatrixEffectQuaternion( getQuat(cubit,numLayers), new Static3D(0,0,0) ); |
|
| 419 |
mesh.apply(quat,0xffffffff,0); |
|
| 420 |
|
|
| 421 |
return mesh; |
|
| 422 |
} |
|
| 423 |
|
|
| 424 | 393 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 425 | 394 |
|
| 426 | 395 |
int getFaceColor(int cubit, int cubitface, int numLayers) |
| src/main/java/org/distorted/objects/TwistyJing.java | ||
|---|---|---|
| 21 | 21 |
|
| 22 | 22 |
import android.content.res.Resources; |
| 23 | 23 |
|
| 24 |
import org.distorted.helpers.FactoryCubit; |
|
| 25 | 24 |
import org.distorted.helpers.ObjectShape; |
| 26 | 25 |
import org.distorted.helpers.ObjectSticker; |
| 27 |
import org.distorted.library.effect.MatrixEffectQuaternion; |
|
| 28 | 26 |
import org.distorted.library.main.DistortedEffects; |
| 29 | 27 |
import org.distorted.library.main.DistortedTexture; |
| 30 |
import org.distorted.library.mesh.MeshBase; |
|
| 31 | 28 |
import org.distorted.library.mesh.MeshSquare; |
| 32 | 29 |
import org.distorted.library.type.Static3D; |
| 33 | 30 |
import org.distorted.library.type.Static4D; |
| ... | ... | |
| 331 | 328 |
|
| 332 | 329 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 333 | 330 |
|
| 334 |
private Static4D getQuat(int cubit, int numLayers)
|
|
| 331 |
Static4D getQuat(int cubit, int numLayers) |
|
| 335 | 332 |
{
|
| 336 | 333 |
return QUATS[ROT_QUAT[cubit]]; |
| 337 | 334 |
} |
| 338 | 335 |
|
| 339 | 336 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 340 | 337 |
|
| 341 |
private int getNumCubitVariants(int numLayers)
|
|
| 338 |
int getNumCubitVariants(int numLayers) |
|
| 342 | 339 |
{
|
| 343 | 340 |
return 3; |
| 344 | 341 |
} |
| ... | ... | |
| 350 | 347 |
return cubit<4 ? 0 : (cubit<10?1:2); |
| 351 | 348 |
} |
| 352 | 349 |
|
| 353 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 354 |
|
|
| 355 |
MeshBase createCubitMesh(int cubit, int numLayers) |
|
| 356 |
{
|
|
| 357 |
int variant = getCubitVariant(cubit,numLayers); |
|
| 358 |
|
|
| 359 |
if( mMeshes==null ) |
|
| 360 |
{
|
|
| 361 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
| 362 |
factory.clear(); |
|
| 363 |
mMeshes = new MeshBase[getNumCubitVariants(numLayers)]; |
|
| 364 |
} |
|
| 365 |
|
|
| 366 |
if( mMeshes[variant]==null ) |
|
| 367 |
{
|
|
| 368 |
ObjectShape shape = getObjectShape(cubit,numLayers); |
|
| 369 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
| 370 |
factory.createNewFaceTransform(shape); |
|
| 371 |
mMeshes[variant] = factory.createRoundedSolid(shape); |
|
| 372 |
} |
|
| 373 |
|
|
| 374 |
MeshBase mesh = mMeshes[variant].copy(true); |
|
| 375 |
MatrixEffectQuaternion quat = new MatrixEffectQuaternion( getQuat(cubit,numLayers), new Static3D(0,0,0) ); |
|
| 376 |
mesh.apply(quat,0xffffffff,0); |
|
| 377 |
|
|
| 378 |
return mesh; |
|
| 379 |
} |
|
| 380 |
|
|
| 381 | 350 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 382 | 351 |
|
| 383 | 352 |
int getColor(int face) |
| src/main/java/org/distorted/objects/TwistyKilominx.java | ||
|---|---|---|
| 21 | 21 |
|
| 22 | 22 |
import android.content.res.Resources; |
| 23 | 23 |
|
| 24 |
import org.distorted.helpers.FactoryCubit; |
|
| 25 | 24 |
import org.distorted.helpers.ObjectShape; |
| 26 | 25 |
import org.distorted.helpers.ObjectSticker; |
| 27 | 26 |
import org.distorted.helpers.QuatHelper; |
| 28 |
import org.distorted.library.effect.MatrixEffectQuaternion; |
|
| 29 | 27 |
import org.distorted.library.main.DistortedEffects; |
| 30 | 28 |
import org.distorted.library.main.DistortedTexture; |
| 31 |
import org.distorted.library.mesh.MeshBase; |
|
| 32 | 29 |
import org.distorted.library.mesh.MeshSquare; |
| 33 |
import org.distorted.library.type.Static3D; |
|
| 34 | 30 |
import org.distorted.library.type.Static4D; |
| 35 | 31 |
import org.distorted.main.R; |
| 36 | 32 |
|
| ... | ... | |
| 539 | 535 |
|
| 540 | 536 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 541 | 537 |
|
| 542 |
private Static4D getQuat(int cubit, int numLayers)
|
|
| 538 |
Static4D getQuat(int cubit, int numLayers) |
|
| 543 | 539 |
{
|
| 544 | 540 |
int numCubitsPerCorner = numCubitsPerCorner(numLayers); |
| 545 | 541 |
int numCubitsPerEdge = numCubitsPerEdge(numLayers); |
| ... | ... | |
| 549 | 545 |
|
| 550 | 546 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 551 | 547 |
|
| 552 |
private int getNumCubitVariants(int numLayers)
|
|
| 548 |
int getNumCubitVariants(int numLayers) |
|
| 553 | 549 |
{
|
| 554 | 550 |
int[] sizes = ObjectList.KILO.getSizes(); |
| 555 | 551 |
int variants = sizes.length; |
| ... | ... | |
| 581 | 577 |
return highestSize-2; |
| 582 | 578 |
} |
| 583 | 579 |
|
| 584 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 585 |
|
|
| 586 |
MeshBase createCubitMesh(int cubit, int numLayers) |
|
| 587 |
{
|
|
| 588 |
int variant = getCubitVariant(cubit,numLayers); |
|
| 589 |
|
|
| 590 |
if( mMeshes==null ) |
|
| 591 |
{
|
|
| 592 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
| 593 |
factory.clear(); |
|
| 594 |
mMeshes = new MeshBase[getNumCubitVariants(numLayers)]; |
|
| 595 |
} |
|
| 596 |
|
|
| 597 |
if( mMeshes[variant]==null ) |
|
| 598 |
{
|
|
| 599 |
ObjectShape shape = getObjectShape(cubit,numLayers); |
|
| 600 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
| 601 |
factory.createNewFaceTransform(shape); |
|
| 602 |
mMeshes[variant] = factory.createRoundedSolid(shape); |
|
| 603 |
} |
|
| 604 |
|
|
| 605 |
MeshBase mesh = mMeshes[variant].copy(true); |
|
| 606 |
MatrixEffectQuaternion quat = new MatrixEffectQuaternion( getQuat(cubit,numLayers), new Static3D(0,0,0) ); |
|
| 607 |
mesh.apply(quat,0xffffffff,0); |
|
| 608 |
|
|
| 609 |
return mesh; |
|
| 610 |
} |
|
| 611 |
|
|
| 612 | 580 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 613 | 581 |
|
| 614 | 582 |
int getCornerColor(int cubit, int cubitface, int numLayers, int numCubitsPerCorner) |
| src/main/java/org/distorted/objects/TwistyMegaminx.java | ||
|---|---|---|
| 21 | 21 |
|
| 22 | 22 |
import android.content.res.Resources; |
| 23 | 23 |
|
| 24 |
import org.distorted.helpers.FactoryCubit; |
|
| 25 | 24 |
import org.distorted.helpers.ObjectShape; |
| 26 | 25 |
import org.distorted.helpers.ObjectSticker; |
| 27 | 26 |
import org.distorted.helpers.QuatHelper; |
| 28 |
import org.distorted.library.effect.MatrixEffectQuaternion; |
|
| 29 | 27 |
import org.distorted.library.main.DistortedEffects; |
| 30 | 28 |
import org.distorted.library.main.DistortedTexture; |
| 31 |
import org.distorted.library.mesh.MeshBase; |
|
| 32 | 29 |
import org.distorted.library.mesh.MeshSquare; |
| 33 |
import org.distorted.library.type.Static3D; |
|
| 34 | 30 |
import org.distorted.library.type.Static4D; |
| 35 | 31 |
import org.distorted.main.R; |
| 36 | 32 |
|
| ... | ... | |
| 450 | 446 |
|
| 451 | 447 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 452 | 448 |
|
| 453 |
private Static4D getQuat(int cubit, int numLayers)
|
|
| 449 |
Static4D getQuat(int cubit, int numLayers) |
|
| 454 | 450 |
{
|
| 455 | 451 |
int numCubitsPerCorner = numCubitsPerCorner(numLayers); |
| 456 | 452 |
int numCubitsPerEdge = numCubitsPerEdge(numLayers); |
| ... | ... | |
| 460 | 456 |
|
| 461 | 457 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 462 | 458 |
|
| 463 |
private int getNumCubitVariants(int numLayers)
|
|
| 459 |
int getNumCubitVariants(int numLayers) |
|
| 464 | 460 |
{
|
| 465 | 461 |
int[] sizes = ObjectList.MEGA.getSizes(); |
| 466 | 462 |
int variants = sizes.length; |
| ... | ... | |
| 491 | 487 |
return numShapes-1; |
| 492 | 488 |
} |
| 493 | 489 |
|
| 494 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 495 |
|
|
| 496 |
MeshBase createCubitMesh(int cubit, int numLayers) |
|
| 497 |
{
|
|
| 498 |
int variant = getCubitVariant(cubit,numLayers); |
|
| 499 |
|
|
| 500 |
if( mMeshes==null ) |
|
| 501 |
{
|
|
| 502 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
| 503 |
factory.clear(); |
|
| 504 |
mMeshes = new MeshBase[getNumCubitVariants(numLayers)]; |
|
| 505 |
} |
|
| 506 |
|
|
| 507 |
if( mMeshes[variant]==null ) |
|
| 508 |
{
|
|
| 509 |
ObjectShape shape = getObjectShape(cubit,numLayers); |
|
| 510 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
| 511 |
factory.createNewFaceTransform(shape); |
|
| 512 |
mMeshes[variant] = factory.createRoundedSolid(shape); |
|
| 513 |
} |
|
| 514 |
|
|
| 515 |
MeshBase mesh = mMeshes[variant].copy(true); |
|
| 516 |
MatrixEffectQuaternion quat = new MatrixEffectQuaternion( getQuat(cubit,numLayers), new Static3D(0,0,0) ); |
|
| 517 |
mesh.apply(quat,0xffffffff,0); |
|
| 518 |
|
|
| 519 |
return mesh; |
|
| 520 |
} |
|
| 521 |
|
|
| 522 | 490 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 523 | 491 |
|
| 524 | 492 |
int getCornerColor(int cubit, int cubitface, int numLayers, int numCubitsPerCorner) |
| src/main/java/org/distorted/objects/TwistyMinx.java | ||
|---|---|---|
| 21 | 21 |
|
| 22 | 22 |
import android.content.res.Resources; |
| 23 | 23 |
|
| 24 |
import org.distorted.helpers.FactoryCubit; |
|
| 25 | 24 |
import org.distorted.library.main.DistortedEffects; |
| 26 | 25 |
import org.distorted.library.main.DistortedTexture; |
| 27 |
import org.distorted.library.mesh.MeshBase; |
|
| 28 | 26 |
import org.distorted.library.mesh.MeshSquare; |
| 29 | 27 |
import org.distorted.library.type.Static3D; |
| 30 | 28 |
import org.distorted.library.type.Static4D; |
| src/main/java/org/distorted/objects/TwistyObject.java | ||
|---|---|---|
| 29 | 29 |
|
| 30 | 30 |
import org.distorted.helpers.FactoryCubit; |
| 31 | 31 |
import org.distorted.helpers.FactorySticker; |
| 32 |
import org.distorted.helpers.ObjectShape; |
|
| 32 | 33 |
import org.distorted.helpers.ObjectSticker; |
| 33 | 34 |
import org.distorted.helpers.QuatHelper; |
| 34 | 35 |
import org.distorted.library.effect.Effect; |
| ... | ... | |
| 287 | 288 |
} |
| 288 | 289 |
} |
| 289 | 290 |
|
| 291 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 292 |
|
|
| 293 |
private MeshBase createCubitMesh(int cubit, int numLayers) |
|
| 294 |
{
|
|
| 295 |
int variant = getCubitVariant(cubit,numLayers); |
|
| 296 |
|
|
| 297 |
if( mMeshes==null ) |
|
| 298 |
{
|
|
| 299 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
| 300 |
factory.clear(); |
|
| 301 |
mMeshes = new MeshBase[getNumCubitVariants(numLayers)]; |
|
| 302 |
} |
|
| 303 |
|
|
| 304 |
if( mMeshes[variant]==null ) |
|
| 305 |
{
|
|
| 306 |
ObjectShape shape = getObjectShape(cubit,numLayers); |
|
| 307 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
| 308 |
factory.createNewFaceTransform(shape); |
|
| 309 |
mMeshes[variant] = factory.createRoundedSolid(shape); |
|
| 310 |
} |
|
| 311 |
|
|
| 312 |
MeshBase mesh = mMeshes[variant].copy(true); |
|
| 313 |
MatrixEffectQuaternion quat = new MatrixEffectQuaternion( getQuat(cubit,numLayers), new Static3D(0,0,0) ); |
|
| 314 |
mesh.apply(quat,0xffffffff,0); |
|
| 315 |
|
|
| 316 |
return mesh; |
|
| 317 |
} |
|
| 318 |
|
|
| 290 | 319 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 291 | 320 |
|
| 292 | 321 |
public void setObjectRatio(float sizeChange) |
| ... | ... | |
| 974 | 1003 |
abstract int getNumFaces(); |
| 975 | 1004 |
abstract int getNumStickerTypes(int numLayers); |
| 976 | 1005 |
abstract int getNumCubitFaces(); |
| 977 |
abstract MeshBase createCubitMesh(int cubit, int numLayers); |
|
| 978 | 1006 |
abstract ObjectSticker retSticker(int face); |
| 979 | 1007 |
abstract int getColor(int face); |
| 980 | 1008 |
abstract int getFaceColor(int cubit, int cubitface, int numLayers); |
| 981 | 1009 |
abstract float returnMultiplier(); |
| 982 | 1010 |
abstract float[][] getCuts(int numLayers); |
| 983 | 1011 |
abstract boolean shouldResetTextureMaps(); |
| 1012 |
abstract int getCubitVariant(int cubit, int numLayers); |
|
| 1013 |
abstract int getNumCubitVariants(int numLayers); |
|
| 1014 |
abstract Static4D getQuat(int cubit, int numLayers); |
|
| 1015 |
abstract ObjectShape getObjectShape(int cubit, int numLayers); |
|
| 984 | 1016 |
|
| 985 | 1017 |
public abstract Static3D[] getRotationAxis(); |
| 986 | 1018 |
public abstract boolean isSolved(); |
| src/main/java/org/distorted/objects/TwistyPyraminx.java | ||
|---|---|---|
| 21 | 21 |
|
| 22 | 22 |
import android.content.res.Resources; |
| 23 | 23 |
|
| 24 |
import org.distorted.helpers.FactoryCubit; |
|
| 25 | 24 |
import org.distorted.helpers.ObjectShape; |
| 26 | 25 |
import org.distorted.helpers.ObjectSticker; |
| 27 |
import org.distorted.library.effect.MatrixEffectQuaternion; |
|
| 28 | 26 |
import org.distorted.library.main.DistortedEffects; |
| 29 | 27 |
import org.distorted.library.main.DistortedTexture; |
| 30 |
import org.distorted.library.mesh.MeshBase; |
|
| 31 | 28 |
import org.distorted.library.mesh.MeshSquare; |
| 32 | 29 |
import org.distorted.library.type.Static3D; |
| 33 | 30 |
import org.distorted.library.type.Static4D; |
| ... | ... | |
| 336 | 333 |
|
| 337 | 334 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 338 | 335 |
|
| 339 |
private Static4D getQuat(int cubit, int numLayers)
|
|
| 336 |
Static4D getQuat(int cubit, int numLayers) |
|
| 340 | 337 |
{
|
| 341 | 338 |
return QUATS[0]; |
| 342 | 339 |
} |
| 343 | 340 |
|
| 344 | 341 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 345 | 342 |
|
| 346 |
private int getNumCubitVariants(int numLayers)
|
|
| 343 |
int getNumCubitVariants(int numLayers) |
|
| 347 | 344 |
{
|
| 348 | 345 |
return 2; |
| 349 | 346 |
} |
| ... | ... | |
| 355 | 352 |
return cubit<getNumOctahedrons(numLayers) ? 0:1; |
| 356 | 353 |
} |
| 357 | 354 |
|
| 358 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 359 |
|
|
| 360 |
MeshBase createCubitMesh(int cubit, int numLayers) |
|
| 361 |
{
|
|
| 362 |
int variant = getCubitVariant(cubit,numLayers); |
|
| 363 |
|
|
| 364 |
if( mMeshes==null ) |
|
| 365 |
{
|
|
| 366 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
| 367 |
factory.clear(); |
|
| 368 |
mMeshes = new MeshBase[getNumCubitVariants(numLayers)]; |
|
| 369 |
} |
|
| 370 |
|
|
| 371 |
if( mMeshes[variant]==null ) |
|
| 372 |
{
|
|
| 373 |
ObjectShape shape = getObjectShape(cubit,numLayers); |
|
| 374 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
| 375 |
factory.createNewFaceTransform(shape); |
|
| 376 |
mMeshes[variant] = factory.createRoundedSolid(shape); |
|
| 377 |
} |
|
| 378 |
|
|
| 379 |
MeshBase mesh = mMeshes[variant].copy(true); |
|
| 380 |
MatrixEffectQuaternion quat = new MatrixEffectQuaternion( getQuat(cubit,numLayers), new Static3D(0,0,0) ); |
|
| 381 |
mesh.apply(quat,0xffffffff,0); |
|
| 382 |
|
|
| 383 |
return mesh; |
|
| 384 |
} |
|
| 385 |
|
|
| 386 | 355 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 387 | 356 |
|
| 388 | 357 |
int getColor(int face) |
| src/main/java/org/distorted/objects/TwistyRedi.java | ||
|---|---|---|
| 21 | 21 |
|
| 22 | 22 |
import android.content.res.Resources; |
| 23 | 23 |
|
| 24 |
import org.distorted.helpers.FactoryCubit; |
|
| 25 | 24 |
import org.distorted.helpers.ObjectShape; |
| 26 | 25 |
import org.distorted.helpers.ObjectSticker; |
| 27 |
import org.distorted.library.effect.MatrixEffectQuaternion; |
|
| 28 | 26 |
import org.distorted.library.main.DistortedEffects; |
| 29 | 27 |
import org.distorted.library.main.DistortedTexture; |
| 30 |
import org.distorted.library.mesh.MeshBase; |
|
| 31 | 28 |
import org.distorted.library.mesh.MeshSquare; |
| 32 | 29 |
import org.distorted.library.type.Static3D; |
| 33 | 30 |
import org.distorted.library.type.Static4D; |
| ... | ... | |
| 314 | 311 |
|
| 315 | 312 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 316 | 313 |
|
| 317 |
private Static4D getQuat(int cubit, int numLayers)
|
|
| 314 |
Static4D getQuat(int cubit, int numLayers) |
|
| 318 | 315 |
{
|
| 319 | 316 |
switch(cubit) |
| 320 | 317 |
{
|
| ... | ... | |
| 346 | 343 |
|
| 347 | 344 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 348 | 345 |
|
| 349 |
private int getNumCubitVariants(int numLayers)
|
|
| 346 |
int getNumCubitVariants(int numLayers) |
|
| 350 | 347 |
{
|
| 351 | 348 |
return 2; |
| 352 | 349 |
} |
| ... | ... | |
| 358 | 355 |
return cubit<8 ? 0:1; |
| 359 | 356 |
} |
| 360 | 357 |
|
| 361 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 362 |
|
|
| 363 |
MeshBase createCubitMesh(int cubit, int numLayers) |
|
| 364 |
{
|
|
| 365 |
int variant = getCubitVariant(cubit,numLayers); |
|
| 366 |
|
|
| 367 |
if( mMeshes==null ) |
|
| 368 |
{
|
|
| 369 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
| 370 |
factory.clear(); |
|
| 371 |
mMeshes = new MeshBase[getNumCubitVariants(numLayers)]; |
|
| 372 |
} |
|
| 373 |
|
|
| 374 |
if( mMeshes[variant]==null ) |
|
| 375 |
{
|
|
| 376 |
ObjectShape shape = getObjectShape(cubit,numLayers); |
|
| 377 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
| 378 |
factory.createNewFaceTransform(shape); |
|
| 379 |
mMeshes[variant] = factory.createRoundedSolid(shape); |
|
| 380 |
} |
|
| 381 |
|
|
| 382 |
MeshBase mesh = mMeshes[variant].copy(true); |
|
| 383 |
MatrixEffectQuaternion quat = new MatrixEffectQuaternion( getQuat(cubit,numLayers), new Static3D(0,0,0) ); |
|
| 384 |
mesh.apply(quat,0xffffffff,0); |
|
| 385 |
|
|
| 386 |
return mesh; |
|
| 387 |
} |
|
| 388 |
|
|
| 389 | 358 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 390 | 359 |
|
| 391 | 360 |
int getFaceColor(int cubit, int cubitface, int size) |
| src/main/java/org/distorted/objects/TwistyRex.java | ||
|---|---|---|
| 21 | 21 |
|
| 22 | 22 |
import android.content.res.Resources; |
| 23 | 23 |
|
| 24 |
import org.distorted.helpers.FactoryCubit; |
|
| 25 | 24 |
import org.distorted.helpers.ObjectShape; |
| 26 | 25 |
import org.distorted.helpers.ObjectSticker; |
| 27 |
import org.distorted.library.effect.MatrixEffectQuaternion; |
|
| 28 | 26 |
import org.distorted.library.main.DistortedEffects; |
| 29 | 27 |
import org.distorted.library.main.DistortedTexture; |
| 30 |
import org.distorted.library.mesh.MeshBase; |
|
| 31 | 28 |
import org.distorted.library.mesh.MeshSquare; |
| 32 | 29 |
import org.distorted.library.type.Static3D; |
| 33 | 30 |
import org.distorted.library.type.Static4D; |
| ... | ... | |
| 357 | 354 |
|
| 358 | 355 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 359 | 356 |
|
| 360 |
private Static4D getQuat(int cubit, int numLayers)
|
|
| 357 |
Static4D getQuat(int cubit, int numLayers) |
|
| 361 | 358 |
{
|
| 362 | 359 |
switch(cubit) |
| 363 | 360 |
{
|
| ... | ... | |
| 412 | 409 |
|
| 413 | 410 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 414 | 411 |
|
| 415 |
private int getNumCubitVariants(int numLayers)
|
|
| 412 |
int getNumCubitVariants(int numLayers) |
|
| 416 | 413 |
{
|
| 417 | 414 |
return 3; |
| 418 | 415 |
} |
| ... | ... | |
| 424 | 421 |
return cubit<24 ? 0 : (cubit<30?1:2); |
| 425 | 422 |
} |
| 426 | 423 |
|
| 427 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 428 |
|
|
| 429 |
MeshBase createCubitMesh(int cubit, int numLayers) |
|
| 430 |
{
|
|
| 431 |
int variant = getCubitVariant(cubit,numLayers); |
|
| 432 |
|
|
| 433 |
if( mMeshes==null ) |
|
| 434 |
{
|
|
| 435 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
| 436 |
factory.clear(); |
|
| 437 |
mMeshes = new MeshBase[getNumCubitVariants(numLayers)]; |
|
| 438 |
} |
|
| 439 |
|
|
| 440 |
if( mMeshes[variant]==null ) |
|
| 441 |
{
|
|
| 442 |
ObjectShape shape = getObjectShape(cubit,numLayers); |
|
| 443 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
| 444 |
factory.createNewFaceTransform(shape); |
|
| 445 |
mMeshes[variant] = factory.createRoundedSolid(shape); |
|
| 446 |
} |
|
| 447 |
|
|
| 448 |
MeshBase mesh = mMeshes[variant].copy(true); |
|
| 449 |
MatrixEffectQuaternion quat = new MatrixEffectQuaternion( getQuat(cubit,numLayers), new Static3D(0,0,0) ); |
|
| 450 |
mesh.apply(quat,0xffffffff,0); |
|
| 451 |
|
|
| 452 |
return mesh; |
|
| 453 |
} |
|
| 454 |
|
|
| 455 | 424 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 456 | 425 |
|
| 457 | 426 |
int getFaceColor(int cubit, int cubitface, int numLayers) |
| src/main/java/org/distorted/objects/TwistySkewb.java | ||
|---|---|---|
| 407 | 407 |
|
| 408 | 408 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 409 | 409 |
|
| 410 |
private Static4D getQuat(int cubit, int numLayers)
|
|
| 410 |
Static4D getQuat(int cubit, int numLayers) |
|
| 411 | 411 |
{
|
| 412 | 412 |
int numCorners = getNumCorners(); |
| 413 | 413 |
int numEdges = getNumEdges(numLayers); |
| ... | ... | |
| 475 | 475 |
int N = numLayers==2 ? 7:5; |
| 476 | 476 |
int E1= numLayers==2 ? 3:2; |
| 477 | 477 |
int E2= numLayers==2 ? 5:3; |
| 478 |
float[][] bands= new float[][] |
|
| 479 |
{
|
|
| 480 |
{0.028f,35,0.16f,0.7f,N,E1,E1},
|
|
| 481 |
{0.000f, 0,1.00f,0.0f,3, 1,E2}
|
|
| 482 |
}; |
|
| 478 |
float[][] bands = new float[][] { {0.028f,35,0.16f,0.7f,N,E1,E1}, {0.000f, 0,1.00f,0.0f,3,1,E2} };
|
|
| 483 | 479 |
int[] bandIndices = new int[] { 0,0,0,1,1,1 };
|
| 484 | 480 |
float[][] corners = new float[][] { {0.08f,0.15f}, {0.08f,0.20f} };
|
| 485 | 481 |
int[] cornerIndices = new int[] { 1,1,1,0,0 };
|
| 486 | 482 |
float[][] centers = new float[][] { {-0.25f, -0.25f, -0.25f} };
|
| 487 | 483 |
int[] centerIndices = new int[] { 0,0,0,-1,0 };
|
| 488 |
|
|
| 489 | 484 |
return new ObjectShape(VERTICES_CORNER,VERT_INDEXES_CORNER,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null); |
| 490 | 485 |
} |
| 491 | 486 |
else if( variant==1 ) |
| 492 | 487 |
{
|
| 493 | 488 |
int N = numLayers==2 ? 7:5; |
| 494 | 489 |
int E = numLayers==2 ? 5:2; |
| 495 |
float[][] bands= new float[][] |
|
| 496 |
{
|
|
| 497 |
{0.035f,30,0.16f,0.8f,N,2,E},
|
|
| 498 |
{0.020f,45,0.16f,0.2f,3,1,2}
|
|
| 499 |
}; |
|
| 490 |
float[][] bands = new float[][] { {0.035f,30,0.16f,0.8f,N,2,E}, {0.020f,45,0.16f,0.2f,3,1,2} };
|
|
| 500 | 491 |
int[] bandIndices = new int[] { 0,0,1,1 };
|
| 501 | 492 |
float[][] corners = new float[][] { {0.07f,0.20f}, {0.02f,0.30f} };
|
| 502 | 493 |
int[] cornerIndices = new int[] { 0,0,1,1 };
|
| 503 | 494 |
float[][] centers = new float[][] { {0.0f, -0.25f, -0.25f} };
|
| 504 | 495 |
int[] centerIndices = new int[] { 0,0,0,0 };
|
| 505 |
|
|
| 506 | 496 |
return new ObjectShape(VERTICES_EDGE,VERT_INDEXES_EDGE,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null); |
| 507 | 497 |
} |
| 508 | 498 |
else |
| 509 | 499 |
{
|
| 510 | 500 |
int N = numLayers==2 ? 7:6; |
| 511 | 501 |
int E = numLayers==2 ? 3:1; |
| 512 |
float[][] bands= new float[][] |
|
| 513 |
{
|
|
| 514 |
{0.051f,35,SQ2/8,0.9f, N,E,E},
|
|
| 515 |
{0.000f, 0, 1,0.0f, 3,0,0}
|
|
| 516 |
}; |
|
| 502 |
float[][] bands = new float[][] { {0.051f,35,SQ2/8,0.9f,N,E,E}, {0.000f,0,1,0.0f,3,0,0} };
|
|
| 517 | 503 |
int[] bandIndices = new int[] { 0,1,1,1,1 };
|
| 518 | 504 |
float[][] corners = new float[][] { {0.06f,0.10f} };
|
| 519 | 505 |
int[] cornerIndices = new int[] { 0,0,0,0,0 };
|
| 520 | 506 |
float[][] centers = new float[][] { {0,0,-0.2f} };
|
| 521 | 507 |
int[] centerIndices = new int[] { 0,0,0,0,-1 };
|
| 522 |
|
|
| 523 | 508 |
return new ObjectShape(VERTICES_FACE,VERT_INDEXES_FACE,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null); |
| 524 | 509 |
} |
| 525 | 510 |
} |
| 526 | 511 |
|
| 527 | 512 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 528 | 513 |
|
| 529 |
private int getNumCubitVariants(int numLayers)
|
|
| 514 |
int getNumCubitVariants(int numLayers) |
|
| 530 | 515 |
{
|
| 531 | 516 |
return 3; |
| 532 | 517 |
} |
| ... | ... | |
| 541 | 526 |
return cubit<numCorners+numEdges ? 1:2; |
| 542 | 527 |
} |
| 543 | 528 |
|
| 544 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 545 |
|
|
| 546 |
MeshBase createCubitMesh(int cubit, int numLayers) |
|
| 547 |
{
|
|
| 548 |
int variant = getCubitVariant(cubit,numLayers); |
|
| 549 |
|
|
| 550 |
if( mMeshes==null ) |
|
| 551 |
{
|
|
| 552 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
| 553 |
factory.clear(); |
|
| 554 |
mMeshes = new MeshBase[getNumCubitVariants(numLayers)]; |
|
| 555 |
} |
|
| 556 |
|
|
| 557 |
if( mMeshes[variant]==null ) |
|
| 558 |
{
|
|
| 559 |
ObjectShape shape = getObjectShape(cubit,numLayers); |
|
| 560 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
| 561 |
factory.createNewFaceTransform(shape); |
|
| 562 |
mMeshes[variant] = factory.createRoundedSolid(shape); |
|
| 563 |
} |
|
| 564 |
|
|
| 565 |
MeshBase mesh = mMeshes[variant].copy(true); |
|
| 566 |
MatrixEffectQuaternion quat = new MatrixEffectQuaternion( getQuat(cubit,numLayers), new Static3D(0,0,0) ); |
|
| 567 |
mesh.apply(quat,0xffffffff,0); |
|
| 568 |
|
|
| 569 |
return mesh; |
|
| 570 |
} |
|
| 571 |
|
|
| 572 | 529 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 573 | 530 |
|
| 574 | 531 |
int getFaceColor(int cubit, int cubitface, int numLayers) |
| src/main/java/org/distorted/objects/TwistySquare.java | ||
|---|---|---|
| 21 | 21 |
|
| 22 | 22 |
import android.content.res.Resources; |
| 23 | 23 |
|
| 24 |
import org.distorted.helpers.FactoryCubit; |
|
| 25 | 24 |
import org.distorted.library.main.DistortedEffects; |
| 26 | 25 |
import org.distorted.library.main.DistortedTexture; |
| 27 |
import org.distorted.library.mesh.MeshBase; |
|
| 28 | 26 |
import org.distorted.library.mesh.MeshSquare; |
| 29 | 27 |
import org.distorted.library.type.Static3D; |
| 30 | 28 |
import org.distorted.library.type.Static4D; |
| src/main/java/org/distorted/objects/TwistySquare1.java | ||
|---|---|---|
| 21 | 21 |
|
| 22 | 22 |
import android.content.res.Resources; |
| 23 | 23 |
|
| 24 |
import org.distorted.helpers.FactoryCubit; |
|
| 25 | 24 |
import org.distorted.helpers.ObjectShape; |
| 26 | 25 |
import org.distorted.helpers.ObjectSticker; |
| 27 |
import org.distorted.library.effect.MatrixEffectQuaternion; |
|
| 28 | 26 |
import org.distorted.library.main.DistortedEffects; |
| 29 | 27 |
import org.distorted.library.main.DistortedTexture; |
| 30 |
import org.distorted.library.mesh.MeshBase; |
|
| 31 | 28 |
import org.distorted.library.mesh.MeshSquare; |
| 32 |
import org.distorted.library.type.Static3D; |
|
| 33 | 29 |
import org.distorted.library.type.Static4D; |
| 34 | 30 |
import org.distorted.main.R; |
| 35 | 31 |
|
| ... | ... | |
| 223 | 219 |
|
| 224 | 220 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 225 | 221 |
|
| 226 |
private Static4D getQuat(int cubit, int numLayers)
|
|
| 222 |
Static4D getQuat(int cubit, int numLayers) |
|
| 227 | 223 |
{
|
| 228 | 224 |
return QUATS[QUAT_NUMBER[cubit]]; |
| 229 | 225 |
} |
| 230 | 226 |
|
| 231 | 227 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 232 | 228 |
|
| 233 |
private int getNumCubitVariants(int numLayers)
|
|
| 229 |
int getNumCubitVariants(int numLayers) |
|
| 234 | 230 |
{
|
| 235 | 231 |
return 3; |
| 236 | 232 |
} |
| ... | ... | |
| 242 | 238 |
return cubit<2 ? 0 : (cubit<10 ? 1:2); |
| 243 | 239 |
} |
| 244 | 240 |
|
| 245 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 246 |
|
|
| 247 |
MeshBase createCubitMesh(int cubit, int numLayers) |
|
| 248 |
{
|
|
| 249 |
int variant = getCubitVariant(cubit,numLayers); |
|
| 250 |
|
|
| 251 |
if( mMeshes==null ) |
|
| 252 |
{
|
|
| 253 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
| 254 |
factory.clear(); |
|
| 255 |
mMeshes = new MeshBase[getNumCubitVariants(numLayers)]; |
|
| 256 |
} |
|
| 257 |
|
|
| 258 |
if( mMeshes[variant]==null ) |
|
| 259 |
{
|
|
| 260 |
ObjectShape shape = getObjectShape(cubit,numLayers); |
|
| 261 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
| 262 |
factory.createNewFaceTransform(shape); |
|
| 263 |
mMeshes[variant] = factory.createRoundedSolid(shape); |
|
| 264 |
} |
|
| 265 |
|
|
| 266 |
MeshBase mesh = mMeshes[variant].copy(true); |
|
| 267 |
MatrixEffectQuaternion quat = new MatrixEffectQuaternion( getQuat(cubit,numLayers), new Static3D(0,0,0) ); |
|
| 268 |
mesh.apply(quat,0xffffffff,0); |
|
| 269 |
|
|
| 270 |
return mesh; |
|
| 271 |
} |
|
| 272 |
|
|
| 273 | 241 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 274 | 242 |
|
| 275 | 243 |
ObjectSticker retSticker(int face) |
| src/main/java/org/distorted/objects/TwistySquare2.java | ||
|---|---|---|
| 21 | 21 |
|
| 22 | 22 |
import android.content.res.Resources; |
| 23 | 23 |
|
| 24 |
import org.distorted.helpers.FactoryCubit; |
|
| 25 | 24 |
import org.distorted.helpers.ObjectShape; |
| 26 | 25 |
import org.distorted.helpers.ObjectSticker; |
| 27 |
import org.distorted.library.effect.MatrixEffectQuaternion; |
|
| 28 | 26 |
import org.distorted.library.main.DistortedEffects; |
| 29 | 27 |
import org.distorted.library.main.DistortedTexture; |
| 30 |
import org.distorted.library.mesh.MeshBase; |
|
| 31 | 28 |
import org.distorted.library.mesh.MeshSquare; |
| 32 |
import org.distorted.library.type.Static3D; |
|
| 33 | 29 |
import org.distorted.library.type.Static4D; |
| 34 | 30 |
import org.distorted.main.R; |
| 35 | 31 |
|
| ... | ... | |
| 199 | 195 |
int[] cornerIndices = new int[] { 0,0,0,0,0,0,0,0 };
|
| 200 | 196 |
float[][] centers = new float[][] { { -0.75f, 0.0f, 0.0f} };
|
| 201 | 197 |
int[] centerIndices = new int[] { 0,0,0,0,0,0,0,0 };
|
| 202 |
|
|
| 203 | 198 |
return new ObjectShape(VERTICES_MIDDLE,VERT_INDEXES_MIDDLE,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null); |
| 204 | 199 |
} |
| 205 | 200 |
else if( variant==1 ) |
| ... | ... | |
| 210 | 205 |
int[] cornerIndices = new int[] { 0,0,-1,0,0,-1 };
|
| 211 | 206 |
float[][] centers = new float[][] { { 0.0f, 0.0f,-0.5f} };
|
| 212 | 207 |
int[] centerIndices = new int[] { 0,0,-1,0,0,-1 };
|
| 213 |
|
|
| 214 | 208 |
return new ObjectShape(VERTICES_EDGE,VERT_INDEXES_EDGE,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null); |
| 215 | 209 |
} |
| 216 | 210 |
else |
| ... | ... | |
| 221 | 215 |
int[] cornerIndices = new int[] { 0,0,-1,0,0,-1 };
|
| 222 | 216 |
float[][] centers = new float[][] { { 0.0f, 0.0f,-0.5f} };
|
| 223 | 217 |
int[] centerIndices = new int[] { 0,0,-1,0,0,-1 };
|
| 224 |
|
|
| 225 | 218 |
return new ObjectShape(VERTICES_CORNER,VERT_INDEXES_CORNER,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null); |
| 226 | 219 |
} |
| 227 | 220 |
} |
| 228 | 221 |
|
| 229 | 222 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 230 | 223 |
|
| 231 |
private Static4D getQuat(int cubit, int numLayers)
|
|
| 224 |
Static4D getQuat(int cubit, int numLayers) |
|
| 232 | 225 |
{
|
| 233 | 226 |
return QUATS[QUAT_NUMBER[cubit]]; |
| 234 | 227 |
} |
| 235 | 228 |
|
| 236 | 229 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 237 | 230 |
|
| 238 |
private int getNumCubitVariants(int numLayers)
|
|
| 231 |
int getNumCubitVariants(int numLayers) |
|
| 239 | 232 |
{
|
| 240 | 233 |
return 3; |
| 241 | 234 |
} |
| ... | ... | |
| 247 | 240 |
return cubit<2 ? 0 : (cubit<10 ? 1:2); |
| 248 | 241 |
} |
| 249 | 242 |
|
| 250 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 251 |
|
|
| 252 |
MeshBase createCubitMesh(int cubit, int numLayers) |
|
| 253 |
{
|
|
| 254 |
int variant = getCubitVariant(cubit,numLayers); |
|
| 255 |
|
|
| 256 |
if( mMeshes==null ) |
|
| 257 |
{
|
|
| 258 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
| 259 |
factory.clear(); |
|
| 260 |
mMeshes = new MeshBase[getNumCubitVariants(numLayers)]; |
|
| 261 |
} |
|
| 262 |
|
|
| 263 |
if( mMeshes[variant]==null ) |
|
| 264 |
{
|
|
| 265 |
ObjectShape shape = getObjectShape(cubit,numLayers); |
|
| 266 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
| 267 |
factory.createNewFaceTransform(shape); |
|
| 268 |
mMeshes[variant] = factory.createRoundedSolid(shape); |
|
| 269 |
} |
|
| 270 |
|
|
| 271 |
MeshBase mesh = mMeshes[variant].copy(true); |
|
| 272 |
MatrixEffectQuaternion quat = new MatrixEffectQuaternion( getQuat(cubit,numLayers), new Static3D(0,0,0) ); |
|
| 273 |
mesh.apply(quat,0xffffffff,0); |
|
| 274 |
|
|
| 275 |
return mesh; |
|
| 276 |
} |
|
| 277 |
|
|
| 278 | 243 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 279 | 244 |
|
| 280 | 245 |
ObjectSticker retSticker(int face) |
| src/main/java/org/distorted/objects/TwistyUltimate.java | ||
|---|---|---|
| 21 | 21 |
|
| 22 | 22 |
import android.content.res.Resources; |
| 23 | 23 |
|
| 24 |
import org.distorted.helpers.FactoryCubit; |
|
| 25 | 24 |
import org.distorted.helpers.ObjectShape; |
| 26 | 25 |
import org.distorted.helpers.ObjectSticker; |
| 27 |
import org.distorted.library.effect.MatrixEffectQuaternion; |
|
| 28 | 26 |
import org.distorted.library.main.DistortedEffects; |
| 29 | 27 |
import org.distorted.library.main.DistortedTexture; |
| 30 |
import org.distorted.library.mesh.MeshBase; |
|
| 31 | 28 |
import org.distorted.library.mesh.MeshSquare; |
| 32 | 29 |
import org.distorted.library.type.Static3D; |
| 33 | 30 |
import org.distorted.library.type.Static4D; |
| ... | ... | |
| 257 | 254 |
int[] cornerIndices = new int[] { 0, 0, 0, 0,-1, 0, 0, 0 };
|
| 258 | 255 |
float[][] centers = new float[][] { { 0.0f,-0.5f, -(SQ5+3)/4 } };
|
| 259 | 256 |
int[] centerIndices = new int[] { 0,0,0,0,0,0,0,0 };
|
| 260 |
|
|
| 261 | 257 |
return new ObjectShape(VERTICES_SMALL_RIGHT,VERT_INDEXES_SMALL_RIGHT,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null); |
| 262 | 258 |
} |
| 263 | 259 |
else if( variant==1 ) |
| ... | ... | |
| 284 | 280 |
|
| 285 | 281 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 286 | 282 |
|
| 287 |
private Static4D getQuat(int cubit, int numLayers)
|
|
| 283 |
Static4D getQuat(int cubit, int numLayers) |
|
| 288 | 284 |
{
|
| 289 | 285 |
return QUATS[QUAT_INDEX[cubit]]; |
| 290 | 286 |
} |
| 291 | 287 |
|
| 292 | 288 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 293 | 289 |
|
| 294 |
private int getNumCubitVariants(int numLayers)
|
|
| 290 |
int getNumCubitVariants(int numLayers) |
|
| 295 | 291 |
{
|
| 296 | 292 |
return 3; |
| 297 | 293 |
} |
| ... | ... | |
| 303 | 299 |
return cubit<4 ? 0 : (cubit<8 ? 1:2); |
| 304 | 300 |
} |
| 305 | 301 |
|
| 306 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 307 |
|
|
| 308 |
MeshBase createCubitMesh(int cubit, int numLayers) |
|
| 309 |
{
|
|
| 310 |
int variant = getCubitVariant(cubit,numLayers); |
|
| 311 |
|
|
| 312 |
if( mMeshes==null ) |
|
| 313 |
{
|
|
| 314 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
| 315 |
factory.clear(); |
|
| 316 |
mMeshes = new MeshBase[getNumCubitVariants(numLayers)]; |
|
| 317 |
} |
|
| 318 |
|
|
| 319 |
if( mMeshes[variant]==null ) |
|
| 320 |
{
|
|
| 321 |
ObjectShape shape = getObjectShape(cubit,numLayers); |
|
| 322 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
| 323 |
factory.createNewFaceTransform(shape); |
|
| 324 |
mMeshes[variant] = factory.createRoundedSolid(shape); |
|
| 325 |
} |
|
| 326 |
|
|
| 327 |
MeshBase mesh = mMeshes[variant].copy(true); |
|
| 328 |
MatrixEffectQuaternion quat = new MatrixEffectQuaternion( getQuat(cubit,numLayers), new Static3D(0,0,0) ); |
|
| 329 |
mesh.apply(quat,0xffffffff,0); |
|
| 330 |
|
|
| 331 |
return mesh; |
|
| 332 |
} |
|
| 333 |
|
|
| 334 | 302 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 335 | 303 |
|
| 336 | 304 |
float[][] getCubitPositions(int numLayers) |
Also available in: Unified diff
Finally remove cubit creation from the implementation classes and move it to the TwistyObject.