Skip to content

Instantly share code, notes, and snippets.

View williammanco's full-sized avatar
㊙️

William Manco williammanco

㊙️
View GitHub Profile
@williammanco
williammanco / ECSExampleInES6.js
Created September 16, 2022 21:41 — forked from TheSeamau5/ECSExampleInES6.js
ECS Example in Javascript / ES6
// HELPER FUNCTIONS
const has = (entity, components) => {
const exists = (x) => typeof x !== "undefined";
return components.map((component) => exists(entity[component]))
.reduce((x,y) => x && y);
};
const clone = (object) => {
if (object === null || typeof object !== 'object'){
return object;
@williammanco
williammanco / GLSL-Math.md
Created March 21, 2019 15:02 — forked from patriciogonzalezvivo/GLSL-Math.md
GLSL Math functions

Trigonometry

const float PI = 3.1415926535897932384626433832795;
const float PI_2 = 1.57079632679489661923;
const float PI_4 = 0.785398163397448309616;

float PHI = (1.0+sqrtf(5.0))/2.0;
@williammanco
williammanco / README.md
Created November 9, 2018 08:03 — forked from balupton/README.md
Node.js Best Practice Exception Handling
# https://blender.stackexchange.com/q/57306/3710
# https://blender.stackexchange.com/q/79779/3710
bl_info = {
"name": "Add-on Template",
"description": "",
"author": "",
"version": (0, 0, 1),
"blender": (2, 70, 0),
"location": "3D View > Tools",
@williammanco
williammanco / unlock-autoplay-audio-video.md
Created May 7, 2018 17:32 — forked from TimvanScherpenzeel/unlock-autoplay-audio-video.md
Implementing audio and video autoplay unlocking

Implementing audio and video autoplay unlocking

Due to recent changes in the autoplay policy of Chrome 66 developers of interactive experiences on the web are facing new challenges regarding audio and video autoplay. The new policy has unfortunately broken many of the older experiences that rely on autoplaying audio and video.

So how to move forward?

Previous solutions

Previously developers used to face this issue on iOS mobile devices where the audio context was locked. Most developers fixed this by using the initial touch event of a user to unlock the audio.

@williammanco
williammanco / IceMaterial.js
Created October 30, 2017 08:45 — forked from mattdesl/IceMaterial.js
fast subsurface scattering in ThreeJS PBR material — see "TRANSLUCENCY" in the frag shader
const glslify = require('glslify');
const path = require('path');
const assign = require('object-assign');
const defined = require('defined');
// This is the original source, we will copy + paste it for our own GLSL
// const vertexShader = THREE.ShaderChunk.meshphysical_vert;
// const fragmentShader = THREE.ShaderChunk.meshphysical_frag;
// Our custom shaders
@williammanco
williammanco / MeshCustomMaterial.js
Created September 20, 2017 05:44 — forked from mattdesl/MeshCustomMaterial.js
Custom mesh standard material with glslify + ThreeJS r83dev
const glslify = require('glslify');
const path = require('path');
// This is the original source, we will copy + paste it for our own GLSL
// const vertexShader = THREE.ShaderChunk.meshphysical_vert;
// const fragmentShader = THREE.ShaderChunk.meshphysical_frag;
// Our custom shaders
const fragmentShader = glslify(path.resolve(__dirname, 'standard.frag'));
const vertexShader = glslify(path.resolve(__dirname, 'standard.vert'));