Never took the time to dissect Three.js gallery code ā I used to just grab it and make it work, since I know the craziness of Three.js. But this is the first time Iām really digging into it and adding new features to the Three.js gallery:
Video autoplay
GIF support
WordPress image uploads (automatic)
Easily handles 1000+ images with video without killing the browser (will add and test soon)
ToyBox Procedural Plugin – v1.1 (POTATO PC & MOBILE OPTIMIZED)
/** * ToyBox Procedural Plugin - v1.1 (POTATO PC & MOBILE OPTIMIZED) * Extension for ToyBox Core. * Style: Randomized themes on every click. */constTB_GEN= (function(){// Internal Helper: Uses Core TB.spawnVoxelconstspawn=(x,y,z,c,s,h)=>{if (typeofTB!=='undefined') {// We set saveHistory to false during loops to save RAM/CPUTB.spawnVoxel(x,y,z,c,s,false,"gen_group",h);}};return{terrain:function(size=15){// Reduced default size for mobile safety (30x30 grid)console.log("Generating Lite Terrain...");// STYLE RANDOMIZERconststyles= [{c:3,freq:0.2,amp:2},// Grasslands (Green){c:1,freq:0.4,amp:3},// Desert Peaks (Orange){c:10,freq:0.1,amp:1},// Snow Plains (White){c:13,freq:0.3,amp:4},// Dark Mountains (Slate){c:5,freq:0.5,amp:2}// Crystal Reef (Cyan/Transparent) ];consttheme=styles[Math.floor(Math.random() *styles.length)];constseed=Math.random() *50;constgrid=1.0;for (letx=-size;x<size;x++) {for (letz=-size;z<size;z++) {// Optimized Math: Lower frequency noiseconsty=Math.round(Math.sin(x*theme.freq+seed) *Math.cos(z*theme.freq+seed) *theme.amp );// Skip blocks below ground to save memoryif (y<-1) continue;spawn(x*grid,y,z*grid,theme.c,grid,grid);}}TB.saveGame();// Final save},maze:function(size=12){// Small size is much faster for pathfinding/mobileconsole.log("Generating Lite Maze...");// STYLE RANDOMIZERconstwallColors= [13,12,0,7];// Slate, Blue, Red, Purpleconstcolor=wallColors[Math.floor(Math.random() *wallColors.length)];constwallHeight=Math.random() >0.5?2:1;constdensity=0.6+ (Math.random() *0.2);// Random wall frequencyfor (letx=-size;x<size;x++) {for (letz=-size;z<size;z++) {// Logic: Create paths by checking grid moduloif (x%2===0||z%2===0) {if (Math.random() >density) {spawn(x,wallHeight/2,z,color,1,wallHeight);}}}}TB.saveGame();}};})();