mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-22 10:35:16 +01:00
Improve redraw-trigger on settings-changes
This commit is contained in:
parent
77c1e42009
commit
73103eda3b
@ -43,6 +43,7 @@ export default {
|
||||
animation = animate(t => {
|
||||
let u = EasingFunctions.easeOutQuad(t);
|
||||
this.mapViewer.uniforms.sunlightStrength.value = startValue * (1-u) + targetValue * u;
|
||||
this.$bluemap.mapViewer.redraw();
|
||||
}, 300);
|
||||
}
|
||||
}
|
||||
|
@ -8,15 +8,15 @@
|
||||
|
||||
<Group :title="$t('lighting.title')">
|
||||
<Slider :value="mapViewer.uniforms.sunlightStrength.value" :min="0" :max="1" :step="0.01"
|
||||
@update="mapViewer.uniforms.sunlightStrength.value = $event">{{$t('lighting.sunlight')}}</Slider>
|
||||
@update="mapViewer.uniforms.sunlightStrength.value = $event; $bluemap.mapViewer.redraw()">{{$t('lighting.sunlight')}}</Slider>
|
||||
<Slider :value="mapViewer.uniforms.ambientLight.value" :min="0" :max="1" :step="0.01"
|
||||
@update="mapViewer.uniforms.ambientLight.value = $event">{{$t('lighting.ambientLight')}}</Slider>
|
||||
@update="mapViewer.uniforms.ambientLight.value = $event; $bluemap.mapViewer.redraw()">{{$t('lighting.ambientLight')}}</Slider>
|
||||
</Group>
|
||||
|
||||
<Group :title="$t('resolution.title')">
|
||||
<SimpleButton v-for="stage of qualityStages" :key="stage.name"
|
||||
:active="mapViewer.superSampling === stage.value"
|
||||
@action="$bluemap.mapViewer.superSampling = stage.value; $bluemap.saveUserSettings();"
|
||||
@action="$bluemap.mapViewer.superSampling = stage.value; $bluemap.saveUserSettings(); $bluemap.mapViewer.redraw()"
|
||||
>{{stage.name}}</SimpleButton>
|
||||
</Group>
|
||||
|
||||
|
@ -114,8 +114,8 @@ export class MapViewer {
|
||||
|
||||
this.lastFrame = 0;
|
||||
this.lastRedrawChange = 0;
|
||||
events.addEventListener("bluemapCameraMoved", () => this.lastRedrawChange = Date.now())
|
||||
events.addEventListener("bluemapTileLoaded", () => this.lastRedrawChange = Date.now())
|
||||
events.addEventListener("bluemapCameraMoved", this.redraw)
|
||||
events.addEventListener("bluemapTileLoaded", this.redraw)
|
||||
|
||||
// initialize
|
||||
this.initializeRootElement();
|
||||
@ -163,6 +163,8 @@ export class MapViewer {
|
||||
|
||||
this.camera.aspect = this.rootElement.clientWidth / this.rootElement.clientHeight;
|
||||
this.camera.updateProjectionMatrix();
|
||||
|
||||
this.redraw();
|
||||
};
|
||||
|
||||
/**
|
||||
@ -264,6 +266,13 @@ export class MapViewer {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Call to wake up the render-loop and render on high-fps for a while
|
||||
*/
|
||||
redraw = () => {
|
||||
this.lastRedrawChange = Date.now();
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
* The render-loop to update and possibly render a new frame.
|
||||
|
Loading…
Reference in New Issue
Block a user