Project

General

Profile

« Previous | Next » 

Revision a0d89fd1

Added by Leszek Koltunski over 2 years ago

Introduce InitData, a data structure used to initialize a TwistyObject.
Current (optional) members: int[] numLayers, int param [intended: type of the Crazy 3x3 planet], float[][] pos [position of a bandaged cube] )

View differences:

src/main/java/org/distorted/bandaged/BandagedCreatorRenderer.java
43 43
import org.distorted.library.type.Static3D;
44 44
import org.distorted.library.type.Static4D;
45 45
import org.distorted.objectlib.json.JsonWriter;
46
import org.distorted.objectlib.main.InitData;
46 47
import org.distorted.objectlib.main.ShapeHexahedron;
47 48
import org.distorted.objectlib.main.TwistyObject;
48 49
import org.distorted.objectlib.objects.TwistyBandagedGeneric;
......
429 430
         pos[attached++] = mCubits[i].getPosition();
430 431
         }
431 432

  
432
     TwistyBandagedGeneric.setPositions(pos);
433
     TwistyObject obj = new TwistyBandagedGeneric( mObjSize, TwistyObject.MESH_NICE, TwistyObject.MODE_NORM,
433
     InitData data = new InitData(mObjSize,pos);
434
     TwistyObject obj = new TwistyBandagedGeneric( data, TwistyObject.MESH_NICE, TwistyObject.MODE_NORM,
434 435
                                                   new Static4D(0,0,0,1), new Static3D(0,0,0), 1.0f, null );
435 436
     String name = obj.getShortName();
436 437
     BandagedCreatorActivity act = (BandagedCreatorActivity) mView.getContext();
437 438

  
438 439
     if( act.objectDoesntExist(name) && createObjectJson(obj,act) )
439 440
       {
440
       setupIconCreation(act);
441
       setupIconCreation(act,data);
441 442
       act.addObject(obj.getShortName());
442 443
       }
443 444
     }
......
519 520

  
520 521
///////////////////////////////////////////////////////////////////////////////////////////////////
521 522

  
522
   private void setupIconCreation(Activity act)
523
   private void setupIconCreation(Activity act, InitData data)
523 524
     {
524 525
     final float R=1.0f;
525 526
     final int FBO_WIDTH  = (int)(R*720);
526 527
     final int FBO_HEIGHT = (int)(R*1280);
527 528
     final float OBJECT_SIZE = R*0.35f;
528 529

  
529
     TwistyObject obj = new TwistyBandagedGeneric( mObjSize, TwistyObject.MESH_NICE, TwistyObject.MODE_ICON,
530
     TwistyObject obj = new TwistyBandagedGeneric( data, TwistyObject.MESH_NICE, TwistyObject.MODE_ICON,
530 531
                                                   ShapeHexahedron.DEFAULT_ROT, new Static3D(0,0,0), OBJECT_SIZE, null );
531 532

  
532 533
     DistortedEffects effects = obj.getObjectEffects();

Also available in: Unified diff