This file contains 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
precision highp float; | |
precision highp int; | |
#define SHADER_NAME ShaderMaterial | |
#define GAMMA_FACTOR 2 | |
#define DOUBLE_SIDED | |
#define NUM_CLIPPING_PLANES 0 | |
uniform mat4 viewMatrix; | |
uniform vec3 cameraPosition; | |
#define TONE_MAPPING | |
#define saturate(a) clamp( a, 0.0, 1.0 ) |
This file contains 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
// Rotations | |
const step = 'q1'; | |
const cameraRotations = { | |
q1: { | |
x: 0.75, | |
y: 0, | |
z: 0, | |
}, | |
q2A: { | |
x: -0, |
This file contains 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 [sound, setSound] = useState() | |
const [listener, setListener] = useState() | |
const [analyser, setAnalyser] = useState() | |
const [data, setData] = useState(1) | |
// load a sound and set it as the Audio object's buffer | |
useEffect(() => { | |
const listener = new THREE.AudioListener() | |
setListener(listener) | |
const sound = new THREE.PositionalAudio(listener) | |
setSound(sound) |
This file contains 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
// | |
// Description : Array and textureless GLSL 2D/3D/4D simplex | |
// noise functions. | |
// Author : Ian McEwan, Ashima Arts. | |
// Maintainer : stegu | |
// 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 | |
// https://github.com/stegu/webgl-noise |
This file contains 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
import * as React from 'react'; | |
import { Uniform } from 'three'; | |
import { Effect } from 'postprocessing'; | |
const fragmentShader = ` | |
void mainImage(const in vec4 inputColor, const in vec2 uv, out vec4 outputColor) { | |
if (uv.y < .5) discard; | |
outputColor = vec4(vec3(average(inputColor.rgb)), inputColor.a); | |
}`; |
This file contains 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
let Web3 = require("web3"); | |
// Replace value of rpc with https://rpc-mumbai.matic.today for Mumbai | |
let rpc = "https://rpc-mainnet.matic.network"; | |
const provider = new Web3.providers.HttpProvider(rpc); | |
const web3 = new Web3(provider); | |
// Add your private key | |
web3.eth.accounts.wallet.add("pvt-key"); |
This file contains 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
var _ = require('lodash'); | |
... | |
Post | |
.findOne(req.param('id')) | |
.populate('user') | |
.populate('comments') | |
.then(function(post) { | |
var commentUsers = User.find({ |
This file contains 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
var keystone = require('keystone'); | |
var Types = keystone.Field.Types; | |
var randToken = require('rand-token'); | |
/** | |
* File Model | |
* ========== | |
*/ | |
var File = new keystone.List('File', { |
This file contains 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
#define SHADER_NAME PolyhedronMaterial | |
precision highp float; | |
uniform sampler2D map; | |
uniform vec2 uvDisp; | |
uniform float time; | |
varying float smoothShading; | |
// varying vec3 viewPos; | |
varying vec2 vUV; |
This file contains 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
import React, { useEffect, useMemo } from 'react' | |
import { useFrame, useThree, extend, useLoader } from 'react-three-fiber' | |
import * as THREE from 'three' | |
import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer' | |
import { RenderPass } from 'three/examples/jsm/postprocessing/RenderPass' | |
import { ShaderPass } from 'three/examples/jsm/postprocessing/ShaderPass' | |
// import { UnrealBloomPass } from 'three/examples/jsm/postprocessing/UnrealBloomPass' | |
import { FXAAShader } from 'three/examples/jsm/shaders/FXAAShader' |