Project

General

Profile

« Previous | Next » 

Revision b1f2ccf5

Added by Leszek Koltunski about 3 years ago

Convert the first object, the Cube, to the new Cubit-creating engine.

View differences:

src/main/java/org/distorted/objects/TwistyDiamond.java
94 94

  
95 95
  private static final int[] mTetraToFaceMap = new int[] {1,2,3,0,5,6,7,4};
96 96

  
97
  private final double[][] VERTICES_TETRA = new double[][]
98
          {
99
             {-0.5, SQ2/4, 0.0},
100
             { 0.5, SQ2/4, 0.0},
101
             { 0.0,-SQ2/4, 0.5},
102
             { 0.0,-SQ2/4,-0.5}
103
          };
104

  
105
  private final int[][] VERT_INDEXES_TETRA = new int[][]
106
          {
107
             {2,1,0},   // counterclockwise!
108
             {2,3,1},
109
             {3,2,0},
110
             {3,0,1}
111
          };
112

  
113
  private final double[][] VERTICES_OCTA = new double[][]
114
          {
115
             { 0.5,   0.0, 0.5},
116
             { 0.5,   0.0,-0.5},
117
             {-0.5,   0.0,-0.5},
118
             {-0.5,   0.0, 0.5},
119
             { 0.0, SQ2/2, 0.0},
120
             { 0.0,-SQ2/2, 0.0}
121
          };
122

  
123
  private final int[][] VERT_INDEXES_OCTA = new int[][]
124
          {
125
             {3,0,4},   // counterclockwise!
126
             {0,1,4},
127
             {1,2,4},
128
             {2,3,4},
129
             {5,0,3},
130
             {5,1,0},
131
             {5,2,1},
132
             {5,3,2}
133
          };
134

  
97 135
  private static MeshBase mOctaMesh, mTetraMesh;
98 136

  
99 137
///////////////////////////////////////////////////////////////////////////////////////////////////
......
104 142
    super(size, size, quat, texture, mesh, effects, moves, ObjectList.DIAM, res, scrWidth);
105 143
    }
106 144

  
145
///////////////////////////////////////////////////////////////////////////////////////////////////
146

  
147
  double[][] getVertices(int cubitType)
148
    {
149
    if( cubitType==0 )  // Tetrahedron
150
      {
151
      return VERTICES_TETRA;
152
      }
153
    if( cubitType==1 )  // Octahedron
154
      {
155
      return VERTICES_OCTA;
156
      }
157

  
158
    return null;
159
    }
160

  
161
///////////////////////////////////////////////////////////////////////////////////////////////////
162

  
163
  int[][] getVertIndexes(int cubitType)
164
    {
165
    if( cubitType==0 )  // Tetrahedron
166
      {
167
      return VERT_INDEXES_TETRA;
168
      }
169
    if( cubitType==1 )  // Octahedron
170
      {
171
      return VERT_INDEXES_OCTA;
172
      }
173

  
174
    return null;
175
    }
176

  
177
///////////////////////////////////////////////////////////////////////////////////////////////////
178

  
179
  int getNumCubitTypes(int numLayers)
180
    {
181
    return 2;
182
    }
183

  
107 184
///////////////////////////////////////////////////////////////////////////////////////////////////
108 185

  
109 186
  float getScreenRatio()

Also available in: Unified diff