forked from google/filament
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new post-process functions (google#1400)
- Loading branch information
Showing
8 changed files
with
131 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
LAYOUT_LOCATION(0) in highp vec2 vertex_uv; | ||
|
||
LAYOUT_LOCATION(0) out vec4 fragColor; | ||
|
||
/** @public-api */ | ||
vec2 getUV() { | ||
return vertex_uv; | ||
} | ||
|
||
struct PostProcessInputs { | ||
vec4 color; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
void main() { | ||
PostProcessInputs inputs; | ||
inputs.color = vec4(1.0); | ||
|
||
// Invoke user code | ||
postProcess(inputs); | ||
|
||
fragColor = inputs.color; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
LAYOUT_LOCATION(LOCATION_POSITION) in vec4 position; | ||
|
||
LAYOUT_LOCATION(0) out vec2 vertex_uv; | ||
|
||
void main() { | ||
vertex_uv = (position.xy * 0.5 + 0.5) * frameUniforms.resolution.xy; | ||
|
||
gl_Position = position; | ||
|
||
#if defined(TARGET_METAL_ENVIRONMENT) | ||
// Metal texture space is vertically flipped that of OpenGL's, so flip the Y coords so we sample | ||
// the frame correctly. Vulkan doesn't need this fix because its clip space is mirrored | ||
// (the Y axis points down the screen). | ||
gl_Position.y = -gl_Position.y; | ||
#endif | ||
} |