Skip to content

Instantly share code, notes, and snippets.

View DefinitelyMaybe's full-sized avatar

DefinitelyMaybe DefinitelyMaybe

View GitHub Profile
@DefinitelyMaybe
DefinitelyMaybe / TSL.js
Created June 17, 2024 00:46
donut to monkey point cloud
const material = new SpriteNodeMaterial({ transparent: true, depthWrite: false, blending: THREE.AdditiveBlending})
// Mixed position
const getMixed Position = tslFn(([origin, target]) =>
{
// Noises
const noiseOrigin = simplexNoise3d(vec3(origin.mul(noiseScaleUniform)))
const noiseTarget = simplexNoise3d(vec3(target.mul<noiseScaleUniform)))
const noise = mix(noiseOrigin, noiseTarget, progressUniform).smoothstep(-1, 1)
function uint8ArrayToHex(uint8Array) {
return Array.from(uint8Array)
.map((byte) => byte.toString(16).padStart(2, "0"))
.join("");
}
function extractFlagAndPID(inputArray) {
const first3Bits = inputArray[0] & 0b111;
const next13Bits = ((inputArray[0] & 0b00011111) << 8) | inputArray[1];
function uint8ArrayToHex(uint8Array) {
return Array.from(uint8Array)
.map((byte) => byte.toString(16).padStart(2, "0"))
.join("");
}
function extractFlagAndPID(inputArray) {
const first3Bits = inputArray[0] & 0b111;
const next13Bits = ((inputArray[0] & 0b00011111) << 8) | inputArray[1];
function uint8ArrayToHex(uint8Array) {
return Array.from(uint8Array)
.map((byte) => byte.toString(16).padStart(2, "0"))
.join("");
}
function extractFlagAndPID(inputArray) {
const first3Bits = inputArray[0] & 0b111;
const next13Bits = ((inputArray[0] & 0b11111000) << 8) | inputArray[1];
import { createEventDispatcher, onDestroy } from 'svelte';
import { Euler, Camera } from 'three';
import {
useThrelte,
useParent
} from '@threlte/core';
// Set to constrain the pitch of the camera
// Range is 0 to Math.PI radians
export let minPolarAngle = 0; // radians
alkjsdbflkajsdf
@DefinitelyMaybe
DefinitelyMaybe / GridHelper.bubled.js
Created April 11, 2020 00:19
Example of rollup buble conversion.
/**
* @author mrdoob / http://mrdoob.com/
*/
var GridHelper = /*@__PURE__*/(function (LineSegments) {
function GridHelper ( size, divisions, color1, color2 ) {
size = size || 10;
divisions = divisions || 10;
color1 = new Color( color1 !== undefined ? color1 : 0x444444 );
@DefinitelyMaybe
DefinitelyMaybe / dependencies.json
Last active March 26, 2020 02:23
three/src/ dependencies
{
"notusedinexamples": [
"node_modules/three/src/animation/AnimationAction.js",
"node_modules/three/src/animation/AnimationObjectGroup.js",
"node_modules/three/src/animation/KeyframeTrack.js",
"node_modules/three/src/animation/PropertyMixer.js",
"node_modules/three/src/animation/tracks/StringKeyframeTrack.js",
"node_modules/three/src/audio/AudioAnalyser.js",
"node_modules/three/src/audio/AudioContext.js",
"node_modules/three/src/audio/AudioListener.js",
@DefinitelyMaybe
DefinitelyMaybe / converter.py
Last active March 15, 2020 03:03
Three.js to ES6 classes
import os, shutil, re, time
# Use local scripts within the node_modules folder
BASE_DIRECTORY = 'node_modules/three/examples'
# 'node_modules/three/examples' is the first target
# 'node_modules/three/src' is the second target
OUTPUT_DIRECTORY = 'three/examples/'
# delete contents of output folder and debugging files
CLEAN_OUTPUT_DIR = True
@DefinitelyMaybe
DefinitelyMaybe / HarmonicOscillator.py
Last active November 29, 2016 10:19
matplotlib can be installed via pip
import matplotlib.pyplot as plt
import math
def SmoothUpdate(objPos, objVel, finPos, deltaTime, dampingRatio, angularFrequency):
"""
This function is a derivative of work done by:
Copyright (c) 2008-2012 Ryan Juckett
http://www.ryanjuckett.com/