Revision ca4521e3
Added by Leszek Koltunski over 7 years ago
| src/main/java/org/distorted/library/effect/PostprocessEffectGlow.java | ||
|---|---|---|
| 32 | 32 |
|
| 33 | 33 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 34 | 34 |
/** |
| 35 |
* Add a (colored) glow about each object in the Framebuffer.
|
|
| 35 |
* Add a (colored) glow around an object.
|
|
| 36 | 36 |
*/ |
| 37 | 37 |
public class PostprocessEffectGlow extends PostprocessEffect |
| 38 | 38 |
{
|
| src/main/res/raw/main_fragment_shader.glsl | ||
|---|---|---|
| 32 | 32 |
////////////////////////////////////////////////////////////////////////////////////////////// |
| 33 | 33 |
// per-pixel linked list. Order Independent Transparency. |
| 34 | 34 |
|
| 35 |
in vec2 v_Pixel; // location of the current fragment, in pixels |
|
| 36 | 35 |
uniform uvec2 u_Size; |
| 37 | 36 |
uniform uint u_numRecords; |
| 38 | 37 |
|
| src/main/res/raw/main_vertex_shader.glsl | ||
|---|---|---|
| 28 | 28 |
out vec3 v_Normal; // |
| 29 | 29 |
out vec2 v_TexCoordinate; // |
| 30 | 30 |
|
| 31 |
#ifdef OIT |
|
| 32 |
out vec2 v_Pixel; // 2D pixel coords in window space |
|
| 33 |
uniform uvec2 u_Size; // size of the output surface, in pixels. |
|
| 34 |
#endif |
|
| 35 |
|
|
| 36 | 31 |
uniform vec3 u_objD; // half of object width x half of object height X half the depth; |
| 37 | 32 |
// point (0,0,0) is the center of the object |
| 38 | 33 |
|
| ... | ... | |
| 161 | 156 |
#endif |
| 162 | 157 |
|
| 163 | 158 |
v_Position = v; |
| 164 |
|
|
| 165 |
#ifdef OIT |
|
| 166 |
v_Pixel = (a_Position.xy + 0.5) * vec2(u_Size); |
|
| 167 |
#endif |
|
| 168 |
|
|
| 169 | 159 |
v_endPosition = v + (0.3*u_objD.x)*n; |
| 170 | 160 |
v_TexCoordinate = a_TexCoordinate; |
| 171 | 161 |
v_Normal = normalize(vec3(u_MVMatrix*vec4(n,0.0))); |
Also available in: Unified diff
Simplify Main OIT shader.