Project

General

Profile

« Previous | Next » 

Revision a56bc359

Added by Leszek Koltunski over 7 years ago

Major change in API: separate the GRID from DistortedObject; completely remove classes derived from DistortedObject.

View differences:

src/main/java/org/distorted/library/DistortedNode.java
37 37
  private static HashMap<ArrayList<Long>,NodeData> mMapNodeID = new HashMap<>();
38 38
  private static long mNextNodeID =0;
39 39

  
40
  private DistortedObjectGrid mGrid;
40 41
  private DistortedObject mObject;
41 42
  private NodeData mData;
42 43

  
......
101 102
        if( mObject.mBitmapSet[0] )
102 103
          {
103 104
          GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mObject.mTextureDataH[0]);
104
          mObject.drawNoEffectsPriv(mData.mDF);
105
          mObject.drawNoEffectsPriv(mGrid, mData.mDF);
105 106
          }
106 107
      
107 108
        synchronized(this)
......
117 118
      mData.mDF.setAsInput();
118 119
      }
119 120
    
120
    mObject.drawPriv(currTime, df);
121
    mObject.drawPriv(currTime, mGrid, df);
121 122
    }
122 123
  
123 124
///////////////////////////////////////////////////////////////////////////////////////////////////
......
222 223

  
223 224
///////////////////////////////////////////////////////////////////////////////////////////////////
224 225
// Debug - print all the Node IDs
225

  
226
/*
226 227
  void debug(int depth)
227 228
    {
228 229
    String tmp="";
......
251 252
      android.util.Log.e("NODE", "key="+key+" NodeID: "+tmp.ID);
252 253
      }
253 254
    }
254

  
255
*/
255 256
///////////////////////////////////////////////////////////////////////////////////////////////////
256 257
// PUBLIC API
257 258
///////////////////////////////////////////////////////////////////////////////////////////////////
......
260 261
 *     
261 262
 * @param obj DistortedObject to put into the new Node.
262 263
 */
263
  public DistortedNode(DistortedObject obj)
264
  public DistortedNode(DistortedObject obj, DistortedObjectGrid grid)
264 265
    {
265 266
    mObject = obj;
267
    mGrid   = grid;
266 268
    mParent = null;
267 269
    mChildren = null;
268 270
    mNumChildren = new int[1];
......
297 299
  public DistortedNode(DistortedNode node, int flags)
298 300
    {
299 301
    mParent = null;
300
    mObject = node.mObject.deepCopy(flags);
302
    mObject = new DistortedObject(node.mObject,flags);
303
    mGrid   = node.mGrid;
301 304

  
302 305
    if( (flags & Distorted.CLONE_CHILDREN) != 0 )
303 306
      {
......
352 355
 * @param obj DistortedObject to initialize our child Node with.
353 356
 * @return the newly constructed child Node, or null if we couldn't allocate resources.
354 357
 */
355
  public synchronized DistortedNode attach(DistortedObject obj)
358
  public synchronized DistortedNode attach(DistortedObject obj, DistortedObjectGrid grid)
356 359
    {
357 360
    ArrayList<Long> prev = generateIDList(); 
358 361
      
359 362
    if( mChildren==null ) mChildren = new ArrayList<>(2);
360
    DistortedNode node = new DistortedNode(obj);
363
    DistortedNode node = new DistortedNode(obj,grid);
361 364
    node.mParent = this;
362 365
    mChildren.add(node);
363 366
    mNumChildren[0]++;

Also available in: Unified diff