Closed Blitzy closed 4 months ago
@Blitzy Everything else looks good apart from those two things I mentioned. Once fixed, I think the transfer error will go away.
@KallynGowdy your fix commit resolved the error issue. I'd say this is ready for merge.
This pull request needs some review!!
This pull request exposes some functionality for HTMLCanvasElement to user scripts. More specifically it exposes
transferControlToOffscreen()
andgetContext()
on HTMLCanvasElement so that it becomes possible to utilize it for drawing to. This made it possible to use a normal<canvas>
element combined with anOffscreenCanvas
to display a user script managed three.js scene for example. It also addsgetBoundingClientRect()
for HTMLElement.Review Points :
Its not particularly ideal that a function like
getBoundingClientRect()
ortransferControlToOffscreen()
which are just synchronous functions that return a value immediately get converted intoPromise
when proxied. I'm not sure if there is a better way to handle this with the current system.There is a
postMessage
error that occurs when trying to transfer theOffscreenCanvas
. However, despite the below error, theOffscreenCanvas
is still operational from the user script and can things update and render as you would expect. I do not know why this error is occuring and would like some guidance.Test Three.js Scene AUX FIle
This AUX uses the features implemented by this pull request to show a scene with ~350 randomly generated spinng cubes. The camera smoothly swirls around the cubes, meanwhile the user is able to click on any cube to light it up and make it glow in the scene.
AUX File: rc-threejs-basic-v3-1-18-simAppFork_20240313_183455.aux.zip