Revision 630703d1
Added by Leszek Koltunski about 7 years ago
src/main/java/org/distorted/examples/differenteffects/DifferentEffectsRenderer.java | ||
---|---|---|
111 | 111 |
{ |
112 | 112 |
mEffects[i].abortEffects(EffectTypes.MATRIX); |
113 | 113 |
} |
114 |
|
|
115 |
float qx = (float)width /bmpWidth; |
|
116 |
float qy = (float)height/bmpHeight; |
|
117 |
|
|
118 |
if( qx > NUM*qy ) // screen more 'horizontal' than NUM bitmaps next to each other |
|
114 |
|
|
115 |
if( (float)bmpHeight/(NUM*bmpWidth) > (float)height/width ) |
|
119 | 116 |
{ |
120 |
for(int i=0; i<NUM; i++) |
|
117 |
int w = (height*bmpWidth)/bmpHeight; |
|
118 |
float factor = (float)height/bmpHeight; |
|
119 |
|
|
120 |
for(int i=NUM-1; i>=0; i--) |
|
121 | 121 |
{ |
122 |
mEffects[i].move( new Static3D( qy*((0.5f+i)/NUM-0.5f), 0, 0) );
|
|
123 |
mEffects[i].scale( new Static3D( qy/qx, 1, 1) );
|
|
122 |
mEffects[i].move( new Static3D((width-NUM*w)/2 +i*w , 0, 0) );
|
|
123 |
mEffects[i].scale(factor);
|
|
124 | 124 |
} |
125 | 125 |
} |
126 | 126 |
else |
127 | 127 |
{ |
128 |
for(int i=0; i<NUM; i++) |
|
128 |
int w = width/NUM; |
|
129 |
int h = (width*bmpHeight)/(bmpWidth*NUM); |
|
130 |
float factor = (float)width/(bmpWidth*NUM); |
|
131 |
|
|
132 |
for(int i=NUM-1; i>=0; i--) |
|
129 | 133 |
{ |
130 |
mEffects[i].move( new Static3D( (0.5f+i)/NUM-0.5f, 0, 0) );
|
|
131 |
mEffects[i].scale( new Static3D( 1.0f/NUM, (qx/qy)/NUM, 1) );
|
|
134 |
mEffects[i].move( new Static3D(i*w, (height-h)/2, 0) );
|
|
135 |
mEffects[i].scale(factor);
|
|
132 | 136 |
} |
133 | 137 |
} |
134 | 138 |
|
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.