Revision e02264ff
Added by Leszek Koltunski over 7 years ago
src/main/java/org/distorted/library/DistortedEffectsPostprocess.java | ||
---|---|---|
67 | 67 |
return mP; |
68 | 68 |
} |
69 | 69 |
|
70 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
71 |
|
|
72 |
int postprocessPriv(long currTime, DistortedOutputSurface surface) |
|
73 |
{ |
|
74 |
return mP.postprocess(currTime,surface); |
|
75 |
} |
|
76 |
|
|
77 | 70 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
78 | 71 |
|
79 | 72 |
private void releasePriv() |
src/main/java/org/distorted/library/DistortedOutputSurface.java | ||
---|---|---|
116 | 116 |
} |
117 | 117 |
|
118 | 118 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
119 |
// Render all children, one by one. If there are no postprocessing effects, just render to THIS. |
|
120 |
// Otherwise, render to a buffer and on each change of Postprocessing Bucket, apply the postprocessing |
|
121 |
// to a whole buffer and merge it. |
|
119 | 122 |
|
120 | 123 |
int renderChildren(long time, int num, ArrayList<DistortedNode> children) |
121 | 124 |
{ |
... | ... | |
124 | 127 |
EffectQueuePostprocess lastP=null, currP; |
125 | 128 |
long lastB=0, currB; |
126 | 129 |
|
127 |
// Render all children, one by one. |
|
128 |
// If there are no postprocessing effects, just render to THIS. |
|
129 |
// Otherwise, render to a buffer and on each change of Postprocessing Bucket, |
|
130 |
// apply the postprocessing to a whole buffer and merge it. |
|
131 |
|
|
132 | 130 |
for(int i=0; i<num; i++) |
133 | 131 |
{ |
134 | 132 |
child = children.get(i); |
... | ... | |
137 | 135 |
|
138 | 136 |
if( lastB!=currB && lastB!=0 ) |
139 | 137 |
{ |
140 |
//android.util.Log.e("output", "i="+i+" postprocess and merge"); |
|
141 | 138 |
numRenders += lastP.postprocess(time,this); |
142 | 139 |
} |
143 | 140 |
|
144 | 141 |
if( currB==0 ) |
145 | 142 |
{ |
146 |
//android.util.Log.e("output", "i="+i+" draw to this"); |
|
147 | 143 |
numRenders += child.draw(time,this); |
148 | 144 |
} |
149 | 145 |
else |
... | ... | |
154 | 150 |
mBuffer2 = new DistortedFramebuffer(false , DistortedSurface.TYPE_TREE, mWidth, mHeight); |
155 | 151 |
} |
156 | 152 |
|
157 |
//android.util.Log.e("output", "i="+i+" draw to buffer"); |
|
158 | 153 |
numRenders += child.draw(time,mBuffer1); |
159 | 154 |
if( i==num-1 ) |
160 | 155 |
{ |
161 |
//android.util.Log.e("output", "i="+i+" postprocess and merge"); |
|
162 | 156 |
numRenders += currP.postprocess(time,this); |
163 | 157 |
} |
164 | 158 |
} |
src/main/java/org/distorted/library/EffectQueuePostprocess.java | ||
---|---|---|
174 | 174 |
if( currTime==mTime ) return false; |
175 | 175 |
if( mTime==0 ) mTime = currTime; |
176 | 176 |
long step = (currTime-mTime); |
177 |
|
|
177 |
|
|
178 | 178 |
for(int i=0; i<mNumEffects; i++) |
179 | 179 |
{ |
180 | 180 |
mCurrentDuration[i] += step; |
... | ... | |
197 | 197 |
else mInter[0][i] = null; |
198 | 198 |
} |
199 | 199 |
} |
200 |
|
|
200 |
|
|
201 | 201 |
mTime = currTime; |
202 | 202 |
|
203 | 203 |
return true; |
... | ... | |
264 | 264 |
|
265 | 265 |
int postprocess(long time, DistortedOutputSurface surface) |
266 | 266 |
{ |
267 |
if( mNumEffects>0 && compute(time) )
|
|
267 |
if( mNumEffects>0 ) |
|
268 | 268 |
{ |
269 |
compute(time); |
|
270 |
|
|
269 | 271 |
surface.mBuffer1.setAsInput(); |
270 | 272 |
float w = surface.mWidth; |
271 | 273 |
float h = surface.mHeight; |
Also available in: Unified diff
Bugfix (before we couldn't call postprocess() more than once per frame)