Project

General

Profile

Download (16.5 KB) Statistics
| Branch: | Revision:

library / src / main / java / org / distorted / library / DistortedNode.java @ f28fffc2

1 d333eb6b Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2016 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Distorted.                                                               //
5
//                                                                                               //
6
// Distorted is free software: you can redistribute it and/or modify                             //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Distorted is distributed in the hope that it will be useful,                                  //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19
20 6a06a912 Leszek Koltunski
package org.distorted.library;
21
22
import java.util.ArrayList;
23
import java.util.HashMap;
24
25 194ab46f Leszek Koltunski
import android.opengl.GLES30;
26 6a06a912 Leszek Koltunski
27
///////////////////////////////////////////////////////////////////////////////////////////////////
28
/**
29 a09ada4c Leszek Koltunski
 * Class which represents a Node in a Tree of (InputSurface,Mesh,Effects) triplets.
30 c204c69d leszek
 * <p>
31 a09ada4c Leszek Koltunski
 * Having organized such sets into a Tree, we can then render any Node to any OutputSurface.
32 7b8086eb Leszek Koltunski
 * That recursively renders the set held in the Node and all its children.
33 c204c69d leszek
 * <p>
34
 * The class takes special care to only render identical sub-trees once. Each Node holds a reference
35
 * to sub-class 'NodeData'. Two identical sub-trees attached at different points of the main tree
36
 * will point to the same NodeData; only the first of this is rendered (when mData.numRendered==0).
37 6a06a912 Leszek Koltunski
 */
38 c204c69d leszek
public class DistortedNode implements DistortedAttacheable
39 6a06a912 Leszek Koltunski
  {
40 bd3da5b2 Leszek Koltunski
  private static HashMap<ArrayList<Long>,NodeData> mMapNodeID = new HashMap<>();
41
  private static long mNextNodeID =0;
42
43 f28fffc2 Leszek Koltunski
  private DistortedNode mParent;
44 05403bba Leszek Koltunski
  private MeshObject mMesh;
45 07d8ef09 Leszek Koltunski
  private DistortedEffects mEffects;
46 c5369f1b leszek
  private DistortedInputSurface mSurface;
47 6a06a912 Leszek Koltunski
  private NodeData mData;
48 bd3da5b2 Leszek Koltunski
49 a09ada4c Leszek Koltunski
  private ArrayList<DistortedNode> mChildren;
50 6a06a912 Leszek Koltunski
  private int[] mNumChildren;  // ==mChildren.length(), but we only create mChildren if the first one gets added
51
52
  private class NodeData
53
    {
54 bd3da5b2 Leszek Koltunski
    long ID;
55 6a06a912 Leszek Koltunski
    int numPointingNodes;
56 7691a39f leszek
    int numRender;
57 af27df87 leszek
    ArrayList<Long> key;
58 8c327653 Leszek Koltunski
    DistortedFramebuffer mFBO;
59 6a06a912 Leszek Koltunski
60 af27df87 leszek
    NodeData(long id, ArrayList<Long> k)
61 6a06a912 Leszek Koltunski
      {
62 bd3da5b2 Leszek Koltunski
      ID              = id;
63 af27df87 leszek
      key             = k;
64 bd3da5b2 Leszek Koltunski
      numPointingNodes= 1;
65 7691a39f leszek
      numRender       =-1;
66 8c327653 Leszek Koltunski
      mFBO            = null;
67 6a06a912 Leszek Koltunski
      }
68 bd3da5b2 Leszek Koltunski
    }
69 6a06a912 Leszek Koltunski
 
70 436899f2 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
71
72 7b8086eb Leszek Koltunski
  static synchronized void onDestroy()
73 436899f2 Leszek Koltunski
    {
74
    mNextNodeID = 0;
75
    mMapNodeID.clear();
76
    }
77
78 6a06a912 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
79
80
  private ArrayList<Long> generateIDList()
81
    {
82 9361b337 Leszek Koltunski
    ArrayList<Long> ret = new ArrayList<>();
83 6a06a912 Leszek Koltunski
     
84 c5369f1b leszek
    ret.add( mSurface.getID() );
85 7691a39f leszek
86
    if( mNumChildren[0]==0 )
87
      {
88
      ret.add(-mEffects.getID());
89
      }
90
91 a09ada4c Leszek Koltunski
    DistortedNode node;
92 6a06a912 Leszek Koltunski
   
93
    for(int i=0; i<mNumChildren[0]; i++)
94
      {
95
      node = mChildren.get(i);
96
      ret.add(node.mData.ID);
97
      }
98
   
99
    return ret;
100
    }
101
102 fee0865c Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
103
// Debug - print all the Node IDs
104 c204c69d leszek
105 af27df87 leszek
  @SuppressWarnings("unused")
106 fee0865c Leszek Koltunski
  void debug(int depth)
107
    {
108
    String tmp="";
109
    int i;
110
111
    for(i=0; i<depth; i++) tmp +="   ";
112 07037b8a leszek
    tmp += ("NodeID="+mData.ID+" nodes pointing: "+mData.numPointingNodes+" surfaceID="+
113 f28fffc2 Leszek Koltunski
            mSurface.getID()+" FBO="+(mData.mFBO==null ? "null":mData.mFBO.getID()))+
114
            " parent sID="+(mParent==null ? "null": (mParent.mSurface.getID()));
115 fee0865c Leszek Koltunski
116 1942537e Leszek Koltunski
    android.util.Log.e("NODE", tmp);
117 fee0865c Leszek Koltunski
118
    for(i=0; i<mNumChildren[0]; i++)
119
      mChildren.get(i).debug(depth+1);
120
    }
121
122
///////////////////////////////////////////////////////////////////////////////////////////////////
123
// Debug - print contents of the HashMap
124
125 af27df87 leszek
  @SuppressWarnings("unused")
126 fee0865c Leszek Koltunski
  static void debugMap()
127
    {
128
    NodeData tmp;
129
130
    for(ArrayList<Long> key: mMapNodeID.keySet())
131
      {
132
      tmp = mMapNodeID.get(key);
133 c204c69d leszek
      android.util.Log.e("NODE", "NodeID: "+tmp.ID+" <-- "+key);
134
      }
135
    }
136
137
///////////////////////////////////////////////////////////////////////////////////////////////////
138 f28fffc2 Leszek Koltunski
// tree isomorphism algorithm
139 c204c69d leszek
140 f28fffc2 Leszek Koltunski
  private void adjustIsomorphism()
141 c204c69d leszek
    {
142
    ArrayList<Long> newList = generateIDList();
143
    NodeData newData = mMapNodeID.get(newList);
144
145 f28fffc2 Leszek Koltunski
    if( newData!=null )
146
      {
147
      newData.numPointingNodes++;
148
      }
149
    else
150 c204c69d leszek
      {
151 af27df87 leszek
      newData = new NodeData(++mNextNodeID,newList);
152 c204c69d leszek
      mMapNodeID.put(newList,newData);
153
      }
154 07037b8a leszek
155 f28fffc2 Leszek Koltunski
    boolean deleteOldFBO = false;
156
    boolean createNewFBO = false;
157 c204c69d leszek
158 f28fffc2 Leszek Koltunski
    if( --mData.numPointingNodes==0 )
159 c204c69d leszek
      {
160 f28fffc2 Leszek Koltunski
      mMapNodeID.remove(mData.key);
161
      if( mData.mFBO!=null ) deleteOldFBO=true;
162
      }
163
    if( mNumChildren[0]>0 && newData.mFBO==null )
164
      {
165
      createNewFBO = true;
166
      }
167
    if( mNumChildren[0]==0 && newData.mFBO!=null )
168
      {
169
      newData.mFBO.markForDeletion();
170
      android.util.Log.d("NODE", "ERROR!! this NodeData cannot possibly contain a non-null FBO!! "+newData.mFBO.getID() );
171
      newData.mFBO = null;
172
      }
173 c204c69d leszek
174 f28fffc2 Leszek Koltunski
    if( deleteOldFBO && createNewFBO )
175
      {
176
      newData.mFBO = mData.mFBO;  // just copy over
177
      android.util.Log.d("NODE", "copying over FBOs "+mData.mFBO.getID() );
178
      }
179
    else if( deleteOldFBO )
180
      {
181
      mData.mFBO.markForDeletion();
182
      android.util.Log.d("NODE", "deleting old FBO "+mData.mFBO.getID() );
183
      mData.mFBO = null;
184
      }
185
    else if( createNewFBO )
186
      {
187
      newData.mFBO = new DistortedFramebuffer(true, DistortedSurface.TYPE_TREE, mSurface.getWidth(),mSurface.getHeight());
188
      android.util.Log.d("NODE", "creating new FBO "+newData.mFBO.getID() );
189
      }
190 af27df87 leszek
191 f28fffc2 Leszek Koltunski
    mData = newData;
192 c204c69d leszek
193 f28fffc2 Leszek Koltunski
    if( mParent!=null ) mParent.adjustIsomorphism();
194 fee0865c Leszek Koltunski
    }
195 c204c69d leszek
196 a0f644b7 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
197 7691a39f leszek
// return the total number of render calls issued
198 a0f644b7 Leszek Koltunski
199 d03782c0 leszek
  int drawRecursive(int renderNum, long currTime, DistortedOutputSurface surface)
200 a0f644b7 Leszek Koltunski
    {
201 7691a39f leszek
    int ret = 0;
202 c5369f1b leszek
    float halfX = mSurface.getWidth()/2.0f;
203
    float halfY = mSurface.getHeight()/2.0f;
204 a0f644b7 Leszek Koltunski
205 d03782c0 leszek
    if( mNumChildren[0]>0 && mData.numRender!=renderNum )
206 a0f644b7 Leszek Koltunski
      {
207 d03782c0 leszek
      mData.numRender = renderNum;
208
      mData.mFBO.setAsOutput();
209 a0f644b7 Leszek Koltunski
210 d03782c0 leszek
      GLES30.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
211
      GLES30.glClear( GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT);
212 a0f644b7 Leszek Koltunski
213 d03782c0 leszek
      if( mSurface.setAsInput() )
214
        {
215
        ret++;
216
        DistortedEffects.drawNoEffectsPriv(halfX, halfY, mMesh, mData.mFBO);
217 a0f644b7 Leszek Koltunski
        }
218
219 d03782c0 leszek
      for(int i=0; i<mNumChildren[0]; i++)
220
        {
221
        ret += mChildren.get(i).drawRecursive(renderNum, currTime, mData.mFBO);
222
        }
223 a0f644b7 Leszek Koltunski
      }
224
225 d03782c0 leszek
    DistortedInputSurface input = mNumChildren[0]==0 ? mSurface : mData.mFBO;
226 7691a39f leszek
227 d03782c0 leszek
    if( input.setAsInput() )
228
      {
229
      ret++;
230
      mEffects.drawPriv(halfX, halfY, mMesh, surface, currTime);
231
      }
232
233
    return ret;
234 a0f644b7 Leszek Koltunski
    }
235
236 6a06a912 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
237
// PUBLIC API
238
///////////////////////////////////////////////////////////////////////////////////////////////////
239
/**
240 a09ada4c Leszek Koltunski
 * Constructs new Node.
241 6a06a912 Leszek Koltunski
 *     
242 c5369f1b leszek
 * @param surface InputSurface to put into the new Node.
243 07d8ef09 Leszek Koltunski
 * @param effects DistortedEffects to put into the new Node.
244 05403bba Leszek Koltunski
 * @param mesh MeshObject to put into the new Node.
245 6a06a912 Leszek Koltunski
 */
246 a09ada4c Leszek Koltunski
  public DistortedNode(DistortedInputSurface surface, DistortedEffects effects, MeshObject mesh)
247 6a06a912 Leszek Koltunski
    {
248 c5369f1b leszek
    mSurface       = surface;
249 8ca9f899 Leszek Koltunski
    mEffects       = effects;
250
    mMesh          = mesh;
251
    mChildren      = null;
252
    mNumChildren   = new int[1];
253
    mNumChildren[0]= 0;
254 f28fffc2 Leszek Koltunski
    mParent        = null;
255
256 9361b337 Leszek Koltunski
    ArrayList<Long> list = new ArrayList<>();
257 c5369f1b leszek
    list.add(mSurface.getID());
258 7691a39f leszek
    list.add(-mEffects.getID());
259 1942537e Leszek Koltunski
260 6a06a912 Leszek Koltunski
    mData = mMapNodeID.get(list);
261
   
262
    if( mData!=null )
263
      {
264
      mData.numPointingNodes++;
265
      }
266
    else
267
      {
268 af27df87 leszek
      mData = new NodeData(++mNextNodeID,list);
269 1942537e Leszek Koltunski
      mMapNodeID.put(list, mData);
270 6a06a912 Leszek Koltunski
      }
271
    }
272
273
///////////////////////////////////////////////////////////////////////////////////////////////////  
274
/**
275 a09ada4c Leszek Koltunski
 * Copy-constructs new Node from another Node.
276 6a06a912 Leszek Koltunski
 *     
277 a09ada4c Leszek Koltunski
 * @param node The DistortedNode to copy data from.
278 6a06a912 Leszek Koltunski
 * @param flags bit field composed of a subset of the following:
279 29a06526 Leszek Koltunski
 *        {@link Distorted#CLONE_SURFACE},  {@link Distorted#CLONE_MATRIX}, {@link Distorted#CLONE_VERTEX},
280 6a06a912 Leszek Koltunski
 *        {@link Distorted#CLONE_FRAGMENT} and {@link Distorted#CLONE_CHILDREN}.
281 29a06526 Leszek Koltunski
 *        For example flags = CLONE_SURFACE | CLONE_CHILDREN.
282 6a06a912 Leszek Koltunski
 */
283 a09ada4c Leszek Koltunski
  public DistortedNode(DistortedNode node, int flags)
284 6a06a912 Leszek Koltunski
    {
285 432442f9 Leszek Koltunski
    mEffects= new DistortedEffects(node.mEffects,flags);
286 f28fffc2 Leszek Koltunski
    mMesh   = node.mMesh;
287
    mParent = null;
288 9361b337 Leszek Koltunski
289 29a06526 Leszek Koltunski
    if( (flags & Distorted.CLONE_SURFACE) != 0 )
290 e7a20702 Leszek Koltunski
      {
291 c5369f1b leszek
      mSurface = node.mSurface;
292 e7a20702 Leszek Koltunski
      }
293
    else
294
      {
295 c5369f1b leszek
      int w = node.mSurface.getWidth();
296
      int h = node.mSurface.getHeight();
297 8ca9f899 Leszek Koltunski
298 c5369f1b leszek
      if( node.mSurface instanceof DistortedTexture )
299 8ca9f899 Leszek Koltunski
        {
300 09ab7524 Leszek Koltunski
        mSurface = new DistortedTexture(w,h, DistortedSurface.TYPE_TREE);
301 8ca9f899 Leszek Koltunski
        }
302 c5369f1b leszek
      else if( node.mSurface instanceof DistortedFramebuffer )
303 8ca9f899 Leszek Koltunski
        {
304 c5369f1b leszek
        boolean hasDepth = ((DistortedFramebuffer) node.mSurface).hasDepth();
305 09ab7524 Leszek Koltunski
        mSurface = new DistortedFramebuffer(hasDepth,DistortedSurface.TYPE_TREE,w,h);
306 8ca9f899 Leszek Koltunski
        }
307 e7a20702 Leszek Koltunski
      }
308 9361b337 Leszek Koltunski
    if( (flags & Distorted.CLONE_CHILDREN) != 0 )
309 6a06a912 Leszek Koltunski
      {
310 c204c69d leszek
      if( node.mChildren==null )     // do NOT copy over the NULL!
311
        {
312
        node.mChildren = new ArrayList<>(2);
313
        }
314
315 6a06a912 Leszek Koltunski
      mChildren = node.mChildren;
316
      mNumChildren = node.mNumChildren;
317
      }
318
    else
319
      {
320
      mChildren = null;
321
      mNumChildren = new int[1];
322
      mNumChildren[0] = 0;
323
      }
324
   
325
    ArrayList<Long> list = generateIDList();
326
   
327
    mData = mMapNodeID.get(list);
328
   
329
    if( mData!=null )
330
      {
331
      mData.numPointingNodes++;
332
      }
333
    else
334
      {
335 af27df87 leszek
      mData = new NodeData(++mNextNodeID,list);
336 6a06a912 Leszek Koltunski
      mMapNodeID.put(list, mData);
337
      }
338
    }
339 c204c69d leszek
340 6a06a912 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
341
/**
342
 * Adds a new child to the last position in the list of our Node's children.
343 c204c69d leszek
 * <p>
344
 * We cannot do this mid-render - actual attachment will be done just before the next render, by the
345
 * DistortedAttachDeamon (by calling attachNow())
346
 *
347 6a06a912 Leszek Koltunski
 * @param node The new Node to add.
348
 */
349 c204c69d leszek
  public void attach(DistortedNode node)
350 6a06a912 Leszek Koltunski
    {
351 c204c69d leszek
    DistortedAttachDaemon.attach(this,node);
352 6a06a912 Leszek Koltunski
    }
353 c204c69d leszek
354 6a06a912 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
355
/**
356
 * Adds a new child to the last position in the list of our Node's children.
357 c204c69d leszek
 * <p>
358
 * We cannot do this mid-render - actual attachment will be done just before the next render, by the
359
 * DistortedAttachDeamon (by calling attachNow())
360
 *
361 c5369f1b leszek
 * @param surface InputSurface to initialize our child Node with.
362 07d8ef09 Leszek Koltunski
 * @param effects DistortedEffects to initialize our child Node with.
363 05403bba Leszek Koltunski
 * @param mesh MeshObject to initialize our child Node with.
364 6a06a912 Leszek Koltunski
 * @return the newly constructed child Node, or null if we couldn't allocate resources.
365
 */
366 c204c69d leszek
  public DistortedNode attach(DistortedInputSurface surface, DistortedEffects effects, MeshObject mesh)
367 6a06a912 Leszek Koltunski
    {
368 c204c69d leszek
    DistortedNode node = new DistortedNode(surface,effects,mesh);
369
    DistortedAttachDaemon.attach(this,node);
370
    return node;
371
    }
372 f8377ef8 leszek
373 c204c69d leszek
///////////////////////////////////////////////////////////////////////////////////////////////////
374
/**
375
 * This is not really part of the public API. Has to be public only because it is a part of the
376
 * DistortedAttacheable interface, which should really be a class that we extend here instead but
377
 * Java has no multiple inheritance.
378
 *
379
 * @param node The new Node to add.
380
 */
381
  public void attachNow(DistortedNode node)
382
    {
383 9361b337 Leszek Koltunski
    if( mChildren==null ) mChildren = new ArrayList<>(2);
384 c204c69d leszek
385 f28fffc2 Leszek Koltunski
    node.mParent = this;
386 6a06a912 Leszek Koltunski
    mChildren.add(node);
387
    mNumChildren[0]++;
388 f28fffc2 Leszek Koltunski
    adjustIsomorphism();
389 6a06a912 Leszek Koltunski
    }
390 c204c69d leszek
391 6a06a912 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
392
/**
393
 * Removes the first occurrence of a specified child from the list of children of our Node.
394 c204c69d leszek
 * <p>
395
 * We cannot do this mid-render - actual detachment will be done just before the next render, by the
396
 * DistortedAttachDeamon (by calling detachNow())
397
 *
398 6a06a912 Leszek Koltunski
 * @param node The Node to remove.
399
 */
400 c204c69d leszek
  public void detach(DistortedNode node)
401 6a06a912 Leszek Koltunski
    {
402 c204c69d leszek
    DistortedAttachDaemon.detach(this,node);
403 6a06a912 Leszek Koltunski
    }
404 a09ada4c Leszek Koltunski
405 6a06a912 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
406
/**
407
 * Removes the first occurrence of a specified child from the list of children of our Node.
408 a09ada4c Leszek Koltunski
 * <p>
409
 * A bit questionable method as there can be many different Nodes attached as children, some
410
 * of them having the same Effects but - for instance - different Mesh. Use with care.
411 c204c69d leszek
 * <p>
412
 * We cannot do this mid-render - actual detachment will be done just before the next render, by the
413
 * DistortedAttachDeamon (by calling detachNow())
414 a09ada4c Leszek Koltunski
 *
415 07d8ef09 Leszek Koltunski
 * @param effects DistortedEffects to remove.
416 6a06a912 Leszek Koltunski
 */
417 c204c69d leszek
  public void detach(DistortedEffects effects)
418 6a06a912 Leszek Koltunski
    {
419 07d8ef09 Leszek Koltunski
    long id = effects.getID();
420 a09ada4c Leszek Koltunski
    DistortedNode node;
421
422 6a06a912 Leszek Koltunski
    for(int i=0; i<mNumChildren[0]; i++)
423
      {
424
      node = mChildren.get(i);
425 a09ada4c Leszek Koltunski
426 07d8ef09 Leszek Koltunski
      if( node.mEffects.getID()==id )
427 6a06a912 Leszek Koltunski
        {
428 c204c69d leszek
        DistortedAttachDaemon.detach(this,node);
429
        break;
430 6a06a912 Leszek Koltunski
        }
431
      }
432
    }
433 a09ada4c Leszek Koltunski
434 6a06a912 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
435
/**
436 c204c69d leszek
 * This is not really part of the public API. Has to be public only because it is a part of the
437
 * DistortedAttacheable interface, which should really be a class that we extend here instead but
438
 * Java has no multiple inheritance.
439
 *
440
 * @param node The Node to remove.
441 6a06a912 Leszek Koltunski
 */
442 c204c69d leszek
  public void detachNow(DistortedNode node)
443 6a06a912 Leszek Koltunski
    {
444 c204c69d leszek
    if( mNumChildren[0]>0 && mChildren.remove(node) )
445 6a06a912 Leszek Koltunski
      {
446 f28fffc2 Leszek Koltunski
      node.mParent = null;
447 c204c69d leszek
      mNumChildren[0]--;
448 f28fffc2 Leszek Koltunski
      adjustIsomorphism();
449 6a06a912 Leszek Koltunski
      }
450 c204c69d leszek
    }
451
452
///////////////////////////////////////////////////////////////////////////////////////////////////
453
/**
454
 * Removes all children Nodes.
455
 * <p>
456
 * We cannot do this mid-render - actual detachment will be done just before the next render, by the
457
 * DistortedAttachDeamon (by calling detachAllNow())
458
 */
459
  public void detachAll()
460
    {
461
    DistortedAttachDaemon.detachAll(this);
462
    }
463
464
///////////////////////////////////////////////////////////////////////////////////////////////////
465
/**
466
 * This is not really part of the public API. Has to be public only because it is a part of the
467
 * DistortedAttacheable interface, which should really be a class that we extend here instead but
468
 * Java has no multiple inheritance.
469
 */
470
  public void detachAllNow()
471
    {
472 6a06a912 Leszek Koltunski
    if( mNumChildren[0]>0 )
473
      {
474 f28fffc2 Leszek Koltunski
      DistortedNode tmp;
475 af27df87 leszek
476 f28fffc2 Leszek Koltunski
      for(int i=mNumChildren[0]-1; i>=0; i--)
477 af27df87 leszek
        {
478 f28fffc2 Leszek Koltunski
        tmp = mChildren.remove(i);
479
        tmp.mParent = null;
480 af27df87 leszek
        }
481 f28fffc2 Leszek Koltunski
482
      mNumChildren[0] = 0;
483
      adjustIsomorphism();
484 6a06a912 Leszek Koltunski
      }
485
    }
486 d1e740c5 Leszek Koltunski
487 6a06a912 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
488
/**
489 421c2728 Leszek Koltunski
 * Returns the DistortedEffects object that's in the Node.
490 6a06a912 Leszek Koltunski
 * 
491 421c2728 Leszek Koltunski
 * @return The DistortedEffects contained in the Node.
492 6a06a912 Leszek Koltunski
 */
493 421c2728 Leszek Koltunski
  public DistortedEffects getEffects()
494 6a06a912 Leszek Koltunski
    {
495 07d8ef09 Leszek Koltunski
    return mEffects;
496 4e2382f3 Leszek Koltunski
    }
497
498
///////////////////////////////////////////////////////////////////////////////////////////////////
499
/**
500 c5369f1b leszek
 * Returns the DistortedInputSurface object that's in the Node.
501 4e2382f3 Leszek Koltunski
 *
502 c5369f1b leszek
 * @return The DistortedInputSurface contained in the Node.
503 4e2382f3 Leszek Koltunski
 */
504 c5369f1b leszek
  public DistortedInputSurface getSurface()
505 4e2382f3 Leszek Koltunski
    {
506 c5369f1b leszek
    return mSurface;
507 6a06a912 Leszek Koltunski
    }
508
509 8c327653 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
510
/**
511
 * Returns the DistortedFramebuffer object that's in the Node.
512
 *
513
 * @return The DistortedFramebuffer contained in the Node.
514
 */
515
  public DistortedFramebuffer getFramebuffer()
516
    {
517
    return mData.mFBO;
518
    }
519 6a06a912 Leszek Koltunski
520 8c327653 Leszek Koltunski
  }