Project

General

Profile

« Previous | Next » 

Revision 9cae4322

Added by Leszek Koltunski about 5 years ago

Some simplifications to the Node.

View differences:

src/main/java/org/distorted/library/main/DistortedNode.java
77 77

  
78 78
  private class NodeData
79 79
    {
80
    long ID;
80
    final long ID;
81
    final ArrayList<Long> key;
82

  
81 83
    int numPointingNodes;
82 84
    long currTime;
83
    ArrayList<Long> key;
84 85
    DistortedFramebuffer mFBO;
85 86

  
86 87
    NodeData(long id, ArrayList<Long> k)
......
199 200
    }
200 201

  
201 202
///////////////////////////////////////////////////////////////////////////////////////////////////
202
// tree isomorphism algorithm
203 203

  
204
  private void adjustIsomorphism()
204
  private NodeData retData()
205 205
    {
206 206
    ArrayList<Long> newList = generateIDList();
207 207
    NodeData newData = mMapNodeID.get(newList);
......
216 216
      mMapNodeID.put(newList,newData);
217 217
      }
218 218

  
219
    return newData;
220
    }
221

  
222
///////////////////////////////////////////////////////////////////////////////////////////////////
223
// tree isomorphism algorithm
224

  
225
  private void adjustIsomorphism()
226
    {
227
    NodeData newData = retData();
219 228
    boolean deleteOldFBO = false;
220 229
    boolean createNewFBO = false;
221 230

  
......
238 247
    if( deleteOldFBO && createNewFBO )
239 248
      {
240 249
      newData.mFBO = mData.mFBO;  // just copy over
241
      //android.util.Log.d("NODE", "copying over FBOs "+mData.mFBO.getID() );
242 250
      }
243 251
    else if( deleteOldFBO )
244 252
      {
245 253
      mData.mFBO.markForDeletion();
246
      //android.util.Log.d("NODE", "deleting old FBO "+mData.mFBO.getID() );
247 254
      mData.mFBO = null;
248 255
      }
249 256
    else if( createNewFBO )
......
251 258
      int width  = mFboW <= 0 ? mSurface.getWidth()  : mFboW;
252 259
      int height = mFboH <= 0 ? mSurface.getHeight() : mFboH;
253 260
      newData.mFBO = new DistortedFramebuffer(1,mFboDepthStencil, DistortedSurface.TYPE_TREE, width, height);
254
      //android.util.Log.d("NODE", "creating new FBO "+newData.mFBO.getID() );
255 261
      }
256 262

  
257 263
    mData = newData;
......
399 405
    mState         = new DistortedRenderState();
400 406
    mChildren      = null;
401 407
    mNumChildren   = new int[1];
402
    mNumChildren[0]= 0;
403 408
    mParent        = null;
404 409
    mSurfaceParent = null;
405 410
    mRenderWayOIT  = false;
......
408 413
    mFboH            = 0;  // mSurface's dimensions
409 414
    mFboDepthStencil = DistortedFramebuffer.DEPTH_NO_STENCIL;
410 415

  
411
    ArrayList<Long> list = new ArrayList<>();
412
    list.add(mSurface.getID());
413
    list.add(-mEffects.getID());
414

  
415
    mData = mMapNodeID.get(list);
416
   
417
    if( mData!=null )
418
      {
419
      mData.numPointingNodes++;
420
      }
421
    else
422
      {
423
      mData = new NodeData(++mNextNodeID,list);
424
      mMapNodeID.put(list, mData);
425
      }
426

  
416
    mData = retData();
427 417
    mEffects.newNode(this);
428 418
    }
429 419

  
......
490 480
      {
491 481
      mChildren = null;
492 482
      mNumChildren = new int[1];
493
      mNumChildren[0] = 0;
494
      }
495
   
496
    ArrayList<Long> list = generateIDList();
497
   
498
    mData = mMapNodeID.get(list);
499
   
500
    if( mData!=null )
501
      {
502
      mData.numPointingNodes++;
503
      }
504
    else
505
      {
506
      mData = new NodeData(++mNextNodeID,list);
507
      mMapNodeID.put(list, mData);
508 483
      }
509 484

  
485
    mData = retData();
510 486
    mEffects.newNode(this);
511 487
    }
512 488

  

Also available in: Unified diff