Project

General

Profile

« Previous | Next » 

Revision 9e7b6dbd

Added by Leszek Koltunski almost 6 years ago

Redefine the Vertex Region from (x,y,r,unused) to (x,y,z,r). This takes into account the 'Z', which makes it possible to warp only one side of a 3D Mesh like Sphere.

Also corresponding changes in applications.

View differences:

src/main/java/org/distorted/examples/aroundtheworld/AroundTheWorldEffectsManager.java
145 145

  
146 146
    // WHITENESS
147 147
    // Vertex Effects
148
    wLipsRegion = new Static4D(0,0,100,100);
148
    wLipsRegion = new Static4D(0,0,0,100);
149 149
    wLipsCenter = new Static3D(300,500,0);
150 150
    wLipsFactor = new Static1D(0.7f);
151 151
    wLipsDyn    = new Dynamic1D();
......
153 153

  
154 154
    // ASIANNESS
155 155
    // Vertex Effects
156
    aLipsNoseRegion    = new Static4D(0,0,267,267);
156
    aLipsNoseRegion    = new Static4D(0,0,0,267);
157 157
    aLipsNoseCenter    = new Static3D(300,560,0);
158 158
    aLipsNoseDyn       = new Dynamic3D();
159 159
    aLipsNoseFactor    = new Static3D(0,0,0);
160 160
    aLipsNoseDyn.add(aLipsNoseFactor);
161 161

  
162
    aNoseBroaderRegion = new Static4D(0,0,130,130);
162
    aNoseBroaderRegion = new Static4D(0,0,0,130);
163 163
    aNoseBroaderCenter = new Static3D(300,307,0);
164 164
    aNoseBroaderDyn    = new Dynamic2D();
165 165
    aNoseBroaderFactor = new Static2D(0,90);
166 166
    aNoseBroaderDyn.add(aNoseBroaderFactor);
167 167

  
168
    aNostrilsRegion    = new Static4D(0,0,60,60);
168
    aNostrilsRegion    = new Static4D(0,0,0,60);
169 169
    aNostrilsCenter    = new Static3D(300,336,0);
170 170
    aNostrilsDyn       = new Dynamic3D();
171 171
    aNostrilsFactor    = new Static3D(0,0,0);
172 172
    aNostrilsDyn.add(aNostrilsFactor);
173 173

  
174
    aEyesRegion        = new Static4D(0,0,83,83);
174
    aEyesRegion        = new Static4D(0,0,0,83);
175 175
    aLEyeCenter        = new Static3D(176,230,0);
176 176
    aREyeCenter        = new Static3D(420,230,0);
177 177
    aLEyeDyn           = new Dynamic1D();
......
181 181
    aLEyeDyn.add(aLEyeFactor);
182 182
    aREyeDyn.add(aREyeFactor);
183 183

  
184
    aEyebrowsRegion    = new Static4D(0,0,142,142);
184
    aEyebrowsRegion    = new Static4D(0,0,0,142);
185 185
    aEyebrowsCenter    = new Static3D(300,100,0);
186 186
    aEyebrowsDyn       = new Dynamic3D();
187 187
    aEyebrowsFactor    = new Static3D(0,0,0);
......
204 204

  
205 205
    // BLACKNESS
206 206
    // Vertex Effects
207
    bFaceRegion        = new Static4D(0,0,600,600);
207
    bFaceRegion        = new Static4D(0,0,0,600);
208 208
    bFaceCenter        = new Static3D(300,300,0);
209 209
    bFaceFactor        = new Static2D(1.0f,90.0f);
210 210
    bFaceDyn           = new Dynamic2D();
211 211
    bFaceDyn.add(bFaceFactor);
212 212

  
213
    bTipLowerRegion    = new Static4D(0,0,41,41);
213
    bTipLowerRegion    = new Static4D(0,0,0,41);
214 214
    bTipLowerCenter    = new Static3D(300,393,0);
215 215
    bTipLowerFactor    = new Static3D(0,0,0);
216 216
    bTipLowerDyn       = new Dynamic3D();
217 217
    bTipLowerDyn.add(bTipLowerFactor);
218 218

  
219
    bWholeNoseRegion   = new Static4D(0,0,130,130);
219
    bWholeNoseRegion   = new Static4D(0,0,0,130);
220 220
    bWholeNoseCenter   = new Static3D(300,357,0);
221 221
    bWholeNoseFactor   = new Static2D(1.0f,90.0f);
222 222
    bWholeNoseDyn      = new Dynamic2D();
223 223
    bWholeNoseDyn.add(bWholeNoseFactor);
224 224

  
225
    bNoseBroaderRegion = new Static4D(0,0,95,95);
225
    bNoseBroaderRegion = new Static4D(0,0,0,95);
226 226
    bNoseBroaderCenter = new Static3D(300,408,0);
227 227
    bNoseBroaderFactor = new Static2D(1.0f,90.0f);
228 228
    bNoseBroaderDyn    = new Dynamic2D();
229 229
    bNoseBroaderDyn.add(bNoseBroaderFactor);
230 230

  
231
    bLipsRegion        = new Static4D(0,96,118,118);
231
    bLipsRegion        = new Static4D(0,96,0,118);
232 232
    bLipsCenter        = new Static3D(300,458,0);
233 233
    bLipsFactor        = new Static2D(1.0f,0.0f);
234 234
    bLipsDyn           = new Dynamic2D();
src/main/java/org/distorted/examples/bean/BeanRenderer.java
63 63
     
64 64
      Static3D pointLeft  = new Static3D( 98, 183, 0);
65 65
      Static3D pointRight = new Static3D(233, 140, 0);
66
      Static4D regionLeft = new Static4D( -3,-33,47,47);
67
      Static4D regionRight= new Static4D(-14,-33,47,47);
66
      Static4D regionLeft = new Static4D( -3,-33, 0,47);
67
      Static4D regionRight= new Static4D(-14,-33, 0,47);
68 68
      Dynamic3D dynLeft   = new Dynamic3D(2000,0.0f);
69 69
      Dynamic3D dynRight  = new Dynamic3D(2000,0.0f);
70 70

  
src/main/java/org/distorted/examples/check/CheckRenderer.java
105 105
      dSwirl.add(mSwirl1);
106 106
      dSwirl.add(mSwirl2);
107 107

  
108
      if( !mEffects.apply( new VertexEffectSwirl(new Static1D(30), dSwirl, new Static4D( 0,0,40,40)) ) )
108
      if( !mEffects.apply( new VertexEffectSwirl(new Static1D(30), dSwirl, new Static4D( 0,0,0,40)) ) )
109 109
        {
110 110
        Log.e("Check", "Failed to add Swirl effect!");
111 111
        }
src/main/java/org/distorted/examples/deform/DeformRenderer.java
158 158
   void setRegionRadius(int r)
159 159
      {
160 160
      mRadius = ( r==100 ? 100.0f : r/100.0f);
161
      mRegion.set3(mRadius*scrWidth);
161
      mRegion.set4(mRadius*scrWidth);
162 162
      }
163 163

  
164 164
///////////////////////////////////////////////////////////////////////////////////////////////////
......
175 175
     scrHeight = height;
176 176
     scrWidth  = width;
177 177

  
178
     mRegion.set3(mRadius*scrWidth);
178
     mRegion.set4(mRadius*scrWidth);
179 179

  
180 180
     Canvas stretchCanvas;
181 181
     int w=width/2;
......
223 223
       }
224 224
     catch(Exception ex)
225 225
       {
226
       android.util.Log.e("DeformRenderer", ex.toString() );
226
       android.util.Log.e("Deform", ex.toString() );
227 227
       }
228 228
     }
229 229

  
src/main/java/org/distorted/examples/differenteffects/DifferentEffectsRenderer.java
71 71
      // mEffects[0] effects
72 72
      Static3D pLeft = new Static3D(214, 206, 0);
73 73
      Static3D pRight= new Static3D(390, 212, 0);
74
      Static4D RegionEye = new Static4D(0,0,60,60);
74
      Static4D RegionEye = new Static4D(0,0,0,60);
75 75
      
76 76
      // mEffects[1] effects
77 77
      Dynamic3D dyn = new Dynamic3D(1000,0.0f);
src/main/java/org/distorted/examples/effectqueue/EffectQueueSurfaceView.java
96 96
      final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
97 97
      setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
98 98
      setRenderer(mRenderer);
99
      mRegionV= new Static4D(0,0,RADIUS,RADIUS);
99
      mRegionV= new Static4D(0,0,0,RADIUS);
100 100
      setEffect(0);  
101 101
      }
102 102
    }
src/main/java/org/distorted/examples/effects3d/Effects3DActivity2.java
63 63
  private Bitmap mBitmap;
64 64

  
65 65
  private float mCenterX, mCenterY, mCenterZ;
66
  private float mRegionX, mRegionY, mRegionR;
66
  private float mRegionX, mRegionY, mRegionZ, mRegionR;
67 67
  private DistortedEffects mEffects;
68 68
  private ViewPager mViewPager;
69 69
  private Effects3DTabViewPager mPager;
......
196 196

  
197 197
///////////////////////////////////////////////////////////////////////////////////////////////////
198 198

  
199
  public void setRegion(float x, float y, float r)
199
  public void setRegion(float x, float y, float z, float r)
200 200
    {
201 201
    mRegionX = x;
202 202
    mRegionY =-y;
203
    mRegionZ = z;
203 204
    mRegionR = r;
204 205

  
205 206
    Effects3DSurfaceView view = findViewById(R.id.effects3dSurfaceView);
206
    view.getRenderer().setRegion(mRegionX, mRegionY, mRegionR);
207
    view.getRenderer().setRegion(mRegionX, mRegionY, mRegionZ, mRegionR);
207 208
    }
208 209

  
209 210
///////////////////////////////////////////////////////////////////////////////////////////////////
......
246 247
    return mRegionY;
247 248
    }
248 249

  
250
///////////////////////////////////////////////////////////////////////////////////////////////////
251

  
252
  public float getRegionZ()
253
    {
254
    return mRegionZ;
255
    }
256

  
249 257
///////////////////////////////////////////////////////////////////////////////////////////////////
250 258

  
251 259
  public float getRegionR()
......
290 298
    mCenterY = 0.5f*getHeight();
291 299
    mRegionX = 0;
292 300
    mRegionY = 0;
301
    mRegionZ = 0;
293 302
    mRegionR = getWidth()/2;
294 303

  
295 304
    Effects3DSurfaceView view = findViewById(R.id.effects3dSurfaceView);
296 305
    Effects3DRenderer renderer= view.getRenderer();
297 306

  
298 307
    renderer.setCenter( mCenterX, mCenterY, mCenterZ );
299
    renderer.setRegion( mRegionX, mRegionY, mRegionR );
308
    renderer.setRegion( mRegionX, mRegionY, mRegionZ, mRegionR );
300 309
    }
301 310

  
302 311
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/effects3d/Effects3DEffect.java
392 392

  
393 393
    float factorX = act.getWidth() / 100.0f;
394 394
    float factorY = act.getHeight()/ 100.0f;
395
   // float factorZ = act.getDepth() / 100.0f;
395 396

  
396 397
    int deduct = (mName.getType() == EffectType.VERTEX ? 50:0);
397 398

  
398
    float  x = (mInterRegion[0]-deduct)*factorX;
399
    float  y = (mInterRegion[1]-deduct)*factorY;
400
    float rx =  mInterRegion[2]        *factorX;
401
    float ry =  mInterRegion[3]        *factorY;
399
    float x = (mInterRegion[0]-deduct)*factorX;
400
    float y = (mInterRegion[1]-deduct)*factorY;
401
    float z = (mInterRegion[2]-deduct)*factorX;   // ??
402
    float r =  mInterRegion[3]        *(factorX+factorY)/2;
402 403

  
403
    mRegionSta.set(x,y,rx,ry);
404
    mRegionSta.set(x,y,z,r);
404 405
    }
405 406

  
406 407
///////////////////////////////////////////////////////////////////////////////////////////////////
......
634 635
      seek[i].setProgress( mInterRegion[i] );
635 636
      }
636 637

  
637
    act.setRegion(mRegionSta.get1(),mRegionSta.get2(),mRegionSta.get3());
638
    act.setRegion(mRegionSta.get1(),mRegionSta.get2(),mRegionSta.get3(), mRegionSta.get4() );
638 639

  
639 640
    return mRegion;
640 641
    }
......
764 765
      view.getRenderer().showRegionAndCenter( showR,showC );
765 766

  
766 767
      act.setCenter(mCenterSta.get1(),mCenterSta.get2(),mCenterSta.get3());
767
      act.setRegion(mRegionSta.get1(),mRegionSta.get2(),mRegionSta.get3());
768
      act.setRegion(mRegionSta.get1(),mRegionSta.get2(),mRegionSta.get3(), mRegionSta.get4());
768 769
      }
769 770
    }
770 771

  
src/main/java/org/distorted/examples/effects3d/Effects3DRenderer.java
199 199

  
200 200
///////////////////////////////////////////////////////////////////////////////////////////////////
201 201

  
202
    void setRegion(float x, float y, float r)
202
    void setRegion(float x, float y, float z, float r)
203 203
      {
204 204
      mFactorReg = 2*mFactorObj*r/mRegionTexture.getWidth();
205
      mRegionPoint.set(mFactorObj*x,-mFactorObj*y,0);
205
      mRegionPoint.set(mFactorObj*x,-mFactorObj*y, mFactorObj*z);
206 206
      mRegionScalePoint.set(mFactorReg,mFactorReg,mFactorReg);
207 207
      }
208 208

  
src/main/java/org/distorted/examples/flag/FlagRenderer.java
85 85
      mQuat2 = new Static4D(-0.25189602f,0.3546389f,0.009657208f,0.90038127f);  // something semi-random that looks good
86 86

  
87 87
      Static3D waveCenter = new Static3D(mObjWidth, mObjHeight/2, 0);  // middle of the right edge
88
      Static4D waveRegion = new Static4D(0,0,mObjWidth,mObjWidth);
88
      Static4D waveRegion = new Static4D(0,0,0,mObjWidth);
89 89

  
90 90
      mEffects.apply( new VertexEffectWave(mWaveDyn, waveCenter, waveRegion) );
91 91

  
src/main/java/org/distorted/examples/girl/GirlRenderer.java
71 71
      Static3D pRight= new Static3D(247, 264, 0);
72 72
      
73 73
      // Size
74
      Static4D sinkRegion = new Static4D(0,0,60,60);
74
      Static4D sinkRegion = new Static4D(0,0,0,60);
75 75
      
76 76
      s0 = new Static1D(1.0f);
77 77
      
......
79 79
      diSink.add(s0);
80 80
      
81 81
      // Upper Movement
82
      Static4D Region = new Static4D(0,0,45,45);
82
      Static4D Region = new Static4D(0,0,0,45);
83 83
      
84 84
      Dynamic3D diL = new Dynamic3D(1000,0.0f);
85 85
      Dynamic3D diR = new Dynamic3D(1000,0.0f);
......
101 101
      
102 102
      // Lower Movement
103 103
      Static3D pHips = new Static3D(216,505,0);
104
      Static4D HipsRegion = new Static4D(0,0,120,120);
104
      Static4D HipsRegion = new Static4D(0,0,0,120);
105 105
      Dynamic1D diHips = new Dynamic1D(1500,0.0f);
106 106
      
107 107
      dBegin = new Static1D(0);
......
228 228
       }
229 229
     catch(Exception ex)
230 230
       {
231
       android.util.Log.e("Renderer", ex.getMessage() );
231
       android.util.Log.e("Girl", ex.getMessage() );
232 232
       }
233 233
     }
234 234
}
src/main/java/org/distorted/examples/listener/ListenerRenderer.java
93 93
      dDistort.add(new Static3D(0,0,     0));
94 94
      dDistort.add(new Static3D(0,0,height));
95 95

  
96
      return mEffects.apply( new VertexEffectDistort(dDistort, new Static3D(pointx,pointy,0), new Static4D(0,0,radius,radius)) );
96
      return mEffects.apply( new VertexEffectDistort(dDistort, new Static3D(pointx,pointy,0), new Static4D(0,0,0,radius)) );
97 97
      }
98 98
   
99 99
///////////////////////////////////////////////////////////////////////////////////////////////////
......
180 180
       }
181 181
     catch(Exception ex)
182 182
       {
183
       android.util.Log.e("Renderer", ex.getMessage() );
183
       android.util.Log.e("Listener", ex.getMessage() );
184 184
       }
185 185
     }
186 186
}
src/main/java/org/distorted/examples/monalisa/MonaLisaRenderer.java
63 63
      Static3D pLeft = new Static3D( 90, 258, 0);
64 64
      Static3D pRight= new Static3D(176, 255, 0);
65 65

  
66
      Static4D rLeft = new Static4D(-10,-10,25,25);
67
      Static4D rRight= new Static4D( 10, -5,25,25);
66
      Static4D rLeft = new Static4D(-10,-10, 0,25);
67
      Static4D rRight= new Static4D( 10, -5, 0,25);
68 68
      Dynamic3D dLeft = new Dynamic3D(1000,0.0f);
69 69
      Dynamic3D dRight= new Dynamic3D(1000,0.0f);
70 70
      dLeft.add ( new Static3D(  0,  0,0) );
src/main/java/org/distorted/examples/movingeffects/MovingEffectsRenderer.java
125 125
       }
126 126
     catch(Exception ex)
127 127
       {
128
       android.util.Log.e("Renderer", ex.getMessage() );
128
       android.util.Log.e("MovingEffects", ex.getMessage() );
129 129
       }
130 130
     }
131 131

  
src/main/java/org/distorted/examples/movingeffects/MovingEffectsSurfaceView.java
123 123
      mSize2 = max/80;
124 124
      mSizeR = max/6;
125 125

  
126
      mRegionVertex.set(0,0, mSizeR,mSizeR);
126
      mRegionVertex.set(0,0,0,mSizeR);
127 127
      mDistort.set3(max/10);
128 128
      }
129 129

  
src/main/java/org/distorted/examples/plainmonalisa/RenderThread.java
83 83
    Static3D pLeft = new Static3D( 90, 258, 0);
84 84
    Static3D pRight= new Static3D(176, 255, 0);
85 85

  
86
    Static4D rLeft = new Static4D(-10,-10,25,25);
87
    Static4D rRight= new Static4D( 10, -5,25,25);
86
    Static4D rLeft = new Static4D(-10,-10, 0,25);
87
    Static4D rRight= new Static4D( 10, -5, 0,25);
88 88

  
89 89
    Dynamic3D dLeft = new Dynamic3D(1000,0.0f);
90 90
    Dynamic3D dRight= new Dynamic3D(1000,0.0f);
src/main/java/org/distorted/examples/projection/ProjectionRenderer.java
123 123
      int min = width<height ? width:height;
124 124

  
125 125
      mVector.set(0,0,min/5);
126
      mRegion.set(0,0,min/5,min/5);
126
      mRegion.set(0,0,0,min/5);
127 127

  
128 128
      mPoint1.set(  width/4,   height/4, 0);
129 129
      mPoint2.set(3*width/4,   height/4, 0);
src/main/java/org/distorted/examples/save/SaveRenderer.java
81 81
    Static3D pLeft = new Static3D(132, 264, 0);
82 82
    Static3D pRight= new Static3D(247, 264, 0);
83 83
      
84
    Static4D sinkRegion = new Static4D(0,0,60,60);
84
    Static4D sinkRegion = new Static4D(0,0,0,60);
85 85
      
86 86
    s0 = new Static1D(boobsSink);
87 87
      
src/main/java/org/distorted/examples/wind/WindEffectsManager.java
89 89
    {
90 90
    Static3D midLeft = new Static3D(0,mHeight/2,0);
91 91
    Static3D midRight = new Static3D(mWidth,mHeight/2,0);
92
    Static4D windRegion = new Static4D(0,0,mWidth,mHeight);
92
    Static4D windRegion = new Static4D(0,0,0,mHeight);
93 93

  
94 94
    setWind(wind);
95 95

  

Also available in: Unified diff