Revision 16b22aab
Added by Leszek Koltunski about 5 years ago
src/main/java/org/distorted/examples/glow/GlowRenderer.java | ||
---|---|---|
25 | 25 |
|
26 | 26 |
import org.distorted.examples.R; |
27 | 27 |
import org.distorted.library.effect.EffectQuality; |
28 |
import org.distorted.library.effect.MatrixEffectMove; |
|
29 | 28 |
import org.distorted.library.effect.MatrixEffectScale; |
30 | 29 |
import org.distorted.library.effect.PostprocessEffectGlow; |
31 | 30 |
import org.distorted.library.main.Distorted; |
... | ... | |
54 | 53 |
private DistortedScreen mScreen; |
55 | 54 |
private PostprocessEffectGlow mGlow; |
56 | 55 |
private int mRootW, mRootH; |
57 |
private Static3D mMove, mScale;
|
|
56 |
private Static3D mScale; |
|
58 | 57 |
private Static1D mRadius; |
59 | 58 |
private Static4D mColor; |
60 | 59 |
|
... | ... | |
67 | 66 |
mRootW = LEAF_SIZE; |
68 | 67 |
mRootH = LEAF_SIZE; |
69 | 68 |
mLeaf = new DistortedTexture(mRootW,mRootH); |
70 |
mMove = new Static3D(0,0,0); |
|
71 | 69 |
mScale = new Static3D(1,1,1); |
72 | 70 |
mRadius= new Static1D(25); |
73 | 71 |
mColor = new Static4D(1.0f,0.0f,0.0f,0.5f); // half-transparent red |
... | ... | |
75 | 73 |
mGlow = new PostprocessEffectGlow(mRadius,mColor); |
76 | 74 |
|
77 | 75 |
DistortedEffects effects = new DistortedEffects(); |
78 |
effects.apply(new MatrixEffectMove(mMove)); |
|
79 | 76 |
effects.apply(new MatrixEffectScale(mScale)); |
80 | 77 |
effects.apply(mGlow); |
81 | 78 |
|
... | ... | |
124 | 121 |
float qw = (float)width /mRootW; |
125 | 122 |
float qh = (float)height/mRootH; |
126 | 123 |
float factor = 0.8f* (qw<qh ? qw:qh); |
127 |
int w = (int)(factor*mRootW); |
|
128 |
int h = (int)(factor*mRootH); |
|
129 | 124 |
|
130 |
mMove.set((width-w)/2 ,(height-h)/2, 0); |
|
131 | 125 |
mScale.set( factor,factor,factor ); |
132 | 126 |
mScreen.resize(width, height); |
133 | 127 |
} |
Also available in: Unified diff
Fix several more apps for the 'center-of-matrix-effects-in-screen-center' change.