Project

General

Profile

« Previous | Next » 

Revision 2a261997

Added by Leszek Koltunski over 7 years ago

Simplify Effect classes.

View differences:

src/main/java/org/distorted/examples/effects3d/Effects3DEffect.java
100 100

  
101 101
    switch(mName)
102 102
      {
103
      case ROTATE           : effect = new MatrixEffectRotate(mDyn4, mCenterDyn); break;
104
      case QUATERNION       : effect = new MatrixEffectQuaternion(mDyn4, mCenterDyn); break;
105
      case MOVE             : effect = new MatrixEffectMove(mDyn3)            ; break;
106
      case SCALE            : effect = new MatrixEffectScale(mDyn3)            ; break;
107
      case SHEAR            : effect = new MatrixEffectShear(mDyn3, mCenterDyn); break;
108

  
109
      case DISTORT          : effect = new VertexEffectDistort(mDyn3, mCenterDyn, mRegionDyn); break;
110
      case DEFORM           : effect = new VertexEffectDeform(mDyn3, mCenterDyn, mRegionDyn); break;
111
      case SINK             : effect = new VertexEffectSink(mDyn1, mCenterDyn, mRegionDyn); break;
112
      case PINCH            : effect = new VertexEffectPinch(mDyn2, mCenterDyn, mRegionDyn); break;
113
      case SWIRL            : effect = new VertexEffectSwirl(mDyn1, mCenterDyn, mRegionDyn); break;
114
      case WAVE             : effect = new VertexEffectWave(mDyn5, mCenterDyn, mRegionDyn); break;
115

  
116
      case ALPHA            : effect = new FragmentEffectAlpha(mDyn1,        mRegionDyn, false); break;
103
      case ROTATE           : effect = new MatrixEffectRotate      (mDyn1, mDyn3, mCenterDyn); break;
104
      case QUATERNION       : effect = new MatrixEffectQuaternion  (mDyn4, mCenterDyn); break;
105
      case MOVE             : effect = new MatrixEffectMove        (mDyn3)            ; break;
106
      case SCALE            : effect = new MatrixEffectScale       (mDyn3)            ; break;
107
      case SHEAR            : effect = new MatrixEffectShear       (mDyn3, mCenterDyn); break;
108

  
109
      case DISTORT          : effect = new VertexEffectDistort     (mDyn3, mCenterDyn, mRegionDyn); break;
110
      case DEFORM           : effect = new VertexEffectDeform      (mDyn3, mCenterDyn, mRegionDyn); break;
111
      case SINK             : effect = new VertexEffectSink        (mDyn1, mCenterDyn, mRegionDyn); break;
112
      case PINCH            : effect = new VertexEffectPinch       (mDyn2, mCenterDyn, mRegionDyn); break;
113
      case SWIRL            : effect = new VertexEffectSwirl       (mDyn1, mCenterDyn, mRegionDyn); break;
114
      case WAVE             : effect = new VertexEffectWave        (mDyn5, mCenterDyn, mRegionDyn); break;
115

  
116
      case ALPHA            : effect = new FragmentEffectAlpha     (mDyn1,        mRegionDyn, false); break;
117 117
      case SMOOTH_ALPHA     : effect = new FragmentEffectAlpha     (mDyn1,        mRegionDyn, true ); break;
118
      case CHROMA           : effect = new FragmentEffectChroma(mDyn1, mDyn3, mRegionDyn, false); break;
118
      case CHROMA           : effect = new FragmentEffectChroma    (mDyn1, mDyn3, mRegionDyn, false); break;
119 119
      case SMOOTH_CHROMA    : effect = new FragmentEffectChroma    (mDyn1, mDyn3, mRegionDyn, true ); break;
120 120
      case BRIGHTNESS       : effect = new FragmentEffectBrightness(mDyn1,        mRegionDyn, false); break;
121 121
      case SMOOTH_BRIGHTNESS: effect = new FragmentEffectBrightness(mDyn1,        mRegionDyn, true ); break;
122 122
      case SATURATION       : effect = new FragmentEffectSaturation(mDyn1,        mRegionDyn, false); break;
123 123
      case SMOOTH_SATURATION: effect = new FragmentEffectSaturation(mDyn1,        mRegionDyn, true ); break;
124
      case CONTRAST         : effect = new FragmentEffectContrast(mDyn1,        mRegionDyn, false); break;
124
      case CONTRAST         : effect = new FragmentEffectContrast  (mDyn1,        mRegionDyn, false); break;
125 125
      case SMOOTH_CONTRAST  : effect = new FragmentEffectContrast  (mDyn1,        mRegionDyn, true ); break;
126 126
      }
127 127

  
......
143 143
                              float rx = (mInter[1]-50)/ 50.0f;
144 144
                              float ry = (mInter[2]-50)/ 50.0f;
145 145
                              float rz = (mInter[3]-50)/ 50.0f;
146
                              mSta4.set(an,rx,ry,rz);
146
                              mSta1.set(an);
147
                              mSta3.set(rx,ry,rz);
147 148
                              break;
148 149
      case QUATERNION       : float qx = (mInter[0]-50)/ 50.0f;
149 150
                              float qy = (mInter[1]-50)/ 50.0f;
......
388 389
               mSta3 = new Static3D(0,0,0);
389 390
               mDyn3.add(mSta3);
390 391
               break;
391
      case 4 : if( mName == EffectName.ROTATE || mName == EffectName.QUATERNION )
392
      case 4 : if( mName == EffectName.QUATERNION )
392 393
                 {
393 394
                 mDyn4 = new Dynamic4D();
394 395
                 mSta4 = new Static4D(0,0,0,0);
src/main/java/org/distorted/examples/matrix3d/Matrix3DEffect.java
100 100

  
101 101
    switch(mName)
102 102
      {
103
      case ROTATE           : effect = new MatrixEffectRotate      (mDyn4, mCenterDyn); break;
104
      case QUATERNION       : effect = new MatrixEffectQuaternion  (mDyn4, mCenterDyn); break;
105
      case MOVE             : effect = new MatrixEffectMove        (mDyn3)            ; break;
106
      case SCALE            : effect = new MatrixEffectScale       (mDyn3)            ; break;
107
      case SHEAR            : effect = new MatrixEffectShear       (mDyn3, mCenterDyn); break;
103
      case ROTATE           : effect = new MatrixEffectRotate      (mDyn1, mDyn3, mCenterDyn); break;
104
      case QUATERNION       : effect = new MatrixEffectQuaternion  (mDyn4,        mCenterDyn); break;
105
      case MOVE             : effect = new MatrixEffectMove        (mDyn3                   ); break;
106
      case SCALE            : effect = new MatrixEffectScale       (mDyn3                   ); break;
107
      case SHEAR            : effect = new MatrixEffectShear       (mDyn3,        mCenterDyn); break;
108 108

  
109 109
      case DISTORT          : effect = new VertexEffectDistort     (mDyn3, mCenterDyn, mRegionDyn); break;
110 110
      case DEFORM           : effect = new VertexEffectDeform      (mDyn3, mCenterDyn, mRegionDyn); break;
......
143 143
                              float rx = (mInter[1]-50)/ 50.0f;
144 144
                              float ry = (mInter[2]-50)/ 50.0f;
145 145
                              float rz = (mInter[3]-50)/ 50.0f;
146
                              mSta4.set(an,rx,ry,rz);
146
                              mSta1.set(an);
147
                              mSta3.set(rx,ry,rz);
147 148
                              break;
148 149
      case QUATERNION       : float qx = (mInter[0]-50)/ 50.0f;
149 150
                              float qy = (mInter[1]-50)/ 50.0f;
......
397 398
               mSta3 = new Static3D(0,0,0);
398 399
               mDyn3.add(mSta3);
399 400
               break;
400
      case 4 : if( mName == EffectName.ROTATE || mName == EffectName.QUATERNION )
401
      case 4 : if( mName == EffectName.QUATERNION )
401 402
                 {
402 403
                 mDyn4 = new Dynamic4D();
403 404
                 mSta4 = new Static4D(0,0,0,0);

Also available in: Unified diff