Project

General

Profile

« Previous | Next » 

Revision e4bf4d02

Added by Leszek Koltunski over 3 years ago

Progress with Megaminx.

View differences:

src/main/java/org/distorted/objects/FactoryCubit.java
776 776
    float[] bands0 = computeBands(0.04f,34,  X1,0.2f,5);
777 777
    float[] bands1 = computeBands(0.00f,34,0.3f,0.2f,2);
778 778

  
779
    meshes[0] = new MeshPolygon(vertices0, bands0, 1, 1);
779
    meshes[0] = new MeshPolygon(vertices0, bands0, 0, 0);
780 780
    meshes[0].setEffectAssociation(0, 1,0);
781 781
    meshes[1] = meshes[0].copy(true);
782 782
    meshes[1].setEffectAssociation(0, 2,0);
783
    meshes[2] = new MeshPolygon(vertices1, bands1, 1, 4);
783
    meshes[2] = new MeshPolygon(vertices1, bands1, 0, 0);
784 784
    meshes[2].setEffectAssociation(0, 4,0);
785 785
    meshes[3] = meshes[2].copy(true);
786 786
    meshes[3].setEffectAssociation(0, 8,0);
787
    meshes[4] = new MeshPolygon(vertices2, bands1, 1, 4);
787
    meshes[4] = new MeshPolygon(vertices2, bands1, 0, 0);
788 788
    meshes[4].setEffectAssociation(0,16,0);
789 789
    meshes[5] = meshes[4].copy(true);
790 790
    meshes[5].setEffectAssociation(0,32,0);
......
792 792
    return new MeshJoined(meshes);
793 793
    }
794 794

  
795
///////////////////////////////////////////////////////////////////////////////////////////////////
796

  
797
  MeshBase createFacesMegaminxCenter(float width)
798
    {
799
    MeshBase[] meshes = new MeshPolygon[2];
800

  
801
    float R  = width/(2*COS54);
802

  
803
    float X1 = width/2;
804
    float Y1 = R*SIN54;
805
    float X2 = R*COS18;
806
    float Y2 = R*SIN18;
807

  
808
    float[] vertices0 = { -X1,+Y1, -X2,-Y2, 0.0f,-R, +X2,-Y2, +X1,+Y1 };
809
    float[] bands0 = computeBands(+0.04f,45, R/3,0.2f,4);
810
    float[] bands1 = computeBands( 0.00f,34, R/3,0.2f,2);
811

  
812
    meshes[0] = new MeshPolygon(vertices0, bands0, 0, 0);
813
    meshes[0].setEffectAssociation(0,1,0);
814
    meshes[1] = new MeshPolygon(vertices0, bands1, 0, 0);
815
    meshes[1].setEffectAssociation(0,2,0);
816

  
817
    return new MeshJoined(meshes);
818
    }
819

  
795 820
///////////////////////////////////////////////////////////////////////////////////////////////////
796 821
// EFFECTS
797 822
///////////////////////////////////////////////////////////////////////////////////////////////////
......
1451 1476
    return effect;
1452 1477
    }
1453 1478

  
1479
///////////////////////////////////////////////////////////////////////////////////////////////////
1480

  
1481
  VertexEffect[] createVertexEffectsMegaminxCenter()
1482
    {
1483
    VertexEffect[] effect = new VertexEffect[1];
1484

  
1485
    Static1D angle = new Static1D(DIHEDRAL2);
1486
    Static3D axisX = new Static3D( 1.0f, 0.0f, 0.0f);
1487
    Static3D center= new Static3D( 0, 0, 0);
1488

  
1489
    effect[0] = new VertexEffectRotate(angle, axisX, center);
1490

  
1491
    return effect;
1492
    }
1493

  
1454 1494
///////////////////////////////////////////////////////////////////////////////////////////////////
1455 1495
// OBJECTS
1456 1496
///////////////////////////////////////////////////////////////////////////////////////////////////
......
1875 1915

  
1876 1916
    mesh.mergeEffComponents();
1877 1917

  
1918
    return mesh;
1919
    }
1920

  
1921
///////////////////////////////////////////////////////////////////////////////////////////////////
1922

  
1923
  MeshBase createMegaminxCenterMesh(float width)
1924
    {
1925
    MeshBase mesh = createFacesMegaminxCenter(width);
1926
    VertexEffect[] effects = createVertexEffectsMegaminxCenter();
1927
    for( VertexEffect effect : effects ) mesh.apply(effect);
1928

  
1929
    mesh.mergeEffComponents();
1930
    mesh.addEmptyTexComponent();
1931
    mesh.addEmptyTexComponent();
1932
    mesh.addEmptyTexComponent();
1933
    mesh.addEmptyTexComponent();
1934

  
1878 1935
    return mesh;
1879 1936
    }
1880 1937
  }

Also available in: Unified diff