playcanvas
Version:
Open-source WebGL/WebGPU 3D engine for the web
55 lines (52 loc) • 1.64 kB
JavaScript
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 {
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]);
}
}
constructor(device, node, cameraNode, layer, workBuffer){
this._workBufferFormatVersion = -1;
this.fisheyeProj = new FisheyeProjection();
this.device = device;
this.node = node;
this.cameraNode = cameraNode;
this.layer = layer;
this.workBuffer = workBuffer;
this._workBufferFormatVersion = workBuffer?.format.extraStreamsVersion ?? -1;
}
}
export { GSplatRenderer };