import Stats from 'stats-gl'
const stats = new Stats({ trackFPS: true });
const offscreen = canvas.transferControlToOffscreen();
const worker = new Worker('mrt_worker.js');
worker.postMessage({ canvas: offscreen }, [offscreen]);
worker.onmessage = (e) => {
if (e.data.type === 'stats') stats.setData(e.data);
if (e.data.type === 'texture')
stats.setTextureBitmap(e.data.name, e.data.bitmap);
};
import { mrt, output, normalView,
diffuseColor, positionWorld } from 'three/tsl'
scenePass.setMRT(mrt({
output, normal: directionToColor(normalView),
diffuse: diffuseColor, position: positionWorld
}));
diffuse.toStatsGL('Diffuse');
normal.toStatsGL('Normal');
position.toStatsGL('Position');
depth.toStatsGL('Depth');