Skip to content

Commit

Permalink
Deploying to gh-pages from @ 6556fee 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
kainino0x committed Oct 1, 2024
1 parent 2c77536 commit a3cef22
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 11 deletions.
20 changes: 16 additions & 4 deletions sample/particles/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sample/particles/main.js.map

Large diffs are not rendered by default.

24 changes: 18 additions & 6 deletions sample/particles/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ function configureContext() {
toneMapping: { mode: simulationParams.toneMappingMode },
alphaMode: 'premultiplied',
});
hdrFolder.name = getHdrFolderName();
}

const particlesBuffer = device.createBuffer({
Expand Down Expand Up @@ -346,13 +347,24 @@ hdrFolder
hdrFolder.add(simulationParams, 'brightnessFactor', 0, 4, 0.1);
hdrFolder.open();
const hdrMediaQuery = window.matchMedia('(dynamic-range: high)');
function updateHdrFolderName() {
hdrFolder.name = `HDR settings ${
hdrMediaQuery.matches ? '' : '⚠️ Your display is not compatible'
}`;
function getHdrFolderName() {
if (!hdrMediaQuery.matches) {
return "HDR settings ⚠️ Display isn't compatible";
}
if (!('getConfiguration' in GPUCanvasContext.prototype)) {
return 'HDR settings';
}
if (
simulationParams.toneMappingMode === 'extended' &&
context.getConfiguration().toneMapping?.mode !== 'extended'
) {
return "HDR settings ⚠️ Browser doesn't support HDR canvas";
}
return 'HDR settings';
}
updateHdrFolderName();
hdrMediaQuery.onchange = updateHdrFolderName;
hdrMediaQuery.onchange = () => {
hdrFolder.name = getHdrFolderName();
};

const computePipeline = device.createComputePipeline({
layout: 'auto',
Expand Down

0 comments on commit a3cef22

Please sign in to comment.