Project

General

Profile

« Previous | Next » 

Revision 16b22aab

Added by Leszek Koltunski about 5 years ago

Fix several more apps for the 'center-of-matrix-effects-in-screen-center' change.

View differences:

src/main/java/org/distorted/examples/triblur/TriblurRenderer.java
56 56

  
57 57
    private static final int[] OBJECTS =
58 58
        {
59
        -150, 0, 0,   255,   0,  0,  // x,y,z, R,G,B
59
        -130, 0, 0,   255,   0,  0,  // x,y,z, R,G,B
60 60
           0, 0, 0,   255, 255,  0,  //
61
        +150, 0, 0,     0, 255,  0,  //
61
        +130, 0, 0,     0, 255,  0,  //
62 62
        };
63 63

  
64 64
    private static final int NUM_OBJECTS = OBJECTS.length/NUM;
......
72 72
    private PostprocessEffectBlur[] mBlur;
73 73
    private PostprocessEffectGlow[] mGlow;
74 74
    private int[] mEffectStatus;
75
    private Static3D mMove1, mMove2, mScale1, mScale2, mCenter;
75
    private Static3D mScale1, mScale2;
76 76

  
77 77
    Static4D mQuat1, mQuat2;
78 78
    int mScreenMin;
......
105 105

  
106 106
      DistortedEffects[] effects= new DistortedEffects[NUM_OBJECTS];
107 107

  
108
      mMove1  = new Static3D(0,0,0);
109
      mMove2  = new Static3D(0,0,0);
110 108
      mScale1 = new Static3D(1,1,1);
111 109
      mScale2 = new Static3D(1.5f,1.5f,1.5f);
112
      mCenter = new Static3D(0,0,0);
110
      Static3D center = new Static3D(0,0,0);
113 111

  
114
      MatrixEffectMove moveEffect1 = new MatrixEffectMove(mMove1);
115
      MatrixEffectMove moveEffect2 = new MatrixEffectMove(mMove2);
116 112
      MatrixEffectScale scaleEffect1 = new MatrixEffectScale(mScale1);
117 113
      MatrixEffectScale scaleEffect2 = new MatrixEffectScale(mScale2);
118
      MatrixEffectQuaternion quatEffect1 = new MatrixEffectQuaternion(mQuat1, mCenter);
119
      MatrixEffectQuaternion quatEffect2 = new MatrixEffectQuaternion(mQuat2, mCenter);
114
      MatrixEffectQuaternion quatEffect1 = new MatrixEffectQuaternion(mQuat1, center);
115
      MatrixEffectQuaternion quatEffect2 = new MatrixEffectQuaternion(mQuat2, center);
120 116

  
121 117
      for(int i=0; i<NUM_OBJECTS; i++)
122 118
        {
......
130 126

  
131 127
        effects[i].apply(mBlur[i]);
132 128
        effects[i].apply(chroma[i]);
133
        effects[i].apply( (i==0||i==NUM_OBJECTS-1) ?  moveEffect1 :  moveEffect2 );
134 129
        effects[i].apply( (i==0||i==NUM_OBJECTS-1) ? scaleEffect1 : scaleEffect2 );
135 130
        effects[i].apply(quatEffect1);
136 131
        effects[i].apply(quatEffect2);
......
220 215
      float factor2 = 0.80f*factor1;
221 216
      mScale1.set(factor1,factor1,factor1);
222 217
      mScale2.set(factor2,factor2,factor2);
223
      mCenter.set((float)OBJ_SIZE/2, (float)OBJ_SIZE/2, (float)OBJ_SIZE/2 );
224
      mMove1.set( (width -factor1*OBJ_SIZE)/2 ,(height-factor1*OBJ_SIZE)/2 , -factor1*OBJ_SIZE);
225
      mMove2.set( (width -factor2*OBJ_SIZE)/2 ,(height-factor2*OBJ_SIZE)/2 , -factor2*OBJ_SIZE);
226 218
      mScreen.resize(width, height);
227 219
      }
228 220

  

Also available in: Unified diff