donmccurdy / glTF-Transform

glTF 2.0 SDK for JavaScript and TypeScript, on Web and Node.js.
https://gltf-transform.dev
MIT License
1.43k stars 150 forks source link

fix(view/lights): for spotlights, restore parent on its target #1491

Open divyun opened 3 months ago

divyun commented 3 months ago

Resolves #1490

Target is added as a child to light. https://github.com/donmccurdy/glTF-Transform/blob/23e2bc6c2aae0dd7cdbb1cf589bfa125b6768426/packages/view/src/subjects/LightSubject.ts#L50 But when the lights are cloned here https://github.com/donmccurdy/glTF-Transform/blob/23e2bc6c2aae0dd7cdbb1cf589bfa125b6768426/packages/view/src/pools/SingleUserPool.ts#L29, the corresponding clone in three.js https://github.com/mrdoob/three.js/blob/817a222f2d12baf44a38baf256bc9d4f65d82465/src/lights/SpotLight.js#L61 doesn't add a parent to target.