summaryrefslogtreecommitdiffstats
path: root/cwd/shaders/block.fs
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-06-14 16:22:52 +0200
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-06-14 16:22:52 +0200
commitac8905602d1f221a71ddcdc86796344101276321 (patch)
tree21deaeb615d6789e7ddf14844cbf8faf0081af7e /cwd/shaders/block.fs
parent2017-06-07 (diff)
downloadAltCraft-ac8905602d1f221a71ddcdc86796344101276321.tar
AltCraft-ac8905602d1f221a71ddcdc86796344101276321.tar.gz
AltCraft-ac8905602d1f221a71ddcdc86796344101276321.tar.bz2
AltCraft-ac8905602d1f221a71ddcdc86796344101276321.tar.lz
AltCraft-ac8905602d1f221a71ddcdc86796344101276321.tar.xz
AltCraft-ac8905602d1f221a71ddcdc86796344101276321.tar.zst
AltCraft-ac8905602d1f221a71ddcdc86796344101276321.zip
Diffstat (limited to 'cwd/shaders/block.fs')
-rw-r--r--cwd/shaders/block.fs18
1 files changed, 14 insertions, 4 deletions
diff --git a/cwd/shaders/block.fs b/cwd/shaders/block.fs
index 8795fb2..d1716bc 100644
--- a/cwd/shaders/block.fs
+++ b/cwd/shaders/block.fs
@@ -1,11 +1,17 @@
#version 330 core
in vec2 UvPosition;
+in vec3 FragmentPosition;
+flat in int Block;
+flat in int State;
+in vec4 ndcPos;
-uniform int Block;
-uniform int State;
+//uniform int Block;
+//uniform int State;
uniform sampler2D textureAtlas;
uniform float time;
+uniform int isInside;
+uniform vec2 windowSize;
// TextureIndex: [most significant bit]<-...<-side[3bit]<-id[13]<-state[4]
layout(std140) uniform TextureIndexes { // binding point: 0
@@ -23,7 +29,6 @@ vec4 GetDepthColor();
vec4 GetCheckerColor();
vec4 VTC(int value);
-in vec3 FragmentPosition;
int GetBlockSide(){
int side=6;
if (FragmentPosition.y==-0.5)
@@ -62,10 +67,15 @@ vec3 hsv2rgb(vec3 c)
void main() {
+/*gl_FragColor = vec4(0,1,0,1);
+if (isInside==0)
+ gl_FragColor = vec4(1,0,0,1);
+ return;*/
vec4 BlockTextureCoords = GetTextureByBlockId();
vec2 AtlasCoords = TransformTextureCoord(BlockTextureCoords, UvPosition);
gl_FragColor = texture(textureAtlas, AtlasCoords);
- if (id==2 && side==1) { //Grass colorizing
+ if (gl_FragColor.a<0.1) discard;
+ if (Block==2 && side==1 || Block==18 || Block==31 && state==1 || Block==31 && state==2) { //Grass and leaves colorizing
const float BiomeColor = 0.275;
vec3 hsvColor = rgb2hsv(gl_FragColor.xyz);
hsvColor[0]+=BiomeColor;