Revision 915b7b2b
Added by Leszek Koltunski over 7 years ago
src/main/java/org/distorted/library/main/DistortedOutputSurface.java | ||
---|---|---|
206 | 206 |
|
207 | 207 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
208 | 208 |
|
209 |
private int blitWithDepth(int quality, long currTime)
|
|
209 |
private int blitWithDepth(long currTime, DistortedFramebuffer buffer)
|
|
210 | 210 |
{ |
211 |
DistortedFramebuffer buffer = mBuffer[quality]; |
|
212 |
|
|
213 | 211 |
GLES30.glViewport(0, 0, mWidth, mHeight); |
214 | 212 |
setAsOutput(currTime); |
215 | 213 |
GLES30.glActiveTexture(GLES30.GL_TEXTURE0); |
... | ... | |
250 | 248 |
|
251 | 249 |
int renderChildren(long time, int num, ArrayList<DistortedNode> children) |
252 | 250 |
{ |
253 |
int numRenders = 0; |
|
251 |
int numRenders = 0, bucketChange = 0;
|
|
254 | 252 |
DistortedNode child1, child2; |
255 |
DistortedEffects lastP=null, currP; |
|
256 |
long lastB=0, currB; |
|
257 |
int bucketChange=0; |
|
258 |
int lastQ=0, currQ; |
|
253 |
DistortedEffects lastEffects=null, currEffects; |
|
254 |
long lastBucket=0, currBucket; |
|
255 |
int lastQuality=0, currQuality; |
|
259 | 256 |
|
260 | 257 |
sCurr = ""; |
261 | 258 |
|
262 | 259 |
for(int i=0; i<num; i++) |
263 | 260 |
{ |
264 | 261 |
child1 = children.get(i); |
265 |
currP = child1.getEffects();
|
|
266 |
currB = currP==null ? 0 : currP.getBucket();
|
|
267 |
currQ = currP==null ? 0 : currP.getQuality();
|
|
262 |
currEffects = child1.getEffects();
|
|
263 |
currBucket = currEffects==null ? 0 : currEffects.getBucket();
|
|
264 |
currQuality = currEffects==null ? 0 : currEffects.getQuality();
|
|
268 | 265 |
|
269 |
sCurr += (" "+currB); |
|
266 |
sCurr += (" "+currBucket);
|
|
270 | 267 |
|
271 |
if( currB==0 ) numRenders += child1.draw(time,this); |
|
268 |
if( currBucket==0 ) numRenders += child1.draw(time,this);
|
|
272 | 269 |
else |
273 | 270 |
{ |
274 | 271 |
if( mBuffer[0]==null ) createBuffers(); |
275 | 272 |
|
276 |
if( lastB!=currB )
|
|
273 |
if( lastBucket!=currBucket )
|
|
277 | 274 |
{ |
278 |
if( lastB!=0 ) |
|
275 |
if( lastBucket!=0 )
|
|
279 | 276 |
{ |
280 | 277 |
for(int j=bucketChange; j<i; j++) |
281 | 278 |
{ |
282 | 279 |
child2 = children.get(j); |
283 |
numRenders += child2.markStencilAndDepth(time,mBuffer[lastQ],lastP);
|
|
280 |
numRenders += child2.markStencilAndDepth(time,mBuffer[lastQuality],lastEffects);
|
|
284 | 281 |
} |
285 | 282 |
|
286 |
numRenders += lastP.postprocess(time, this);
|
|
287 |
numRenders += blitWithDepth(lastQ,time);
|
|
283 |
numRenders += lastEffects.postprocess(time, this);
|
|
284 |
numRenders += blitWithDepth(time, mBuffer[lastQuality]);
|
|
288 | 285 |
} |
289 | 286 |
|
290 | 287 |
bucketChange = i; |
291 | 288 |
} |
292 | 289 |
|
293 |
numRenders += child1.draw(time,mBuffer[currQ]); |
|
290 |
numRenders += child1.draw(time,mBuffer[currQuality]);
|
|
294 | 291 |
|
295 | 292 |
if( i==num-1 ) |
296 | 293 |
{ |
297 | 294 |
for(int j=bucketChange; j<num; j++) |
298 | 295 |
{ |
299 | 296 |
child2 = children.get(j); |
300 |
numRenders += child2.markStencilAndDepth(time,mBuffer[currQ],currP);
|
|
297 |
numRenders += child2.markStencilAndDepth(time,mBuffer[currQuality],currEffects);
|
|
301 | 298 |
} |
302 | 299 |
|
303 |
numRenders += currP.postprocess(time,this);
|
|
304 |
numRenders += blitWithDepth(currQ,time);
|
|
300 |
numRenders += currEffects.postprocess(time,this);
|
|
301 |
numRenders += blitWithDepth(time,mBuffer[currQuality]);
|
|
305 | 302 |
} |
306 | 303 |
} |
307 | 304 |
|
308 |
lastQ = currQ;
|
|
309 |
lastP = currP;
|
|
310 |
lastB = currB;
|
|
305 |
lastQuality = currQuality;
|
|
306 |
lastEffects = currEffects;
|
|
307 |
lastBucket = currBucket;
|
|
311 | 308 |
} |
312 | 309 |
|
313 | 310 |
if( !sLast.equals(sCurr) ) android.util.Log.e("surface", "rendering: "+sCurr); |
Also available in: Unified diff
Minor