Skip to content

Instantly share code, notes, and snippets.

View akella's full-sized avatar
🏠
Working from home

Yuri Artiukh akella

🏠
Working from home
View GitHub Profile
@akella
akella / curl.glsl
Created November 5, 2023 09:03
curl.glsl
#define PI 3.1415926538
const float EPS = 0.001;
vec4 mod289(vec4 x) {
return x - floor(x * (1.0 / 289.0)) * 289.0;
}
float mod289(float x) {
return x - floor(x * (1.0 / 289.0)) * 289.0;
}
vec4 permute(vec4 x) {
@akella
akella / oklab.glsl
Created October 8, 2023 07:55
oklab.glsl
float fixedpow(float a, float x)
{
return pow(abs(a), x) * sign(a);
}
float cbrt(float a)
{
return fixedpow(a, 0.3333333333);
}
@akella
akella / noise.glsl
Created June 19, 2022 07:43
noise.glsl
//
// GLSL textureless classic 3D noise "cnoise",
// with an RSL-style periodic variant "pnoise".
// Author: Stefan Gustavson (stefan.gustavson@liu.se)
// Version: 2011-10-11
//
// Many thanks to Ian McEwan of Ashima Arts for the
// ideas for permutation and gradient selection.
//
// Copyright (c) 2011 Stefan Gustavson. All rights reserved.
move(orientation, position) {
this.isAnimated = true;
let temp = new THREE.Vector3();
let start = new THREE.Spherical().setFromVector3(this.camera.position);
let finish = new THREE.Spherical().setFromVector3(position);
if(Math.abs(start.theta-finish.theta)>Math.PI){
if( Math.abs(start.theta-finish.theta - 2*Math.PI) <Math.abs(start.theta-finish.theta + 2*Math.PI)){
finish.theta +=2*Math.PI
} else{
finish.theta -=2*Math.PI
import gsap from "gsap";
move(orientation, position) {
this.isAnimated = true;
let temp = new THREE.Vector3();
let start = new THREE.Spherical().setFromVector3(this.camera.position);
let finish = new THREE.Spherical().setFromVector3(position);
gsap.to(this.controls.target, {
duration: 2,
@akella
akella / asd
Created January 11, 2022 14:44
ad
I am attesting that this GitHub handle akella is linked to the Tezos account tz1TyhGTFiCSAS4XXGr21YfDgp37hYVY4x26 for tzprofiles
sig:edsigu3GfoE8g8sKtpjD2mjQkr1uKWUan5rgB94nUL6dHksWbsDUjabDWRbTR33DEGRq2BpBvCetJQHxmLFoz41JLuFZiLxp2qV
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
canvas{
border: 1px solid #000;
@akella
akella / noise.glsl
Created January 24, 2021 08:42
noise4d
//
// Description : Array and textureless GLSL 2D/3D/4D simplex
// noise functions.
// Author : Ian McEwan, Ashima Arts.
// Maintainer : ijm
// Lastmod : 20110822 (ijm)
// License : Copyright (C) 2011 Ashima Arts. All rights reserved.
// Distributed under the MIT License. See LICENSE file.
// https://github.com/ashima/webgl-noise
//
@akella
akella / sw.js
Created January 22, 2021 16:03
sw boilerplate
// navigator.serviceWorker.register('sw.js');
var CACHE = "cache-name";
self.addEventListener("install", function (evt) {
console.log("Установка");
evt.waitUntil(precache());
});
@akella
akella / ProfiledContourGeometry.js
Created December 27, 2020 13:31
christmas tree
// from https://discourse.threejs.org/t/profiledcontourgeometry/2330
// Author: Prisoner849
function ProfiledContourGeometry(profileShape, contour, contourClosed, openEnded) {
contourClosed = contourClosed !== undefined ? contourClosed : true;
openEnded = openEnded !== undefined ? openEnded : false;
openEnded = contourClosed === true ? false : openEnded;
let profileGeometry = new THREE.ShapeBufferGeometry(profileShape);