Revision 16b22aab
Added by Leszek Koltunski about 5 years ago
src/main/java/org/distorted/examples/blur/BlurRenderer.java | ||
---|---|---|
58 | 58 |
private MeshFlat mMesh; |
59 | 59 |
private Static1D mRadiusSta; |
60 | 60 |
private int mObjHeight, mObjWidth; |
61 |
private Static3D mMove, mScale, mBufferMove, mBufferScale;
|
|
61 |
private Static3D mScale, mBufferScale;
|
|
62 | 62 |
|
63 | 63 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
64 | 64 |
|
... | ... | |
73 | 73 |
Dynamic1D radiusDyn = new Dynamic1D(); |
74 | 74 |
radiusDyn.add(mRadiusSta); |
75 | 75 |
|
76 |
mMove = new Static3D(0,0,0); |
|
77 | 76 |
mScale= new Static3D(1,1,1); |
78 |
mBufferMove = new Static3D(0,0,0); |
|
79 | 77 |
mBufferScale= new Static3D(1,1,1); |
80 | 78 |
|
81 | 79 |
mBufferEffects = new DistortedEffects(); |
82 |
mBufferEffects.apply(new MatrixEffectMove(mBufferMove)); |
|
83 | 80 |
mBufferEffects.apply(new MatrixEffectScale(mBufferScale)); |
84 | 81 |
|
85 | 82 |
mEffects = new DistortedEffects(); |
86 | 83 |
mEffects.apply( new PostprocessEffectBlur(radiusDyn) ); |
87 |
mEffects.apply(new MatrixEffectMove(mMove)); |
|
88 | 84 |
mEffects.apply(new MatrixEffectScale(mScale)); |
89 | 85 |
} |
90 | 86 |
|
... | ... | |
114 | 110 |
float qw1 = (float)width /SIZE; |
115 | 111 |
float qh1 = (float)height/SIZE; |
116 | 112 |
float factor1 = 0.8f* (qw1<qh1 ? qw1:qh1); |
117 |
int w1 = (int)(factor1*SIZE); |
|
118 |
int h1 = (int)(factor1*SIZE); |
|
119 | 113 |
|
120 |
mBufferMove.set((width-w1)/2 ,(height-h1)/2, 0); |
|
121 | 114 |
mBufferScale.set( factor1,factor1,factor1 ); |
122 | 115 |
|
123 | 116 |
float qw2 = (float)SIZE/mObjWidth; |
124 | 117 |
float qh2 = (float)SIZE/mObjHeight; |
125 | 118 |
float factor2 = 0.9f* (qw2<qh2 ? qw2:qh2); |
126 |
int w2 = (int)(factor2*mObjWidth); |
|
127 |
int h2 = (int)(factor2*mObjHeight); |
|
128 | 119 |
|
129 |
mMove.set((SIZE-w2)/2 ,(SIZE-h2)/2, 0); |
|
130 | 120 |
mScale.set( factor2,factor2,factor2 ); |
131 | 121 |
|
132 | 122 |
mScreen.resize(width, height); |
Also available in: Unified diff
Fix several more apps for the 'center-of-matrix-effects-in-screen-center' change.