Project

General

Profile

« Previous | Next » 

Revision 16663e27

Added by Leszek Koltunski over 2 years ago

Bandaged: generalize the FactoryBandagedCubit to be able to create bandaged cubits of any cuboid NxMxK where 1<=N,M,K<=5.

View differences:

src/main/java/org/distorted/bandaged/BandagedCreatorRenderer.java
398 398
         }
399 399

  
400 400
     TwistyBandagedGeneric.setPositions(pos);
401
     TwistyObject obj = new TwistyBandagedGeneric( new Static4D(0,0,0,1), 1.0f, TwistyObject.MODE_NORM);
401
     TwistyObject obj = new TwistyBandagedGeneric( new int[] {3,3,3}, TwistyObject.MESH_NICE, TwistyObject.MODE_NORM,
402
                                                   new Static4D(0,0,0,1), new Static3D(0,0,0), 1.0f, null );
402 403
     String name = obj.getShortName();
403 404
     BandagedCreatorActivity act = (BandagedCreatorActivity) mView.getContext();
404 405

  
......
474 475
     final int FBO_HEIGHT = (int)(R*360);
475 476
     final float OBJECT_SIZE = R*0.38f;
476 477

  
477
     TwistyObject object = new TwistyBandagedGeneric(ShapeHexahedron.DEFAULT_ROT, OBJECT_SIZE, TwistyObject.MODE_ICON);
478
     DistortedEffects effects = object.getObjectEffects();
479
     DistortedNode node = object.getNode();
478
     TwistyObject obj = new TwistyBandagedGeneric( new int[] {3,3,3}, TwistyObject.MESH_NICE, TwistyObject.MODE_ICON,
479
                                                   ShapeHexahedron.DEFAULT_ROT, new Static3D(0,0,0), OBJECT_SIZE, null );
480

  
481
     DistortedEffects effects = obj.getObjectEffects();
482
     DistortedNode node = obj.getNode();
480 483

  
481 484
     if( mFramebuffer==null )
482 485
       {
......
493 496
     border.setHaloDepth(false);
494 497
     effects.apply(border);
495 498

  
496
     final String name = object.getShortName()+".png";
499
     final String name = obj.getShortName()+".png";
497 500
     File file = new File(act.getFilesDir(), name);
498 501
     String filename = file.getAbsolutePath();
499 502

  
src/main/java/org/distorted/bandaged/BandagedCubit.java
35 35
import org.distorted.library.type.Static1D;
36 36
import org.distorted.library.type.Static3D;
37 37
import org.distorted.library.type.Static4D;
38
import org.distorted.objectlib.helpers.FactoryBandaged3x3Cubit;
38
import org.distorted.objectlib.helpers.FactoryBandagedCubit;
39 39
import org.distorted.objectlib.helpers.FactoryCubit;
40 40

  
41 41
import static org.distorted.objectlib.main.TwistyObject.COLOR_BLUE;
......
173 173
      computeMove(mPosition);
174 174
      mMove = new Static3D(0,0,0);
175 175

  
176
      FactoryBandaged3x3Cubit factory = FactoryBandaged3x3Cubit.getInstance();
176
      FactoryBandagedCubit factory = FactoryBandagedCubit.getInstance();
177 177
      MeshBase mesh = factory.createMesh(mPosition,false,mRoundCorners);
178 178

  
179 179
      DistortedTexture texture = new DistortedTexture();
......
211 211
      computeMove(tmpPosition);
212 212
      mPosition = tmpPosition;
213 213

  
214
      FactoryBandaged3x3Cubit factory = FactoryBandaged3x3Cubit.getInstance();
214
      FactoryBandagedCubit factory = FactoryBandagedCubit.getInstance();
215 215
      MeshBase mesh = factory.createMesh(mPosition,false,mRoundCorners);
216 216
      resetTextureMaps(mesh);
217 217
      mNode.setMesh(mesh);
......
222 222

  
223 223
    public void reset(float scale)
224 224
      {
225
      float x0 = mPosition[0];
226
      float x1 = mPosition[1];
227
      float x2 = mPosition[2];
225
      float x = mPosition[0];
226
      float y = mPosition[1];
227
      float z = mPosition[2];
228 228

  
229 229
      mPosition = new float[3];
230
      mPosition[0] = x0;
231
      mPosition[1] = x1;
232
      mPosition[2] = x2;
230
      mPosition[0] = x;
231
      mPosition[1] = y;
232
      mPosition[2] = z;
233 233

  
234 234
      computeMove(mPosition);
235 235

  
236
      FactoryBandaged3x3Cubit factory = FactoryBandaged3x3Cubit.getInstance();
236
      FactoryBandagedCubit factory = FactoryBandagedCubit.getInstance();
237 237
      MeshBase mesh = factory.createMesh(mPosition,false,mRoundCorners);
238 238
      resetTextureMaps(mesh);
239 239
      mNode.setMesh(mesh);

Also available in: Unified diff