Skip to content

Commit

Permalink
Deploying to gh-pages from @ bf7948f 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
kainino0x committed May 29, 2024
1 parent bd71775 commit 9d9287e
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 7 deletions.
1 change: 1 addition & 0 deletions assets/img/cubemap/credit.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Cubemap image available under a Creative Commons Attribution 3.0 Unported License at https://www.humus.name/index.php?page=Textures&ID=58
2 changes: 1 addition & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ is used to draw instanced particles.',

var cubemap = {
name: 'Cubemap',
description: 'This example shows how to render and sample from a cubemap texture.',
description: 'This example shows how to render and sample from a cubemap texture. Cubemap image available under a Creative Commons Attribution 3.0 Unported License at https://www.humus.name/index.php?page=Textures&ID=58',
filename: "sample/cubemap",
sources: [
{ path: 'main.ts' },
Expand Down
8 changes: 6 additions & 2 deletions sample/cubemap/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/cubemap/main.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion sample/cubemap/meta.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export default {
name: 'Cubemap',
description:
'This example shows how to render and sample from a cubemap texture.',
'This example shows how to render and sample from a cubemap texture. Cubemap image available under a Creative Commons Attribution 3.0 Unported License at https://www.humus.name/index.php?page=Textures&ID=58',
filename: __DIRNAME__,
sources: [
{ path: 'main.ts' },
Expand Down
8 changes: 6 additions & 2 deletions sample/cubemap/sampleCubemap.frag.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ fn main(
@location(1) fragPosition: vec4f
) -> @location(0) vec4f {
// Our camera and the skybox cube are both centered at (0, 0, 0)
// so we can use the cube geomtry position to get viewing vector to sample the cube texture.
// The magnitude of the vector doesn't matter.
// so we can use the cube geometry position to get viewing vector to sample
// the cube texture. The magnitude of the vector doesn't matter.
var cubemapVec = fragPosition.xyz - vec3(0.5);
// When viewed from the inside, cubemaps are left-handed (z away from viewer),
// but common camera matrix convention results in a right-handed world space
// (z toward viewer), so we have to flip it.
cubemapVec.z *= -1;
return textureSample(myTexture, mySampler, cubemapVec);
}

0 comments on commit 9d9287e

Please sign in to comment.