Revision a0b48da6
Added by Leszek Koltunski about 4 years ago
| src/main/java/org/distorted/objects/TwistyIvy.java | ||
|---|---|---|
| 94 | 94 |
{ 11, 12,12,12,12,12 },
|
| 95 | 95 |
}; |
| 96 | 96 |
|
| 97 |
private static MeshBase mCornerMesh, mFaceMesh;
|
|
| 97 |
private static MeshBase[] mMeshes;
|
|
| 98 | 98 |
|
| 99 | 99 |
private static final ObjectSticker[] mStickers; |
| 100 | 100 |
|
| ... | ... | |
| 111 | 111 |
|
| 112 | 112 |
float D = (float)(Math.PI/4); |
| 113 | 113 |
final float[][] angles = { { 0,0,D },{ D,D } };
|
| 114 |
final float[][] radii = { { 0,0.02f,0 },{ 0.06f,0.06f } };
|
|
| 114 |
final float[][] radii = { { 0,0.04f,0 },{ 0.06f,0.06f } };
|
|
| 115 | 115 |
final float[] strokes = { 0.03f, 0.08f };
|
| 116 | 116 |
|
| 117 | 117 |
for(int s=0; s<NUM_STICKERS; s++) |
| ... | ... | |
| 227 | 227 |
|
| 228 | 228 |
MeshBase createCubitMesh(int cubit, int numLayers) |
| 229 | 229 |
{
|
| 230 |
if( mMeshes==null ) |
|
| 231 |
{
|
|
| 232 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
| 233 |
factory.clear(); |
|
| 234 |
mMeshes = new MeshBase[2]; |
|
| 235 |
} |
|
| 236 |
|
|
| 230 | 237 |
MeshBase mesh; |
| 231 | 238 |
|
| 232 | 239 |
if( cubit<4 ) |
| 233 | 240 |
{
|
| 234 |
if( mCornerMesh==null )
|
|
| 241 |
if( mMeshes[0]==null )
|
|
| 235 | 242 |
{
|
| 236 | 243 |
final float angle = (float)Math.PI/(2*IVY_N); |
| 237 | 244 |
final float CORR = 1.0f - 2*IVY_D; |
| ... | ... | |
| 335 | 342 |
|
| 336 | 343 |
FactoryCubit factory = FactoryCubit.getInstance(); |
| 337 | 344 |
factory.createNewFaceTransform(vertices,vertIndexes); |
| 338 |
mCornerMesh = factory.createRoundedSolid(vertices, vertIndexes,
|
|
| 339 |
bands, bandIndexes,
|
|
| 340 |
corners, cornerIndexes,
|
|
| 341 |
centers, centerIndexes,
|
|
| 342 |
getNumCubitFaces(), convexCenter );
|
|
| 345 |
mMeshes[0] = factory.createRoundedSolid(vertices, vertIndexes,
|
|
| 346 |
bands, bandIndexes, |
|
| 347 |
corners, cornerIndexes, |
|
| 348 |
centers, centerIndexes, |
|
| 349 |
getNumCubitFaces(), convexCenter ); |
|
| 343 | 350 |
} |
| 344 |
mesh = mCornerMesh.copy(true);
|
|
| 351 |
mesh = mMeshes[0].copy(true);
|
|
| 345 | 352 |
} |
| 346 | 353 |
else |
| 347 | 354 |
{
|
| 348 |
if( mFaceMesh==null )
|
|
| 355 |
if( mMeshes[1]==null )
|
|
| 349 | 356 |
{
|
| 350 | 357 |
final float angle = (float)Math.PI/(2*IVY_N); |
| 351 | 358 |
final float CORR = 1.0f - 2*IVY_D; |
| ... | ... | |
| 390 | 397 |
|
| 391 | 398 |
FactoryCubit factory = FactoryCubit.getInstance(); |
| 392 | 399 |
factory.createNewFaceTransform(vertices,vert_indices); |
| 393 |
mFaceMesh = factory.createRoundedSolid(vertices, vert_indices,
|
|
| 400 |
mMeshes[1] = factory.createRoundedSolid(vertices, vert_indices,
|
|
| 394 | 401 |
bands, bandIndexes, |
| 395 | 402 |
corners, indexes, |
| 396 | 403 |
centers, indexes, |
| 397 | 404 |
getNumCubitFaces(), null ); |
| 398 | 405 |
} |
| 399 |
mesh = mFaceMesh.copy(true);
|
|
| 406 |
mesh = mMeshes[1].copy(true);
|
|
| 400 | 407 |
} |
| 401 | 408 |
|
| 402 | 409 |
MatrixEffectQuaternion quat = new MatrixEffectQuaternion( QUATS[getQuat(cubit)], new Static3D(0,0,0) ); |
| src/main/java/org/distorted/objects/TwistyRex.java | ||
|---|---|---|
| 126 | 126 |
{ 13,17, 18,18,18,18 },
|
| 127 | 127 |
}; |
| 128 | 128 |
|
| 129 |
private static MeshBase mCornerMesh, mFaceMesh, mEdgeMesh;
|
|
| 129 |
private static MeshBase[] mMeshes;
|
|
| 130 | 130 |
|
| 131 | 131 |
private static final ObjectSticker[] mStickers; |
| 132 | 132 |
|
| ... | ... | |
| 332 | 332 |
|
| 333 | 333 |
MeshBase createCubitMesh(int cubit, int numLayers) |
| 334 | 334 |
{
|
| 335 |
if( mMeshes==null ) |
|
| 336 |
{
|
|
| 337 |
FactoryCubit factory = FactoryCubit.getInstance(); |
|
| 338 |
factory.clear(); |
|
| 339 |
mMeshes = new MeshBase[3]; |
|
| 340 |
} |
|
| 341 |
|
|
| 335 | 342 |
MeshBase mesh; |
| 336 | 343 |
|
| 337 | 344 |
if( cubit<24 ) |
| 338 | 345 |
{
|
| 339 |
if( mCornerMesh==null )
|
|
| 346 |
if( mMeshes[0]==null )
|
|
| 340 | 347 |
{
|
| 341 | 348 |
float G = (1-REX_D)*SQ2/2; |
| 342 | 349 |
|
| ... | ... | |
| 368 | 375 |
|
| 369 | 376 |
FactoryCubit factory = FactoryCubit.getInstance(); |
| 370 | 377 |
factory.createNewFaceTransform(vertices,vertIndexes); |
| 371 |
mCornerMesh = factory.createRoundedSolid(vertices, vertIndexes,
|
|
| 372 |
bands, bandIndexes,
|
|
| 373 |
corners, indexes,
|
|
| 374 |
centers, indexes,
|
|
| 375 |
getNumCubitFaces(), null );
|
|
| 378 |
mMeshes[0] = factory.createRoundedSolid(vertices, vertIndexes,
|
|
| 379 |
bands, bandIndexes, |
|
| 380 |
corners, indexes, |
|
| 381 |
centers, indexes, |
|
| 382 |
getNumCubitFaces(), null ); |
|
| 376 | 383 |
} |
| 377 |
mesh = mCornerMesh.copy(true);
|
|
| 384 |
mesh = mMeshes[0].copy(true);
|
|
| 378 | 385 |
} |
| 379 | 386 |
else if( cubit<30 ) |
| 380 | 387 |
{
|
| 381 |
if( mFaceMesh==null )
|
|
| 388 |
if( mMeshes[1]==null )
|
|
| 382 | 389 |
{
|
| 383 | 390 |
double[][] vertices = |
| 384 | 391 |
{
|
| ... | ... | |
| 405 | 412 |
|
| 406 | 413 |
FactoryCubit factory = FactoryCubit.getInstance(); |
| 407 | 414 |
factory.createNewFaceTransform(vertices,vertIndexes); |
| 408 |
mFaceMesh = factory.createRoundedSolid(vertices, vertIndexes,
|
|
| 415 |
mMeshes[1] = factory.createRoundedSolid(vertices, vertIndexes,
|
|
| 409 | 416 |
bands, bandIndexes, |
| 410 | 417 |
null, indexes, |
| 411 | 418 |
null, indexes, |
| 412 | 419 |
getNumCubitFaces(), null ); |
| 413 | 420 |
} |
| 414 |
mesh = mFaceMesh.copy(true);
|
|
| 421 |
mesh = mMeshes[1].copy(true);
|
|
| 415 | 422 |
} |
| 416 | 423 |
else |
| 417 | 424 |
{
|
| 418 |
if( mEdgeMesh==null )
|
|
| 425 |
if( mMeshes[2]==null )
|
|
| 419 | 426 |
{
|
| 420 | 427 |
float E = 0.5f - REX_D; |
| 421 | 428 |
float F = 0.5f; |
| ... | ... | |
| 451 | 458 |
|
| 452 | 459 |
FactoryCubit factory = FactoryCubit.getInstance(); |
| 453 | 460 |
factory.createNewFaceTransform(vertices,vertIndexes); |
| 454 |
mEdgeMesh = factory.createRoundedSolid(vertices, vertIndexes,
|
|
| 455 |
bands, bandIndexes, |
|
| 456 |
corners, indexes, |
|
| 457 |
centers, indexes, |
|
| 458 |
getNumCubitFaces(), null ); |
|
| 461 |
mMeshes[2] = factory.createRoundedSolid(vertices, vertIndexes,
|
|
| 462 |
bands, bandIndexes,
|
|
| 463 |
corners, indexes,
|
|
| 464 |
centers, indexes,
|
|
| 465 |
getNumCubitFaces(), null );
|
|
| 459 | 466 |
} |
| 460 |
mesh = mEdgeMesh.copy(true);
|
|
| 467 |
mesh = mMeshes[2].copy(true);
|
|
| 461 | 468 |
} |
| 462 | 469 |
|
| 463 | 470 |
MatrixEffectQuaternion quat = new MatrixEffectQuaternion( getQuat(cubit), new Static3D(0,0,0) ); |
Also available in: Unified diff
Minor.