Revision 05403bba
Added by Leszek Koltunski over 7 years ago
src/main/java/org/distorted/library/DistortedTree.java | ||
---|---|---|
26 | 26 |
|
27 | 27 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
28 | 28 |
/** |
29 |
* Class which represents a Node in a Tree of (Texture,Grid,Effects) objects.
|
|
29 |
* Class which represents a Node in a Tree of (Texture,Mesh,Effects) objects.
|
|
30 | 30 |
* |
31 | 31 |
* Having organized such sets into a Tree, we can then render any Node to any Framebuffer. |
32 | 32 |
* That recursively renders the set held in the Node and all its children. |
... | ... | |
36 | 36 |
private static HashMap<ArrayList<Long>,NodeData> mMapNodeID = new HashMap<>(); |
37 | 37 |
private static long mNextNodeID =0; |
38 | 38 |
|
39 |
private MeshObject mGrid;
|
|
39 |
private MeshObject mMesh;
|
|
40 | 40 |
private DistortedEffects mEffects; |
41 | 41 |
private DistortedTexture mTexture; |
42 | 42 |
private NodeData mData; |
... | ... | |
222 | 222 |
GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT); |
223 | 223 |
|
224 | 224 |
if( mTexture.setAsInput() ) |
225 |
mEffects.drawNoEffectsPriv(mTexture.mHalfX, mTexture.mHalfY, mGrid, mData.mDF);
|
|
225 |
mEffects.drawNoEffectsPriv(mTexture.mHalfX, mTexture.mHalfY, mMesh, mData.mDF);
|
|
226 | 226 |
|
227 | 227 |
synchronized(this) |
228 | 228 |
{ |
... | ... | |
240 | 240 |
mData.mDF.setAsInput(); |
241 | 241 |
} |
242 | 242 |
|
243 |
mEffects.drawPriv(mTexture.mHalfX, mTexture.mHalfY, mGrid, df, currTime);
|
|
243 |
mEffects.drawPriv(mTexture.mHalfX, mTexture.mHalfY, mMesh, df, currTime);
|
|
244 | 244 |
} |
245 | 245 |
|
246 | 246 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
251 | 251 |
* |
252 | 252 |
* @param texture DistortedTexture to put into the new Node. |
253 | 253 |
* @param effects DistortedEffects to put into the new Node. |
254 |
* @param grid MeshObject to put into the new Node.
|
|
254 |
* @param mesh MeshObject to put into the new Node.
|
|
255 | 255 |
*/ |
256 |
public DistortedTree(DistortedTexture texture, DistortedEffects effects, MeshObject grid)
|
|
256 |
public DistortedTree(DistortedTexture texture, DistortedEffects effects, MeshObject mesh)
|
|
257 | 257 |
{ |
258 | 258 |
mTexture= texture; |
259 | 259 |
mEffects= effects; |
260 |
mGrid = grid;
|
|
260 |
mMesh = mesh;
|
|
261 | 261 |
mParent = null; |
262 | 262 |
mChildren = null; |
263 | 263 |
mNumChildren = new int[1]; |
... | ... | |
293 | 293 |
{ |
294 | 294 |
mParent = null; |
295 | 295 |
mEffects= new DistortedEffects(node.mEffects,flags); |
296 |
mGrid = node.mGrid;
|
|
296 |
mMesh = node.mMesh;
|
|
297 | 297 |
|
298 | 298 |
if( (flags & Distorted.CLONE_BITMAP) != 0 ) |
299 | 299 |
{ |
... | ... | |
355 | 355 |
* |
356 | 356 |
* @param texture DistortedTexture to initialize our child Node with. |
357 | 357 |
* @param effects DistortedEffects to initialize our child Node with. |
358 |
* @param grid MeshObject to initialize our child Node with.
|
|
358 |
* @param mesh MeshObject to initialize our child Node with.
|
|
359 | 359 |
* @return the newly constructed child Node, or null if we couldn't allocate resources. |
360 | 360 |
*/ |
361 |
public synchronized DistortedTree attach(DistortedTexture texture, DistortedEffects effects, MeshObject grid)
|
|
361 |
public synchronized DistortedTree attach(DistortedTexture texture, DistortedEffects effects, MeshObject mesh)
|
|
362 | 362 |
{ |
363 | 363 |
ArrayList<Long> prev = generateIDList(); |
364 | 364 |
|
365 | 365 |
if( mChildren==null ) mChildren = new ArrayList<>(2); |
366 |
DistortedTree node = new DistortedTree(texture,effects,grid);
|
|
366 |
DistortedTree node = new DistortedTree(texture,effects,mesh);
|
|
367 | 367 |
node.mParent = this; |
368 | 368 |
mChildren.add(node); |
369 | 369 |
mNumChildren[0]++; |
Also available in: Unified diff
rename all the 'grid' variables to 'mesh'.