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.plane = new PlaneBufferGeometry(1, 1, 1, 1); | |
this.viewerMaterial = new RawShaderMaterial({ | |
blending: AdditiveBlending, | |
vertexShader: ` | |
precision highp float; | |
uniform mat4 modelViewMatrix; | |
uniform mat4 projectionMatrix; | |
attribute vec2 uv; |
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.geometry = new BufferGeometry(); | |
this.geometry.addAttribute('position', new BufferAttribute(ids, 1)); | |
this.material = new RawShaderMaterial({ | |
name: 'Particles', | |
fragmentShader: ` | |
precision highp float; | |
void main() { | |
gl_FragColor = vec4(0.584,0.052,0.880, 1.0); | |
} |
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 POINTS = 256; | |
const vertices = new Float32Array(POINTS * 4); | |
const ids = new Float32Array(POINTS); | |
for (let i = 0; i < POINTS * 4; i += 4) { | |
vertices[i + 0] = randomFloat(-5, 5); | |
vertices[i + 1] = randomFloat(-5, 5); | |
vertices[i + 2] = randomFloat(-5, 5); | |
vertices[i + 3] = randomFloat(0, 4); // random ID, for different sizes | |
} |
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
precision highp float; | |
uniform float uTime; | |
uniform sampler2D texture; | |
uniform sampler2D uWind; | |
uniform sampler2D uTrail; | |
void main() { | |
float pixelHeight = 1.0 / RESOLUTION.y; | |
float pixelWidth = 1.0 / RESOLUTION.x; | |
vec2 uv = gl_FragCoord.xy / RESOLUTION.xy; |
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, | |
RepeatWrapping, | |
} from 'three'; | |
import FBO from '../utils/fbo'; | |
import textures from 'gl/utils/textures'; | |
import trail from '../utils/trail'; | |
import bidello from 'bidello'; |
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
// Button DOM | |
<a href="#" data-component="trackable" data-type="button">Yo, button</a> | |
// Trackable kapla component (https://github.com/thierrymichel/kapla) | |
// Using it just to track when some dom is "mounted/unmounted" | |
import { Component } from 'kapla'; | |
import dom from 'gl/dom'; | |
export default class extends Component { | |
init() { |
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
/** | |
* Try to fix iOS lock on audio. | |
* | |
* By default, audio on iOS is locked until a sound is played within a user interaction, | |
* and then it plays normally the rest of the page session. | |
*/ | |
// Inspired from https://github.com/goldfire/howler.js/blob/2.0/src/howler.core.js#L212 | |
export default class IosUnlock { |
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
/* | |
To use it, simply declare: | |
`const post = new PostFX(rendering);` | |
Then on update, instead of: | |
`rendering.render(scene, camera);` | |
replace with: | |
`post.render(scene, camera);` | |
*/ | |
import { |
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 drawille = require('drawille') | |
const bunny = require('bunny') | |
const glmatrix = require('gl-matrix') | |
const width = 200 | |
const height = 200 | |
const canvas = new drawille(width, height) | |
const mat4 = glmatrix.mat4 | |
const vec3 = glmatrix.vec3 | |
let points = [] |
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
export default class ObjectPool { | |
constructor(options = {}) { | |
this.options = Object.assign({ | |
number: 10, | |
Create() { | |
return {}; | |
}, | |
}, options); | |
this.available = []; |