This file contains hidden or 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
/* | |
const pnts = [-2,0,-2,-2,0,2,2,0,2,2,0,-2]; | |
for( let v of iterFlatVec3Buf( pnts ) ) console.log( v ); | |
instead of | |
const v = [0,0,0]; | |
for( let i=0; i < pnts.length; i+=3 ){ | |
v[0] = pnts[i+0]; | |
v[1] = pnts[i+1]; |
This file contains hidden or 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
function nanoID( t=21 ){ | |
const r = crypto.getRandomValues( new Uint8Array( t ) ); | |
let n, e = ''; | |
for( ;t--; ){ | |
n = 63 & r[ t ]; | |
e += ( n < 36 )? n.toString( 36 ) : | |
( n < 62 )? ( n - 26 ).toString( 36 ).toUpperCase() : | |
( n < 63 )? '_' : '-'; | |
} | |
return e; |
This file contains hidden or 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
function KeyboardEvents(){ | |
let self; | |
const keys = new Map(); // State of a key press, lets user hold down multiple buttons | |
// #region HANDLERS | |
const onKeyDown = e=>{ keys.set( e.key, true ); }; | |
const onKeyUp = e=>{ keys.set( e.key, false ); }; | |
// #endregion | |
// #region MAIN |
This file contains hidden or 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
import * as THREE from 'three'; | |
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js'; | |
/* | |
const App = useThreeWebGL2(); | |
App.scene.add( facedCube( [0,3,0], 6 ) ); | |
App | |
.sphericalLook( 45, 35, 40 ) | |
.renderLoop(); | |
*/ |
This file contains hidden or 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
import { ShaderChunk } from 'three'; | |
/* | |
USAGE | |
const geo = new THREE.BoxGeometry( 1, 1, 1 ); | |
const mat = new THREE.PointsMaterial( { size: 0.5, vertexColors: true } ); | |
const mesh = new THREE.Points( geo, mat ); | |
resolvedShaderPromise( mat ). | |
then( sh => console.log( sh ) ); | |
*/ |
This file contains hidden or 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
function nanoID( t=21 ){ | |
const r = crypto.getRandomValues( new Uint8Array( t ) ); | |
let n, e = ''; | |
for( ;t--; ){ | |
n = 63 & r[ t ]; | |
e += ( n < 36 )? n.toString( 36 ) : | |
( n < 62 )? ( n - 26 ).toString( 36 ).toUpperCase() : | |
( n < 63 )? '_' : '-'; | |
} | |
return e; |
This file contains hidden or 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
/* [ NOTES ] ============================================================ | |
BigInt has 64 bits, since its signed there is only 63 bits to work with. | |
First 5 bits are reserved to store the Level value, which results the max value of 31 | |
63bits - 5bits = 58 bits for quadrant information | |
Each quadrant needs 2bits to store its information | |
So 58 / 2 = 29, which is the max level to generate ids from |
This file contains hidden or 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
jntCount = ChainPose.count; | |
angles[] = new Array( jntCount ).fill( 0 ) | |
loop | |
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
// Get world space transform (pos,rot,scl) of each bone in the chain | |
// Then preallocate space for the jacobian matrix | |
transforms[] = compute_WorldSpace_Transforms( ChainPose ); | |
jacobian = Array( transforms.length * 3 * 3 ); // Each Joint gets 3 floats for 3 axes | |
This file contains hidden or 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
/* | |
const fnWorker = ( evt )=>{ | |
const data = evt.data; | |
fnCreateVert( data ); | |
}; | |
async function fnCreateVert( y ){ | |
const vert = new Float32Array( [0,y,0] ); | |
console.log( 'Elevation Request', y, vert ); | |
console.log( 'Size before post', vert.byteLength ); |
This file contains hidden or 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
Create a folder called .vscode at the root of the project, add this file to it. | |
ctrl+shift-b will rust the quickstart script. | |
If you run the shortcut again, it will prompt you to terminate or restart the task. You will need to use a mouse to select the options. | |
---------- | |
::FUTURE:: | |
https://github.com/microsoft/vscode/pull/117129 | |
instancePolicy doesn't work yet. Waiting on review/merge. |