Skip to content

Commit 0bb03a5

Browse files
author
eaglercraft
committed
u35
1 parent 16648bc commit 0bb03a5

40 files changed

+340
-154
lines changed

desktopRuntime/resources/assets/eagler/glsl/core.fsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ void main() {
170170

171171
#ifdef COMPILE_ENABLE_FOG
172172
vec3 fogPos = v_position4f.xyz / v_position4f.w;
173-
float dist = sqrt(dot(fogPos, fogPos));
173+
float dist = length(fogPos);
174174
float fogDensity = u_fogParameters4f.y;
175175
float fogStart = u_fogParameters4f.z;
176176
float fogEnd = u_fogParameters4f.w;

desktopRuntime/resources/assets/eagler/glsl/deferred/deferred_fog.fsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ void main() {
6969
fragPos4f.xyz /= fragPos4f.w;
7070
fragPos4f.w = 1.0;
7171

72-
float l = sqrt(dot(fragPos4f.xyz, fragPos4f.xyz));
72+
float l = length(fragPos4f.xyz);
7373
#ifdef COMPILE_FOG_LINEAR
7474
float f = (l - u_linearFogParam2f.x) / (u_linearFogParam2f.y - u_linearFogParam2f.x);
7575
#else

desktopRuntime/resources/assets/eagler/glsl/deferred/forward_core.fsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ void main() {
431431
float type = u_fogParameters4f.x - atmos;
432432
fogBlend4f = mix(u_fogColorLight4f, u_fogColorDark4f, lightmapCoords2f.g);
433433

434-
float l = sqrt(dot(v_position4f.xyz, v_position4f.xyz));
434+
float l = length(v_position4f.xyz);
435435
if(type == 1.0) {
436436
f = (l - u_fogParameters4f.z) / (u_fogParameters4f.w - u_fogParameters4f.z);
437437
}else {

desktopRuntime/resources/assets/eagler/glsl/deferred/forward_glass_highlights.fsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ void main() {
292292
fogFade = mix(u_fogColorDark4f.a, u_fogColorLight4f.a, lightmapCoords2f.g);
293293

294294
float f;
295-
float l = sqrt(dot(v_position4f.xyz, v_position4f.xyz));
295+
float l = length(v_position4f.xyz);
296296
if(type == 1.0) {
297297
f = (l - u_fogParameters4f.z) / (u_fogParameters4f.w - u_fogParameters4f.z);
298298
}else {

desktopRuntime/resources/assets/eagler/glsl/deferred/realistic_water_render.fsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ void main() {
397397
float type = u_fogParameters4f.x - atmos;
398398
fogBlend4f = mix(u_fogColorLight4f, u_fogColorDark4f, lightmapCoords2f.g);
399399

400-
float f, l = sqrt(dot(v_position4f.xyz, v_position4f.xyz));
400+
float f, l = length(v_position4f.xyz);
401401
if(type == 1.0) {
402402
f = (l - u_fogParameters4f.z) / (u_fogParameters4f.w - u_fogParameters4f.z);
403403
}else {

desktopRuntime/resources/assets/eagler/glsl/deferred/shader_pack_info.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "§eHigh Performance PBR",
33
"desc": "Pack made from scratch specifically for this client, designed to give what I call the best balance between quality and performance possible in a browser but obviously that's just my opinion",
4-
"vers": "1.2.0",
4+
"vers": "1.2.1",
55
"author": "lax1dude",
66
"api_vers": 1,
77
"features": [

desktopRuntime/resources/assets/eagler/glsl/dynamiclights/accel_particle_dynamiclights.fsh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ void main() {
4848
}
4949

5050
vec4 light;
51+
float blockLight = v_lightmap2f.x;
5152
float diffuse = 0.0;
53+
float len;
5254
if(u_dynamicLightCount1i > 0) {
5355
vec4 worldPosition4f = u_inverseViewMatrix4f * v_position4f;
5456
worldPosition4f.xyz /= worldPosition4f.w;
@@ -57,11 +59,13 @@ void main() {
5759
for(int i = 0; i < safeLightCount; ++i) {
5860
light = u_dynamicLightArray[i];
5961
light.xyz = light.xyz - worldPosition4f.xyz;
60-
diffuse += max(dot(normalize(light.xyz), normalVector3f) * 0.8 + 0.2, 0.0) * max(light.w - sqrt(dot(light.xyz, light.xyz)), 0.0);
62+
len = length(light.xyz);
63+
diffuse += max(dot(light.xyz / len, normalVector3f) * 0.8 + 0.2, 0.0) * max(light.w - len, 0.0);
6164
}
65+
blockLight = min(blockLight + diffuse * 0.066667, 1.0);
6266
}
6367

64-
color *= texture(u_lightmapTexture, vec2(min(v_lightmap2f.x + diffuse * 0.066667, 1.0), v_lightmap2f.y));
68+
color *= texture(u_lightmapTexture, vec2(blockLight, v_lightmap2f.y));
6569

6670
output4f = color;
6771
}

desktopRuntime/resources/assets/eagler/glsl/dynamiclights/core_dynamiclights.fsh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,12 @@ void main() {
152152

153153
#ifdef COMPILE_ENABLE_LIGHTMAP
154154
float diffuse = 0.0;
155+
#ifdef COMPILE_LIGHTMAP_ATTRIB
156+
float blockLight = v_lightmap2f.x;
157+
#else
158+
float blockLight = u_textureCoords02.x;
159+
#endif
160+
float len;
155161
vec4 light;
156162
if(u_dynamicLightCount1i > 0) {
157163
vec4 worldPosition4f = u_inverseViewMatrix4f * v_position4f;
@@ -161,13 +167,15 @@ void main() {
161167
for(int i = 0; i < safeLightCount; ++i) {
162168
light = u_dynamicLightArray[i];
163169
light.xyz = light.xyz - worldPosition4f.xyz;
164-
diffuse += max(dot(normalize(light.xyz), normalVector3f) * 0.8 + 0.2, 0.0) * max(light.w - sqrt(dot(light.xyz, light.xyz)), 0.0);
170+
len = length(light.xyz);
171+
diffuse += max(dot(light.xyz / len, normalVector3f) * 0.8 + 0.2, 0.0) * max(light.w - len, 0.0);
165172
}
173+
blockLight = min(blockLight + diffuse * 0.066667, 1.0);
166174
}
167175
#ifdef COMPILE_LIGHTMAP_ATTRIB
168-
color *= texture(u_samplerLightmap, vec2(min(v_lightmap2f.x + diffuse * 0.066667, 1.0), v_lightmap2f.y));
176+
color *= texture(u_samplerLightmap, vec2(blockLight, v_lightmap2f.y));
169177
#else
170-
color *= texture(u_samplerLightmap, vec2(min(u_textureCoords02.x + diffuse * 0.066667, 1.0), u_textureCoords02.y));
178+
color *= texture(u_samplerLightmap, vec2(blockLight, u_textureCoords02.y));
171179
#endif
172180
#endif
173181

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Change to 0 to disable blur
2+
enable_blur=1
46 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)