Project

General

Profile

« Previous | Next » 

Revision 1b80a6e2

Added by Leszek Koltunski over 2 years ago

New postprocess effect 'Border' (not working yet) and adding it to the testing app 'Triblur'.

View differences:

src/main/java/org/distorted/examples/triblur/TriblurRenderer.java
31 31
import org.distorted.library.effect.MatrixEffectQuaternion;
32 32
import org.distorted.library.effect.MatrixEffectScale;
33 33
import org.distorted.library.effect.PostprocessEffectBlur;
34
import org.distorted.library.effect.PostprocessEffectBorder;
34 35
import org.distorted.library.effect.PostprocessEffectGlow;
35 36
import org.distorted.library.effect.VertexEffectScale;
36 37
import org.distorted.library.main.DistortedLibrary;
......
66 67
    private static final int NUM_OBJECTS = OBJECTS.length/NUM;
67 68
    private static final int OBJ_SIZE    = 100;
68 69

  
69
    private GLSurfaceView mView;
70
    private DistortedTexture mTex;
71
    private DistortedNode[] mNode;
72
    private Static2D[] mEffectHaloRadius;
73
    private DistortedScreen mScreen;
74
    private PostprocessEffectBlur[] mBlur;
75
    private PostprocessEffectGlow[] mGlow;
76
    private int[] mEffectStatus;
77
    private Static3D mScale1, mScale2;
70
    private final GLSurfaceView mView;
71
    private final DistortedTexture mTex;
72
    private final DistortedNode[] mNode;
73
    private final Static2D[] mEffectHaloRadius;
74
    private final Static1D[] mEffectHalo;
75
    private final DistortedScreen mScreen;
76
    private final PostprocessEffectBlur[] mBlur;
77
    private final PostprocessEffectGlow[] mGlow;
78
    private final PostprocessEffectBorder[] mBord;
79
    private final int[] mEffectStatus;
80
    private final Static3D mScale1, mScale2;
78 81

  
79 82
    Static4D mQuat1, mQuat2;
80 83
    int mScreenMin;
......
97 100

  
98 101
      mEffectStatus    = new int[NUM_OBJECTS];
99 102
      mEffectHaloRadius= new Static2D[NUM_OBJECTS];
103
      mEffectHalo      = new Static1D[NUM_OBJECTS];
100 104
      mNode            = new DistortedNode[NUM_OBJECTS];
101 105
      mBlur            = new PostprocessEffectBlur[NUM_OBJECTS];
102 106
      mGlow            = new PostprocessEffectGlow[NUM_OBJECTS];
107
      mBord            = new PostprocessEffectBorder[NUM_OBJECTS];
103 108

  
104 109
      FragmentEffectChroma[] chroma= new FragmentEffectChroma[NUM_OBJECTS];
105 110
      Static3D[] chromaVector      = new Static3D[NUM_OBJECTS];
......
122 127
        moveVector[i]       = new Static3D(OBJECTS[NUM*i  ], OBJECTS[NUM*i+1], OBJECTS[NUM*i+2]);
123 128
        chromaVector[i]     = new Static3D(OBJECTS[NUM*i+3], OBJECTS[NUM*i+4], OBJECTS[NUM*i+5]);
124 129
        mEffectHaloRadius[i]= new Static2D(10,10);
130
        mEffectHalo[i]      = new Static1D(10);
125 131
        mBlur[i]            = new PostprocessEffectBlur(mEffectHaloRadius[i] );
126 132
        mGlow[i]            = new PostprocessEffectGlow(mEffectHaloRadius[i], new Static4D(1.0f,1.0f,1.0f,0.5f) );
133
        mBord[i]            = new PostprocessEffectBorder(mEffectHalo[i], new Static4D(0.0f,0.0f,0.0f,0.5f) );
127 134
        chroma[i]           = new FragmentEffectChroma( new Static1D(0.3f), chromaVector[i]);
128 135
        effects[i]          = new DistortedEffects();
129
        effects[i].apply(mBlur[i]);
130 136
        effects[i].apply(chroma[i]);
131 137
        effects[i].apply(scaleEffectV);
132 138
        effects[i].apply(new MatrixEffectMove(moveVector[i]));
......
134 140
        effects[i].apply(quatEffect1);
135 141
        effects[i].apply( (i==0||i==NUM_OBJECTS-1) ? scaleEffect1 : scaleEffect2 );
136 142

  
137
        mEffectStatus[i] = 1;
143
        mEffectStatus[i] = 0;
138 144
        mNode[i] = new DistortedNode(mTex, effects[i], mesh );
139 145
        mScreen.attach(mNode[i]);
140 146
        }
......
228 234
      if( object>=0 && object<NUM_OBJECTS )
229 235
        {
230 236
        mEffectHaloRadius[object].set(range*0.5f,range*0.5f);
237
        mEffectHalo[object].set(range*0.5f);
231 238
        }
232 239
      }
233 240

  
......
251 258

  
252 259
          if( effect==1 ) mNode[object].getEffects().apply(mBlur[object]);
253 260
          if( effect==2 ) mNode[object].getEffects().apply(mGlow[object]);
261
          if( effect==3 ) mNode[object].getEffects().apply(mBord[object]);
254 262
          }
255 263
        }
256 264
      else

Also available in: Unified diff