Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplified shader system to only reference one file
- Loading branch information
Showing
6 changed files
with
53 additions
and
48 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
varying vec3 N, L; | ||
varying vec2 coord; | ||
uniform sampler2D sc_texture; | ||
|
||
#ifdef SC_VERTEX_SHADER | ||
void | ||
main(void) | ||
{ | ||
coord = sc_texcoord; | ||
gl_Position = sc_mvp_matrix * vec4(sc_vertex, 1.0); | ||
N = sc_normal_matrix * sc_normal; | ||
L = vec3(0.3, 3.0, 10.0); | ||
} | ||
#endif | ||
|
||
#ifdef SC_FRAGMENT_SHADER | ||
void | ||
main(void) | ||
{ | ||
float intensity = max(0.0, dot(normalize(N), normalize(L))); | ||
gl_FragColor = texture2D(sc_texture, coord); | ||
gl_FragColor.rgb *= intensity; | ||
} | ||
#endif |
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 was deleted.
Oops, something went wrong.
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