Skip to content

v5.0.0

Choose a tag to compare

@alvarosabu alvarosabu released this 20 Sep 16:04
· 1610 commits to main since this release

5.0.0 (2025-09-20)

⚠ BREAKING CHANGES

ESM Only

  • Tres is now ESM only - Removed UMD build configuration from package.json and adjusted exports to only include ES module
  • Updated vite.config.ts to specify the output format as ES, enhancing compatibility with modern module systems

Event System Overhaul

  • New event system based on pmdrs/pointer-events - Only first element intersected will trigger the pointer event, no more need to stop propagation on occlusion
  • Replaced raycaster with events system throughout the codebase

Loop System Refactoring

  • onAfterRender has been renamed to onRender
  • onBeforeRender renamed to onBeforeLoop, then back to onBeforeRender
  • onLoop renamed to onRender
  • Removed deprecated loop implementation and updated related composables

Context API Changes

  • useTresReady is no longer available - replaced by isReady in the renderer in the context
  • onTresReady is no longer available - renderer.isReady should be leveraged instead
  • camera ctx property is now an object with the camera manager instead of the active camera
  • useRenderer now returns invalidate and advance - useTresContextProvider no longer contains render state
  • invalidate, advance, canBeInvalidated and the renderer instance are now accessed through the context via renderer
  • The renderer instance in the context is now readonly
  • Removed emit from useTresContextProvider and useTresEventManager
  • The types EmitEventName and EmitEventFn are no longer exported from @Tresjs/core

Composables Removed/Deprecated

  • useTexture composable moved to @Tresjs/cientos package
  • useSeek is deprecated and removed

Loader Changes

  • useLoader API changed - no longer returns the plain object, now returns an object with reactive data (resource|s), isLoading, error) and a load method, can be used both sync and async (suspense)

🚀 New Features

Core Features

  • WebGPU native support - Added support for WebGPU rendering
  • New useTres composable - Provides access to the Tres context
  • Enhanced useLoop and useRenderLoop - Completely refactored with better event handling
  • Expose render mode - Made render mode accessible to users
  • Make utility methods available - Some utility methods are now exposed for user consumption
  • Model and animation recipe - Added comprehensive model and animation examples

Developer Experience

  • Tres Devtools integration - Added context inspector for better debugging
  • Warning system - Warn user if the canvas has no area
  • Enhanced Nuxt configuration - Include package version in AppHeader

Performance & Reliability

  • Improved texture loading - Added initial value support to useLoader
  • Better event handling - Enhanced pointer events system with occlusion handling
  • Optimized rendering loop - More efficient render loop management

🐛 Bug Fixes

  • Fixed elapsed time retrieval in useCreateRafLoop to use the latest clock property
  • Avoided pierced props to setScalar when numerical
  • Fixed docs SSG 404 issues
  • Removed development exports from package.json
  • Added forgotten ready emit
  • Fixed multiple playground experiences and examples
  • Improved scene object handling in Tres Devtools
  • Enhanced orthographic camera setup and controls
  • Fixed camera manual check and projection matrix updates

🔧 Refactoring & Code Improvements

Major Refactors

  • useRenderer refactoring - Moved renderer logic from useTresContextProvider to useRenderer
  • Context system overhaul - Complete restructuring of the context API
  • Event system rewrite - Based on pmdrs/pointer-events for better performance
  • Camera management - Enhanced camera handling with Three.js Camera type
  • Performance state removal - Removed performance state from useTresContextProvider

Code Quality

  • Improved type safety throughout the codebase
  • Enhanced readability and maintainability
  • Cleaned up unused code and comments
  • Better error handling and edge case management
  • Streamlined component implementations

📚 Documentation Updates

  • Updated documentation to reflect all breaking changes
  • Added migration guides for deprecated composables
  • Enhanced examples in the cookbook
  • Fixed import documentation
  • Added community resources section
  • Updated API documentation for new composables

👥 Contributors

Special thanks to all contributors who made v5.0.0 possible:

🔗 Related Pull Requests

Key PRs that shaped v5.0.0:

  • #965 - v5 release
  • #1035 - useLoop and useRenderLoop refactoring
  • #1032 - Expose render mode
  • #1029 - WebGPU native support
  • #1022 - Refactor useRenderer
  • #1017 - Introduce useTres composable
  • #1013 - Add context inspector devtools
  • #1008 - Remove useTexture
  • #1007 - Add initial value support to useLoader
  • #1004 - Context camera is now a state
  • #1000 - Remove useTresReady
  • #999 - Removal of emit from useTresContextProvider
  • #993 - Move renderer logic to useRenderer
  • #990 - Deprecate useSeek composable

This release represents a major milestone for TresJS, bringing significant improvements in performance, developer experience, and API consistency. While there are breaking changes, the new architecture provides a much more robust foundation for future development.

For migration assistance, please refer to our updated documentation and migration guides.

Full Changelog: 4.3.6...5.0.0