Project

General

Profile

« Previous | Next » 

Revision 74686c71

Added by Leszek Koltunski almost 5 years ago

Small improvement.

View differences:

src/main/java/org/distorted/magic/RubikRenderer.java
24 24

  
25 25
import org.distorted.effect.BaseEffect;
26 26
import org.distorted.library.effect.VertexEffectSink;
27
import org.distorted.library.main.DistortedEffects;
28 27
import org.distorted.library.main.DistortedLibrary;
29 28
import org.distorted.library.main.DistortedScreen;
30
import org.distorted.library.main.DistortedTexture;
31
import org.distorted.library.mesh.MeshFlat;
32 29
import org.distorted.library.message.EffectListener;
33 30
import org.distorted.object.RubikObject;
34 31
import org.distorted.object.RubikObjectList;
......
57 54
    private boolean mIsSolved;
58 55
    private RubikObject mOldObject, mNewObject;
59 56
    private int mScreenWidth, mScreenHeight;
60
    private MeshFlat mMesh;
61 57
    private SharedPreferences mPreferences;
62 58

  
63 59
///////////////////////////////////////////////////////////////////////////////////////////////////
......
86 82
      mCanUI       = true;
87 83

  
88 84
      mEffectID = new long[BaseEffect.Type.LENGTH];
89

  
90
      mMesh= new MeshFlat(20,20);
91 85
      }
92 86

  
93 87
///////////////////////////////////////////////////////////////////////////////////////////////////
......
99 93
     if( mOldObject!=null ) mOldObject.releaseResources();
100 94
     mOldObject = mNewObject;
101 95

  
102
     DistortedTexture texture = new DistortedTexture(TEXTURE_SIZE,TEXTURE_SIZE);
103
     DistortedEffects effects = new DistortedEffects();
104

  
105
     mNewObject = object.create(mView.getQuatCurrent(), mView.getQuatAccumulated(), texture, mMesh, effects);
96
     mNewObject = object.create(mView.getQuatCurrent(), mView.getQuatAccumulated());
106 97
     mNewObject.createTexture();
107 98
     mView.setMovement(object.getObjectMovementClass());
108 99

  
src/main/java/org/distorted/object/RubikCubeMovement.java
67 67
///////////////////////////////////////////////////////////////////////////////////////////////////
68 68
// retFace{X,Y,Z}axis: 3 functions which return which real AXIS gets mapped to which when we look
69 69
// directly at a given face. For example, when we look at the RIGHT face of the cube (with TOP still
70
// in the top) then the 'real' X axis becomes the 'Z' axis, thus retFaceZaxis(RIGHT) = VECTX.
70
// in the top) then the 'real' X axis becomes the 'Z' axis, thus retFaceXaxis(RIGHT) = VECTZ.
71 71

  
72 72
    private int retFaceXaxis(int face)
73 73
      {
src/main/java/org/distorted/object/RubikObject.java
181 181
  public abstract long finishRotationNow(EffectListener listener);
182 182
  public abstract void removeRotationNow();
183 183

  
184
  public abstract void releaseResources();
185
  public abstract void createTexture();
186 184
  public abstract void apply(Effect effect, int position);
187 185
  public abstract void remove(long effectID);
186

  
187
  public abstract void releaseResources();
188
  public abstract void createTexture();
189

  
188 190
  public abstract void solve();
189 191
  public abstract boolean isSolved();
190 192
  }
src/main/java/org/distorted/object/RubikObjectList.java
25 25
import org.distorted.library.type.Static4D;
26 26
import org.distorted.magic.R;
27 27

  
28
import static org.distorted.magic.RubikRenderer.TEXTURE_SIZE;
29

  
28 30
///////////////////////////////////////////////////////////////////////////////////////////////////
29 31

  
30 32
public enum RubikObjectList
......
82 84
    }
83 85

  
84 86
///////////////////////////////////////////////////////////////////////////////////////////////////
87
// TODO - currently all objects in the list are RubikCubes of various sizes
85 88

  
86
  public RubikObject create(Static4D quatCur, Static4D quatAcc, DistortedTexture texture, MeshFlat mesh, DistortedEffects effects)
89
  public RubikObject create(Static4D quatCur, Static4D quatAcc)
87 90
    {
91
    DistortedTexture texture = new DistortedTexture(TEXTURE_SIZE,TEXTURE_SIZE);
92
    DistortedEffects effects = new DistortedEffects();
93
    MeshFlat mesh= new MeshFlat(20,20);
94

  
88 95
    return new RubikCube(mObjectSize, quatCur, quatAcc, texture, mesh, effects);
89 96
    }
90 97

  
91 98
///////////////////////////////////////////////////////////////////////////////////////////////////
99
// TODO - currently all objects in the list are RubikCubes of various sizes
92 100

  
93 101
  public RubikObjectMovement getObjectMovementClass()
94 102
    {

Also available in: Unified diff