UNPKG

@babylonjs/viewer

Version:

The Babylon Viewer aims to simplify a specific but common Babylon.js use case: loading, viewing, and interacting with a 3D model.

50 lines (48 loc) 1.74 kB
import { g as getGltfPunctualLight } from './gltf-light-pointer-state-FBNUQ5Q_.esm.js'; import { _ as _appendPointerHandlers } from './gltf-feature-animation-pointer-DbLO7iMT.esm.js'; import './index-By0tcgYN.esm.js'; import './visibility-BuRfFMHe.esm.js'; import './gltf-animation-CvJhPzAe.esm.js'; const _lightHandlers = [ // /extensions/KHR_lights_punctual/lights/{l}/{color|intensity|range|spot/outerConeAngle} [ /^\/extensions\/KHR_lights_punctual\/lights\/(\d+)\/(color|intensity|range|spot\/outerConeAngle)$/, (m, ctx) => { const lightIdx = +m[1]; const field = m[2]; const getLight = () => { return getGltfPunctualLight(ctx._json, lightIdx) ?? null; }; return { arity: field === "color" ? 3 : 1, writer: (out, off) => { const light = getLight(); if (!light) { return; } if (field === "color") { if (light.diffuse) { light.diffuse[0] = out[off]; light.diffuse[1] = out[off + 1]; light.diffuse[2] = out[off + 2]; } if (light.specular) { light.specular[0] = out[off]; light.specular[1] = out[off + 1]; light.specular[2] = out[off + 2]; } } else if (field === "intensity") { light.intensity = out[off]; } else if (field === "range") { light.range = out[off]; } else if (light.lightType === "spot") { light.angle = out[off] * 2; } light._bumpLightVersion?.(); } }; } ] ]; _appendPointerHandlers(_lightHandlers); //# sourceMappingURL=animation-pointer-lights-f4E4fB55.esm.js.map