summaryrefslogtreecommitdiffstats
path: root/shaders/fshader.fsh
diff options
context:
space:
mode:
Diffstat (limited to 'shaders/fshader.fsh')
-rw-r--r--shaders/fshader.fsh30
1 files changed, 30 insertions, 0 deletions
diff --git a/shaders/fshader.fsh b/shaders/fshader.fsh
new file mode 100644
index 0000000..f67bbfc
--- /dev/null
+++ b/shaders/fshader.fsh
@@ -0,0 +1,30 @@
+//precision highp float;
+uniform mediump vec4 color;
+varying highp vec4 v_AmbientAndDiffuseColor;
+varying highp vec4 v_SpecularColor;
+varying highp float v_AmbientLightBrightness;
+varying highp float v_DiffuseBrightness;
+varying highp float v_SpecularBrightness;
+varying highp vec2 v_TexCoord;
+uniform highp vec2 u_viewPortCenter;
+uniform highp float u_diameterSquare;
+
+uniform bool u_TextureEnabled;
+uniform sampler2D s_Texture;
+
+//highp vec2 centerVec;
+
+
+void main(void)
+{
+// centerVec = gl_FragCoord.xy - u_viewPortCenter;
+// if(dot(centerVec, centerVec) > u_diameterSquare)
+// discard;
+
+ if(u_TextureEnabled)
+ gl_FragColor = texture2D(s_Texture, v_TexCoord) * (v_AmbientLightBrightness + v_DiffuseBrightness)
+ + v_SpecularBrightness * v_SpecularColor;
+ else
+ gl_FragColor = v_AmbientAndDiffuseColor * (v_AmbientLightBrightness + v_DiffuseBrightness)
+ + v_SpecularBrightness * v_SpecularColor;
+}