Revision 984dc935
Added by Leszek Koltunski almost 7 years ago
src/main/java/org/distorted/library/DistortedNode.java | ||
---|---|---|
259 | 259 |
|
260 | 260 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
261 | 261 |
|
262 |
int markStencilAndDraw(long currTime, DistortedOutputSurface surface, int quality)
|
|
262 |
int markStencilAndDraw(long currTime, DistortedOutputSurface surface, DistortedEffectsPostprocess effects)
|
|
263 | 263 |
{ |
264 | 264 |
DistortedInputSurface input = mNumChildren[0]==0 ? mSurface : mData.mFBO; |
265 | 265 |
|
266 | 266 |
if( input.setAsInput() ) |
267 | 267 |
{ |
268 |
int quality = effects.getQuality(); |
|
268 | 269 |
DistortedFramebuffer buffer1 = surface.mBuffer1[quality]; |
269 | 270 |
DistortedFramebuffer buffer2 = surface.mBuffer2[quality]; |
270 | 271 |
float w = mSurface.getWidth() /2.0f; |
271 | 272 |
float h = mSurface.getHeight()/2.0f; |
272 | 273 |
|
273 |
// Mark area of our object + marginInPixels pixels around with 1s in Stencil buffer |
|
274 |
buffer2.setAsOutput(currTime); |
|
275 |
DistortedRenderState.setUpStencilMark(); |
|
276 |
mEffects.drawPriv(w, h, mMesh, buffer2, currTime, EffectQueuePostprocess.MAX_BLUR*buffer2.mMipmap); |
|
277 |
|
|
278 | 274 |
// Actually draw our object. |
279 | 275 |
buffer1.setAsOutput(currTime); |
280 | 276 |
mState.apply(); |
281 | 277 |
mEffects.drawPriv(w, h, mMesh, buffer1, currTime, 0); |
278 |
|
|
279 |
// Mark area of our object + marginInPixels pixels around with 1s in Stencil buffer |
|
280 |
buffer2.setAsOutput(currTime); |
|
281 |
DistortedRenderState.setUpStencilMark(); |
|
282 |
mEffects.drawPriv(w, h, mMesh, buffer2, currTime, effects.getHalo()*buffer2.mMipmap); |
|
283 |
DistortedRenderState.unsetUpStencilMark(); |
|
284 |
|
|
282 | 285 |
return 1; |
283 | 286 |
} |
284 | 287 |
return 0; |
Also available in: Unified diff
10% speedup with postprocessing.