Skip to content

Commit 34a67c7

Browse files
committed
Loosen the camera angle bounds
1 parent 18b4b0b commit 34a67c7

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

BlueMapCommon/webapp/src/js/MapViewer.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export class MapViewer {
5555
camera: null,
5656
controlsManager: null,
5757
uniforms: {
58+
distance: { value: 0 },
5859
sunlightStrength: { value: 1 },
5960
ambientLight: { value: 0 },
6061
skyColor: { value: new Color(0.5, 0.5, 1) },
@@ -303,6 +304,7 @@ export class MapViewer {
303304
this.camera.position.z -= sZ;
304305

305306
// update uniforms
307+
this.data.uniforms.distance.value = this.controlsManager.distance;
306308
this.data.uniforms.hiresTileMap.value.pos.copy(this.map.hiresTileManager.centerTile);
307309
this.data.uniforms.hiresTileMap.value.translate.set(
308310
this.map.data.hires.translate.x - sX,
@@ -374,6 +376,7 @@ export class MapViewer {
374376
this.renderer.initTexture(texture);
375377
}
376378

379+
this.data.uniforms.distance.value = this.controlsManager.distance;
377380
this.data.uniforms.skyColor.value = map.data.skyColor;
378381
this.data.uniforms.ambientLight.value = map.data.ambientLight;
379382
this.data.uniforms.hiresTileMap.value.map = map.hiresTileManager.tileMap.texture;

BlueMapCommon/webapp/src/js/controls/map/MapControls.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ export class MapControls {
214214
}
215215

216216
getMaxPerspectiveAngleForDistance(distance) {
217-
return MathUtils.clamp((1 - Math.pow(Math.max(distance - 5, 0.001) / 500, 0.5)) * HALF_PI,0, HALF_PI)
217+
return MathUtils.clamp((1 - Math.pow(Math.max(distance - 5, 0.001) * 0.0005, 0.5)) * HALF_PI,0, HALF_PI)
218218
}
219219

220220
initializeHammer() {

BlueMapCommon/webapp/src/js/map/lowres/LowresFragmentShader.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ struct TileMap {
4141
vec2 pos;
4242
};
4343
44+
uniform float distance;
4445
uniform float sunlightStrength;
4546
uniform float ambientLight;
4647
uniform TileMap hiresTileMap;
@@ -52,7 +53,7 @@ uniform float lodScale;
5253
5354
varying vec3 vPosition;
5455
varying vec3 vWorldPosition;
55-
varying float vDistance;
56+
//varying float vDistance;
5657
5758
float metaToHeight(vec4 meta) {
5859
float heightUnsigned = meta.g * 65280.0 + meta.b * 255.0;
@@ -78,7 +79,7 @@ vec2 posToMetaUV(vec2 pos) {
7879
7980
void main() {
8081
//discard if hires tile is loaded at that position
81-
if (vDistance < 900.0 && texture(hiresTileMap.map, ((vWorldPosition.xz - hiresTileMap.translate) / hiresTileMap.scale - hiresTileMap.pos) / hiresTileMap.size + 0.5).r > 0.75) discard;
82+
if (distance < 1000.0 && texture(hiresTileMap.map, ((vWorldPosition.xz - hiresTileMap.translate) / hiresTileMap.scale - hiresTileMap.pos) / hiresTileMap.size + 0.5).r > 0.75) discard;
8283
8384
vec4 color = texture(textureImage, posToColorUV(vPosition.xz));
8485
color.a = 1.0; // don't use alpha channel
@@ -96,7 +97,7 @@ void main() {
9697
float aoStrength = 0.0;
9798
if(lod == 1.0) {
9899
aoStrength = smoothstep(PI - 0.8, PI - 0.2, acos(-clamp(viewMatrix[1][2], 0.0, 1.0)));
99-
aoStrength *= 1.0 - smoothstep(300.0, 500.0, vDistance);
100+
aoStrength *= 1.0 - smoothstep(200.0, 600.0, distance);
100101
101102
if (aoStrength > 0.0) {
102103
const float r = 3.0;

BlueMapCommon/webapp/src/js/map/lowres/LowresVertexShader.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ uniform vec2 textureSize;
3434
3535
varying vec3 vPosition;
3636
varying vec3 vWorldPosition;
37-
varying float vDistance;
37+
//varying float vDistance;
3838
3939
float metaToHeight(vec4 meta) {
4040
float heightUnsigned = meta.g * 65280.0 + meta.b * 255.0;
@@ -59,7 +59,7 @@ void main() {
5959
vec4 viewPos = viewMatrix * worldPos;
6060
6161
vWorldPosition = worldPos.xyz;
62-
vDistance = -viewPos.z;
62+
//vDistance = -viewPos.z;
6363
6464
gl_Position = projectionMatrix * viewPos;
6565

0 commit comments

Comments
 (0)