Skip to content

refactor!: context camera is now a state #1004

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

Conversation

alvarosabu
Copy link
Member

@alvarosabu alvarosabu commented Apr 27, 2025

BREAKING CHANGE: camera ctx property is now an object with the camera manager instead of the active camera

Closes #985

BREAKING CHANGE: camera ctx property is now an object with the camera manager instead of the active camera
@alvarosabu alvarosabu requested a review from Tinoooo April 27, 2025 08:36
@alvarosabu alvarosabu self-assigned this Apr 27, 2025
@alvarosabu alvarosabu added p3-significant High-priority enhancement (priority) breaking-change labels Apr 27, 2025
@alvarosabu alvarosabu added this to the v5 milestone Apr 27, 2025
Copy link

pkg-pr-new bot commented Apr 27, 2025

Open in StackBlitz

npm i https://pkg.pr.new/@tresjs/core@1004

commit: b630003

- Replaced instances of TresCamera with Three.js Camera type across the codebase for better compatibility and consistency.
- Updated camera management logic in useCamera composable and related components to reflect the new type.
- Simplified currentCamera logic to use computed properties instead of watch.
- Updated the orthographic camera initialization to correctly calculate frustum dimensions based on the aspect ratio.
- Introduced zoom functionality for the orthographic camera.
- Simplified the useControls setup by removing unnecessary properties and focusing on essential controls.
- Adjusted the camera update logic to reflect the new control structure, ensuring proper projection matrix updates.
@alvarosabu alvarosabu requested a review from Tinoooo May 6, 2025 15:52
…nents

- Removed manual camera initialization in favor of using TresJS components for perspective and orthographic cameras.
- Updated the template to conditionally render the appropriate camera based on the selected camera type.
- Enhanced readability and maintainability by leveraging TresJS's built-in camera properties and methods.
- Eliminated unused imports for OrthographicCamera and PerspectiveCamera from Three.js to streamline the code.
- This change enhances code clarity and reduces unnecessary dependencies, aligning with the recent updates to utilize TresJS components for camera management.
@alvarosabu alvarosabu requested a review from Tinoooo May 14, 2025 18:40
@alvarosabu alvarosabu merged commit d5daf5d into next May 15, 2025
4 checks passed
@alvarosabu alvarosabu deleted the chore/985-add-usecamera-return-object-to-state-instead-of-spreading-it branch May 15, 2025 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change p3-significant High-priority enhancement (priority)
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Add useCamera return object to state instead of spreading it
2 participants