This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (c) 2012 Brandon Jones | |
* | |
* This software is provided 'as-is', without any express or implied | |
* warranty. In no event will the authors be held liable for any damages | |
* arising from the use of this software. | |
* | |
* Permission is granted to anyone to use this software for any purpose, | |
* including commercial applications, and to alter it and redistribute it | |
* freely, subject to the following restrictions: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This was basically ripped straight from http://en.wikipedia.org/wiki/Multiply-with-carry, just javscriptified. | |
var CMWCRand = function(seed) { | |
var i, PHI = 0x9e3779b9; | |
if(!seed) { seed = Date.now(); } | |
var Q = this.Q = new Uint32Array(4096); | |
this.c = 362436; | |
this.i = 4095; | |
Q[0] = seed; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am toji on github. | |
* I am toji (https://keybase.io/toji) on keybase. | |
* I have a public key whose fingerprint is 58B8 A064 C3EF E15A E7EA 976A 6B3C 9E34 B948 FFFC | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http() { | |
python -c "import BaseHTTPServer as bhs, SimpleHTTPServer as shs; bhs.HTTPServer(('127.0.0.1', $1), shs.SimpleHTTPRequestHandler).serve_forever()" & | |
} | |
(Called like: "http 8000") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
XTENSIONS GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_EGL_sync GL_OES_vertex_half_float GL_OES_framebuffer_object GL_OES_rgb8_rgba8 GL_OES_compressed_ETC1_RGB8_texture GL_AMD_compressed_ATC_texture GL_KHR_texture_compression_astc_ldr GL_KHR_texture_compression_astc_hdr GL_OES_texture_compression_astc GL_OES_texture_npot GL_EXT_texture_filter_anisotropic GL_EXT_texture_format_BGRA8888 GL_OES_texture_3D GL_EXT_color_buffer_float GL_EXT_color_buffer_half_float GL_QCOM_alpha_test GL_OES_depth24 GL_OES_packed_depth_stencil GL_OES_depth_texture GL_OES_depth_texture_cube_map GL_EXT_sRGB GL_OES_texture_float GL_OES_texture_float_linear GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_EXT_texture_type_2_10_10_10_REV GL_EXT_texture_sRGB_decode GL_OES_element_index_uint GL_EXT_copy_image GL_EXT_geometry_shader GL_EXT_tessellation_shader GL_OES_texture_stencil8 GL_EXT_shader_io_blocks GL_OES_shader_image_atomic GL_OES_sample_variables GL_EXT_texture_border_clamp GL_EXT_multisampled_render_to_texture GL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function()%7Bw%3Dwindow%3Bs%3D%22requestAnimationFrame%22%3Br%3Dw%5Bs%5D%3Bw%5Bs%5D%3Df%3D%3E%7Bw%5Bs%5D%3Dr%3Br(t%3D%3E%7Bf(t)%3Bl%20%3D%20document.querySelectorAll(%22canvas%22)%3Bfor%20(c%20of%20l)%20%7Bi%3Dnew%20Image()%3Bdocument.body.appendChild(i)%3Bi.src%3Dc.toDataURL()%3B%7D%7D)%3B%7D%7D)() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A barebones example of how to use the motion-controllers library and assets repository to load controller models in yor WebXR app | |
// This gist will not go into the details of how to set up a WebXR app (See https://immersive-web.github.io/webxr-samples/ for that) | |
// but will instead focus on the parts needed to find and load the appropriate controller. | |
// The motion-controllers library is small enough that it can easily be dropped into your own codebase if you wish, but loading it | |
// directly from a CDN like jsdelivr is an even easier route to getting up and running. | |
import { fetchProfile } from 'https://cdn.jsdelivr.net/npm/@webxr-input-profiles/[email protected]/dist/motion-controllers.module.js'; | |
// The assets package (https://www.npmjs.com/package/@webxr-input-profiles/assets) is larger, about 67Mb at time of writing, | |
// so it may be more beneficial to always use a CDN for it, especially since that will enable your app to pick up new controllers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let nextId = 0; | |
const allocatedObjects = new Map(); | |
const refLossTimes = new Map(); | |
let reportCount = 0; | |
let reportTime = 0; | |
const finReg = new FinalizationRegistry((id) => { | |
const lossTime = performance.now() - refLossTimes.get(id); | |
refLossTimes.delete(id); |