Project

General

Profile

« Previous | Next » 

Revision 8396c548

Added by Leszek Koltunski over 2 years ago

Make cube meshes much smaller (by initroducing two distinct types of cubits -

1) corners and edges
2) face cubits (which now have simpler meshes)

View differences:

src/main/java/org/distorted/objectlib/objects/TwistyCube.java
199 199
    {
200 200
    int extraI, extraV, num;
201 201
    float height;
202
    int variant = getCubitVariant(cubit,numLayers);
202 203

  
203 204
    switch(numLayers)
204
      {
205
      case 2 : num = 6; extraI = 2; extraV = 2; height = 0.045f; break;
206
      case 3 : num = 5; extraI = 2; extraV = 2; height = 0.045f; break;
207
      case 4 : num = 5; extraI = 1; extraV = 1; height = 0.045f; break;
208
      default: num = 5; extraI = 0; extraV = 0; height = 0.045f; break;
209
      }
205
        {
206
        case 2 : num = 6; extraI = 2; extraV = 2; height = 0.045f; break;
207
        case 3 : num = 5; extraI = 2; extraV = 2; height = 0.045f; break;
208
        case 4 : num = 5; extraI = 1; extraV = 1; height = 0.045f; break;
209
        default: num = 5; extraI = 0; extraV = 0; height = 0.045f; break;
210
        }
210 211

  
211 212
    double[][] vertices = new double[][]
212 213
          {
......
230 231
              {3,7,5,1}
231 232
          };
232 233

  
233
    float[][] bands     = new float[][] { {height,35,0.5f,0.7f,num,extraI,extraV} };
234
    int[] bandIndices   = new int[] { 0,0,0,0,0,0};
235 234
    float[][] corners   = new float[][] { {0.036f,0.12f} };
236 235
    int[] cornerIndices = new int[] { 0,0,0,0,0,0,0,0 };
237 236
    float[][] centers   = new float[][] { {0.0f, 0.0f, 0.0f} };
238 237
    int[] centerIndices = new int[] { 0,0,0,0,0,0,0,0 };
239 238

  
240
    return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
239
    if( variant==0 )
240
      {
241
      float[][] bands   = new float[][] { {height,35,0.5f,0.7f,num,extraI,extraV} };
242
      int[] bandIndices = new int[] { 0,0,0,0,0,0};
243
      return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
244
      }
245
    else
246
      {
247
      int extraI2, extraV2, num2;
248

  
249
      switch(numLayers)
250
        {
251
        case 2 : num2 = 6; extraI2 = 2; extraV2 = 2; break;
252
        case 3 : num2 = 5; extraI2 = 1; extraV2 = 0; break;
253
        case 4 : num2 = 4; extraI2 = 0; extraV2 = 0; break;
254
        default: num2 = 3; extraI2 = 0; extraV2 = 0; break;
255
        }
256

  
257
      float[][] bands   = new float[][] { {height,35,0.5f,0.7f,num,extraI,extraV}, {height,35,0.5f,0.7f,num2,extraI2,extraV2} };
258
      int[] bandIndices = new int[] { 1,1,1,1,0,1};
259
      return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
260
      }
241 261
    }
242 262

  
243 263
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff