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
// cols (int) – character width | |
// progress (float) – progress in the range (0-1) | |
function drawProgress (cols, progress) { | |
const { stdout } = process | |
let c0 = Math.round(progress * cols) | |
let c1 = cols - c0 | |
let b0 = new Array(c0).fill('/').join('') | |
let b1 = new Array(c1).fill('.').join('') |
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
import { | |
Scene, | |
PerspectiveCamera, | |
WebGLRenderer | |
} from 'three' | |
function createXrThree () { | |
let sessionState = { | |
isActive: false, | |
scene: null, |
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
import { | |
NearestFilter, | |
RGBAFormat, | |
Uniform | |
} from 'three' | |
import { | |
BlendFunction, | |
Effect | |
} from 'postprocessing' |
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
import { SavePass } from 'postprocessing' | |
export class SaveSwapPass extends SavePass { | |
render (renderer, inputBuffer, outputBuffer, deltaTime, stencilTest, composer) { | |
let currentRenderTarget = this.renderTarget | |
let composerRenderTargetName = inputBuffer === composer.inputBuffer | |
? 'inputBuffer' | |
: 'outputBuffer' | |
this.renderTarget = composer[composerRenderTargetName] |
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
const WebVRPolyfill = require('webvr-polyfill') | |
const polyfill = new WebVRPolyfill({ | |
BUFFER_SCALE: 0.5, | |
CARDBOARD_UI_DISABLED: true, | |
DIRTY_SUBMIT_FRAME_BINDINGS: false | |
}) | |
console.log('WebVRPolyfill', polyfill) | |
const regl = require('regl')({ |
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
const createREGL = require('regl') | |
const { mat4 } = require('gl-matrix') | |
const { Stats } = require('@jpweeks/rstats') | |
const { LineBuilder } = require('regl-line-builder') | |
const regl = createREGL() | |
const setupCamera = regl({ | |
uniforms: { | |
view: mat4.identity([]), | |
projection: ({ viewportWidth, viewportHeight }) => { |
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
const traversable = require('traverse') | |
const state = traversable({ | |
layers: [ | |
{ | |
color: 'red' | |
}, | |
{ | |
color: 'blue' | |
} |
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
const createREGL = require('regl') | |
const mat4 = require('gl-mat4') | |
const { Stats } = require('@jpweeks/rstats') | |
const { LineBuilder } = require('regl-line-builder') | |
const regl = createREGL() | |
const setupCamera = regl({ | |
uniforms: { | |
view: mat4.identity([]), | |
projection: ({ viewportWidth, viewportHeight }) => { |
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
const createREGL = require('regl') | |
const mat4 = require('gl-mat4') | |
const { LineBuilder } = require('regl-line-builder') | |
const regl = createREGL() | |
const setupCamera = regl({ | |
uniforms: { | |
view: mat4.identity([]), | |
projection: ({ viewportWidth, viewportHeight }) => { | |
const w = viewportWidth / 2 |
NewerOlder