Project

General

Profile

« Previous | Next » 

Revision f7f24f23

Added by Leszek Koltunski about 3 years ago

Progress with RubikControl.

View differences:

src/main/java/org/distorted/control/RubikControlWhole.java
26 26
import org.distorted.library.effect.MatrixEffectScale;
27 27
import org.distorted.library.main.DistortedEffects;
28 28
import org.distorted.library.main.DistortedNode;
29
import org.distorted.library.main.DistortedScreen;
29 30
import org.distorted.library.main.DistortedTexture;
30 31
import org.distorted.library.mesh.MeshQuad;
31 32
import org.distorted.library.type.Dynamic;
......
41 42

  
42 43
class RubikControlWhole
43 44
  {
44
  private static final int NUM_NODE = 2;
45
  private static final int NUM_EFFE = 2;
45
  private static final int NUM_NODE = 4;
46
  private static final int NUM_EFFE = 4;
46 47

  
47 48
  private final RubikControl mControl;
48 49
  private DistortedEffects[] mEffects;
49 50
  private DistortedNode[] mNodes;
50 51
  private long mEffectID;
51 52

  
52
  private Dynamic3D mDynamic;
53
  private MatrixEffectMove mMove;
53
  private Dynamic3D mDynamicHand1;
54
  private MatrixEffectMove mMoveHand1;
54 55

  
55 56
///////////////////////////////////////////////////////////////////////////////////////////////////
56 57

  
......
74 75
    {
75 76
    if( mEffects==null )
76 77
      {
77
      mEffects   = new DistortedEffects[NUM_EFFE];
78
      mEffects[0]= new DistortedEffects();
79
      mEffects[1]= new DistortedEffects();
78
      mEffects = new DistortedEffects[NUM_EFFE];
79
      for(int i=0; i<NUM_EFFE; i++) mEffects[i]= new DistortedEffects();
80 80

  
81
      float x1 = 200;
82
      float y1 = 300;
81
      DistortedScreen screen = mControl.getScreen();
82
      int wid = screen.getWidth();
83
      int hei = screen.getHeight();
84

  
85
      float x1 = wid*0.35f;
86
      float y1 = hei*0.28f;
83 87
      float z  = 0;
84 88

  
85 89
      Static3D point0 = new Static3D(-x1,-y1,z);
86
      Static3D point1 = new Static3D(+x1,-y1,z);
87
      Static3D point2 = new Static3D(+x1,+y1,z);
88

  
89
      mDynamic = new Dynamic3D(10000,0.5f);
90
      mDynamic.add(point0);
91
      mDynamic.add(point1);
92
      mDynamic.add(point2);
93
      mDynamic.setMode(Dynamic.MODE_PATH);
94

  
95
      mMove = new MatrixEffectMove(mDynamic);
96
      mMove.notifyWhenFinished(mControl);
97
      mEffectID = mMove.getID();
90
      Static3D point1 = new Static3D(  0,-y1,z);
91
      Static3D point2 = new Static3D(+x1,-y1,z);
92
      Static3D point3 = new Static3D(+x1,  0,z);
93
      Static3D point4 = new Static3D(+x1,+y1,z);
94
      Static3D point5 = new Static3D(  0,  0,z);
95

  
96
      mDynamicHand1 = new Dynamic3D(15000,0.5f);
97
      mDynamicHand1.add(point0);
98
      mDynamicHand1.add(point0);
99
      mDynamicHand1.add(point1);
100
      mDynamicHand1.add(point2);
101
      mDynamicHand1.add(point2);
102
      mDynamicHand1.add(point3);
103
      mDynamicHand1.add(point4);
104
      mDynamicHand1.add(point4);
105
      mDynamicHand1.add(point5);
106
      mDynamicHand1.add(point0);
107
      mDynamicHand1.add(point0);
108
      mDynamicHand1.setMode(Dynamic.MODE_PATH);
109
      mDynamicHand1.setConvexity(0.0f);
110

  
111
      mMoveHand1 = new MatrixEffectMove(mDynamicHand1);
112
      mMoveHand1.notifyWhenFinished(mControl);
113
      mEffectID = mMoveHand1.getID();
98 114

  
99 115
      mEffects[0].apply( new MatrixEffectScale(150));
100
      mEffects[0].apply(mMove);
101
      mEffects[1].apply( new MatrixEffectScale(300));
102
      mEffects[1].apply(mMove);
116
      mEffects[0].apply(mMoveHand1);
117
      mEffects[2].apply( new MatrixEffectScale(300));
118
      mEffects[2].apply(mMoveHand1);
103 119
      }
104 120
    else
105 121
      {
106
      mDynamic.resetToBeginning();
107
      mMove.notifyWhenFinished(mControl);
122
      mDynamicHand1.resetToBeginning();
123
      mMoveHand1.notifyWhenFinished(mControl);
108 124
      }
109 125
    }
110 126

  
......
125 141
        DistortedTexture textureCirc = new DistortedTexture();
126 142
        textureCirc.setTexture(bmpCirc);
127 143
        mNodes[0]= new DistortedNode(textureCirc,mEffects[0],mesh);
144
        mNodes[1]= new DistortedNode(textureCirc,mEffects[1],mesh);
128 145

  
129 146
        Bitmap bmpHand = openBitmap(act, R.drawable.ui_hand_pointer);
130 147
        DistortedTexture textureHand = new DistortedTexture();
131 148
        textureHand.setTexture(bmpHand);
132
        mNodes[1]= new DistortedNode(textureHand,mEffects[1],mesh);
149
        mNodes[2]= new DistortedNode(textureHand,mEffects[2],mesh);
150
        mNodes[3]= new DistortedNode(textureHand,mEffects[3],mesh);
133 151
        }
134 152
      else
135 153
        {

Also available in: Unified diff