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
// mix foreground and background based on foreground alpha value | |
vec4 finalColor; | |
finalColor.rgb = foreground.rgb + (background.rgb * (1.0 - foreground.a)); | |
finalColor.a = foreground.a + (background.a * (1.0 - foreground.a)); |
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
checkPerf() { | |
// performance test based on cpu performance | |
// higher score means worse performance | |
// based on Baptiste Briel's work: http://awams.bbriel.me/27 | |
let perf = 0; | |
const start = (performance || Date).now(); | |
let array = []; | |
for(let i = 0; i < 20000; i++) { | |
array = Math.pow(Math.sin(Math.random()), 2); |
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
/*** | |
Really basic example of how I'm rendering the WebGL elements of my portfolio: https://www.martin-laxenaire.fr/ | |
***/ | |
import { | |
Curtains, | |
Plane, | |
Vec2, | |
PingPongPlane, | |
RenderTarget, | |
ShaderPass |
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
/*** | |
Helper class to create text textures easily with curtains.js | |
Supports: | |
- vertical and horizontal text alignements | |
- lowercase and uppercase | |
- filled or stroked text | |
Does not support: | |
- right to left text (TODO) | |
- custom letter spacing |