📄 Viewport.Pathtracer.js
¶
📊 Analysis Summary¶
Metric | Count |
---|---|
🔧 Functions | 9 |
📦 Imports | 1 |
📊 Variables & Constants | 1 |
📚 Table of Contents¶
🛠️ File Location:¶
📂 editor/js/Viewport.Pathtracer.js
📦 Imports¶
Name | Source |
---|---|
WebGLPathTracer |
three-gpu-pathtracer |
Variables & Constants¶
Name | Type | Kind | Value | Exported |
---|---|---|---|---|
pathTracer |
any |
let/var | null |
✗ |
Functions¶
ViewportPathtracer(renderer: any): { init: (scene: any, camera: any) => void; setSize: () => void; setBackground: () => void; setEnvironment: () => void; updateMaterials: () => void; update: () => void; reset: () => void; getSamples: () => any; }
¶
Parameters:
renderer
any
Returns: { init: (scene: any, camera: any) => void; setSize: () => void; setBackground: () => void; setEnvironment: () => void; updateMaterials: () => void; update: () => void; reset: () => void; getSamples: () => any; }
Calls:
pathTracer.setScene
pathTracer.updateCamera
pathTracer.updateEnvironment
pathTracer.updateMaterials
pathTracer.renderSample
Internal Comments:
// path tracer size automatically updates based on the canvas (x4)
// update environment settings based on initialized scene fields (x4)
Code
function ViewportPathtracer( renderer ) {
let pathTracer = null;
function init( scene, camera ) {
if ( pathTracer === null ) {
pathTracer = new WebGLPathTracer( renderer );
pathTracer.filterGlossyFactor = 0.5;
}
pathTracer.setScene( scene, camera );
}
function setSize( /* width, height */ ) {
if ( pathTracer === null ) return;
// path tracer size automatically updates based on the canvas
pathTracer.updateCamera();
}
function setBackground( /* background, blurriness */ ) {
if ( pathTracer === null ) return;
// update environment settings based on initialized scene fields
pathTracer.updateEnvironment();
}
function updateMaterials() {
if ( pathTracer === null ) return;
pathTracer.updateMaterials();
}
function setEnvironment( /* environment */ ) {
if ( pathTracer === null ) return;
pathTracer.updateEnvironment();
}
function update() {
if ( pathTracer === null ) return;
pathTracer.renderSample();
}
function reset() {
if ( pathTracer === null ) return;
pathTracer.updateCamera();
}
function getSamples() {
if ( pathTracer === null ) return;
return pathTracer.samples;
}
return {
init: init,
setSize: setSize,
setBackground: setBackground,
setEnvironment: setEnvironment,
updateMaterials: updateMaterials,
update: update,
reset: reset,
getSamples: getSamples
};
}
init(scene: any, camera: any): void
¶
Parameters:
scene
any
camera
any
Returns: void
Calls:
pathTracer.setScene
Code
setSize(): void
¶
Returns: void
Calls:
pathTracer.updateCamera
Internal Comments:
Code
setBackground(): void
¶
Returns: void
Calls:
pathTracer.updateEnvironment
Internal Comments:
Code
updateMaterials(): void
¶
Returns: void
Calls:
pathTracer.updateMaterials
Code
setEnvironment(): void
¶
Returns: void
Calls:
pathTracer.updateEnvironment
Code
update(): void
¶
Returns: void
Calls:
pathTracer.renderSample
reset(): void
¶
Returns: void
Calls:
pathTracer.updateCamera
getSamples(): any
¶
Returns: any