Skip to content

Instantly share code, notes, and snippets.

View bhouston's full-sized avatar

Ben Houston bhouston

View GitHub Profile
"#if MAX_AREA_LIGHTS > 0",
"for( int i = 0; i < MAX_AREA_LIGHTS; i ++ ) {",
"vec3 lPosition = ( viewMatrix * vec4( areaLightPosition[ i ], 1.0 ) ).xyz;",
//"vec3 lVector = lPosition.xyz + vViewPosition.xyz;",
"vec3 width = areaLightWidth[ i ];",
"vec3 height = areaLightHeight[ i ];",
var shuffle = require('shuffle-array');
var PoissonDiskSampling = require('poisson-disk-sampling');
var p = new PoissonDiskSampling([1000, 1000], 100, 100, 10);
var points = p.fill();
for( i = 0; i < points.length; i ++ ) {
points[i][0] = Math.round( points[i][0] * 100 ) / (1000*100);
points[i][1] = Math.round( points[i][1] * 100 ) / (1000*100);
}
shuffle( points );
@bhouston
bhouston / MeshCurvature.cs
Created February 20, 2018 16:02
C# (C-Sharp) Mesh Curvature complete implementation.
// Ben Houston <[email protected]>
/*
Based upon:
Szymon Rusinkiewicz
Princeton University
TriMesh_curvature.cc
Computation of per-vertex principal curvatures and directions.
#include <SPI.h>
#include <SD.h>
const int chipSelect = 4;
const int waterPumpRelayPin = 8;
const int moisture_minimum = 400;
const int watering_delay = 1000;
const int loop_delay_minutes = 5;
const int loop_delay = 60 * 1000 * loop_delay_minutes;
let arrayBuffer = new ArrayBuffer( 12 * 16 );
let floatArray = new Float32Array( arrayBuffer );
let intArray = new Int32Array( arrayBuffer );
function hashFloat1( v ) {
floatArray[0] = v;
return intArray[0];
}
function hashFloat2( v0, v1 ) {

The capacities of glslify are the following:

#pragma glslify: topDot = require(./my-function.glsl)

It allows for the import of a named function from another class. This likely works in a recursive fashion.


  • It does not allow for inline javascript execution.
  • It does not output JS modules.
@bhouston
bhouston / note.mjs
Created August 8, 2020 16:14
parse gitlab time spends from notes
import { Spend } from '../plan/model.mjs';
import nodemon from 'nodemon';
import { log, logPush, logPop } from '../logging.mjs';
var spendBodyRegex = /(?<operation>(added|subtracted)) (?<duration>([0-9]+[mowdhs]+ )*)(of time spent at )(?<date>[0-9\-]+)/;
var spendResetBody = "removed time spent";
//var durationRegex = new RegExp( '^((?<months>[0-9]+)mo(\\w)*)?((?<weeks>[0-9]+)w(\\w)*)?((?<days>[0-9]+)d(\\w)*)?((?<hours>[0-9]+)h(\\w)*)?((?<minutes>[0-9]+)m(\\w)*)?((?<seconds>[0-9]+)s(\\w)*)?' );
@bhouston
bhouston / index.html
Created May 20, 2021 19:11
Reproduction of unreliable AR intents for SceneViewer on Android - 2021-05-20
<input type="text" id="modelUrl" style="width:100%" value="http://exocortex.github.io/glb-crash/icosphere.glb">
<br>
<a id="link"></a>
<script>
function setUrl(url) {
link.innerHTML = url;
link.href = `intent://arvr.google.com/scene-viewer/1.0?enable_vertical_placement=true&file=${escape(url)}&mode=ar_only&resizable=false&title=AR#Intent;scheme=https;package=com.google.ar.core;action=android.intent.action.VIEW;end`
}
import { FileLoader } from './FileLoader';
import { DataTexture } from '../textures/DataTexture';
import { DefaultLoadingManager } from './LoadingManager';
import { _Math } from '../math/Math';
function IESLoader(manager) {
this.manager = (manager !== undefined) ? manager : DefaultLoadingManager;
}
@bhouston
bhouston / TRAAPass.js
Created May 25, 2023 01:48
Temporal Reproduction Anti-Alising for Three.js
THREE.TRAAPass = function(scene, camera, resolution) {
THREE.Pass.call(this);
this.scene = scene;
this.camera = camera;
// old velcotiy material.
function getSuperSampleTRAAMaterial() {
return new THREE.ShaderMaterial({
defines: {