Revision 8c327653
Added by Leszek Koltunski about 7 years ago
src/main/java/org/distorted/library/DistortedTree.java | ||
---|---|---|
50 | 50 |
long ID; |
51 | 51 |
int numPointingNodes; |
52 | 52 |
int numRendered; |
53 |
DistortedFramebuffer mDF;
|
|
53 |
DistortedFramebuffer mFBO;
|
|
54 | 54 |
|
55 | 55 |
NodeData(long id) |
56 | 56 |
{ |
57 | 57 |
ID = id; |
58 | 58 |
numPointingNodes= 1; |
59 | 59 |
numRendered = 0; |
60 |
mDF = null;
|
|
60 |
mFBO = null;
|
|
61 | 61 |
} |
62 | 62 |
} |
63 | 63 |
|
... | ... | |
124 | 124 |
|
125 | 125 |
if( newList.size()>1 ) |
126 | 126 |
{ |
127 |
if( mData.mDF==null )
|
|
128 |
mData.mDF = new DistortedFramebuffer(mTexture.getWidth(), mTexture.getHeight());
|
|
127 |
if( mData.mFBO ==null )
|
|
128 |
mData.mFBO = new DistortedFramebuffer(mTexture.getWidth(), mTexture.getHeight());
|
|
129 | 129 |
} |
130 | 130 |
else |
131 | 131 |
{ |
132 |
if( mData.mDF!=null )
|
|
132 |
if( mData.mFBO !=null )
|
|
133 | 133 |
{ |
134 |
mData.mDF.markForDeletion();
|
|
135 |
mData.mDF = null;
|
|
134 |
mData.mFBO.markForDeletion();
|
|
135 |
mData.mFBO = null;
|
|
136 | 136 |
} |
137 | 137 |
else |
138 | 138 |
{ |
... | ... | |
160 | 160 |
{ |
161 | 161 |
tmp = mMapNodeID.get(key); |
162 | 162 |
|
163 |
if( tmp.mDF != null )
|
|
163 |
if( tmp.mFBO != null )
|
|
164 | 164 |
{ |
165 |
tmp.mDF.reset();
|
|
165 |
tmp.mFBO.reset();
|
|
166 | 166 |
tmp.numRendered = 0; |
167 | 167 |
} |
168 | 168 |
} |
... | ... | |
212 | 212 |
} |
213 | 213 |
else |
214 | 214 |
{ |
215 |
mData.mDF.createFBO();
|
|
215 |
mData.mFBO.createFBO();
|
|
216 | 216 |
|
217 | 217 |
if( mData.numRendered==0 ) |
218 | 218 |
{ |
219 |
mData.mDF.setAsOutput();
|
|
219 |
mData.mFBO.setAsOutput();
|
|
220 | 220 |
|
221 | 221 |
GLES20.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); |
222 | 222 |
GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT); |
223 | 223 |
|
224 | 224 |
if( mTexture.setAsInput() ) |
225 |
mEffects.drawNoEffectsPriv(mTexture.mHalfX, mTexture.mHalfY, mMesh, mData.mDF);
|
|
225 |
mEffects.drawNoEffectsPriv(mTexture.mHalfX, mTexture.mHalfY, mMesh, mData.mFBO);
|
|
226 | 226 |
|
227 | 227 |
synchronized(this) |
228 | 228 |
{ |
229 | 229 |
for(int i=0; i<mNumChildren[0]; i++) |
230 | 230 |
{ |
231 |
mChildren.get(i).drawRecursive(currTime, mData.mDF);
|
|
231 |
mChildren.get(i).drawRecursive(currTime, mData.mFBO);
|
|
232 | 232 |
} |
233 | 233 |
} |
234 | 234 |
} |
... | ... | |
237 | 237 |
mData.numRendered %= mData.numPointingNodes; |
238 | 238 |
|
239 | 239 |
df.setAsOutput(); |
240 |
mData.mDF.setAsInput();
|
|
240 |
mData.mFBO.setAsInput();
|
|
241 | 241 |
} |
242 | 242 |
|
243 | 243 |
mEffects.drawPriv(mTexture.mHalfX, mTexture.mHalfY, mMesh, df, currTime); |
... | ... | |
476 | 476 |
return mTexture; |
477 | 477 |
} |
478 | 478 |
|
479 |
} |
|
479 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
480 |
/** |
|
481 |
* Returns the DistortedFramebuffer object that's in the Node. |
|
482 |
* |
|
483 |
* @return The DistortedFramebuffer contained in the Node. |
|
484 |
*/ |
|
485 |
public DistortedFramebuffer getFramebuffer() |
|
486 |
{ |
|
487 |
return mData.mFBO; |
|
488 |
} |
|
480 | 489 |
|
490 |
} |
Also available in: Unified diff
First attempt at making it possible to dynamically add and remove DEPTH attachments from an FBO.