Revision e3c87517
Added by Leszek Koltunski about 4 years ago
src/main/java/org/distorted/examples/inflate/InflateActivity.java | ||
---|---|---|
143 | 143 |
int height= mLay.getHeight(); |
144 | 144 |
int w = mNumCols>0 ? (int)( 0.9f*width / mNumCols) : 0; |
145 | 145 |
int h = mNumRows>0 ? (int)( 0.9f*height/ mNumRows) : 0; |
146 |
int size= w<h ? w:h;
|
|
146 |
int size= Math.min(w, h);
|
|
147 | 147 |
int pad = size<20 ? 1 : size/20; |
148 | 148 |
|
149 | 149 |
mLay.removeAllViews(); |
... | ... | |
219 | 219 |
Intent mainInt = new Intent( getApplicationContext(), InflateActivity2.class); |
220 | 220 |
Bundle b = new Bundle(); |
221 | 221 |
|
222 |
int rows,cols; |
|
223 |
|
|
224 |
switch( InflateMeshList.getDimension(mObjectType) ) |
|
225 |
{ |
|
226 |
case 0: rows = 1; // a quad |
|
227 |
cols = 1; |
|
228 |
break; |
|
229 |
case 1: rows = mNumRows; // Triangles, Sphere |
|
230 |
cols = mNumRows; |
|
231 |
break; |
|
232 |
default:rows = mNumRows; |
|
233 |
cols = mNumCols; |
|
234 |
break; |
|
235 |
} |
|
236 |
|
|
237 |
b.putInt("type", mObjectType); |
|
238 |
b.putInt("cols", cols); |
|
239 |
b.putInt("rows", rows); |
|
240 |
b.putInt("slices", mNumSlic); |
|
222 |
b.putInt("type" , mObjectType); |
|
223 |
b.putInt("cols" , InflateMeshList.getCols(mObjectType, mNumCols, mNumRows, mNumSlic) ); |
|
224 |
b.putInt("rows" , InflateMeshList.getRows(mObjectType, mNumCols, mNumRows, mNumSlic) ); |
|
225 |
b.putInt("slices", InflateMeshList.getSlic(mObjectType, mNumCols, mNumRows, mNumSlic) ); |
|
241 | 226 |
b.putInt("bitmap", mBitmapID); |
242 | 227 |
|
243 |
if( mObjectType==0 ) // cubes |
|
244 |
{ |
|
245 |
String str = ""; |
|
246 |
|
|
247 |
for(int i=0; i<mNumRows*mNumCols; i++) |
|
248 |
str += mShape[i] ? "1" : "0"; |
|
249 |
|
|
250 |
b.putString("string", str); |
|
251 |
} |
|
252 |
else |
|
253 |
{ |
|
254 |
b.putString("string", ""); |
|
255 |
} |
|
228 |
b.putString("string", InflateMeshList.getString(mObjectType, mNumCols, mNumRows, mShape)); |
|
256 | 229 |
|
257 | 230 |
mainInt.putExtras(b); |
258 | 231 |
startActivity(mainInt); |
Also available in: Unified diff
Convert the first app, Inflate, to the new MeshBase.setStretch-less API ( use VertexEffectScale instead )