Project

General

Profile

« Previous | Next » 

Revision 39086ebb

Added by Leszek Koltunski about 7 years ago

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.

View differences:

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

  

Also available in: Unified diff