Extracted from https://github.com/rpavlik/maya2osg/tree/master/src/GLSL
varying vec2 vTexCoord;
varying vec3 vNormal;
varying vec3 vEye;
void main() {
| precision highp float; | |
| uniform float time; | |
| uniform vec2 mouse; | |
| uniform vec2 resolution; | |
| float ball(vec2 p, float fx, float fy, float ax, float ay) { | |
| vec2 r = vec2(p.x + sin(time * fx) * ax, p.y + cos(time * fy) * ay); | |
| return 0.09 / length(r); | |
| } |
| // 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; |
| {0: 'tench, Tinca tinca', | |
| 1: 'goldfish, Carassius auratus', | |
| 2: 'great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias', | |
| 3: 'tiger shark, Galeocerdo cuvieri', | |
| 4: 'hammerhead, hammerhead shark', | |
| 5: 'electric ray, crampfish, numbfish, torpedo', | |
| 6: 'stingray', | |
| 7: 'cock', | |
| 8: 'hen', | |
| 9: 'ostrich, Struthio camelus', |
| #!/usr/bin/env python | |
| import errno | |
| import os | |
| from os import path | |
| import argparse | |
| import time | |
| from multiprocessing.dummy import Pool | |
| from urllib3 import HTTPConnectionPool | |
| import ujson as json |
| #include "ThreadedCin.h" | |
| #pragma mark - Lifecycle | |
| ThreadedCin::ThreadedCin () { | |
| latest = ""; | |
| } | |
| ThreadedCin::~ThreadedCin () { | |
| stopThread(); |
| // | |
| // Simplify.swift | |
| // | |
| // Simplification of a 3D-polyline. | |
| // A port of https://github.com/hgoebl/simplify-java for Swift | |
| // | |
| // | |
| // The MIT License (MIT) | |
| // | |
| // Created by Lachlan Hurst on 10/02/2015. |
Extracted from https://github.com/rpavlik/maya2osg/tree/master/src/GLSL
varying vec2 vTexCoord;
varying vec3 vNormal;
varying vec3 vEye;
void main() {
Please consider using http://lygia.xyz instead of copy/pasting this functions. It expand suport for voronoi, voronoise, fbm, noise, worley, noise, derivatives and much more, through simple file dependencies. Take a look to https://github.com/patriciogonzalezvivo/lygia/tree/main/generative
float rand(float n){return fract(sin(n) * 43758.5453123);}
float noise(float p){
float fl = floor(p);
float fc = fract(p);
| // Determine if an element is in the visible viewport | |
| function isInViewport(element) { | |
| var rect = element.getBoundingClientRect(); | |
| var html = document.documentElement; | |
| return ( | |
| rect.top >= 0 && | |
| rect.left >= 0 && | |
| rect.bottom <= (window.innerHeight || html.clientHeight) && | |
| rect.right <= (window.innerWidth || html.clientWidth) | |
| ); |
| /* | |
| ** Copyright (c) 2012, Romain Dura [email protected] | |
| ** | |
| ** Permission to use, copy, modify, and/or distribute this software for any | |
| ** purpose with or without fee is hereby granted, provided that the above | |
| ** copyright notice and this permission notice appear in all copies. | |
| ** | |
| ** THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
| ** WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
| ** MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY |