<!doctype html> | |
<meta charset="utf-8"> | |
<title>Benchmark</title> | |
<body></body> | |
<style>html, body, #map { height: 100%; margin: 0; } </style> | |
<div id="map"></div> | |
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.40.0/mapbox-gl.js'></script> | |
<!-- <script src="mapbox-gl.js"></script> --> |
I tried to run https://dev.to/andraconnect/augmented-reality-in-10-lines-of-html and https://github.com/jeromeetienne/ar.js from my own computer and got the following error:
Can't access user media :()
This error comes from:
https://github.com/jeromeetienne/jsartoolkit-experiments/blob/master/basic.html Line 100: navigator.getUserMedia
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 |
// SAT collision check and resolution | |
// Public domain | |
// Usage example: | |
// if (testCollision(obb1, obb2, mtv)) { // obb1, obb2 - sf::RectangleShape, mtv - sf::Vector2f | |
// obb1.move(mtv); | |
// } | |
static const float NORMAL_TOLERANCE = 0.0001f; | |
using RectVertexArray = std::array<sf::Vector2f, 4>; |
Tweening between one and many polygons with an approach that's faster and more robust than this Voronoi jigsaw attempt.
This approach uses earcut and some artisanal TopoJSON to triangulate the polygon and successively merge the triangles into the desired number of pieces, and then adds/rewinds points for smoother transitions (see this demo for a better look at what's happening behind the scenes).
See also: Triangulation morphing, Jigsaw morphing, Smoother polygon transitions
// The following code is licensed under the MIT license: https://gist.github.com/TheRealMJP/bc503b0b87b643d3505d41eab8b332ae | |
// Samples a texture with Catmull-Rom filtering, using 9 texture fetches instead of 16. | |
// See http://vec3.ca/bicubic-filtering-in-fewer-taps/ for more details | |
float4 SampleTextureCatmullRom(in Texture2D<float4> tex, in SamplerState linearSampler, in float2 uv, in float2 texSize) | |
{ | |
// We're going to sample a a 4x4 grid of texels surrounding the target UV coordinate. We'll do this by rounding | |
// down the sample location to get the exact center of our "starting" texel. The starting texel will be at | |
// location [1, 1] in the grid, where [0, 0] is the top left corner. | |
float2 samplePos = uv * texSize; |
# RGB to Lab conversion | |
# Step 1: RGB to XYZ | |
# http://www.easyrgb.com/index.php?X=MATH&H=02#text2 | |
# Step 2: XYZ to Lab | |
# http://www.easyrgb.com/index.php?X=MATH&H=07#text7 | |
def rgb2lab(inputColor): |
function slugify(text) | |
{ | |
var from = "ãàáäâẽèéëêìíïîõòóöôùúüûñç·/_,:;"; | |
var to = "aaaaaeeeeeiiiiooooouuuunc------"; | |
_.each( from, function( character, i ) { | |
text = text.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i)); | |
}); | |
return text | |
.toString() // Cast to string | |
.toLowerCase() // Convert the string to lowercase letters |