Revision 687263cc
Added by Leszek Koltunski about 4 years ago
src/main/java/org/distorted/examples/inflate/InflateActivity2.java | ||
---|---|---|
54 | 54 |
private TextView mTextLevel; |
55 | 55 |
private DistortedTexture mTexture; |
56 | 56 |
private MeshBase mMesh; |
57 |
private int mNumCols, mNumRows, mNumSlic; |
|
57 | 58 |
|
58 | 59 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
59 | 60 |
|
... | ... | |
98 | 99 |
|
99 | 100 |
String str = b.getString("string"); |
100 | 101 |
int objectType = b.getInt("type"); |
101 |
int numCols = b.getInt("cols"); |
|
102 |
int numRows = b.getInt("rows"); |
|
103 |
int numSlic = b.getInt("slices"); |
|
104 | 102 |
int bitmapID = b.getInt("bitmap"); |
103 |
mNumCols = b.getInt("cols"); |
|
104 |
mNumRows = b.getInt("rows"); |
|
105 |
mNumSlic = b.getInt("slices"); |
|
105 | 106 |
|
106 |
int maxsize = numCols > numRows ? (numCols>numSlic ? numCols:numSlic) : (numRows>numSlic ? numRows:numSlic) ;
|
|
107 |
int maxsize = mNumCols > mNumRows ? (mNumCols>mNumSlic ? mNumCols:mNumSlic) : (mNumRows>mNumSlic ? mNumRows:mNumSlic) ;
|
|
107 | 108 |
|
108 | 109 |
createBitmap(maxsize,bitmapID); |
109 | 110 |
|
... | ... | |
111 | 112 |
{ |
112 | 113 |
case 0: if( bitmapID!=-1 ) |
113 | 114 |
{ |
114 |
mMesh = new MeshCubes(numCols, str, numSlic);
|
|
115 |
mMesh = new MeshCubes(mNumCols, str, mNumSlic);
|
|
115 | 116 |
} |
116 | 117 |
else |
117 | 118 |
{ |
118 |
Static4D mapFB = new Static4D(0.0f,0.0f, (float)numCols/maxsize, (float)numRows/maxsize);
|
|
119 |
Static4D mapLR = new Static4D(0.0f,0.0f, (float)numSlic/maxsize, (float)numRows/maxsize);
|
|
120 |
Static4D mapTB = new Static4D(0.0f,0.0f, (float)numCols/maxsize, (float)numSlic/maxsize);
|
|
119 |
Static4D mapFB = new Static4D(0.0f,0.0f, (float)mNumCols/maxsize, (float)mNumRows/maxsize);
|
|
120 |
Static4D mapLR = new Static4D(0.0f,0.0f, (float)mNumSlic/maxsize, (float)mNumRows/maxsize);
|
|
121 |
Static4D mapTB = new Static4D(0.0f,0.0f, (float)mNumCols/maxsize, (float)mNumSlic/maxsize);
|
|
121 | 122 |
|
122 |
mMesh = new MeshCubes(numCols, str, numSlic, mapFB, mapFB, mapLR, mapLR, mapTB, mapTB);
|
|
123 |
mMesh = new MeshCubes(mNumCols, str, mNumSlic, mapFB, mapFB, mapLR, mapLR, mapTB, mapTB);
|
|
123 | 124 |
} |
124 | 125 |
break; |
125 |
case 1: mMesh = new MeshRectangles(numCols,numRows);
|
|
126 |
case 1: mMesh = new MeshRectangles(mNumCols,mNumRows);
|
|
126 | 127 |
break; |
127 |
case 2: mMesh = new MeshSphere(numRows);
|
|
128 |
case 2: mMesh = new MeshSphere(mNumRows);
|
|
128 | 129 |
break; |
129 | 130 |
case 3: mMesh = new MeshQuad(); |
130 | 131 |
break; |
131 | 132 |
} |
132 | 133 |
|
133 |
mTexture = new DistortedTexture(numCols,numRows);
|
|
134 |
mTexture = new DistortedTexture(); |
|
134 | 135 |
|
135 | 136 |
setContentView(R.layout.inflatelayout); |
136 | 137 |
|
... | ... | |
263 | 264 |
{ |
264 | 265 |
return mMesh; |
265 | 266 |
} |
267 |
|
|
268 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
269 |
|
|
270 |
public int getNumCols() |
|
271 |
{ |
|
272 |
return mNumCols; |
|
273 |
} |
|
274 |
|
|
275 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
276 |
|
|
277 |
public int getNumRows() |
|
278 |
{ |
|
279 |
return mNumRows; |
|
280 |
} |
|
281 |
|
|
282 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
283 |
|
|
284 |
public int getNumSlic() |
|
285 |
{ |
|
286 |
return mNumSlic; |
|
287 |
} |
|
266 | 288 |
} |
Also available in: Unified diff
Move the 'pre-multiply mesh before applying any effects' thing from [(Xsize of texture, Ysize of texture) x Mesh's zFactor] to Effects.setStretch(sx,sy,sz)