Project

General

Profile

« Previous | Next » 

Revision a8295031

Added by Leszek Koltunski almost 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/objectlib/objects/TwistyBandagedGeneric.java
22 22
import org.distorted.library.type.Static3D;
23 23
import org.distorted.library.type.Static4D;
24 24
import org.distorted.objectlib.helpers.ObjectSignature;
25
import org.distorted.objectlib.main.InitData;
25 26
import org.distorted.objectlib.scrambling.ScrambleState;
26 27

  
27 28
import java.io.InputStream;
......
31 32
public class TwistyBandagedGeneric extends TwistyBandagedAbstract
32 33
{
33 34
  public static final String OBJECT_NAME = "LOCAL_BANDAGED";
34
  private static float[][] POS;
35
  private static ObjectSignature mSignature;
35
  private float[][] mPosition;
36
  private ObjectSignature mSignature;
36 37

  
37 38
///////////////////////////////////////////////////////////////////////////////////////////////////
38 39

  
39
  public TwistyBandagedGeneric(int[] numL, int meshState, int iconMode, Static4D quat, Static3D move, float scale, InputStream stream)
40
  public TwistyBandagedGeneric(InitData data, int meshState, int iconMode, Static4D quat, Static3D move, float scale, InputStream stream)
40 41
    {
41
    super(numL, meshState, iconMode, quat, move, scale, stream);
42
    super(data, meshState, iconMode, quat, move, scale, stream);
42 43
    }
43 44

  
44 45
///////////////////////////////////////////////////////////////////////////////////////////////////
......
59 60
    return 2;
60 61
    }
61 62

  
62
///////////////////////////////////////////////////////////////////////////////////////////////////
63

  
64
  public static void setPositions(float[][] positions)
65
    {
66
    POS = positions;
67
    mSignature = null;
68
    }
69

  
70 63
///////////////////////////////////////////////////////////////////////////////////////////////////
71 64

  
72 65
  float[][] getPositions()
73 66
    {
74
    if( POS==null )
75
      {
76
      POS = new float[][]
77
        {
78
          {-1.0f, +1.0f, +1.0f},
79
          {-1.0f, +1.0f, -1.0f},
80
          {-1.0f, -1.0f, +1.0f},
81
          {-1.0f, -1.0f, -1.0f},
82
          { 1.0f, +1.0f, -1.0f},
83
          { 1.0f,  1.0f,  1.0f},
84
          { 1.0f, -1.0f, +1.0f},
85
          { 1.0f, -1.0f, -1.0f},
86

  
87
          {-1.0f, +1.0f, +0.0f,
88
           -1.0f,  0.0f, +1.0f,
89
           -1.0f,  0.0f, +0.0f,
90
           -1.0f,  0.0f, -1.0f,
91
           -1.0f, -1.0f, +0.0f,
92
            0.0f, -1.0f, +1.0f,
93
            0.0f, -1.0f, +0.0f,
94
            0.0f, +1.0f, +1.0f,
95
            0.0f, +1.0f, +0.0f,
96
            0.0f, +1.0f, -1.0f,
97
            0.0f,  0.0f, +1.0f,
98
            0.0f,  0.0f, -1.0f,
99
            1.0f, +1.0f, +0.0f,
100
            1.0f, +0.0f, +1.0f,
101
            1.0f,  0.0f, +0.0f,
102
            1.0f,  0.0f, -1.0f,
103
            1.0f, -1.0f, +0.0f,
104
            0.0f, -1.0f, -1.0f},
105
        };
106
      }
107
    return POS;
67
    if( mPosition==null ) mPosition = getInitData().getPos();
68
    return mPosition;
108 69
    }
109 70

  
110 71
///////////////////////////////////////////////////////////////////////////////////////////////////
......
126 87
    if( mSignature==null )
127 88
      {
128 89
      int[] numLayers = getNumLayers();
129
      mSignature = new ObjectSignature(numLayers[0],numLayers[1],numLayers[2],POS);
90
      mSignature = new ObjectSignature(numLayers[0],numLayers[1],numLayers[2],mPosition);
130 91
      }
131 92
    return mSignature;
132 93
    }

Also available in: Unified diff