Revision 2d88fcc3
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/bandaged/BandagedCreatorRenderer.java | ||
---|---|---|
485 | 485 |
} |
486 | 486 |
} |
487 | 487 |
|
488 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
489 |
|
|
490 |
private int computeProjectionAngle() |
|
491 |
{ |
|
492 |
float quot1 = mObjSize[2]/ (float)mObjSize[0]; |
|
493 |
float quot2 = mObjSize[2]/ (float)mObjSize[1]; |
|
494 |
float quot3 = mObjSize[0]/ (float)mObjSize[2]; |
|
495 |
float quot4 = mObjSize[0]/ (float)mObjSize[1]; |
|
496 |
|
|
497 |
float quot5 = Math.max(quot1,quot2); |
|
498 |
float quot6 = Math.max(quot3,quot4); |
|
499 |
float quot7 = Math.max(quot5,quot6); |
|
500 |
|
|
501 |
if( quot7<=1.0f ) return 120; |
|
502 |
else if( quot7<=1.5f ) return 90; |
|
503 |
else if( quot7<=2.0f ) return 60; |
|
504 |
else return 30; |
|
505 |
} |
|
506 |
|
|
488 | 507 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
489 | 508 |
|
490 | 509 |
private void setupIconCreation(Activity act) |
... | ... | |
500 | 519 |
DistortedEffects effects = obj.getObjectEffects(); |
501 | 520 |
DistortedNode node = obj.getNode(); |
502 | 521 |
|
503 |
float quot1 = mObjSize[2]/ (float)mObjSize[0]; |
|
504 |
float quot2 = mObjSize[2]/ (float)mObjSize[1]; |
|
505 |
float quot3 = mObjSize[0]/ (float)mObjSize[2]; |
|
506 |
float quot4 = mObjSize[0]/ (float)mObjSize[1]; |
|
507 |
|
|
508 |
float quot5 = Math.max(quot1,quot2); |
|
509 |
float quot6 = Math.max(quot3,quot4); |
|
510 |
float quot7 = Math.max(quot5,quot6); |
|
511 |
|
|
512 |
int angle; |
|
513 |
|
|
514 |
if( quot7<=1.0f ) angle=120; |
|
515 |
else if( quot7<=1.5f ) angle= 90; |
|
516 |
else if( quot7<=2.0f ) angle= 60; |
|
517 |
else angle= 30; |
|
518 |
|
|
519 | 522 |
if( mFramebuffer==null ) |
520 | 523 |
{ |
521 | 524 |
mFramebuffer = new DistortedFramebuffer(FBO_WIDTH,FBO_HEIGHT,1, InternalOutputSurface.DEPTH_NO_STENCIL); |
522 | 525 |
mFramebuffer.glClearColor(BRIGHTNESS, BRIGHTNESS, BRIGHTNESS, 1.0f); |
523 |
mFramebuffer.setProjection(angle,0.1f); |
|
524 | 526 |
} |
525 | 527 |
|
528 |
mFramebuffer.setProjection( computeProjectionAngle() ,0.1f); |
|
526 | 529 |
mFramebuffer.detachAll(); |
527 | 530 |
mFramebuffer.attach(node); |
528 | 531 |
|
Also available in: Unified diff
Correctly compute bandaged icon's projection angle.