Project

General

Profile

« Previous | Next » 

Revision 61b217a5

Added by Leszek Koltunski almost 4 years ago

Add Gigaminx dmesh.

View differences:

src/main/java/org/distorted/objects/FactoryCubit.java
727 727

  
728 728
///////////////////////////////////////////////////////////////////////////////////////////////////
729 729

  
730
  MeshBase createFacesMegaminxCorner()
730
  MeshBase createFacesMegaminxCorner(int numLayers)
731 731
    {
732 732
    MeshBase[] meshes = new MeshPolygon[6];
733 733

  
734 734
    float Y = COS54/(2*SIN54);
735 735

  
736 736
    float[] vertices0 = { -0.5f, 0.0f, 0.0f, -Y, 0.5f, 0.0f, 0.0f, Y };
737
    float[] bands0 = computeBands(0.04f,34,0.3f,0.2f,5);
738
    float[] bands1 = computeBands(0.00f,34,0.3f,0.2f,2);
737

  
738
    int numBands0 = numLayers==3 ? 5 : 3;
739
    int numBands1 = numLayers==3 ? 2 : 2;
740
    float h       = numLayers==3 ? 0.04f : 0.03f;
741
    int   e       = numLayers==3 ? 4 : 1;
742

  
743
    float[] bands0 = computeBands(h    ,34,0.3f,0.2f, numBands0);
744
    float[] bands1 = computeBands(0.00f,34,0.3f,0.2f, numBands1);
739 745

  
740 746
    meshes[0] = new MeshPolygon(vertices0, bands0, 1, 1);
741 747
    meshes[0].setEffectAssociation(0, 1,0);
......
743 749
    meshes[1].setEffectAssociation(0, 2,0);
744 750
    meshes[2] = meshes[0].copy(true);
745 751
    meshes[2].setEffectAssociation(0, 4,0);
746
    meshes[3] = new MeshPolygon(vertices0, bands1, 1, 4);
752
    meshes[3] = new MeshPolygon(vertices0, bands1, 1, e);
747 753
    meshes[3].setEffectAssociation(0, 8,0);
748 754
    meshes[4] = meshes[3].copy(true);
749 755
    meshes[4].setEffectAssociation(0,16,0);
......
755 761

  
756 762
///////////////////////////////////////////////////////////////////////////////////////////////////
757 763

  
758
  MeshBase createFacesMegaminxEdge(float width, float height)
764
  MeshBase createFacesMegaminxEdge(int numLayers, float width, float height)
759 765
    {
760 766
    MeshBase[] meshes = new MeshPolygon[6];
761 767

  
......
773 779
    float[] vertices1 = { -X1, Y3, -X1, -Y3, X1, -Y2, X1, Y2 };
774 780
    float[] vertices2 = { -X2, 0.0f, 0.0f, -Y4, X2, 0.0f, 0.0f, Y4 };
775 781

  
776
    float[] bands0 = computeBands(0.03f,34,0.2f,0.2f,5);
777
    float[] bands1 = computeBands(0.00f,34,0.3f,0.2f,2);
782
    int numBands0 = numLayers==3 ? 5 : 3;
783
    int numBands1 = numLayers==3 ? 2 : 2;
784
    float h       = numLayers==3 ? 0.03f : 0.03f;
785

  
786
    float[] bands0 = computeBands(h    ,34,0.2f,0.2f,numBands0);
787
    float[] bands1 = computeBands(0.00f,34,0.3f,0.2f,numBands1);
778 788

  
779 789
    meshes[0] = new MeshPolygon(vertices0, bands0, 0, 0);
780 790
    meshes[0].setEffectAssociation(0, 1,0);
......
794 804

  
795 805
///////////////////////////////////////////////////////////////////////////////////////////////////
796 806

  
797
  MeshBase createFacesMegaminxCenter(float width)
807
  MeshBase createFacesMegaminxCenter(int numLayers)
798 808
    {
799 809
    MeshBase[] meshes = new MeshPolygon[2];
800 810

  
......
805 815
    float Y2 = R*SIN18;
806 816

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

  
819
    int numBands0 = numLayers==3 ? 4 : 3;
820
    int numBands1 = numLayers==3 ? 2 : 2;
821
    float h       = numLayers==3 ? 0.04f : 0.04f;
822

  
823
    float[] bands0 = computeBands( h    ,45, R/3,0.2f, numBands0);
824
    float[] bands1 = computeBands( 0.00f,34, R/3,0.2f, numBands1);
810 825

  
811 826
    meshes[0] = new MeshPolygon(vertices0, bands0, 0, 0);
812 827
    meshes[0].setEffectAssociation(0,1,0);
......
1877 1892

  
1878 1893
  MeshBase createMegaminxCornerMesh(int numLayers)
1879 1894
    {
1880
    MeshBase mesh = createFacesMegaminxCorner();
1895
    MeshBase mesh = createFacesMegaminxCorner(numLayers);
1881 1896
    VertexEffect[] effects = createVertexEffectsMegaminxCorner(numLayers);
1882 1897
    for( VertexEffect effect : effects ) mesh.apply(effect);
1883 1898

  
......
1907 1922
// numLayers==3 --> index=0; numLayers=5 --> index=1 ...
1908 1923
// type: 0,1,... 0 --> edge, 1 --> 1 layer deeper, etc
1909 1924

  
1910
  MeshBase createMegaminxEdgeMesh(float width, float height)
1925
  MeshBase createMegaminxEdgeMesh(int numLayers, float width, float height)
1911 1926
    {
1912
    MeshBase mesh = createFacesMegaminxEdge(width,height);
1927
    MeshBase mesh = createFacesMegaminxEdge(numLayers,width,height);
1913 1928
    VertexEffect[] effects = createVertexEffectsMegaminxEdge(width,height);
1914 1929
    for( VertexEffect effect : effects ) mesh.apply(effect);
1915 1930

  
......
1920 1935

  
1921 1936
///////////////////////////////////////////////////////////////////////////////////////////////////
1922 1937

  
1923
  MeshBase createMegaminxCenterMesh(float width)
1938
  MeshBase createMegaminxCenterMesh(int numLayers, float width)
1924 1939
    {
1925
    MeshBase mesh = createFacesMegaminxCenter(width);
1940
    MeshBase mesh = createFacesMegaminxCenter(numLayers);
1926 1941
    VertexEffect[] effects = createVertexEffectsMegaminxCenter(width);
1927 1942
    for( VertexEffect effect : effects ) mesh.apply(effect);
1928 1943

  
src/main/java/org/distorted/objects/ObjectList.java
142 142
  MEGA (
143 143
         new int[][] {
144 144
                       {3 , 21, R.raw.mega3, R.drawable.ui_small_mega3, R.drawable.ui_medium_mega3, R.drawable.ui_big_mega3, R.drawable.ui_huge_mega3} ,
145
              //       {5 , 25, R.raw.kilo3, R.drawable.ui_small_mega5, R.drawable.ui_medium_mega5, R.drawable.ui_big_mega5, R.drawable.ui_huge_mega5} ,
145
                       {5 , 25, R.raw.mega5, R.drawable.ui_small_mega5, R.drawable.ui_medium_mega5, R.drawable.ui_big_mega5, R.drawable.ui_huge_mega5} ,
146 146
                     },
147 147
         TwistyMegaminx.class,
148 148
         new MovementMinx(),
src/main/java/org/distorted/objects/TwistyMegaminx.java
401 401
        float height= (numLayers/3.0f)*(0.5f-MEGA_D)*COS18/((numLayers-1)*0.5f);
402 402
        float width = (numLayers/3.0f)*2*MEGA_D + 2*type*height*SIN18/COS18;
403 403

  
404
        mEdgeMeshes[index][type] = FactoryCubit.getInstance().createMegaminxEdgeMesh(width,height);
404
        mEdgeMeshes[index][type] = FactoryCubit.getInstance().createMegaminxEdgeMesh(numLayers,width,height);
405 405
        }
406 406

  
407 407
      mesh = mEdgeMeshes[index][type].copy(true);
......
411 411
      if( mCenterMeshes[index]==null )
412 412
        {
413 413
        float width = 2 * (numLayers/3.0f) * (MEGA_D+(0.5f-MEGA_D)*SIN18);
414
        mCenterMeshes[index] = FactoryCubit.getInstance().createMegaminxCenterMesh(width);
414
        mCenterMeshes[index] = FactoryCubit.getInstance().createMegaminxCenterMesh(numLayers,width);
415 415
        }
416 416

  
417 417
      mesh = mCenterMeshes[index].copy(true);

Also available in: Unified diff