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;
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
| // 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; |
Code examples from this stack overflow answer.
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
| # 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", |
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?
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.
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 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 |
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 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')); |