From ac8905602d1f221a71ddcdc86796344101276321 Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Wed, 14 Jun 2017 19:22:52 +0500 Subject: 2017-06-14 --- cwd/shaders/block.fs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'cwd/shaders/block.fs') 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; -- cgit v1.2.3