Revision 5c83f4b4
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, float marginInPixels) |
|
262 |
int markStencilAndDraw(long currTime, DistortedOutputSurface surface, int quality, float marginInPixels)
|
|
263 | 263 |
{ |
264 | 264 |
DistortedInputSurface input = mNumChildren[0]==0 ? mSurface : mData.mFBO; |
265 | 265 |
|
266 | 266 |
if( input.setAsInput() ) |
267 | 267 |
{ |
268 |
surface.setAsOutput(currTime); |
|
268 |
DistortedFramebuffer buffer1 = surface.mBuffer1[quality]; |
|
269 |
DistortedFramebuffer buffer2 = surface.mBuffer2[quality]; |
|
270 |
float w = mSurface.getWidth() /2.0f; |
|
271 |
float h = mSurface.getHeight()/2.0f; |
|
269 | 272 |
|
270 | 273 |
// Mark area of our object + marginInPixels pixels around with 1s in Stencil buffer |
274 |
buffer2.setAsOutput(currTime); |
|
271 | 275 |
DistortedRenderState.setUpStencilMark(); |
272 |
mEffects.drawPriv(mSurface.getWidth()/2.0f, mSurface.getHeight()/2.0f, mMesh, surface, currTime, marginInPixels);
|
|
276 |
mEffects.drawPriv(w, h, mMesh, buffer2, currTime, marginInPixels);
|
|
273 | 277 |
|
274 | 278 |
// Actually draw our object. |
279 |
buffer1.setAsOutput(currTime); |
|
275 | 280 |
mState.apply(); |
276 |
mEffects.drawPriv(mSurface.getWidth()/2.0f, mSurface.getHeight()/2.0f, mMesh, surface, currTime, 0);
|
|
281 |
mEffects.drawPriv(w, h, mMesh, buffer1, currTime, 0);
|
|
277 | 282 |
return 1; |
278 | 283 |
} |
279 | 284 |
return 0; |
Also available in: Unified diff
Progress with Stencil in Postprocessing: stencil during the 1st stage postprocess (buffer1->buffer2) works now, provided quality is HIGHEST.
(lower quality --> render errors, looks like Stencil is not set up correctly then)