Skip to content

Instantly share code, notes, and snippets.

@hmans
hmans / ManagedInstancedMesh.ts
Last active January 12, 2021 11:41
Managed Instanced Mesh API
import * as THREE from "three"
export type Instance = {
object: THREE.Object3D
color?: THREE.Color
index: number
data: any
}
/* Our ManagedInstancedMesh class that we can use with just plain old Three.js */
@steveruizok
steveruizok / example.tsx
Last active December 2, 2020 03:48
A utility function for getting the type-asserted value of a ref in React.
import * as React from "react"
import { getRef } from "./getRef"
export default function App() {
const rCanvas = React.useRef<HTMLCanvasElement>(null)
React.useEffect(() => {
const canvas = getRef(rCanvas)
canvas.width = window.innerWidth
canvas.width = window.innerHeight
@tgfrerer
tgfrerer / gradient.glsl
Last active June 17, 2024 07:23
glsl gradient mapping - achieves similar looks as photoshop's (or other graphics editors') gradients with colour stops.
// _____ ___
// / / / / gradient.glsl
// / __/ * / /__ (c) ponies & light, 2014. All rights reserved.
// /__/ /_____/ poniesandlight.co.uk
//
// Created by tgfrerer on 18/03/2014.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights