-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e0603e2
Showing
108 changed files
with
4,652 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// NOTE: This file creates a service worker that cross-origin-isolates the page (read more here: https://web.dev/coop-coep/) which allows us to use wasm threads. | ||
// Normally you would set the COOP and COEP headers on the server to do this, but Github Pages doesn't allow this, so this is a hack to do that. | ||
|
||
/* Edited version of: coi-serviceworker v0.1.6 - Guido Zuidhof, licensed under MIT */ | ||
// From here: https://github.com/gzuidhof/coi-serviceworker | ||
if(typeof window === 'undefined') { | ||
self.addEventListener("install", () => self.skipWaiting()); | ||
self.addEventListener("activate", e => e.waitUntil(self.clients.claim())); | ||
|
||
async function handleFetch(request) { | ||
if(request.cache === "only-if-cached" && request.mode !== "same-origin") { | ||
return; | ||
} | ||
|
||
if(request.mode === "no-cors") { // We need to set `credentials` to "omit" for no-cors requests, per this comment: https://bugs.chromium.org/p/chromium/issues/detail?id=1309901#c7 | ||
request = new Request(request.url, { | ||
cache: request.cache, | ||
credentials: "omit", | ||
headers: request.headers, | ||
integrity: request.integrity, | ||
destination: request.destination, | ||
keepalive: request.keepalive, | ||
method: request.method, | ||
mode: request.mode, | ||
redirect: request.redirect, | ||
referrer: request.referrer, | ||
referrerPolicy: request.referrerPolicy, | ||
signal: request.signal, | ||
}); | ||
} | ||
|
||
let r = await fetch(request).catch(e => console.error(e)); | ||
|
||
if(r.status === 0) { | ||
return r; | ||
} | ||
|
||
const headers = new Headers(r.headers); | ||
headers.set("Cross-Origin-Embedder-Policy", "credentialless"); // or: require-corp | ||
headers.set("Cross-Origin-Opener-Policy", "same-origin"); | ||
|
||
return new Response(r.body, { status: r.status, statusText: r.statusText, headers }); | ||
} | ||
|
||
self.addEventListener("fetch", function(e) { | ||
e.respondWith(handleFetch(e.request)); // respondWith must be executed synchonously (but can be passed a Promise) | ||
}); | ||
|
||
} else { | ||
(async function() { | ||
if(window.crossOriginIsolated !== false) return; | ||
|
||
let registration = await navigator.serviceWorker.register(window.document.currentScript.src).catch(e => console.error("COOP/COEP Service Worker failed to register:", e)); | ||
if(registration) { | ||
console.log("COOP/COEP Service Worker registered", registration.scope); | ||
|
||
registration.addEventListener("updatefound", () => { | ||
console.log("Reloading page to make use of updated COOP/COEP Service Worker."); | ||
window.location.reload(); | ||
}); | ||
|
||
// If the registration is active, but it's not controlling the page | ||
if(registration.active && !navigator.serviceWorker.controller) { | ||
console.log("Reloading page to make use of COOP/COEP Service Worker."); | ||
window.location.reload(); | ||
} | ||
} | ||
})(); | ||
} | ||
|
||
// Code to deregister: | ||
// let registrations = await navigator.serviceWorker.getRegistrations(); | ||
// for(let registration of registrations) { | ||
// await registration.unregister(); | ||
// } |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta name="description" content="Diligent Graphics"> | ||
<title>Diligent Graphics</title> | ||
<link rel="icon" href="images/header/diligentgraphics-icon.ico" type="image/x-icon"> | ||
<link rel="stylesheet" href="styles.css"> | ||
</head> | ||
<body> | ||
|
||
<header> | ||
<a href="https://diligentgraphics.com/" target="_blank"> | ||
<img src="images/header/diligentgraphics-logo.png" alt="Diligent Graphics" class="logo"> | ||
</a> | ||
<a href="https://github.com/DiligentGraphics/DiligentEngine" class="github-link" target="_blank"> | ||
<img src="images/header/github-mark-white.png" alt="GitHub"> | ||
</a> | ||
</header> | ||
|
||
<div class="container"> | ||
<nav> | ||
<h2>Categories</h2> | ||
<ul> | ||
<li><a href="#tutorials">Tutorials</a></li> | ||
<li><a href="#samples">Samples</a></li> | ||
<li><a href="#known-issues">Known issues</a></li> | ||
</ul> | ||
</nav> | ||
|
||
<div class="content"> | ||
<div class="search-bar"> | ||
<input type="text" placeholder="Search Example"> | ||
<span class="search-icon"></span> | ||
</div> | ||
|
||
<section id="tutorials"> | ||
<h2>Tutorials</h2> | ||
<div class="grid" id="tutorialGrid"> | ||
</div> | ||
</section> | ||
|
||
<section id="samples"> | ||
<h2>Samples</h2> | ||
<div class="grid" id="samplesGrid"> | ||
</div> | ||
</section> | ||
<section id="known-issues"> | ||
<h2>Known issues</h2> | ||
<ul> | ||
<li>14 - Compute Shader tutorial doesn't work on WebGL.</li> | ||
<li>18 - Queries tutorial doesn't work on WebGPU.</li> | ||
<li>19 - Render Passes tutorial doesn't work on WebGL.</li> | ||
<li>Atmosphere sample doesn't work on WebGL.</li> | ||
<li>Shadows sample has artifacts on WebGL.</li> | ||
</ul> | ||
</section> | ||
</div> | ||
</div> | ||
|
||
<script src="enable-threads.js"></script> | ||
<script src="script.js"></script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,206 @@ | ||
const tutorials = [ | ||
{ | ||
id: "Tutorial01_HelloTriangle", | ||
title: "01 - Hello Triangle", | ||
description: "This tutorial demonstrates the basics of Diligent Engine API. It shows how to create shaders, pipeline state object and how to render a simple triangle.", | ||
image: "images/content/tutorials/Tutorial01_HelloTriangle.png", | ||
tutorialLink: "wasm-modules/Tutorial01_HelloTriangle/Tutorial01_HelloTriangle.html", | ||
githubLink: "https://github.com/DiligentGraphics/DiligentSamples/tree/master/Tutorials/Tutorial01_HelloTriangle" | ||
}, | ||
{ | ||
id: "Tutorial02_Cube", | ||
title: "02 - Cube", | ||
description: "This tutorial demonstrates how to render an actual 3D object, a cube. It shows how to load shaders from files, create and use vertex, index and uniform buffers.", | ||
image: "images/content/tutorials/Tutorial02_Cube.gif", | ||
tutorialLink: "wasm-modules/Tutorial02_Cube/Tutorial02_Cube.html", | ||
githubLink: "https://github.com/DiligentGraphics/DiligentSamples/tree/master/Tutorials/Tutorial02_Cube" | ||
}, | ||
{ | ||
id: "Tutorial03_Texturing", | ||
title: "03 - Texturing", | ||
description: "This tutorial demonstrates how to apply a texture to a 3D object. It shows how to load a texture from file, create shader resource binding object and how to sample a texture in the shader.", | ||
image: "images/content/tutorials/Tutorial03_Texturing.gif", | ||
tutorialLink: "wasm-modules/Tutorial03_Texturing/Tutorial03_Texturing.html", | ||
githubLink: "https://github.com/DiligentGraphics/DiligentSamples/tree/master/Tutorials/Tutorial03_Texturing" | ||
}, | ||
{ | ||
id: "Tutorial04_Instancing", | ||
title: "04 - Instancing", | ||
description: "This tutorial demonstrates how to use instancing to render multiple copies of one object using unique transformation matrix for every copy.", | ||
image: "images/content/tutorials/Tutorial04_Instancing.gif", | ||
tutorialLink: "wasm-modules/Tutorial04_Instancing/Tutorial04_Instancing.html", | ||
githubLink: "https://github.com/DiligentGraphics/DiligentSamples/tree/master/Tutorials/Tutorial04_Instancing" | ||
}, | ||
{ | ||
id: "Tutorial05_TextureArray", | ||
title: "05 - Texture Array", | ||
description: "This tutorial demonstrates how to combine instancing with texture arrays to use unique texture for every instance.", | ||
image: "images/content/tutorials/Tutorial05_TextureArray.gif", | ||
tutorialLink: "wasm-modules/Tutorial05_TextureArray/Tutorial05_TextureArray.html", | ||
githubLink: "https://github.com/DiligentGraphics/DiligentSamples/tree/master/Tutorials/Tutorial05_TextureArray" | ||
}, | ||
{ | ||
id: "Tutorial06_Multithreading", | ||
title: "06 - Multithreading", | ||
description: "This tutorial shows how to generate command lists in parallel from multiple threads.", | ||
image: "images/content/tutorials/Tutorial06_Multithreading.gif", | ||
tutorialLink: "wasm-modules/Tutorial06_Multithreading/Tutorial06_Multithreading.html", | ||
githubLink: "https://github.com/DiligentGraphics/DiligentSamples/tree/master/Tutorials/Tutorial06_Multithreading" | ||
}, | ||
{ | ||
id: "Tutorial09_Quads", | ||
title: "09 - Quads", | ||
description: "This tutorial shows how to render multiple 2D quads, frequently switching textures and blend modes.", | ||
image: "images/content/tutorials/Tutorial09_Quads.gif", | ||
tutorialLink: "wasm-modules/Tutorial09_Quads/Tutorial09_Quads.html", | ||
githubLink: "https://github.com/DiligentGraphics/DiligentSamples/tree/master/Tutorials/Tutorial09_Quads" | ||
}, | ||
{ | ||
id: "Tutorial10_DataStreaming", | ||
title: "10 - Data Streaming", | ||
description: "This tutorial shows dynamic buffer mapping strategy using MAP_FLAG_DISCARD and MAP_FLAG_DO_NOT_SYNCHRONIZE flags to efficiently stream varying amounts of data to GPU.", | ||
image: "images/content/tutorials/Tutorial10_DataStreaming.gif", | ||
tutorialLink: "wasm-modules/Tutorial10_DataStreaming/Tutorial10_DataStreaming.html", | ||
githubLink: "https://github.com/DiligentGraphics/DiligentSamples/tree/master/Tutorials/Tutorial10_DataStreaming" | ||
}, | ||
{ | ||
id: "Tutorial11_ResourceUpdates", | ||
title: "11 - Resource Updates", | ||
description: "This tutorial demonstrates different ways to update buffers and textures in Diligent Engine and explains important internal details and performance implications related to each method.", | ||
image: "images/content/tutorials/Tutorial11_ResourceUpdates.gif", | ||
tutorialLink: "wasm-modules/Tutorial11_ResourceUpdates/Tutorial11_ResourceUpdates.html", | ||
githubLink: "https://github.com/DiligentGraphics/DiligentSamples/tree/master/Tutorials/Tutorial11_ResourceUpdates" | ||
}, | ||
{ | ||
id: "Tutorial12_RenderTarget", | ||
title: "12 - Render Target", | ||
description: "This tutorial demonstrates how to render a 3d cube into an offscreen render target and do a simple post-processing effect.", | ||
image: "images/content/tutorials/Tutorial12_RenderTarget.gif", | ||
tutorialLink: "wasm-modules/Tutorial12_RenderTarget/Tutorial12_RenderTarget.html", | ||
githubLink: "https://github.com/DiligentGraphics/DiligentSamples/tree/master/Tutorials/Tutorial12_RenderTarget" | ||
}, | ||
{ | ||
id: "Tutorial13_ShadowMap", | ||
title: "13 - Shadow Map", | ||
description: "This tutorial demonstrates how to render basic shadows using a shadow map.", | ||
image: "images/content/tutorials/Tutorial13_ShadowMap.gif", | ||
tutorialLink: "wasm-modules/Tutorial13_ShadowMap/Tutorial13_ShadowMap.html", | ||
githubLink: "https://github.com/DiligentGraphics/DiligentSamples/tree/master/Tutorials/Tutorial13_ShadowMap" | ||
}, | ||
{ | ||
id: "Tutorial14_ComputeShader", | ||
title: "14 - Compute Shader", | ||
description: "This tutorial shows how to implement a simple particle simulation system using compute shaders.", | ||
image: "images/content/tutorials/Tutorial14_ComputeShader.gif", | ||
tutorialLink: "wasm-modules/Tutorial14_ComputeShader/Tutorial14_ComputeShader.html", | ||
githubLink: "https://github.com/DiligentGraphics/DiligentSamples/tree/master/Tutorials/Tutorial14_ComputeShader" | ||
}, | ||
{ | ||
id: "Tutorial16_BindlessResources", | ||
title: "16 - Bindless Resources", | ||
description: "This tutorial shows how to implement bindless resources, a technique that leverages dynamic shader resource indexing feature enabled by the next-gen APIs to significantly improve rendering performance.", | ||
image: "images/content/tutorials/Tutorial16_BindlessResources.gif", | ||
tutorialLink: "wasm-modules/Tutorial16_BindlessResources/Tutorial16_BindlessResources.html", | ||
githubLink: "https://github.com/DiligentGraphics/DiligentSamples/tree/master/Tutorials/Tutorial16_BindlessResources" | ||
}, | ||
{ | ||
id: "Tutorial17_MSAA", | ||
title: "17 - MSAA", | ||
description: "This tutorial demonstrates how to use multisample anti-aliasing (MSAA) to make geometrical edges look smoother and more temporarily stable.", | ||
image: "images/content/tutorials/Tutorial17_MSAA.gif", | ||
tutorialLink: "wasm-modules/Tutorial17_MSAA/Tutorial17_MSAA.html", | ||
githubLink: "https://github.com/DiligentGraphics/DiligentSamples/tree/master/Tutorials/Tutorial17_MSAA" | ||
}, | ||
{ | ||
id: "Tutorial18_Queries", | ||
title: "18 - Queries", | ||
description: "This tutorial demonstrates how to use queries to retrieve various information about the GPU operation, such as the number of primitives rendered, command processing duration, etc.", | ||
image: "images/content/tutorials/Tutorial18_Queries.gif", | ||
tutorialLink: "wasm-modules/Tutorial18_Queries/Tutorial18_Queries.html", | ||
githubLink: "https://github.com/DiligentGraphics/DiligentSamples/tree/master/Tutorials/Tutorial18_Queries" | ||
}, | ||
{ | ||
id: "Tutorial19_RenderPasses", | ||
title: "19 - Render Passes", | ||
description: "This tutorial demonstrates how to use the render passes API to implement simple deferred shading.", | ||
image: "images/content/tutorials/Tutorial19_RenderPasses.gif", | ||
tutorialLink: "wasm-modules/Tutorial19_RenderPasses/Tutorial19_RenderPasses.html", | ||
githubLink: "https://github.com/DiligentGraphics/DiligentSamples/tree/master/Tutorials/Tutorial19_RenderPasses" | ||
}, | ||
{ | ||
id: "Tutorial27_PostProcessing", | ||
title: "27 - Post Processing", | ||
description: "This tutorial demonstrates how to use post-processing effects from the DiligentFX module.", | ||
image: "images/content/tutorials/Tutorial27_PostProcessing.jpg", | ||
tutorialLink: "wasm-modules/Tutorial27_PostProcessing/Tutorial27_PostProcessing.html", | ||
githubLink: "https://github.com/DiligentGraphics/DiligentSamples/tree/master/Tutorials/Tutorial27_PostProcessing" | ||
} | ||
]; | ||
|
||
const samples = [ | ||
{ | ||
id: "Sample_Atmosphere", | ||
title: "Atmosphere", | ||
description: "This sample demonstrates how to integrate Epipolar Light Scattering post-processing effect into an application to render physically-based atmosphere.", | ||
image: "images/content/samples/Atmosphere.gif", | ||
tutorialLink: "wasm-modules/Atmosphere/Atmosphere.html", | ||
githubLink: "https://github.com/DiligentGraphics/DiligentSamples/tree/master/Samples/Atmosphere" | ||
}, | ||
{ | ||
id: "Sample_GLTFViewer", | ||
title: "GLTF Viewer", | ||
description: "This sample demonstrates how to use the Asset Loader and PBR Renderer to load and render GLTF models.", | ||
image: "images/content/samples/GLTFViewer.jpg", | ||
tutorialLink: "wasm-modules/GLTFViewer/GLTFViewer.html", | ||
githubLink: "https://github.com/DiligentGraphics/DiligentSamples/tree/master/Samples/GLTFViewer" | ||
}, | ||
{ | ||
id: "Sample_ImguiDemo", | ||
title: "Dear ImGui Demo", | ||
description: "This sample demonstrates the integration of the engine with dear imgui UI library.", | ||
image: "images/content/samples/ImguiDemo.png", | ||
tutorialLink: "wasm-modules/ImguiDemo/ImguiDemo.html", | ||
githubLink: "https://github.com/DiligentGraphics/DiligentSamples/tree/master/Samples/ImguiDemo" | ||
}, | ||
{ | ||
id: "Sample_Shadows", | ||
title: "Shadows", | ||
description: "This sample demonstrates how to use the Shadowing component to render high-quality shadows.", | ||
image: "images/content/samples/Shadows.jpg", | ||
tutorialLink: "wasm-modules/Shadows/Shadows.html", | ||
githubLink: "https://github.com/DiligentGraphics/DiligentSamples/tree/master/Samples/Shadows" | ||
} | ||
]; | ||
|
||
function createCard(item) { | ||
return ` | ||
<div class="card" id="${item.id}"> | ||
<img src="${item.image}" alt="${item.title}" loading="lazy"> | ||
<h3>${item.title}</h3> | ||
<p>${item.description}</p> | ||
<div class="buttons-container"> | ||
<a href="${item.tutorialLink}" class="view-link">Run sample</a> | ||
<a href="${item.githubLink}" class="github-button" target="_blank">View on GitHub</a> | ||
</div> | ||
</div> | ||
`; | ||
} | ||
|
||
const tutorialGrid = document.getElementById('tutorialGrid'); | ||
const samplesGrid = document.getElementById('samplesGrid'); | ||
|
||
tutorials.forEach(tutorial => { | ||
tutorialGrid.innerHTML += createCard(tutorial); | ||
}); | ||
|
||
samples.forEach(sample => { | ||
samplesGrid.innerHTML += createCard(sample); | ||
}); | ||
|
||
document.querySelector('.search-bar input').addEventListener('input', function(e) { | ||
const query = e.target.value.toLowerCase(); | ||
document.querySelectorAll('.card').forEach(function(card) { | ||
const title = card.querySelector('h3').innerText.toLowerCase(); | ||
card.style.display = title.includes(query) ? '' : 'none'; | ||
}); | ||
}); |
Oops, something went wrong.