45 |
45 |
|
46 |
46 |
private int mNumCols = 3;
|
47 |
47 |
private int mNumRows = 3;
|
48 |
|
private NumberPicker mColsPicker, mRowsPicker;
|
|
48 |
private int mNumSlic = 1;
|
|
49 |
private NumberPicker mColsPicker, mRowsPicker, mSlicPicker;
|
49 |
50 |
private LinearLayout mLay;
|
50 |
51 |
private boolean[] mShape;
|
51 |
52 |
private DistortedTexture mTexture;
|
... | ... | |
64 |
65 |
|
65 |
66 |
mColsPicker = (NumberPicker)findViewById(R.id.cubespicker_cols);
|
66 |
67 |
mRowsPicker = (NumberPicker)findViewById(R.id.cubespicker_rows);
|
67 |
|
|
|
68 |
mSlicPicker = (NumberPicker)findViewById(R.id.cubespicker_slices);
|
|
69 |
|
68 |
70 |
mColsPicker.setMaxValue(40);
|
69 |
71 |
mColsPicker.setMinValue( 0);
|
70 |
72 |
mRowsPicker.setMaxValue(40);
|
71 |
73 |
mRowsPicker.setMinValue( 0);
|
72 |
|
|
|
74 |
mSlicPicker.setMaxValue(40);
|
|
75 |
mSlicPicker.setMinValue( 0);
|
|
76 |
|
73 |
77 |
mColsPicker.setOnValueChangedListener(new OnValueChangeListener()
|
74 |
78 |
{
|
75 |
79 |
@Override
|
... | ... | |
87 |
91 |
setGrid();
|
88 |
92 |
}
|
89 |
93 |
});
|
|
94 |
|
|
95 |
mSlicPicker.setOnValueChangedListener(new OnValueChangeListener()
|
|
96 |
{
|
|
97 |
@Override
|
|
98 |
public void onValueChange(NumberPicker picker, int oldVal, int newVal)
|
|
99 |
{
|
|
100 |
mNumSlic = mSlicPicker.getValue();
|
|
101 |
}
|
|
102 |
});
|
90 |
103 |
}
|
91 |
104 |
|
92 |
105 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
... | ... | |
155 |
168 |
|
156 |
169 |
mColsPicker.setValue(mNumCols);
|
157 |
170 |
mRowsPicker.setValue(mNumRows);
|
158 |
|
|
|
171 |
mSlicPicker.setValue(mNumSlic);
|
|
172 |
|
159 |
173 |
if( hasFocus ) setGrid();
|
160 |
174 |
}
|
161 |
175 |
|
... | ... | |
200 |
214 |
for(int i=0; i<mNumRows*mNumCols; i++)
|
201 |
215 |
str += mShape[i] ? "1" : "0";
|
202 |
216 |
|
203 |
|
mMesh = new MeshCubes(mNumCols, str, 1);
|
|
217 |
mMesh = new MeshCubes(mNumCols, str, mNumSlic);
|
204 |
218 |
mTexture = new DistortedTexture(mNumCols,mNumRows);
|
205 |
219 |
|
206 |
220 |
setContentView(R.layout.cubeslayout);
|
Progress with any depth MeshCubes.