markaren / threepp

C++20 port of three.js (r129)
MIT License
581 stars 50 forks source link

Implementation of multiple scenes example #263

Closed fagg closed 3 weeks ago

fagg commented 4 weeks ago

Hello,

This PR is an implementation of this example from threejs:

https://threejs.org/examples/webgl_multiple_scenes_comparison.html

I found it useful to work through this for my own understanding, so figured I'd share. If you'd like to merge, please do. I won't be offended if not, however.

Thanks.

markaren commented 4 weeks ago

Thanks, I will consider adding it. However, this PR seems to have uncovered a bug related to lights that I need to find time to investigate. Changing to a non MeshBasicMaterial leads to black mesh or segfault depening on how the lights are added (or not added).

markaren commented 4 weeks ago

Seems clone() was not implemented for lights. The segfault remains a mystery, but adding clone resolves the issue.

fagg commented 4 weeks ago

Thanks, I will consider adding it. However, this PR seems to have uncovered a bug related to lights that I need to find time to investigate. Changing to a non MeshBasicMaterial leads to black mesh or segfault depening on how the lights are added (or not added).

I noticed this too with a standard material, though I was unsure if it was intentional or not. I did not get a segfault, just a black mesh.

markaren commented 4 weeks ago

I made some minor changes, but for some reason I am not allowed to push to this branch.

And btw, the clone() fix was pushed to dev (resolving the material issue).

image

fagg commented 4 weeks ago

That's odd, I wonder if it's because I created the fork under my organization's account. Let me know if you'd like me to recreate the PR under my personal account.

fagg commented 4 weeks ago

Yeah, that's definitely the issue and I don't know how to solve it. I pushed the branch to my personal github account:

https://github.com/fagg/threepp/tree/multiple-scenes-example

That should work. Let me know if you want me to recreate the PR.

markaren commented 3 weeks ago

The example should be added as it uses previously unused features. I can either add the changes directly, or you may re-create the PR.

fagg commented 3 weeks ago

The example should be added as it uses previously unused features. I can either add the changes directly, or you may re-create the PR.

Recreated. :)