Skip to content

Instantly share code, notes, and snippets.

@PhoenixIllusion
PhoenixIllusion / data-reader.ts
Created October 22, 2025 14:14
Parsing of a HEIC file. Not exhaustive, just worked on my test image.
export interface BlobLike {
size: number;
slice(start_offset: number, end_offset: number): BlobLike | Promise<BlobLike>;
arrayBuffer(): Promise<ArrayBuffer>;
}
export const enum LogLevel {
OFF,
ERROR,
@PhoenixIllusion
PhoenixIllusion / index.html
Last active October 3, 2025 15:05
Harpagia: Zen Video Tracking tool
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Harpagia: Zen Video Tracking</title>
<style>
body > .container {
position: relative;
@PhoenixIllusion
PhoenixIllusion / decorator.ts
Created September 16, 2025 23:00
Simple 'roll your own' binary inter-process communication protocol with a class + proxy + meta-data of how to encode/decode parameters limited to Float32 and Int32 arrays/values
type ParamType = [0|1, 1|2|3|4];
export const F4: ParamType = [0,4];
export const F3: ParamType = [0,3];
export const F2: ParamType = [0,2];
export const F1: ParamType = [0,1];
export const U4: ParamType = [1,4];
export const U3: ParamType = [1,3];
export const U2: ParamType = [1,2];
export const U1: ParamType = [1,1];
@PhoenixIllusion
PhoenixIllusion / RawJoltBodyContactConstraintAccess.mjs
Created September 12, 2025 15:49
Tool that takes the raw Jolt Pointers of Bodies and the ContactConstraintManager and maps them out to F32/TypedArray raw access
class Reader {
constructor(ptr, buffer) {
this.ptr = ptr;
this.buffer = buffer;
this.offset = 0;
}
Float3() {
this.offset += 4 * 3;
return new Float32Array(this.buffer, this.ptr + this.offset - 12, 3);
@PhoenixIllusion
PhoenixIllusion / index.ts
Last active May 12, 2025 22:59
AssemblyScript - asyncify example - using the JS for asyncify_ functions . Compile passing ` --runPasses asyncify` to the assembly-script asc command
import fs from 'fs';
const wasmBuffer = fs.readFileSync('./build/release.wasm');
interface WasmExports {
asyncStackPtr: number;
initAsyncStack(): void;
asyncify_start_unwind(stackPtr: number): void;
asyncify_start_rewind(stackPtr: number): void;
asyncify_stop_rewind(): void;
run(): void;
@PhoenixIllusion
PhoenixIllusion / parse-grid-map.js
Created September 3, 2024 16:14
Godot: Parse the packed data of a GridMap
const data = new Uint32Array([65531, 65528, 0, 65531, 65529, 0, 65531, 65530, 0, 65531, 65531, 0, 65531, 65532, 0, 65531, 65533, 0, 65531, 65534, 0, 65531, 65535, 0, 65531, 0, 0, 65531, 1, 0, 65531, 2, 0, 65531, 3, 0, 65531, 4, 0, 65531, 5, 0, 65531, 6, 0, 65532, 65528, 0, 65532, 65529, 0, 65532, 65530, 0, 65532, 65531, 0, 65532, 65532, 0, 65532, 65533, 0, 65532, 65534, 0, 65532, 65535, 0, 65532, 0, 0, 65532, 1, 0, 65532, 2, 0, 65532, 3, 0, 65532, 4, 0, 65532, 5, 0, 65532, 6, 0, 65533, 65528, 0, 65533, 65529, 0, 65533, 65530, 0, 65533, 65531, 0, 65533, 65532, 0, 65533, 65533, 0, 65533, 65534, 0, 65533, 65535, 0, 65533, 0, 0, 65533, 1, 0, 65533, 2, 0, 65533, 3, 0, 65533, 4, 0, 65533, 5, 0, 65533, 6, 0, 65534, 65528, 0, 65534, 65529, 0, 65534, 65530, 0, 65534, 65531, 0, 65534, 65532, 0, 65534, 65533, 0, 65534, 65534, 0, 65534, 65535, 0, 65534, 0, 0, 65534, 1, 0, 65534, 2, 0, 65534, 3, 0, 65534, 4, 0, 65534, 5, 0, 65534, 6, 0, 65535, 65528, 0, 65535, 65529, 0, 65535, 65530, 0, 65535, 65531, 0, 65535, 65532, 0, 6
@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/[email protected]/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/[email protected]/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;