Download node_modules/three/src/renderers/webgl/WebGLRenderStates.js from SimWorld-AI/industrial-harbor-viewer: direct link, hf CLI and curl.
- Browser
- Download file 1.69 kB
-
https://huggingface.co/spaces/SimWorld-AI/industrial-harbor-viewer/resolve/main/node_modules/three/src/renderers/webgl/WebGLRenderStates.js
- Command line
-
hf download hf://spaces/SimWorld-AI/industrial-harbor-viewer/node_modules/three/src/renderers/webgl/WebGLRenderStates.js
-
curl -L -o WebGLRenderStates.js https://huggingface.co/spaces/SimWorld-AI/industrial-harbor-viewer/resolve/main/node_modules/three/src/renderers/webgl/WebGLRenderStates.js
1.69 kB
| import { WebGLLights } from './WebGLLights.js'; | |
| function WebGLRenderState( extensions, capabilities ) { | |
| const lights = new WebGLLights( extensions, capabilities ); | |
| const lightsArray = []; | |
| const shadowsArray = []; | |
| function init() { | |
| lightsArray.length = 0; | |
| shadowsArray.length = 0; | |
| } | |
| function pushLight( light ) { | |
| lightsArray.push( light ); | |
| } | |
| function pushShadow( shadowLight ) { | |
| shadowsArray.push( shadowLight ); | |
| } | |
| function setupLights( useLegacyLights ) { | |
| lights.setup( lightsArray, useLegacyLights ); | |
| } | |
| function setupLightsView( camera ) { | |
| lights.setupView( lightsArray, camera ); | |
| } | |
| const state = { | |
| lightsArray: lightsArray, | |
| shadowsArray: shadowsArray, | |
| lights: lights | |
| }; | |
| return { | |
| init: init, | |
| state: state, | |
| setupLights: setupLights, | |
| setupLightsView: setupLightsView, | |
| pushLight: pushLight, | |
| pushShadow: pushShadow | |
| }; | |
| } | |
| function WebGLRenderStates( extensions, capabilities ) { | |
| let renderStates = new WeakMap(); | |
| function get( scene, renderCallDepth = 0 ) { | |
| const renderStateArray = renderStates.get( scene ); | |
| let renderState; | |
| if ( renderStateArray === undefined ) { | |
| renderState = new WebGLRenderState( extensions, capabilities ); | |
| renderStates.set( scene, [ renderState ] ); | |
| } else { | |
| if ( renderCallDepth >= renderStateArray.length ) { | |
| renderState = new WebGLRenderState( extensions, capabilities ); | |
| renderStateArray.push( renderState ); | |
| } else { | |
| renderState = renderStateArray[ renderCallDepth ]; | |
| } | |
| } | |
| return renderState; | |
| } | |
| function dispose() { | |
| renderStates = new WeakMap(); | |
| } | |
| return { | |
| get: get, | |
| dispose: dispose | |
| }; | |
| } | |
| export { WebGLRenderStates }; | |