Skip to content

Instantly share code, notes, and snippets.

@PhoenixIllusion
PhoenixIllusion / overrides.json
Last active May 3, 2024 16:40
Jolt - Typescript NPM Usage Analysis and WebIDL rewriting
{
"class": {
"FixedConstraintSettings": {
"properties": ["mPoint1", "mPoint2"]
},
"PointConstraintSettings": {
"properties": ["mPoint1", "mPoint2"]
},
"DistanceConstraintSettings": {
"properties": ["mPoint1", "mPoint2", "mLimitsSpringSettings"]
@PhoenixIllusion
PhoenixIllusion / Jolt - PhysX - Tetra Map Model.html
Created April 29, 2024 23:12
Jolt Physics - using PhysX tetra generation - Using generated Tetras to map position for detailed model
<!DOCTYPE html>
<html lang="en">
<head>
<title>JoltPhysics.js demo</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/jrouwe/JoltPhysics.js@0.23.0/Examples/style.css">
<script type="importmap">
{
@PhoenixIllusion
PhoenixIllusion / Generate_Tetrahedron_Jolt.html
Created April 25, 2024 22:51
Load ThreeJS files, and convert them to tetrahedron soft-bodies using PhysX, then load into Jolt
<!DOCTYPE html>
<html lang="en">
<head>
<title>JoltPhysics.js demo</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/jrouwe/JoltPhysics.js@0.23.0/Examples///style.css">
<script type="importmap">
{
@PhoenixIllusion
PhoenixIllusion / example.ts
Created April 16, 2024 21:44
Crude port of example.js in Jolt Physics Example folder to Typescript for typescript coding
import * as THREE from 'three';
import Stats from 'stats.js';
import JOLT_NS from 'jolt-physics/wasm-compat';
export var Jolt: typeof JOLT_NS;
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js'
import { WebGL } from './webgl';
// Graphics variables
let container: HTMLDivElement;
import { MeshBVH, acceleratedRaycast } from 'three-mesh-bvh'
import * as THREE from 'three';
THREE.Mesh.prototype.raycast = acceleratedRaycast;
const raycaster = new THREE.Raycaster();
function print(...args: any[]) {
console.log(...args);
}
function len<T>(a: ArrayLike<T>) {
@PhoenixIllusion
PhoenixIllusion / Stereogram-TWGL.html
Last active January 5, 2024 20:35
Stereogram Shader with configurable Pattern, Depth, and values
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>GLSL Stereogram</title>
<style>
canvas {
image-rendering: crisp-edges;
@PhoenixIllusion
PhoenixIllusion / BingoCardMaker.html
Created May 29, 2020 19:28
Allows editing and saving Bingo Cards
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.slim.js"></script>
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg" viewport="0 0 410 510" width="410" height="510" style="width: 100vw;max-width:600px;">
<style>
text {
font-family: sans-serif;
@PhoenixIllusion
PhoenixIllusion / native-zip-file-browse.regpack.js
Created March 10, 2020 23:38
Minified RegPack native-DecompressionStream (with pako rawDeflate fallback) Zip parser for reading ZipFile and getting Blobs of decompressed content
/*
const zip = new ZipReader(fileBlob);
await zip.parse();
console.log(zip.RECORDS);
const blob = await zip.getRecord(1);
*/
for(_=`;s++*pako@(t,eM,!0)Qco^^nst ~~e=%.p($en#e.Ye(XetW])Ki.c||i.fJ],Iif(H,2G.sFin);new ResponsX,{s:or(){this.&&(i+=awaitufferlobRECORDS)).push(async {^nstructtdocum#t.,0,0, De^mpressionStream DataView( functionUt8Array(YbyteL#gthWUt32(rWurn  a(b,GGGG,4,4,$[4K[0Kthrow Err"Error parsg #try"(()=>{"use strict"; tM,nHwdow. ~i= ("gzip"),r= 8).brF0,eQ,rF4,nQ,B([s,t,rKFtream().pipeThrough(i.b()}{(i="https://cdnjs.cloudflarY^m/ajax/libs/@/1.0.10/@_flatYm.js",PromisXMHquerySelect"script[src='"+i+"']"t(ielse{%createElem#t("script"eFrc=i,Yonload=(t(i)},gWElem#tsByTagNamX"head")[0].app#dChild(e)}};%@.flateRaw(tB([eK}var i}%TextDe^der;class nd=t,i=0}p(t~n=[];flW s=0;s<t.l#gth*~i=t[s];HiFn[iFK,J~t=n[J];i+=t;~s=d.b,i-t,tni.f?Yde^dXs):s)}2==i2,nd.gWUt16(i-2,!0),4==i4,nd.gi-4,!0)}n}}~s
@PhoenixIllusion
PhoenixIllusion / native-zip-file-browse.js
Created March 10, 2020 21:30
Read Zip File - Built-In DecompressionStream for entries
"use strict"
const ZIP_EOCD = 0x06054b50;
const ZIP_CENTRAL_DIR_HEADER = 0x02014b50;
const ZIP_LOCAL_HEADER = 0x04034b50;
const decoder = new TextDecoder();
const GZIP_HEADER = new Uint8Array([31,139, 8, 0, 0,0,0,0, 0, 255]);
function deflateFooter(crc, isize){
const footer = new DataView(new Uint8Array(8).buffer);
@PhoenixIllusion
PhoenixIllusion / mask_gif_onto_image.sh
Created April 1, 2019 14:26
Takes a source gif, an overlay image, and a transformed texture square to render under the overlay image. Position animated GIF inside image
FILTER="
[0:v] scale=512:512[src];
[2:v]format=rgba64,colorchannelmixer=rr=1/128:bb=1/128[map16];
[map16]extractplanes=r+b+a[x][y][a];
[src][x][y]remap[remap];
[remap][a]alphamerge[remapa];
[remapa][1:v]overlay"
echo "===="
echo $FILTER
echo "===="