Revision e137d4f5
Added by Leszek Koltunski over 8 years ago
| src/main/java/org/distorted/library/DistortedOutputSurface.java | ||
|---|---|---|
| 121 | 121 |
{
|
| 122 | 122 |
int numRenders = 0; |
| 123 | 123 |
DistortedNode child; |
| 124 |
EffectQueuePostprocess lastP=null, currP=null;
|
|
| 125 |
long lastB=0, currB=0;
|
|
| 124 |
EffectQueuePostprocess lastP=null, currP; |
|
| 125 |
long lastB=0, currB; |
|
| 126 | 126 |
|
| 127 | 127 |
// Render all children, one by one. |
| 128 | 128 |
// If there are no postprocessing effects, just render to THIS. |
| 129 | 129 |
// Otherwise, render to a buffer and on each change of Postprocessing Bucket, |
| 130 | 130 |
// apply the postprocessing to a whole buffer and merge it. |
| 131 |
// |
|
| 132 |
// TODO: in order for this to be efficient, the children really need to be sorted |
|
| 133 |
// to keep the same Buckets together. |
|
| 134 | 131 |
|
| 135 | 132 |
for(int i=0; i<num; i++) |
| 136 | 133 |
{
|
| ... | ... | |
| 138 | 135 |
currP = child.getPostprocess(); |
| 139 | 136 |
currB = currP.getBucket(); |
| 140 | 137 |
|
| 141 |
if( i>0 && currB!=lastB ) |
|
| 142 |
{
|
|
| 143 |
numRenders += lastP.postprocess(time,this); |
|
| 144 |
} |
|
| 138 |
if( i>0 && currB!=lastB ) numRenders += lastP.postprocess(time,this); |
|
| 145 | 139 |
|
| 146 |
if( currB==0 ) |
|
| 147 |
{
|
|
| 148 |
numRenders += child.draw(time,this); |
|
| 149 |
} |
|
| 140 |
if( currB==0 ) numRenders += child.draw(time,this); |
|
| 150 | 141 |
else |
| 151 | 142 |
{
|
| 152 | 143 |
if( mBuffer1==null ) |
| ... | ... | |
| 156 | 147 |
} |
| 157 | 148 |
|
| 158 | 149 |
numRenders += child.draw(time,mBuffer1); |
| 150 |
if( i==num-1 ) numRenders += currP.postprocess(time,this); |
|
| 159 | 151 |
} |
| 160 | 152 |
|
| 161 | 153 |
lastP = currP; |
| 162 | 154 |
lastB = currB; |
| 163 | 155 |
} |
| 164 | 156 |
|
| 165 |
if( currB!=0 ) |
|
| 166 |
{
|
|
| 167 |
numRenders += currP.postprocess(time,this); |
|
| 168 |
} |
|
| 169 |
|
|
| 170 | 157 |
return numRenders; |
| 171 | 158 |
} |
| 172 | 159 |
|
Also available in: Unified diff
Minor.