Revision 7691a39f
Added by Leszek Koltunski about 7 years ago
src/main/java/org/distorted/library/DistortedOutputSurface.java | ||
---|---|---|
27 | 27 |
|
28 | 28 |
abstract class DistortedOutputSurface extends DistortedSurface implements DistortedAttacheable |
29 | 29 |
{ |
30 |
private static int mRender = 0; |
|
31 |
|
|
30 | 32 |
private ArrayList<DistortedNode> mChildren; |
31 | 33 |
private int mNumChildren; // ==mChildren.length(), but we only create mChildren if the first one gets added |
32 | 34 |
|
... | ... | |
105 | 107 |
* Must be called from a thread holding OpenGL Context. |
106 | 108 |
* |
107 | 109 |
* @param time Current time, in milliseconds. This will be passed to all the Effects stored in the children Nodes. |
110 |
* @return Number of objects rendered. |
|
108 | 111 |
*/ |
109 |
public void render(long time)
|
|
112 |
public int render(long time)
|
|
110 | 113 |
{ |
114 |
mRender++; |
|
115 |
|
|
111 | 116 |
// change tree topology (attach and detach children) |
112 | 117 |
// create and delete all underlying OpenGL resources |
113 | 118 |
// Watch out: FIRST change topology, only then deal |
... | ... | |
125 | 130 |
mChildren.get(i).debug(0); |
126 | 131 |
} |
127 | 132 |
|
128 |
//DistortedNode.debugMap();
|
|
133 |
DistortedNode.debugMap(); |
|
129 | 134 |
} |
130 | 135 |
|
131 | 136 |
toDo(); |
... | ... | |
135 | 140 |
DistortedSurface.debugLists(); |
136 | 141 |
} |
137 | 142 |
|
143 |
int numRenders = 0; |
|
144 |
|
|
138 | 145 |
for(int i=0; i<mNumChildren; i++) |
139 | 146 |
{ |
140 |
mChildren.get(i).drawRecursive(time,this);
|
|
147 |
numRenders += mChildren.get(i).drawRecursive(mRender,time,this);
|
|
141 | 148 |
} |
149 |
|
|
150 |
return numRenders; |
|
142 | 151 |
} |
143 | 152 |
|
144 | 153 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
- workaround for the issue with flashing in StarWars
- return number of objects rendered from OutputSurface.render() and use this in Olympic
- rework tree isomorphism so that it now works even if we don't render the whole tree (and also we don't have to reset() the Tree anymore!)
- current a buf with tree isomorphism: Leaf Nodes have the same NodeData only if they agree in Surface AND Effects!