Revision 9e7b6dbd
Added by Leszek Koltunski over 5 years ago
src/main/java/org/distorted/examples/effects3d/Effects3DActivity2.java | ||
---|---|---|
63 | 63 |
private Bitmap mBitmap; |
64 | 64 |
|
65 | 65 |
private float mCenterX, mCenterY, mCenterZ; |
66 |
private float mRegionX, mRegionY, mRegionR; |
|
66 |
private float mRegionX, mRegionY, mRegionZ, mRegionR;
|
|
67 | 67 |
private DistortedEffects mEffects; |
68 | 68 |
private ViewPager mViewPager; |
69 | 69 |
private Effects3DTabViewPager mPager; |
... | ... | |
196 | 196 |
|
197 | 197 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
198 | 198 |
|
199 |
public void setRegion(float x, float y, float r) |
|
199 |
public void setRegion(float x, float y, float z, float r)
|
|
200 | 200 |
{ |
201 | 201 |
mRegionX = x; |
202 | 202 |
mRegionY =-y; |
203 |
mRegionZ = z; |
|
203 | 204 |
mRegionR = r; |
204 | 205 |
|
205 | 206 |
Effects3DSurfaceView view = findViewById(R.id.effects3dSurfaceView); |
206 |
view.getRenderer().setRegion(mRegionX, mRegionY, mRegionR); |
|
207 |
view.getRenderer().setRegion(mRegionX, mRegionY, mRegionZ, mRegionR);
|
|
207 | 208 |
} |
208 | 209 |
|
209 | 210 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
246 | 247 |
return mRegionY; |
247 | 248 |
} |
248 | 249 |
|
250 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
251 |
|
|
252 |
public float getRegionZ() |
|
253 |
{ |
|
254 |
return mRegionZ; |
|
255 |
} |
|
256 |
|
|
249 | 257 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
250 | 258 |
|
251 | 259 |
public float getRegionR() |
... | ... | |
290 | 298 |
mCenterY = 0.5f*getHeight(); |
291 | 299 |
mRegionX = 0; |
292 | 300 |
mRegionY = 0; |
301 |
mRegionZ = 0; |
|
293 | 302 |
mRegionR = getWidth()/2; |
294 | 303 |
|
295 | 304 |
Effects3DSurfaceView view = findViewById(R.id.effects3dSurfaceView); |
296 | 305 |
Effects3DRenderer renderer= view.getRenderer(); |
297 | 306 |
|
298 | 307 |
renderer.setCenter( mCenterX, mCenterY, mCenterZ ); |
299 |
renderer.setRegion( mRegionX, mRegionY, mRegionR ); |
|
308 |
renderer.setRegion( mRegionX, mRegionY, mRegionZ, mRegionR );
|
|
300 | 309 |
} |
301 | 310 |
|
302 | 311 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Redefine the Vertex Region from (x,y,r,unused) to (x,y,z,r). This takes into account the 'Z', which makes it possible to warp only one side of a 3D Mesh like Sphere.
Also corresponding changes in applications.