Revision af27df87
Added by Leszek Koltunski about 7 years ago
src/main/java/org/distorted/library/DistortedNode.java | ||
---|---|---|
53 | 53 |
long ID; |
54 | 54 |
int numPointingNodes; |
55 | 55 |
int numRendered; |
56 |
ArrayList<Long> key; |
|
56 | 57 |
DistortedFramebuffer mFBO; |
57 | 58 |
|
58 |
NodeData(long id) |
|
59 |
NodeData(long id, ArrayList<Long> k)
|
|
59 | 60 |
{ |
60 | 61 |
ID = id; |
62 |
key = k; |
|
61 | 63 |
numPointingNodes= 1; |
62 | 64 |
numRendered = 0; |
63 | 65 |
mFBO = null; |
... | ... | |
108 | 110 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
109 | 111 |
// Debug - print all the Node IDs |
110 | 112 |
|
113 |
@SuppressWarnings("unused") |
|
111 | 114 |
void debug(int depth) |
112 | 115 |
{ |
113 | 116 |
String tmp=""; |
... | ... | |
125 | 128 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
126 | 129 |
// Debug - print contents of the HashMap |
127 | 130 |
|
131 |
@SuppressWarnings("unused") |
|
128 | 132 |
static void debugMap() |
129 | 133 |
{ |
130 | 134 |
NodeData tmp; |
... | ... | |
140 | 144 |
|
141 | 145 |
void treeIsomorphism() |
142 | 146 |
{ |
143 |
android.util.Log.e("NODE", "begin treeIso for Node Surface ID="+mSurface.getID()); |
|
144 |
debug(0); |
|
145 |
debugMap(); |
|
146 |
android.util.Log.e("NODE", "begin treeIso for Node Surface ID="+mSurface.getID()); |
|
147 |
|
|
148 |
ArrayList<Long> oldList = generateIDList(); |
|
149 |
|
|
150 | 147 |
for(int i=0; i<mNumChildren[0]; i++) |
151 | 148 |
{ |
152 | 149 |
mChildren.get(i).treeIsomorphism(); |
... | ... | |
157 | 154 |
|
158 | 155 |
if( newData==null ) |
159 | 156 |
{ |
160 |
android.util.Log.d("NODE", " inserted newData to map, newList="+newList); |
|
161 |
|
|
162 |
|
|
163 |
newData = new NodeData(++mNextNodeID); |
|
157 |
newData = new NodeData(++mNextNodeID,newList); |
|
164 | 158 |
mMapNodeID.put(newList,newData); |
165 |
debugMap(); |
|
166 | 159 |
} |
167 | 160 |
else if( newData.ID != mData.ID ) |
168 | 161 |
{ |
... | ... | |
177 | 170 |
{ |
178 | 171 |
if( mData.mFBO!=null ) |
179 | 172 |
{ |
173 |
android.util.Log.d("NODE", "copying over FBO of node surfaceID="+mSurface.getID()); |
|
174 |
|
|
180 | 175 |
newData.mFBO = mData.mFBO; |
181 | 176 |
fboUsed = true; |
182 | 177 |
} |
183 | 178 |
else |
184 | 179 |
{ |
180 |
android.util.Log.d("NODE", "creating new FBO of node surfaceID="+mSurface.getID()); |
|
185 | 181 |
newData.mFBO = new DistortedFramebuffer(mSurface.getWidth(),mSurface.getHeight()); |
186 | 182 |
} |
187 | 183 |
} |
188 | 184 |
if( mNumChildren[0]==0 && newData.mFBO!=null ) |
189 | 185 |
{ |
186 |
android.util.Log.d("NODE", "deleting FBO of newData node!!"); |
|
187 |
|
|
188 |
|
|
190 | 189 |
newData.mFBO.markForDeletion(); |
191 | 190 |
newData.mFBO = null; |
192 | 191 |
} |
193 | 192 |
|
194 | 193 |
if( --mData.numPointingNodes==0 ) |
195 | 194 |
{ |
196 |
android.util.Log.d("NODE", " removed oldData to map, oldList="+oldList); |
|
197 |
|
|
198 |
|
|
199 |
mMapNodeID.remove(oldList); |
|
200 |
debugMap(); |
|
195 |
mMapNodeID.remove(mData.key); |
|
201 | 196 |
|
202 | 197 |
if( !fboUsed && mData.mFBO!=null ) |
203 | 198 |
{ |
199 |
android.util.Log.d("NODE", "deleting FBO of node surfaceID="+mSurface.getID()); |
|
200 |
|
|
204 | 201 |
mData.mFBO.markForDeletion(); |
205 | 202 |
mData.mFBO = null; |
206 | 203 |
} |
... | ... | |
208 | 205 |
|
209 | 206 |
mData = newData; |
210 | 207 |
} |
211 |
|
|
212 |
android.util.Log.e("NODE", "end treeIso for Node SurfaceID="+mSurface.getID()+" newList="+newList); |
|
213 |
debug(0); |
|
214 |
debugMap(); |
|
215 |
android.util.Log.e("NODE", "end treeIso for Node SurfaceID="+mSurface.getID()+" newList="+newList); |
|
216 | 208 |
} |
217 | 209 |
|
218 | 210 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
282 | 274 |
} |
283 | 275 |
else |
284 | 276 |
{ |
285 |
mData = new NodeData(++mNextNodeID);
|
|
277 |
mData = new NodeData(++mNextNodeID,list);
|
|
286 | 278 |
mMapNodeID.put(list, mData); |
287 | 279 |
} |
288 | 280 |
} |
... | ... | |
348 | 340 |
} |
349 | 341 |
else |
350 | 342 |
{ |
351 |
mData = new NodeData(++mNextNodeID);
|
|
343 |
mData = new NodeData(++mNextNodeID,list);
|
|
352 | 344 |
mMapNodeID.put(list, mData); |
353 | 345 |
} |
354 | 346 |
} |
... | ... | |
458 | 450 |
if( mNumChildren[0]>0 && mChildren.remove(node) ) |
459 | 451 |
{ |
460 | 452 |
mNumChildren[0]--; |
453 |
|
|
454 |
if( mNumChildren[0]==0 && mData.mFBO!=null ) |
|
455 |
{ |
|
456 |
mData.mFBO.markForDeletion(); |
|
457 |
mData.mFBO = null; |
|
458 |
} |
|
461 | 459 |
} |
462 | 460 |
} |
463 | 461 |
|
... | ... | |
485 | 483 |
{ |
486 | 484 |
mNumChildren[0] = 0; |
487 | 485 |
mChildren.clear(); |
486 |
|
|
487 |
if( mData.mFBO!=null ) |
|
488 |
{ |
|
489 |
mData.mFBO.markForDeletion(); |
|
490 |
mData.mFBO = null; |
|
491 |
} |
|
488 | 492 |
} |
489 | 493 |
} |
490 | 494 |
|
Also available in: Unified diff
A lot of different fixes.
A lot of issues still there:
1) if we only render part of the tree, tree isomorphism will sometimes not work correctly
2) when we change Effects that are inside Trees mid-render, even if we detach() the affected parts of the Tree first, for the last frame the new Effects will be used
3) Something is wrong wil the System FBOs after app restart (Blur & MultiBlur apps work erratically)