Revision 5c84d9c2
Added by Leszek Koltunski about 3 years ago
src/main/java/org/distorted/library/effect/PostprocessEffect.java | ||
---|---|---|
98 | 98 |
|
99 | 99 |
private final ArrayList<Job> mJobs = new ArrayList<>(); |
100 | 100 |
private int mQualityLevel; |
101 |
private boolean mUseHaloDepth; |
|
101 | 102 |
|
102 | 103 |
float mQualityScale; |
103 | 104 |
|
... | ... | |
174 | 175 |
return mQualityLevel; |
175 | 176 |
} |
176 | 177 |
|
178 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
179 |
/** |
|
180 |
* Only for use by the library itself. |
|
181 |
* |
|
182 |
* @y.exclude |
|
183 |
*/ |
|
184 |
public boolean getHaloDepth() |
|
185 |
{ |
|
186 |
return mUseHaloDepth; |
|
187 |
} |
|
188 |
|
|
177 | 189 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
178 | 190 |
/** |
179 | 191 |
* Only for use by the library itself. |
... | ... | |
289 | 301 |
mJobs.add(new Job(MIPMAP,quality.getLevel())); |
290 | 302 |
InternalMaster.newSlave(this); |
291 | 303 |
} |
304 |
|
|
305 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
306 |
/** |
|
307 |
* When preprocessing - so drawning the 'halo' - do we also want to write the depth buffer? |
|
308 |
* If yes, the halo would cover the whole object; if no, it would be just around it (and possibly |
|
309 |
* could be covered by other similarly postprocessed objects nearby) |
|
310 |
* |
|
311 |
* @param depth should the halo around the object cover it or not? |
|
312 |
*/ |
|
313 |
public void setHaloDepth(boolean depth) |
|
314 |
{ |
|
315 |
mUseHaloDepth = depth; |
|
316 |
} |
|
292 | 317 |
} |
src/main/java/org/distorted/library/effectqueue/EffectQueuePostprocess.java | ||
---|---|---|
53 | 53 |
private static final int INDEX = EffectType.POSTPROCESS.ordinal(); |
54 | 54 |
|
55 | 55 |
private int mHalo; |
56 |
private boolean mUseHaloDepth; |
|
56 | 57 |
private float mR, mG, mB, mA; |
57 | 58 |
|
58 | 59 |
private static DistortedProgram mPreProgram; |
... | ... | |
90 | 91 |
// that (see preprocess()) |
91 | 92 |
array[NUM_FLOAT_UNIFORMS*i+5]=0.0f; |
92 | 93 |
|
93 |
if( mEffects[i].compute(array, NUM_FLOAT_UNIFORMS*i, currTime, step) ) |
|
94 |
PostprocessEffect effect = (PostprocessEffect)mEffects[i]; |
|
95 |
|
|
96 |
if( effect.compute(array, NUM_FLOAT_UNIFORMS*i, currTime, step) ) |
|
94 | 97 |
{ |
95 | 98 |
EffectMessageSender.newMessage(mEffects[i]); |
96 | 99 |
} |
97 | 100 |
|
98 | 101 |
halo = (int)array[NUM_FLOAT_UNIFORMS*i]; |
99 | 102 |
if( halo>mHalo ) mHalo = halo; |
103 |
|
|
104 |
// TODO (now only really works in case of 1 effect!) |
|
105 |
mUseHaloDepth = effect.getHaloDepth(); |
|
100 | 106 |
} |
101 | 107 |
|
102 | 108 |
// TODO (now only really works in case of 1 effect!) |
... | ... | |
173 | 179 |
|
174 | 180 |
InternalRenderState.setUpStencilMark(mA!=0.0f); |
175 | 181 |
InternalRenderState.disableBlending(); |
182 |
if( !mUseHaloDepth ) GLES30.glDepthMask(false); |
|
176 | 183 |
|
177 | 184 |
GLES30.glViewport(0, 0, width, height ); |
178 | 185 |
|
... | ... | |
198 | 205 |
|
199 | 206 |
InternalRenderState.restoreBlending(); |
200 | 207 |
InternalRenderState.unsetUpStencilMark(); |
208 |
if( !mUseHaloDepth ) GLES30.glDepthMask(true); |
|
201 | 209 |
|
202 | 210 |
return 1; |
203 | 211 |
} |
src/main/java/org/distorted/library/main/InternalRenderState.java | ||
---|---|---|
51 | 51 |
private int blendSrc, blendDst; |
52 | 52 |
} |
53 | 53 |
|
54 |
private RenderState mState; // state the current object wants to have |
|
55 |
static private RenderState cState = new RenderState(); // current OpenGL Stave |
|
56 |
static private RenderState sState = new RenderState(); // saved OpenGL state |
|
54 |
private final RenderState mState; // state the current object wants to have
|
|
55 |
static private final RenderState cState = new RenderState(); // current OpenGL Stave
|
|
56 |
static private final RenderState sState = new RenderState(); // saved OpenGL state
|
|
57 | 57 |
|
58 | 58 |
private int mClear; |
59 | 59 |
|
Also available in: Unified diff
Set possibility for the Postprocessing effects to eclipse the whole object or only work at the edges.