Project

General

Profile

« Previous | Next » 

Revision a8162df9

Added by Leszek Koltunski almost 7 years ago

Beginnings of support of Magnification.

View differences:

src/main/java/org/distorted/library/Distorted.java
34 34
  static int GLSL;
35 35
  static String GLSL_VERSION;
36 36

  
37
  static float mMagnify = 1.0f;
38

  
37 39
  /**
38 40
   * When creating an instance of a DistortedTexture from another instance, clone the Bitmap that's
39 41
   * backing up our DistortedTexture.
......
151 153

  
152 154
    mInitialized = false;
153 155
    }
156

  
157
///////////////////////////////////////////////////////////////////////////////////////////////////
158

  
159
  public static void setMagnify(float m)
160
    {
161
    mMagnify = m;
162
    }
154 163
  }
src/main/java/org/distorted/library/EffectQueueMatrix.java
103 103
    matrix[15] = mMVPMatrix[15];
104 104
    }
105 105

  
106
///////////////////////////////////////////////////////////////////////////////////////////////////
107

  
108
  private void magnify(float halfX, float halfY, float halfZ, float[] projection)
109
    {
110
    float scale = Distorted.mMagnify;
111
    float[] point = new float[4];
112
    point[3] = 0.0f;
113

  
114
    Matrix.scaleM(mViewMatrix, 0, scale, scale, scale);
115
    }
116

  
106 117
///////////////////////////////////////////////////////////////////////////////////////////////////
107 118
// here construct the ModelView and the ModelViewProjection Matrices
108 119

  
......
186 197
      }
187 198

  
188 199
    Matrix.translateM(mViewMatrix, 0, halfX,-halfY,-halfZ);
200

  
201
    if( Distorted.mMagnify!=1.0f ) magnify(halfX,halfY,halfZ, projection.mProjectionMatrix);
202

  
189 203
    Matrix.multiplyMM(mMVPMatrix, 0, projection.mProjectionMatrix, 0, mViewMatrix, 0);
190 204
    }
191 205

  

Also available in: Unified diff