Skip to content

Instantly share code, notes, and snippets.

View michaeldll's full-sized avatar

Michael michaeldll

View GitHub Profile
@michaeldll
michaeldll / compress-textures.js
Created March 5, 2024 13:26
Compress KTX2 with toktx using Node.js
import { exec } from 'child_process';
import fs from 'fs';
import path from 'path';
// By Michael de Laborde
// This script compresses PNG and JPG textures to KTX2 using the Khronos toktx tool.
// Uses low quality but highly compressed ETC1S compression by default.
// REQUIREMENTS:
// Install toktx 4.3.1 from https://github.com/KhronosGroup/KTX-Software/releases/tag/v4.3.1
// InstancedMesh helpers
//
import {
BufferAttribute,
InstancedBufferGeometry,
InstancedMesh,
Matrix4,
Vector3,
Vector4,
} from "three"
import { IndexProjectsPageData } from "types/back"
import React, { useEffect, useMemo, useState } from "react"
import { Texture, TextureLoader } from "three"
import InfiniteSlider from "@components/CanvasGL/InfiniteSlider"
import { makeButton, useTweaks } from "use-tweaks"
import random from "canvas-sketch-util/random"
import { Slide } from "../InfiniteSlider/types"
const ProjectsCanvas = ({ pageProps: { allProjects } }: { pageProps: IndexProjectsPageData }) => {
// State