Project

General

Profile

« Previous | Next » 

Revision d7829514

Added by Leszek Koltunski almost 4 years ago

1) Cube: convert it to the latest library. Main difference: objects are rendered better, individual cubits have rounded corners.
2) Examples: some adjustments to MeshJoin & Predeform
3) Library: fix a bug in main_vertex_shader's 'degree' function, which didn't work proprely in case of a vertex which was exactly at the center (i.e. vector PS was zero)

View differences:

src/main/java/org/distorted/examples/predeform/PredeformEffect.java
204 204
      ///////////////////////////////////////////////////////////////////////////////////////
205 205

  
206 206
      case VERTEX_MOVE      :
207
      case DISTORT          : float ld = mAct.get().getWidth()/50.0f;
207
      case DISTORT          : float ld = 0.02f;
208 208
                              float xd = (mInter[0]-50)*ld;
209 209
                              float yd = (mInter[1]-50)*ld;
210 210
                              float zd = (mInter[2]-50)*ld;
211 211
                              mSta3.set(xd,yd,zd);
212 212
                              break;
213
      case DEFORM           : float le = mAct.get().getWidth()/50.0f;
213
      case DEFORM           : float le = 0.02f;
214 214
                              float xe = (mInter[0]-50)*le;
215 215
                              float ye = (mInter[1]-50)*le;
216 216
                              float ze = (mInter[2]-50)*le;
......
218 218
                              float re = (mInter[3])*le;
219 219
                              mSta1.set(re);
220 220
                              break;
221
      case WAVE             : float l2 = mAct.get().getWidth()/50.0f;
221
      case WAVE             : float l2 = 0.02f;
222 222
                              float x2 = (mInter[0]-50)*l2;
223 223
                              float y2 = (mInter[1]-50)*l2;
224 224
                              float z2 = (mInter[2]-50)*180 / 50.0f;
......
355 355
    {
356 356
    PredeformActivity act = mAct.get();
357 357

  
358
    float x = (mInterCenter[0]*0.012f - 0.6f)*act.getWidth();
359
    float y = (mInterCenter[1]*0.012f - 0.6f)*act.getHeight();
360
    float z = (mInterCenter[2]*0.012f - 0.6f)*act.getDepth();
358
    float x = (mInterCenter[0]*0.012f - 0.6f);
359
    float y = (mInterCenter[1]*0.012f - 0.6f);
360
    float z = (mInterCenter[2]*0.012f - 0.6f);
361 361

  
362 362
    if( mName.getType() == EffectType.MATRIX )
363 363
      {
......
396 396
    {
397 397
    PredeformActivity act = mAct.get();
398 398

  
399
    float factorX = act.getWidth() / 100.0f;
400
    float factorY = act.getHeight()/ 100.0f;
401
 // float factorZ = act.getDepth() / 100.0f;
399
    float factorX = 0.01f;
400
    float factorY = 0.01f;
401
 // float factorZ = 0.01f;
402 402

  
403 403
    int deduct = (mName.getType() == EffectType.VERTEX ? 50:0);
404 404

  

Also available in: Unified diff