Revision 630703d1
Added by Leszek Koltunski about 7 years ago
src/main/java/org/distorted/examples/fbo/FBORenderer.java | ||
---|---|---|
103 | 103 |
|
104 | 104 |
public void onSurfaceChanged(GL10 glUnused, int width, int height) |
105 | 105 |
{ |
106 |
float qx = (float)width /lisaWidth; |
|
107 |
float qy = (float)height/lisaHeight; |
|
108 |
|
|
109 | 106 |
mEffects.abortEffects(EffectTypes.MATRIX); |
110 |
mEffects.scale( qx<qy ? (new Static3D(1,qx/qy,1)) : (new Static3D(qy/qx,1,1)) ); |
|
107 |
|
|
108 |
if( (float)lisaHeight/lisaWidth > (float)height/width ) |
|
109 |
{ |
|
110 |
int w = (height*lisaWidth)/lisaHeight; |
|
111 |
float factor = (float)height/lisaHeight; |
|
112 |
|
|
113 |
mEffects.move( new Static3D((width-w)/2,0,0) ); |
|
114 |
mEffects.scale(factor); |
|
115 |
} |
|
116 |
else |
|
117 |
{ |
|
118 |
int h = (width*lisaHeight)/lisaWidth; |
|
119 |
float factor = (float)width/lisaWidth; |
|
120 |
|
|
121 |
mEffects.move( new Static3D(0,(height-h)/2,0) ); |
|
122 |
mEffects.scale(factor); |
|
123 |
} |
|
111 | 124 |
|
112 | 125 |
mScreen.resize(width, height); |
113 | 126 |
} |
... | ... | |
151 | 164 |
mGridTexture.setTexture(bitmap2); |
152 | 165 |
DistortedEffects gridEffects = new DistortedEffects(); |
153 | 166 |
|
167 |
mEffects.abortAllEffects(); |
|
168 |
|
|
154 | 169 |
mRoot = new DistortedNode(mLisaTexture, mEffects,new MeshFlat(1,1)); |
155 | 170 |
mRoot.attach(mGridTexture,gridEffects,new MeshCubes(10,10,false)); |
156 | 171 |
|
... | ... | |
159 | 174 |
mScreen.detachAll(); |
160 | 175 |
mScreen.attach(mRoot); |
161 | 176 |
|
162 |
gridEffects.scale(0.5f); |
|
177 |
float factor = lisaWidth/(2.0f*gridWidth); |
|
178 |
|
|
179 |
gridEffects.move( new Static3D( (lisaWidth-factor*gridWidth)/2,(lisaHeight-factor*gridHeight)/2,0) ); |
|
180 |
gridEffects.scale(factor); |
|
163 | 181 |
|
164 | 182 |
Dynamic1D rotDyn = new Dynamic1D(12000,0.0f); |
165 | 183 |
rotDyn.add(new Static1D( 0)); |
166 | 184 |
rotDyn.add(new Static1D(360)); |
167 | 185 |
rotDyn.setMode(Dynamic.MODE_JUMP); |
168 | 186 |
|
169 |
gridEffects.rotate(rotDyn, new Static3D(1,0,0), new Static3D(0,0,1.0f/10) );
|
|
187 |
gridEffects.rotate(rotDyn, new Static3D(1,0,0), new Static3D(gridWidth/2,gridHeight/2,gridHeight/10) );
|
|
170 | 188 |
|
171 | 189 |
Dynamic1D sinkDyn = new Dynamic1D(3000,0.0f); |
172 | 190 |
sinkDyn.add(new Static1D(1.0f)); |
Also available in: Unified diff
Revert "Major refactoring: convert the Matrix Effects to be independent of the resolution of the surface we render to."
This reverts commit d79a56d3bc6cc7a22b21abeb180353a1818bd6ad.