Project

General

Profile

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

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

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 3a70bd6d leszek
 * will point to the same NodeData; only the first of this is rendered (mData.numRender!).
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 eadf0859 leszek
      //android.util.Log.d("NODE", "copying over FBOs "+mData.mFBO.getID() );
178 f28fffc2 Leszek Koltunski
      }
179
    else if( deleteOldFBO )
180
      {
181
      mData.mFBO.markForDeletion();
182 eadf0859 leszek
      //android.util.Log.d("NODE", "deleting old FBO "+mData.mFBO.getID() );
183 f28fffc2 Leszek Koltunski
      mData.mFBO = null;
184
      }
185
    else if( createNewFBO )
186
      {
187
      newData.mFBO = new DistortedFramebuffer(true, DistortedSurface.TYPE_TREE, mSurface.getWidth(),mSurface.getHeight());
188 eadf0859 leszek
      //android.util.Log.d("NODE", "creating new FBO "+newData.mFBO.getID() );
189 f28fffc2 Leszek Koltunski
      }
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 d3725071 Leszek Koltunski
 * @y.exclude
380 c204c69d leszek
 * @param node The new Node to add.
381
 */
382
  public void attachNow(DistortedNode node)
383
    {
384 9361b337 Leszek Koltunski
    if( mChildren==null ) mChildren = new ArrayList<>(2);
385 c204c69d leszek
386 f28fffc2 Leszek Koltunski
    node.mParent = this;
387 6a06a912 Leszek Koltunski
    mChildren.add(node);
388
    mNumChildren[0]++;
389 f28fffc2 Leszek Koltunski
    adjustIsomorphism();
390 6a06a912 Leszek Koltunski
    }
391 c204c69d leszek
392 6a06a912 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
393
/**
394
 * Removes the first occurrence of a specified child from the list of children of our Node.
395 c204c69d leszek
 * <p>
396
 * We cannot do this mid-render - actual detachment will be done just before the next render, by the
397
 * DistortedAttachDeamon (by calling detachNow())
398
 *
399 6a06a912 Leszek Koltunski
 * @param node The Node to remove.
400
 */
401 c204c69d leszek
  public void detach(DistortedNode node)
402 6a06a912 Leszek Koltunski
    {
403 c204c69d leszek
    DistortedAttachDaemon.detach(this,node);
404 6a06a912 Leszek Koltunski
    }
405 a09ada4c Leszek Koltunski
406 6a06a912 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
407
/**
408
 * Removes the first occurrence of a specified child from the list of children of our Node.
409 a09ada4c Leszek Koltunski
 * <p>
410
 * A bit questionable method as there can be many different Nodes attached as children, some
411
 * of them having the same Effects but - for instance - different Mesh. Use with care.
412 c204c69d leszek
 * <p>
413
 * We cannot do this mid-render - actual detachment will be done just before the next render, by the
414
 * DistortedAttachDeamon (by calling detachNow())
415 a09ada4c Leszek Koltunski
 *
416 07d8ef09 Leszek Koltunski
 * @param effects DistortedEffects to remove.
417 6a06a912 Leszek Koltunski
 */
418 c204c69d leszek
  public void detach(DistortedEffects effects)
419 6a06a912 Leszek Koltunski
    {
420 07d8ef09 Leszek Koltunski
    long id = effects.getID();
421 a09ada4c Leszek Koltunski
    DistortedNode node;
422
423 6a06a912 Leszek Koltunski
    for(int i=0; i<mNumChildren[0]; i++)
424
      {
425
      node = mChildren.get(i);
426 a09ada4c Leszek Koltunski
427 07d8ef09 Leszek Koltunski
      if( node.mEffects.getID()==id )
428 6a06a912 Leszek Koltunski
        {
429 c204c69d leszek
        DistortedAttachDaemon.detach(this,node);
430
        break;
431 6a06a912 Leszek Koltunski
        }
432
      }
433
    }
434 a09ada4c Leszek Koltunski
435 6a06a912 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
436
/**
437 c204c69d leszek
 * This is not really part of the public API. Has to be public only because it is a part of the
438
 * DistortedAttacheable interface, which should really be a class that we extend here instead but
439
 * Java has no multiple inheritance.
440
 *
441 d3725071 Leszek Koltunski
 * @y.exclude
442 c204c69d leszek
 * @param node The Node to remove.
443 6a06a912 Leszek Koltunski
 */
444 c204c69d leszek
  public void detachNow(DistortedNode node)
445 6a06a912 Leszek Koltunski
    {
446 c204c69d leszek
    if( mNumChildren[0]>0 && mChildren.remove(node) )
447 6a06a912 Leszek Koltunski
      {
448 f28fffc2 Leszek Koltunski
      node.mParent = null;
449 c204c69d leszek
      mNumChildren[0]--;
450 f28fffc2 Leszek Koltunski
      adjustIsomorphism();
451 6a06a912 Leszek Koltunski
      }
452 c204c69d leszek
    }
453
454
///////////////////////////////////////////////////////////////////////////////////////////////////
455
/**
456
 * Removes all children Nodes.
457
 * <p>
458
 * We cannot do this mid-render - actual detachment will be done just before the next render, by the
459
 * DistortedAttachDeamon (by calling detachAllNow())
460
 */
461
  public void detachAll()
462
    {
463
    DistortedAttachDaemon.detachAll(this);
464
    }
465
466
///////////////////////////////////////////////////////////////////////////////////////////////////
467
/**
468
 * This is not really part of the public API. Has to be public only because it is a part of the
469
 * DistortedAttacheable interface, which should really be a class that we extend here instead but
470
 * Java has no multiple inheritance.
471 d3725071 Leszek Koltunski
 *
472
 * @y.exclude
473 c204c69d leszek
 */
474
  public void detachAllNow()
475
    {
476 6a06a912 Leszek Koltunski
    if( mNumChildren[0]>0 )
477
      {
478 f28fffc2 Leszek Koltunski
      DistortedNode tmp;
479 af27df87 leszek
480 f28fffc2 Leszek Koltunski
      for(int i=mNumChildren[0]-1; i>=0; i--)
481 af27df87 leszek
        {
482 f28fffc2 Leszek Koltunski
        tmp = mChildren.remove(i);
483
        tmp.mParent = null;
484 af27df87 leszek
        }
485 f28fffc2 Leszek Koltunski
486
      mNumChildren[0] = 0;
487
      adjustIsomorphism();
488 6a06a912 Leszek Koltunski
      }
489
    }
490 d1e740c5 Leszek Koltunski
491 6a06a912 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
492
/**
493 421c2728 Leszek Koltunski
 * Returns the DistortedEffects object that's in the Node.
494 6a06a912 Leszek Koltunski
 * 
495 421c2728 Leszek Koltunski
 * @return The DistortedEffects contained in the Node.
496 6a06a912 Leszek Koltunski
 */
497 421c2728 Leszek Koltunski
  public DistortedEffects getEffects()
498 6a06a912 Leszek Koltunski
    {
499 07d8ef09 Leszek Koltunski
    return mEffects;
500 4e2382f3 Leszek Koltunski
    }
501
502
///////////////////////////////////////////////////////////////////////////////////////////////////
503
/**
504 c5369f1b leszek
 * Returns the DistortedInputSurface object that's in the Node.
505 4e2382f3 Leszek Koltunski
 *
506 c5369f1b leszek
 * @return The DistortedInputSurface contained in the Node.
507 4e2382f3 Leszek Koltunski
 */
508 c5369f1b leszek
  public DistortedInputSurface getSurface()
509 4e2382f3 Leszek Koltunski
    {
510 c5369f1b leszek
    return mSurface;
511 6a06a912 Leszek Koltunski
    }
512
513 8c327653 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
514
/**
515
 * Returns the DistortedFramebuffer object that's in the Node.
516
 *
517
 * @return The DistortedFramebuffer contained in the Node.
518
 */
519
  public DistortedFramebuffer getFramebuffer()
520
    {
521
    return mData.mFBO;
522
    }
523 6a06a912 Leszek Koltunski
524 8c327653 Leszek Koltunski
  }