Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

Commit

Permalink
MINOR: Add dynamic change of shadow map resolution (#2239)
Browse files Browse the repository at this point in the history
Signed-off-by: Jonathan Stichbury <2533428+nzjony@users.noreply.github.com>
  • Loading branch information
nzjony committed Jul 20, 2021
1 parent 383e063 commit 917ad87
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion @here/harp-examples/src/real-time-shadows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ const guiOptions = {
time: date.getHours() + date.getMinutes() / 60,
timeIndicator: `${date.getHours()}:${date.getMinutes()}`,
debugCamera: false,
enableRasterTiles: false
enableRasterTiles: false,
textureSquareSize: 1024
};
// Reference solar noon time is used to calculate time offsets at specific coordinates.
const refSolarNoon = SunCalc.getTimes(date, 0, 0).solarNoon;
Expand Down Expand Up @@ -297,6 +298,13 @@ function addGuiElements() {
map.addDataSource(hereWebTileDataSource);
}
});
gui.add(guiOptions, "textureSquareSize", 256, 4096, 32).onChange(size => {
(sun.shadow.map as any).dispose();
(sun.shadow as any).map = null;
sun.shadow.mapSize.width = size;
sun.shadow.mapSize.height = size;
map.update();
});
}

export namespace RealTimeShadows {
Expand Down

0 comments on commit 917ad87

Please sign in to comment.