Project

General

Profile

« Previous | Next » 

Revision d03782c0

Added by Leszek Koltunski about 7 years ago

fix for the first issue uncovered by the new Olimpic.

View differences:

src/main/java/org/distorted/library/DistortedNode.java
201 201
///////////////////////////////////////////////////////////////////////////////////////////////////
202 202
// return the total number of render calls issued
203 203

  
204
  int drawRecursive(int render, long currTime, DistortedOutputSurface surface)
204
  int drawRecursive(int renderNum, long currTime, DistortedOutputSurface surface)
205 205
    {
206 206
    int ret = 0;
207 207
    float halfX = mSurface.getWidth()/2.0f;
208 208
    float halfY = mSurface.getHeight()/2.0f;
209 209

  
210
    if( mNumChildren[0]<=0 )
210
    if( mNumChildren[0]>0 && mData.numRender!=renderNum )
211 211
      {
212
      mSurface.setAsInput();
213
      }
214
    else
215
      {
216
      if( mData.numRender!=render )
217
        {
218
        mData.numRender = render;
219
        mData.mFBO.setAsOutput();
212
      mData.numRender = renderNum;
213
      mData.mFBO.setAsOutput();
220 214

  
221
        GLES30.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
222
        GLES30.glClear( GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT);
215
      GLES30.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
216
      GLES30.glClear( GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT);
223 217

  
224
        if( mSurface.setAsInput() )
225
          {
226
          ret++;
227
          DistortedEffects.drawNoEffectsPriv(halfX, halfY, mMesh, mData.mFBO);
228
          }
229

  
230
        for(int i=0; i<mNumChildren[0]; i++)
231
          {
232
          ret += mChildren.get(i).drawRecursive(render, currTime, mData.mFBO);
233
          }
218
      if( mSurface.setAsInput() )
219
        {
220
        ret++;
221
        DistortedEffects.drawNoEffectsPriv(halfX, halfY, mMesh, mData.mFBO);
234 222
        }
235 223

  
236
      mData.mFBO.setAsInput();
224
      for(int i=0; i<mNumChildren[0]; i++)
225
        {
226
        ret += mChildren.get(i).drawRecursive(renderNum, currTime, mData.mFBO);
227
        }
237 228
      }
238 229

  
239
    mEffects.drawPriv(halfX, halfY, mMesh, surface, currTime);
230
    DistortedInputSurface input = mNumChildren[0]==0 ? mSurface : mData.mFBO;
240 231

  
241
    return ret+1;
232
    if( input.setAsInput() )
233
      {
234
      ret++;
235
      mEffects.drawPriv(halfX, halfY, mMesh, surface, currTime);
236
      }
237

  
238
    return ret;
242 239
    }
243 240

  
244 241
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff