Revision b1058021
Added by Leszek Koltunski over 6 years ago
src/main/java/org/distorted/library/main/DistortedOutputSurface.java | ||
---|---|---|
73 | 73 |
// Global buffers used for postprocessing. |
74 | 74 |
private static DistortedFramebuffer[] mBuffer=null; |
75 | 75 |
|
76 |
private float mFOV;
|
|
76 |
float mFOV; |
|
77 | 77 |
float mDistance, mNear; |
78 | 78 |
float[] mProjectionMatrix; |
79 | 79 |
|
... | ... | |
238 | 238 |
// set of them) so before we use them for output, we need to adjust the Viewport as if they were |
239 | 239 |
// smaller. That takes care of outputting pixels to them. When we use them as input, we have to |
240 | 240 |
// adjust the texture coords - see the get{Width|Height}Correction functions. |
241 |
// |
|
242 |
// Also, adjust the Buffers so their Projection is the same like the surface we are supposed to be |
|
243 |
// rendering to. |
|
241 | 244 |
|
242 |
private static void clonePostprocessingViewport(DistortedOutputSurface from) |
|
245 |
private static void clonePostprocessingViewportAndProjection(DistortedOutputSurface from)
|
|
243 | 246 |
{ |
244 |
if( mBuffer[0].mWidth != from.mWidth || mBuffer[0].mHeight != from.mHeight ) |
|
247 |
if( mBuffer[0].mWidth != from.mWidth || mBuffer[0].mHeight != from.mHeight || |
|
248 |
mBuffer[0].mFOV != from.mFOV || mBuffer[0].mNear != from.mNear ) |
|
245 | 249 |
{ |
246 | 250 |
DistortedOutputSurface surface; |
247 | 251 |
|
... | ... | |
251 | 255 |
|
252 | 256 |
surface.mWidth = (int)(from.mWidth *surface.mMipmap); |
253 | 257 |
surface.mHeight = (int)(from.mHeight*surface.mMipmap); |
254 |
|
|
258 |
surface.mFOV = from.mFOV; |
|
255 | 259 |
surface.mNear = from.mNear; // Near plane is independent of the mipmap level |
256 | 260 |
|
257 |
//android.util.Log.e("surface", "viewport "+i+" to ("+from.mWidth+"x"+from.mHeight+")"); |
|
258 |
|
|
259 | 261 |
surface.createProjection(); |
260 | 262 |
|
261 | 263 |
int maxw = surface.mWidth > surface.mRealWidth ? surface.mWidth : surface.mRealWidth; |
... | ... | |
450 | 452 |
{ |
451 | 453 |
if( lastBucket==0 ) |
452 | 454 |
{ |
453 |
clonePostprocessingViewport(this); |
|
455 |
clonePostprocessingViewportAndProjection(this);
|
|
454 | 456 |
} |
455 | 457 |
else |
456 | 458 |
{ |
Also available in: Unified diff
Postprocessing: adjust the Projection of the postprocessing buffers to match the Projection of the surface we are supposed to be rendering to.