Skip to content

Instantly share code, notes, and snippets.

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 = () => {
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,
@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';