Revision 88048c61
Added by Leszek Koltunski almost 9 years ago
| src/main/java/org/distorted/examples/mirror/MirrorRenderer.java | ||
|---|---|---|
| 31 | 31 |
import org.distorted.library.DistortedTexture; |
| 32 | 32 |
import org.distorted.library.GridFlat; |
| 33 | 33 |
import org.distorted.library.type.Dynamic3D; |
| 34 |
import org.distorted.library.type.Static1D; |
|
| 34 | 35 |
import org.distorted.library.type.Static3D; |
| 35 | 36 |
|
| 36 | 37 |
import java.io.IOException; |
| ... | ... | |
| 43 | 44 |
|
| 44 | 45 |
class MirrorRenderer implements GLSurfaceView.Renderer |
| 45 | 46 |
{
|
| 46 |
private static final float MIRROR_SCALE = 0.70f; // each next mirror will be 70% of the size or the previous |
|
| 47 |
private static final float HEAD_SCALE = 0.30f; // Head's height will be 30% of the height of the mirror |
|
| 48 |
private static final float MIRROR_MARGIN= 0.11f; // The frame of the mirror takes up 11% of its width |
|
| 49 |
private static final float MIRROR_MOVE = 0.12f; // Each next mirror is moved to the right by 12% of |
|
| 50 |
// the length of the previous one |
|
| 47 |
private static final float MIRROR_SCALE =0.70f; // each next mirror will be 70% of the size or the previous |
|
| 48 |
private static final float HEAD_SCALE =0.30f; // Head's height will be 30% of the height of the mirror |
|
| 49 |
private static final float MIRROR_BRIGHTNESS=0.70f; // Each next mirror 30% darker |
|
| 50 |
private static final float MIRROR_MARGIN =0.11f; // The frame of the mirror takes up 11% of its width |
|
| 51 |
private static final float MIRROR_MOVE =0.12f; // Each next mirror is moved to the right by 12% of |
|
| 52 |
// the length of the previous one |
|
| 51 | 53 |
|
| 52 | 54 |
private GLSurfaceView mView; |
| 53 | 55 |
private DistortedEffects mEffectsMirror, mEffectsHead, mEffectsNull; |
| ... | ... | |
| 136 | 138 |
|
| 137 | 139 |
mEffectsMirror.scale( new Static3D( (float)mScreenW/mMirrorW, (float)mScreenH/mMirrorH, 1.0f) ); |
| 138 | 140 |
mEffectsOffscreen1.scale(MIRROR_SCALE); |
| 141 |
mEffectsOffscreen1.brightness(new Static1D(MIRROR_BRIGHTNESS)); |
|
| 139 | 142 |
mEffectsOffscreen2.move( new Static3D( MIRROR_MOVE*mScreenW, MIRROR_MOVE*mScreenH*mMirrorW/mMirrorH, 0) ); |
| 140 | 143 |
|
| 141 | 144 |
mEffectsHead.move(mHeadDyn); |
Also available in: Unified diff
Beginnings of support for postprocessing Effects.