Project

General

Profile

« Previous | Next » 

Revision 3e605536

Added by Leszek Koltunski over 2 years ago

Finally remove cubit creation from the implementation classes and move it to the TwistyObject.

View differences:

src/main/java/org/distorted/objects/TwistyUltimate.java
21 21

  
22 22
import android.content.res.Resources;
23 23

  
24
import org.distorted.helpers.FactoryCubit;
25 24
import org.distorted.helpers.ObjectShape;
26 25
import org.distorted.helpers.ObjectSticker;
27
import org.distorted.library.effect.MatrixEffectQuaternion;
28 26
import org.distorted.library.main.DistortedEffects;
29 27
import org.distorted.library.main.DistortedTexture;
30
import org.distorted.library.mesh.MeshBase;
31 28
import org.distorted.library.mesh.MeshSquare;
32 29
import org.distorted.library.type.Static3D;
33 30
import org.distorted.library.type.Static4D;
......
257 254
      int[] cornerIndices = new int[] { 0, 0, 0, 0,-1, 0, 0, 0 };
258 255
      float[][] centers   = new float[][] { { 0.0f,-0.5f, -(SQ5+3)/4 } };
259 256
      int[] centerIndices = new int[] { 0,0,0,0,0,0,0,0 };
260

  
261 257
      return new ObjectShape(VERTICES_SMALL_RIGHT,VERT_INDEXES_SMALL_RIGHT,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
262 258
      }
263 259
    else if( variant==1 )
......
284 280

  
285 281
///////////////////////////////////////////////////////////////////////////////////////////////////
286 282

  
287
  private Static4D getQuat(int cubit, int numLayers)
283
  Static4D getQuat(int cubit, int numLayers)
288 284
    {
289 285
    return QUATS[QUAT_INDEX[cubit]];
290 286
    }
291 287

  
292 288
///////////////////////////////////////////////////////////////////////////////////////////////////
293 289

  
294
  private int getNumCubitVariants(int numLayers)
290
  int getNumCubitVariants(int numLayers)
295 291
    {
296 292
    return 3;
297 293
    }
......
303 299
    return cubit<4 ? 0 : (cubit<8 ? 1:2);
304 300
    }
305 301

  
306
///////////////////////////////////////////////////////////////////////////////////////////////////
307

  
308
  MeshBase createCubitMesh(int cubit, int numLayers)
309
    {
310
    int variant = getCubitVariant(cubit,numLayers);
311

  
312
    if( mMeshes==null )
313
      {
314
      FactoryCubit factory = FactoryCubit.getInstance();
315
      factory.clear();
316
      mMeshes = new MeshBase[getNumCubitVariants(numLayers)];
317
      }
318

  
319
    if( mMeshes[variant]==null )
320
      {
321
      ObjectShape shape = getObjectShape(cubit,numLayers);
322
      FactoryCubit factory = FactoryCubit.getInstance();
323
      factory.createNewFaceTransform(shape);
324
      mMeshes[variant] = factory.createRoundedSolid(shape);
325
      }
326

  
327
    MeshBase mesh = mMeshes[variant].copy(true);
328
    MatrixEffectQuaternion quat = new MatrixEffectQuaternion( getQuat(cubit,numLayers), new Static3D(0,0,0) );
329
    mesh.apply(quat,0xffffffff,0);
330

  
331
    return mesh;
332
    }
333

  
334 302
///////////////////////////////////////////////////////////////////////////////////////////////////
335 303

  
336 304
  float[][] getCubitPositions(int numLayers)

Also available in: Unified diff