Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions shaders/entity.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.


#Group all flat-lighting entity together.
entity.1=text_display minecraft:entity_flame
entity.2=item_frame glow_item_frame
7 changes: 6 additions & 1 deletion shaders/gbuffers_textured.vsh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#endif

//Get Entity id.
uniform int entityId;
attribute float mc_Entity;

//Model * view matrix and it's inverse.
Expand All @@ -21,6 +22,7 @@ varying vec2 coord1;
uniform int frameCounter;

uniform float viewWidth, viewHeight;
uniform ivec2 atlasSize;

#include "/bsl_lib/util/jitter.glsl"

Expand All @@ -34,10 +36,13 @@ void main()
gl_Position = gl_ProjectionMatrix * gbufferModelView * vec4(pos,1);
gl_FogFragCoord = length(pos);

//Item Frame Map
bool isMap = entityId==2 && atlasSize.x < 5.0;

//Calculate view space normal.
vec3 normal = normalize(gl_NormalMatrix * gl_Normal);
//Use flat for flat "blocks" or world space normal for solid blocks.
normal = (mc_Entity==1.) ? vec3(0,1,0) : (gbufferModelViewInverse * vec4(normal,0)).xyz;
normal = (mc_Entity==1. || entityId==1 || isMap) ? vec3(0,1,0) : (gbufferModelViewInverse * vec4(normal,0)).xyz;

//Calculate simple lighting. Thanks to @PepperCode1
float light = min(normal.x * normal.x * 0.6f + normal.y * normal.y * 0.25f * (3.0f + normal.y) + normal.z * normal.z * 0.8f, 1.0f);
Expand Down