Skip to content

Instantly share code, notes, and snippets.

@bzztbomb
bzztbomb / three-mesh-bvh-precompute.js
Created October 6, 2021 17:07
An example of precomputing a BVH for three.js meshes using three-mesh-bvh
//
// This is the Node.js script used to precompute the bvh and store it in a GLTF file.
//
import { Accessor, Extension, ExtensionProperty, NodeIO, PropertyType, ReaderContext, VertexLayout, WriterContext } from '@gltf-transform/core';
import { PropertyGraph } from '@gltf-transform/core/dist/properties';
import { KHRONOS_EXTENSIONS } from '@gltf-transform/extensions';
import { join, normalize, resolve } from 'path';
import { Box3, BufferGeometry, Float32BufferAttribute } from 'three';
import { MeshBVH } from 'three-mesh-bvh';
import yargs from 'yargs';
const cam = Camera.worldTransform.position;
var subscription =
Reactive
.monitorMany(
{
// Monitor camera position, this needs to be done per component since they are individual signals
cx: cam.x,
cy: cam.y,
cz: cam.z,
ox: sparkObject.transform.position.x,
import * as Regl from "regl"
import * as dat from "dat.gui";
const regl = Regl();
const image = new Image()
image.crossOrigin = 'anonymous';
image.src = 'cor-logo.png';
let imageTexture = regl.texture();
image.onload = () => {
// Takes an svg path and generates the path code to draw it on Android.
var parse = require('svg-path-parser');
let d=`
M50.3,67.3v9.8c0,4.1-3.3,7.4-7.4,7.4H15.3c-4.1,0-7.4-3.3-7.4-7.4V60h42.3H78c2,0,3.6,1.6,3.6,3.6l0,0
c0,2-1.6,3.6-3.6,3.6H50.7L50.3,67.3z
`;
let pathOps = parse(d);
console.log(pathOps);
ON THE FIRST WAVE THERE SHALL BE FIFTEEN GRUNTS. OF ELECTRODES, THERE SHALL BE FIVE, THE MOMMIES SHALL NUMBER ONE, AND THE DADDIES SHALL NUMBER ONE.
ON THE SECOND WAVE THERE SHALL BE SEVENTEEN GRUNTS. THE NUMBER OF ELECTRODES SHALL BE FIFTEEN. ONE MOMMY THERE SHALL BE, AND THE NUMBER OF DADDIES SHALL BE ONE. OF MIKEYS, THERE SHALL BE ONE, THE HULKS SHALL NUMBER FIVE, AND THE SPHEROIDS SHALL NUMBER ONE.
ON THE THIRD WAVE THERE SHALL BE TWO AND TWENTY GRUNTS. THE NUMBER OF ELECTRODES SHALL BE FIVE AND TWENTY. TWO MOMMIES THERE SHALL BE, AND THE NUMBER OF DADDIES SHALL BE TWO. OF MIKEYS, THERE SHALL BE TWO, THE HULKS SHALL NUMBER SIX, AND THE SPHEROIDS SHALL NUMBER THREE.
ON THE FOURTH WAVE THERE SHALL BE FOUR AND THIRTY GRUNTS. THE NUMBER OF ELECTRODES SHALL BE FIVE AND TWENTY. TWO MOMMIES THERE SHALL BE, AND THE NUMBER OF DADDIES SHALL BE TWO. OF MIKEYS, THERE SHALL BE TWO, THE HULKS SHALL NUMBER SEVEN, AND THE SPHEROIDS SHALL NUMBER FOUR.
ON THE FIFTH WAVE THERE SHALL BE TWENTY GRUNTS. TWENTY ELECTRODES THERE
<!-- Start of Flickr Badge -->
<style type="text/css">
#flickr_badge_source_txt {padding:0; font: 11px Arial, Helvetica, Sans serif; color:#666666;}
#flickr_badge_icon {display:block !important; margin:0 !important; border: 1px solid rgb(0, 0, 0) !important;}
#flickr_icon_td {padding:0 5px 0 0 !important;}
.flickr_badge_image {text-align:center !important;}
.flickr_badge_image img {border: 1px solid black !important;}
#flickr_www {display:block; padding:0 10px 0 10px !important; font: 11px Arial, Helvetica, Sans serif !important; color:#3993ff !important;}
#flickr_badge_uber_wrapper a:hover,
#flickr_badge_uber_wrapper a:link,
@bzztbomb
bzztbomb / gist:5272584
Created March 29, 2013 18:22
Spit out a grid using VHDL and Spartan 3 FPGA board
----------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 20:18:22 12/13/2009
-- Design Name:
-- Module Name: vga - Behavioral
-- Project Name:
-- Target Devices:
-- Tool versions:
@bzztbomb
bzztbomb / gist:4639808
Created January 26, 2013 02:57
Cinder + OSC Hacks
//Hack #1, publishing OSC port info via Bonjour. Control (http://charlie-roberts.com/Control/) scans Bonjour for available services.
// Call publish_via_bonjour from your ::setup() function
#import <Cocoa/Cocoa.h>
@class NSNetService;
@interface BonjourPublisher : NSObject
{
NSNetService *netService;
}
@bzztbomb
bzztbomb / gist:4597659
Created January 22, 2013 19:36
Cinder + CoreMidi sketch
CinderCoreMidi.h
class CinderCoreMidi
{
public:
static void init();
static void destroy();
};
CinderCoreMidi.cpp
int m_rand()
{
static int a = 6101;
static int b = 997;
static int c = 5583;
int t = a + b + c;
a = b;
b = c;
c = t;