Project

General

Profile

« Previous | Next » 

Revision d79a56d3

Added by Leszek Koltunski about 7 years ago

Major refactoring: convert the Matrix Effects to be independent of the resolution of the surface we render to.

Re-write the first 15 apps to work with this.

View differences:

src/main/java/org/distorted/examples/differenteffects/DifferentEffectsRenderer.java
111 111
       {
112 112
       mEffects[i].abortEffects(EffectTypes.MATRIX);
113 113
       }
114
      
115
     if( (float)bmpHeight/(NUM*bmpWidth) > (float)height/width )
116
       {
117
       int w = (height*bmpWidth)/bmpHeight;
118
       float factor = (float)height/bmpHeight;
119 114

  
120
       for(int i=NUM-1; i>=0; i--)
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
119
       {
120
       for(int i=0; i<NUM; i++)
121 121
         {
122
         mEffects[i].move( new Static3D((width-NUM*w)/2 +i*w , 0, 0) );
123
         mEffects[i].scale(factor);
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) );
124 124
         }
125 125
       }
126 126
     else
127 127
       {
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--)
128
       for(int i=0; i<NUM; i++)
133 129
         {
134
         mEffects[i].move( new Static3D(i*w, (height-h)/2, 0) );
135
         mEffects[i].scale(factor);
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) );
136 132
         }
137 133
       }
138 134
       

Also available in: Unified diff