first commit
This commit is contained in:
commit
42778a9d46
13 changed files with 1192 additions and 0 deletions
19
shaders/sphere.frag
Normal file
19
shaders/sphere.frag
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#version 300 es
|
||||
|
||||
// fragment shaders don't have a default precision so we need
|
||||
// to pick one. mediump is a good default. It means "medium precision"
|
||||
precision highp float;
|
||||
|
||||
in vec3 v_surfaceToLight;
|
||||
|
||||
uniform vec4 u_color;
|
||||
uniform vec3 u_lightPos;
|
||||
|
||||
out vec4 outColor;
|
||||
|
||||
void main() {
|
||||
vec3 surfaceToLightDirection = normalize(v_surfaceToLight);
|
||||
outColor = u_color;
|
||||
float light = 1.0;
|
||||
//outColor.rgb *= surfaceToLightDirection;
|
||||
}
|
||||
21
shaders/sphere.vert
Normal file
21
shaders/sphere.vert
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#version 300 es
|
||||
|
||||
in vec4 a_position;
|
||||
uniform mat4 u_world;
|
||||
uniform mat4 u_matrix;
|
||||
uniform vec3 u_lightPos;
|
||||
uniform vec3 u_light;
|
||||
uniform float u_pointSize;
|
||||
|
||||
out vec3 v_surfaceToLight;
|
||||
|
||||
void main() {
|
||||
// convert the position from pixels to 0.0 to 1.0
|
||||
vec4 pos = a_position * u_matrix;
|
||||
gl_Position = pos;
|
||||
gl_PointSize = u_pointSize;
|
||||
|
||||
vec3 surfaceWorldPosition = (u_world * pos).xyz;
|
||||
|
||||
v_surfaceToLight = u_lightPos - surfaceWorldPosition;
|
||||
}
|
||||
13
shaders/test.frag
Normal file
13
shaders/test.frag
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#version 300 es
|
||||
|
||||
// fragment shaders don't have a default precision so we need
|
||||
// to pick one. mediump is a good default. It means "medium precision"
|
||||
precision mediump float;
|
||||
|
||||
uniform vec4 u_color;
|
||||
|
||||
out vec4 outColor;
|
||||
|
||||
void main() {
|
||||
outColor = u_color;
|
||||
}
|
||||
11
shaders/test.vert
Normal file
11
shaders/test.vert
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#version 300 es
|
||||
|
||||
in vec2 a_position;
|
||||
void main() {
|
||||
// convert the position from pixels to 0.0 to 1.0
|
||||
vec2 scale = a_position / vec2(255.0, 255.0);
|
||||
vec2 remap = scale * 2.0;
|
||||
vec2 space = remap - 1.0;
|
||||
space.y = space.y * 0.85;
|
||||
gl_Position = vec4(space, 0,1);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue