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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Carmen Cincotti - WebGPU Triangle</title> | |
<style> | |
canvas { | |
width: 100%; |
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
const { vec3, mat4 } = glMatrix // from gl-matrix library | |
const lookAtMatrix = mat4.create(); | |
{ | |
const forwardVector = vec3.create(); | |
const positionOfCamera = vec3.fromValues(0, 4, 4); | |
{ | |
const positionOfTarget = vec3.fromValues(0, 0, 0); | |
vec3.subtract(forwardVector, positionOfCamera, positionOfTarget); | |
vec3.normalize(forwardVector, forwardVector); | |
} |
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
interface Mesh { | |
positions: Float32Array; | |
uvs: Float32Array; | |
normals: Float32Array; | |
indices: Uint16Array; | |
} | |
type ObjFile = string | |
type FilePath = string |
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
prometheus: | |
prometheusSpec: | |
additionalScrapeConfigs: | |
- job_name: blackbox | |
metrics_path: /probe | |
scrape_interval: 30s | |
scrape_timeout: 20s | |
params: | |
module: [http_2xx] | |
kubernetes_sd_configs: |
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
modules: | |
http_2xx: | |
prober: http | |
timeout: 20s | |
http: | |
valid_http_versions: ["HTTP/1.1", "HTTP/2.0"] | |
follow_redirects: false | |
preferred_ip_protocol: "ip4" |
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
// Accompanying article can be found at https://carmencincotti.com | |
const TIME_STEP = 0.01; // Hard code for now | |
const STEPS = 500; // number of substeps | |
const particles = [ | |
{ | |
m: 1, // mass | |
w: 1, // hard code mass inverse | |
x: [2, 2, 0], // position |
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
// Isometric Bending Constraint for XPBD, accompanying article at https://www.carmencincotti.com | |
const TIME_STEP = 0.01; // Hard code for now | |
const STEPS = 1000; // number of substeps | |
const particles = [ | |
{ | |
m: 2.0, //mass | |
x: [0, 0, 0], // position | |
p: [0, 0, 0], // temp position, | |
f: [0, 0, 0], // force |
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
// Find neighbor triangles by using an edge list that keeps track of shared edges. | |
// This is taken from Matthias Müller - source: https://github.com/matthias-research/pages/blob/master/tenMinutePhysics/14-cloth.html | |
// I've gone ahead and added in some comments / and typed the function for my own use. | |
// You can find an accompanying article at https://www.carmencincotti.com | |
function findTriNeighbors(indices: Uint16Array): Float32Array { | |
const edges = []; | |
const numTris = indices.length / 3; | |
for (let i = 0; i < numTris; i++) { |
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
// This is taken from Matthias Müller - source: https://github.com/matthias-research/pages/blob/master/tenMinutePhysics/14-cloth.html | |
// I've gone ahead and added in some comments / and typed the function for my own use. | |
// You can find an accompanying article at https://www.carmencincotti.com | |
// Find four points that make up two adjacent triangles | |
// id2 | |
// / \ | |
// / \ | |
// id0 --- id1 | |
// \ / |
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
// More performant Bending Constraint for XPBD, accompanying article at https://www.carmencincotti.com | |
const particles = [ | |
{ | |
m: 1.0, //mass | |
x: [-0.98, -1.00, 0.00], // position | |
p: [-0.98, -1.00, 0.00], // temp position, | |
f: [0, 0, 0], // force | |
v: [0, 0, 0], // velocity | |
w: 1.0, |
OlderNewer