Revision bc9968ad
Added by Leszek Koltunski almost 4 years ago
| src/main/java/org/distorted/examples/meshfile/MeshFileRenderer.java | ||
|---|---|---|
| 289 | 289 |
|
| 290 | 290 |
private void createMesh() |
| 291 | 291 |
{
|
| 292 |
int mode =19;
|
|
| 292 |
int mode =22;
|
|
| 293 | 293 |
int numComponents = 0; |
| 294 | 294 |
float[][] vertices = null; |
| 295 | 295 |
int[][] vertIndexes = null; |
| ... | ... | |
| 1423 | 1423 |
numComponents = 9; |
| 1424 | 1424 |
} |
| 1425 | 1425 |
|
| 1426 |
///// WINDMILL CORNER /////////////////////////////////////////////////////////////// |
|
| 1427 |
|
|
| 1428 |
else if( mode==21 ) |
|
| 1429 |
{
|
|
| 1430 |
final float X = 1.8f; // the cut goes from a corner and splits the opposing side 1.2 / 1.8 |
|
| 1431 |
final float h = 3*X*X/(X*X+9); |
|
| 1432 |
final float d = h*X/3; |
|
| 1433 |
final float l = X/2; |
|
| 1434 |
|
|
| 1435 |
vertices = new float[][] |
|
| 1436 |
{
|
|
| 1437 |
{ -l, 0.5f, 0.0f },
|
|
| 1438 |
{ l, 0.5f, 0.0f },
|
|
| 1439 |
{ l,-0.5f, 0.0f },
|
|
| 1440 |
{ -l,-0.5f, 0.0f },
|
|
| 1441 |
{ d-l, 0.5f, -h },
|
|
| 1442 |
{ d-l,-0.5f, -h },
|
|
| 1443 |
}; |
|
| 1444 |
|
|
| 1445 |
vertIndexes = new int[][] |
|
| 1446 |
{
|
|
| 1447 |
{ 3,2,1,0 },
|
|
| 1448 |
{ 0,1,4 },
|
|
| 1449 |
{ 5,2,3 },
|
|
| 1450 |
{ 5,3,0,4 },
|
|
| 1451 |
{ 2,5,4,1 },
|
|
| 1452 |
}; |
|
| 1453 |
|
|
| 1454 |
bands = new float[][] { {0.03f,20,0.2f,0.4f,5,1,1}, {0.01f,20,0.2f,0.4f,5,1,1} };
|
|
| 1455 |
bandIndexes = new int[] { 0,0,0,1,1 };
|
|
| 1456 |
corners = new float[][] { {0.05f,0.10f} };
|
|
| 1457 |
cornerIndexes= new int[] { 0,0,0,0,-1,-1 };
|
|
| 1458 |
centers = new float[][] { { d-l, 0.0f,-h } };
|
|
| 1459 |
centerIndexes= new int[] { 0,0,0,0,-1,-1 };
|
|
| 1460 |
|
|
| 1461 |
numComponents = 5; |
|
| 1462 |
} |
|
| 1463 |
|
|
| 1464 |
///// WINDMILL EDGE /////////////////////////////////////////////////////////////// |
|
| 1465 |
|
|
| 1466 |
else if( mode==22 ) |
|
| 1467 |
{
|
|
| 1468 |
final float X = 1.8f; // the cut goes from a corner and splits the opposing side 1.2 / 1.8 |
|
| 1469 |
final float h = 3*X*X/(X*X+9); |
|
| 1470 |
final float d = h*X/3; |
|
| 1471 |
final float H = 3*h/X; |
|
| 1472 |
final float l = (3-X)/2; |
|
| 1473 |
|
|
| 1474 |
vertices = new float[][] |
|
| 1475 |
{
|
|
| 1476 |
{ -l, 0.5f, 0.0f },
|
|
| 1477 |
{ l, 0.5f, 0.0f },
|
|
| 1478 |
{ l,-0.5f, 0.0f },
|
|
| 1479 |
{ -l,-0.5f, 0.0f },
|
|
| 1480 |
{h-l, 0.5f, -H },
|
|
| 1481 |
{d+l, 0.5f, -h },
|
|
| 1482 |
{d+l,-0.5f, -h },
|
|
| 1483 |
{h-l,-0.5f, -H }
|
|
| 1484 |
}; |
|
| 1485 |
|
|
| 1486 |
vertIndexes = new int[][] |
|
| 1487 |
{
|
|
| 1488 |
{ 3,2,1,0 },
|
|
| 1489 |
{ 0,1,5,4 },
|
|
| 1490 |
{ 7,6,2,3 },
|
|
| 1491 |
{ 2,6,5,1 },
|
|
| 1492 |
{ 6,7,4,5 },
|
|
| 1493 |
{ 7,3,0,4 }
|
|
| 1494 |
}; |
|
| 1495 |
|
|
| 1496 |
bands = new float[][] { {0.03f,20,0.2f,0.4f,5,1,1}, {0.01f,20,0.2f,0.4f,5,1,1} };
|
|
| 1497 |
bandIndexes = new int[] { 0,0,0,1,1,1 };
|
|
| 1498 |
corners = new float[][] { {0.05f,0.10f} };
|
|
| 1499 |
cornerIndexes= new int[] { 0,0,0,0,-1,-1,-1,-1 };
|
|
| 1500 |
centers = new float[][] { {h-l, 0.5f, -H } };
|
|
| 1501 |
centerIndexes= new int[] { 0,0,0,0,-1,-1,-1,-1 };
|
|
| 1502 |
|
|
| 1503 |
numComponents = 6; |
|
| 1504 |
} |
|
| 1505 |
|
|
| 1426 | 1506 |
///// END DEFINITIONS ///////////////////////////////////////////////////////////////// |
| 1427 | 1507 |
|
| 1428 | 1508 |
FactoryCubit factory = FactoryCubit.getInstance(); |
| ... | ... | |
| 1434 | 1514 |
int[] outer = new int[vertIndexes.length]; |
| 1435 | 1515 |
|
| 1436 | 1516 |
factory.createNewFaceTransform(shape,outer); |
| 1437 |
mMesh = factory.createRoundedSolid(shape,face,numComponents, MESH_NICE );
|
|
| 1517 |
mMesh = factory.createRoundedSolid(shape,face,MESH_NICE,numComponents);
|
|
| 1438 | 1518 |
|
| 1439 | 1519 |
int numEff = mMesh.getNumEffComponents(); |
| 1440 | 1520 |
|
Also available in: Unified diff
Implement the Windmill Cube