Revision db3b12e6
Added by Leszek Koltunski about 5 years ago
| src/main/java/org/distorted/objects/FactoryCubit.java | ||
|---|---|---|
| 39 | 39 |
private static final float SQ3 = (float)Math.sqrt(3); |
| 40 | 40 |
private static final float SQ6 = (float)Math.sqrt(6); |
| 41 | 41 |
|
| 42 |
private static final float IVY_D = 0.10f;
|
|
| 42 |
private static final float IVY_D = 0.12f;
|
|
| 43 | 43 |
private static final int IVY_N = 8; |
| 44 | 44 |
|
| 45 | 45 |
private static final Static1D RADIUS = new Static1D(1); |
| ... | ... | |
| 502 | 502 |
|
| 503 | 503 |
MeshBase createFacesIvyCorner() |
| 504 | 504 |
{
|
| 505 |
return createFacesSkewbCorner(); |
|
| 505 |
MeshBase[] meshes = new MeshBase[6]; |
|
| 506 |
|
|
| 507 |
final float angle = (float)Math.PI/(2*IVY_N); |
|
| 508 |
final float CORR = 1.0f - IVY_D*SQ2; |
|
| 509 |
final float DIST = 0.4f; |
|
| 510 |
final float CORR2 = 0.5f; |
|
| 511 |
float[] vertices = new float[2*(IVY_N+1)+6]; |
|
| 512 |
|
|
| 513 |
vertices[0] = ( 0.5f -DIST)*CORR2; |
|
| 514 |
vertices[1] = (-0.5f+IVY_D-DIST)*CORR2; |
|
| 515 |
vertices[2] = ( 0.5f -DIST)*CORR2; |
|
| 516 |
vertices[3] = ( 0.5f -DIST)*CORR2; |
|
| 517 |
vertices[4] = (-0.5f+IVY_D-DIST)*CORR2; |
|
| 518 |
vertices[5] = ( 0.5f -DIST)*CORR2; |
|
| 519 |
|
|
| 520 |
for(int i=0; i<=IVY_N; i++) |
|
| 521 |
{
|
|
| 522 |
float ang = (IVY_N-i)*angle; |
|
| 523 |
float sin = (float)Math.sin(ang); |
|
| 524 |
float cos = (float)Math.cos(ang); |
|
| 525 |
|
|
| 526 |
vertices[2*i+6] = (CORR*(cos-0.5f)-DIST)*CORR2; |
|
| 527 |
vertices[2*i+7] = (CORR*(sin-0.5f)-DIST)*CORR2; |
|
| 528 |
} |
|
| 529 |
|
|
| 530 |
float[] bands0 = computeBands(+0.02f,18,0.2f,0.5f,5); |
|
| 531 |
float[] bands1 = computeBands(-0.10f,20,0.2f,0.0f,2); |
|
| 532 |
|
|
| 533 |
meshes[0] = new MeshPolygon(vertices,bands0,0,0); |
|
| 534 |
meshes[0].setEffectAssociation(0,1,0); |
|
| 535 |
meshes[1] = meshes[0].copy(true); |
|
| 536 |
meshes[1].setEffectAssociation(0,2,0); |
|
| 537 |
meshes[2] = meshes[0].copy(true); |
|
| 538 |
meshes[2].setEffectAssociation(0,4,0); |
|
| 539 |
meshes[3] = new MeshPolygon(vertices,bands1,0,0); |
|
| 540 |
meshes[3].setEffectAssociation(0,8,0); |
|
| 541 |
meshes[4] = meshes[3].copy(true); |
|
| 542 |
meshes[4].setEffectAssociation(0,16,0); |
|
| 543 |
meshes[5] = meshes[3].copy(true); |
|
| 544 |
meshes[5].setEffectAssociation(0,32,0); |
|
| 545 |
|
|
| 546 |
return new MeshJoined(meshes); |
|
| 506 | 547 |
} |
| 507 | 548 |
|
| 508 | 549 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| ... | ... | |
| 942 | 983 |
|
| 943 | 984 |
VertexEffect[] createVertexEffectsIvyCorner() |
| 944 | 985 |
{
|
| 945 |
return createVertexEffectsSkewbCorner(); |
|
| 986 |
float DIST=0.1f; |
|
| 987 |
|
|
| 988 |
Static3D axisX = new Static3D(1,0,0); |
|
| 989 |
Static3D axisY = new Static3D(0,1,0); |
|
| 990 |
Static1D angle1 = new Static1D(+90); |
|
| 991 |
Static1D angle2 = new Static1D(-90); |
|
| 992 |
Static3D center = new Static3D(0,0,0); |
|
| 993 |
Static3D move1 = new Static3D(-DIST,-DIST,0); |
|
| 994 |
|
|
| 995 |
VertexEffect[] effect = new VertexEffect[5]; |
|
| 996 |
|
|
| 997 |
effect[0] = new VertexEffectScale(2.0f); |
|
| 998 |
effect[1] = new VertexEffectMove(move1); |
|
| 999 |
effect[2] = new VertexEffectScale(new Static3D(1,1,-1)); |
|
| 1000 |
effect[3] = new VertexEffectRotate(angle1,axisX,center); |
|
| 1001 |
effect[4] = new VertexEffectRotate(angle2,axisY,center); |
|
| 1002 |
|
|
| 1003 |
effect[2].setMeshAssociation(54,-1); // meshes 1,2,4,5 |
|
| 1004 |
effect[3].setMeshAssociation(18,-1); // meshes 1,4 |
|
| 1005 |
effect[4].setMeshAssociation(36,-1); // meshes 2,5 |
|
| 1006 |
|
|
| 1007 |
return effect; |
|
| 946 | 1008 |
} |
| 947 | 1009 |
|
| 948 | 1010 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| ... | ... | |
| 1207 | 1269 |
|
| 1208 | 1270 |
Static3D center = new Static3D(-0.5f,-0.5f,-0.5f); |
| 1209 | 1271 |
Static3D[] vertices = new Static3D[4]; |
| 1272 |
float DIST = IVY_D-0.5f; |
|
| 1210 | 1273 |
vertices[0] = new Static3D(+0.5f,+0.5f,+0.5f); |
| 1211 |
vertices[1] = new Static3D(-0.5f,+0.5f,+0.5f);
|
|
| 1212 |
vertices[2] = new Static3D(+0.5f,+0.5f,-0.5f);
|
|
| 1213 |
vertices[3] = new Static3D(+0.5f,-0.5f,+0.5f);
|
|
| 1274 |
vertices[1] = new Static3D( DIST,+0.5f,+0.5f);
|
|
| 1275 |
vertices[2] = new Static3D(+0.5f, DIST,+0.5f);
|
|
| 1276 |
vertices[3] = new Static3D(+0.5f,+0.5f, DIST);
|
|
| 1214 | 1277 |
|
| 1215 | 1278 |
roundCorners(mesh,center,vertices,0.06f,0.12f); |
| 1216 | 1279 |
|
Also available in: Unified diff
Progress with the Ivy.