Revision 39086ebb
Added by Leszek Koltunski over 7 years ago
src/main/java/org/distorted/library/DistortedNode.java | ||
---|---|---|
194 | 194 |
if( mParent!=null ) mParent.adjustIsomorphism(); |
195 | 195 |
} |
196 | 196 |
|
197 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
198 |
// return the total number of render calls issued |
|
199 |
|
|
200 |
int draw(long currTime, DistortedOutputSurface surface) |
|
201 |
{ |
|
202 |
DistortedInputSurface input = mNumChildren[0]==0 ? mSurface : mData.mFBO; |
|
203 |
|
|
204 |
if( input.setAsInput() ) |
|
205 |
{ |
|
206 |
mState.apply(); |
|
207 |
mEffects.drawPriv(mSurface.getWidth()/2.0f, mSurface.getHeight()/2.0f, mMesh, surface, currTime); |
|
208 |
return 1; |
|
209 |
} |
|
210 |
|
|
211 |
return 0; |
|
212 |
} |
|
213 |
|
|
214 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
215 |
// return the total number of render calls issued |
|
216 |
|
|
217 |
int renderRecursive(long currTime) |
|
218 |
{ |
|
219 |
int numRenders = 0; |
|
220 |
|
|
221 |
if( mNumChildren[0]>0 && mData.currTime!=currTime ) |
|
222 |
{ |
|
223 |
mData.currTime = currTime; |
|
224 |
|
|
225 |
for (int i=0; i<mNumChildren[0]; i++) |
|
226 |
{ |
|
227 |
numRenders += mChildren.get(i).renderRecursive(currTime); |
|
228 |
} |
|
229 |
|
|
230 |
mData.mFBO.setAsOutput(); |
|
231 |
|
|
232 |
GLES30.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); |
|
233 |
GLES30.glClear( GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT); |
|
234 |
|
|
235 |
if( mSurface.setAsInput() ) |
|
236 |
{ |
|
237 |
numRenders++; |
|
238 |
DistortedEffects.blitPriv(mData.mFBO); |
|
239 |
} |
|
240 |
|
|
241 |
// 'renderChildren' |
|
242 |
for(int i=0; i<mNumChildren[0]; i++) |
|
243 |
{ |
|
244 |
numRenders += mChildren.get(i).draw(currTime,mData.mFBO); |
|
245 |
} |
|
246 |
} |
|
247 |
|
|
248 |
return numRenders; |
|
249 |
} |
|
250 |
|
|
197 | 251 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
198 | 252 |
// return the total number of render calls issued |
199 | 253 |
|
src/main/java/org/distorted/library/DistortedOutputSurface.java | ||
---|---|---|
103 | 103 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
104 | 104 |
// PUBLIC API |
105 | 105 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
106 |
|
|
107 |
public int render(long time) |
|
108 |
{ |
|
109 |
DistortedAttachDaemon.toDo(); |
|
110 |
toDo(); |
|
111 |
DistortedRenderState.reset(); |
|
112 |
|
|
113 |
int numRenders=0; |
|
114 |
|
|
115 |
for(int i=0; i<mNumChildren; i++) |
|
116 |
{ |
|
117 |
numRenders += mChildren.get(i).renderRecursive(time); |
|
118 |
} |
|
119 |
|
|
120 |
setAsOutput(); |
|
121 |
|
|
122 |
// 'renderChildren' |
|
123 |
for(int i=0; i<mNumChildren; i++) |
|
124 |
{ |
|
125 |
numRenders += mChildren.get(i).draw(time,this); |
|
126 |
} |
|
127 |
|
|
128 |
return numRenders; |
|
129 |
} |
|
130 |
|
|
131 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
132 |
|
|
106 | 133 |
/** |
107 | 134 |
* Draws all the attached children to this OutputSurface. |
108 | 135 |
* <p> |
... | ... | |
111 | 138 |
* @param time Current time, in milliseconds. This will be passed to all the Effects stored in the children Nodes. |
112 | 139 |
* @return Number of objects rendered. |
113 | 140 |
*/ |
114 |
public int render(long time) |
|
141 |
public int renderOld(long time)
|
|
115 | 142 |
{ |
116 | 143 |
// change tree topology (attach and detach children) |
117 | 144 |
/* |
Also available in: Unified diff
New method of rendering.
Advantage: now there's one (well, ATM two, but I hope soon really in one) place where we can have a look at all the Meshes that are being rendered to a OutputSurface.
This should help with proper per-object POSTPROCESSING effects like Multiblur.