Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: container effects, recursive dispose, portal state #72

Merged
merged 7 commits into from
Sep 15, 2022

Conversation

CodyJasonBennett
Copy link
Member

@CodyJasonBennett CodyJasonBennett commented Sep 15, 2022

Mirrors container effects from pmndrs/react-three-fiber#2483, moving #44 to before mount and making use of container methods. Also cleans up leaf children to prevent memory leaks from subtrees.

Additionally, Portals now create state enclaves to isolate scenes, cameras, etc. from the root store. This is particularly useful for postprocessing and complex effects.

function Component {
  // scene & camera are inherited from portal parameters
  const { scene, camera, ... } = useOGL()
}

const scene = new OGL.Transform()
const camera = new OGL.Camera()

<transform>
  {createPortal(<Component />, scene, { camera })
</transform>
@CodyJasonBennett CodyJasonBennett changed the title fix: container effects, recursive dispose Sep 15, 2022
@CodyJasonBennett CodyJasonBennett merged commit 980a392 into main Sep 15, 2022
@CodyJasonBennett CodyJasonBennett deleted the fix/container-effects branch September 15, 2022 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant