UNPKG

playcanvas

Version:

Open-source WebGL/WebGPU 3D engine for the web

69 lines (68 loc) 1.62 kB
import gsplatOutputVS from "../shader-lib/wgsl/chunks/gsplat/vert/gsplatOutput.js"; import { shaderChunksWGSL } from "../shader-lib/wgsl/collections/shader-chunks-wgsl.js"; import { FisheyeProjection } from "../graphics/fisheye-projection.js"; class GSplatRenderer { device; node; cameraNode; layer; workBuffer; renderMode; _workBufferFormatVersion = -1; fisheyeProj = new FisheyeProjection(); constructor(device, node, cameraNode, layer, workBuffer) { this.device = device; this.node = node; this.cameraNode = cameraNode; this.layer = layer; this.workBuffer = workBuffer; this._workBufferFormatVersion = workBuffer?.format.extraStreamsVersion ?? -1; } destroy() { } setRenderMode(renderMode) { this.renderMode = renderMode; } get material() { return null; } setDataSource(source) { this.workBuffer = source; this.onWorkBufferFormatChanged(); } onWorkBufferFormatChanged() { } update(count, textureSize) { } setGpuSortedRendering(drawSlot, sortedIds, numSplatsBuffer, textureSize) { } setCpuSortedRendering() { } setOrderData() { } frameUpdate(params, exposure, fogParams) { } updateOverdrawMode(params) { } _createTonemapIncludes(cincludes) { cincludes.set("gsplatOutputVS", gsplatOutputVS); const chunkNames = [ "tonemappingPS", "tonemappingNonePS", "tonemappingLinearPS", "tonemappingFilmicPS", "tonemappingHejlPS", "tonemappingAcesPS", "tonemappingAces2PS", "tonemappingNeutralPS", "decodePS", "gammaPS" ]; for (const name of chunkNames) { cincludes.set(name, shaderChunksWGSL[name]); } } } export { GSplatRenderer };