Revision a22d1700
Added by Leszek Koltunski over 5 years ago
src/main/java/org/distorted/examples/generic/GenericRenderer.java | ||
---|---|---|
218 | 218 |
void setRegion(float x, float y, float z, float r) |
219 | 219 |
{ |
220 | 220 |
float factorReg = 2*mFactorObj*r/mRegionTexture.getWidth(); |
221 |
|
|
222 | 221 |
mRegionPoint.set(mFactorObj*x,mFactorObj*y, mFactorObj*z); |
223 | 222 |
mRegionScalePoint.set(factorReg,factorReg,factorReg); |
224 | 223 |
} |
... | ... | |
246 | 245 |
|
247 | 246 |
float factorCen; |
248 | 247 |
int centerSize = mCenterTexture.getWidth(); |
249 |
float oldFactorObj = mFactorObj; |
|
250 | 248 |
|
251 | 249 |
if( width*mObjHeight > height*mObjWidth ) // screen is more 'horizontal' than the Object |
252 | 250 |
{ |
... | ... | |
259 | 257 |
factorCen = (0.08f *width)/centerSize; |
260 | 258 |
} |
261 | 259 |
|
262 |
float adjustFactor = mFactorObj/oldFactorObj; |
|
263 |
|
|
264 |
mCenterPoint.set1( mCenterPoint.get1()*adjustFactor ); |
|
265 |
mCenterPoint.set2( mCenterPoint.get2()*adjustFactor ); |
|
266 |
mCenterPoint.set3( mCenterPoint.get3()*adjustFactor ); |
|
267 |
|
|
268 |
mRegionPoint.set1( mRegionPoint.get1()*adjustFactor ); |
|
269 |
mRegionPoint.set2( mRegionPoint.get2()*adjustFactor ); |
|
270 |
mRegionPoint.set3( mRegionPoint.get3()*adjustFactor ); |
|
271 |
|
|
272 |
mRegionScalePoint.set1(mRegionScalePoint.get1()*adjustFactor); |
|
273 |
mRegionScalePoint.set2(mRegionScalePoint.get2()*adjustFactor); |
|
274 |
mRegionScalePoint.set3(mRegionScalePoint.get3()*adjustFactor); |
|
260 |
setCenter(0.5f,0.5f,0.0f); |
|
261 |
setRegion(0.0f,0.0f,0.0f,0.5f); |
|
275 | 262 |
|
276 | 263 |
mMoveObject.set( (width-mFactorObj*mObjWidth)/2 , (height-mFactorObj*mObjHeight)/2 , -mFactorObj*mObjDepth ); |
277 | 264 |
mRotateCen.set(width*0.5f,height*0.5f, 0); |
Also available in: Unified diff
Further improvement for the Generic app.