Revision: 06.08.2023, https://compute.toys/view/407
fn sdSphere(p: vec3f, r: f32) -> f32 {
return length(p) - r;
}| // OcTree with Morton Order | |
| // based on http://marupeke296.com/COL_3D_No15_Octree.html | |
| // | |
| // +------+------+ | |
| // |\ 2 \ 3 \ | |
| // | +------+------+ | |
| // + |\ \ \ | |
| // |\| +------+------+ | |
| // | + | | | | |
| // +0|\| 6 | 7 | |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <title>three.js webgl - modifier - Fast Quadric Mesh Simplification</title> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> | |
| <style> | |
| body { | |
| font-family: Monospace; | |
| background-color: #f0f0f0; |
| import pymel.core as pm | |
| ''' | |
| An Autodesk Maya PyMEL script that calculates a pole vector position | |
| based on 3 input PyNode objects. example: leg, knee, ankle bones. | |
| Chris Lesage [email protected] | |
| ''' | |
| def calculate_pole_vector(p1, p2, p3, poleDistance=1): | |
| """ |
Revision: 06.08.2023, https://compute.toys/view/407
fn sdSphere(p: vec3f, r: f32) -> f32 {
return length(p) - r;
}| // Processing code by Etienne JACOB | |
| // motion blur template by beesandbombs | |
| int[][] result; | |
| float t, c; | |
| float ease(float p) { | |
| return 3*p*p - 2*p*p*p; | |
| } |
| // | |
| // Lookup Tables for Marching Cubes | |
| // | |
| // These tables differ from the original paper (Marching Cubes: A High Resolution 3D Surface Construction Algorithm) | |
| // | |
| // The co-ordinate system has the more convenient properties: | |
| // | |
| // i = cube index [0, 7] | |
| // x = (i & 1) >> 0 | |
| // y = (i & 2) >> 1 |
| // | |
| // Lookup Tables for Transvoxel's Modified Marching Cubes | |
| // | |
| // Unlike the original paper (Marching Cubes: A High Resolution 3D Surface Construction Algorithm), these tables guarantee | |
| // a closed mesh "whose connected components are continuous and free of holes." | |
| // | |
| // Rotations are prioritised over inversions so that 3 of the 6 cases containing ambiguous faces are never added. 3 extra | |
| // cases are added as a post-process, overriding inverses through custom-build rotations to eliminate the rest. | |
| // | |
| // Uses the exact same co-ordinate system as https://gist.github.com/dwilliamson/c041e3454a713e58baf6e4f8e5fffecd |
| /** | |
| * Matches against GLSL shader outputs. | |
| */ | |
| const VARYING_REGEX = /[^\w](?:varying|out)\s+\w+\s+(\w+)\s*;/g | |
| /** | |
| * Adds line numbers to a string with an optional starting offset. | |
| */ | |
| const lineNumbers = (source: string, offset = 0): string => source.replace(/^/gm, () => `${offset++}:`) |
| export class Cache<T extends object, K> { | |
| items = new WeakMap<T, K>() | |
| get<P extends T>(item: P, cb: (item: P) => K) { | |
| if (!this.items.has(item)) { | |
| this.items.set(item, cb(item)) | |
| } | |
| return this.items.get(item)! | |
| } |
| /* | |
| OSL Triangle Voronoi Borders | |
| Based on a shadertoy by Thomas Hooper(tdhooper): | |
| https://www.shadertoy.com/view/ss3fW4 | |
| */ | |
| vector fract(vector v) { return mod(v*.5,.5)*2.; } | |
| vector vstep(vector a, vector b) { |