Skip to content

v0.3.0

Latest
Compare
Choose a tag to compare
@shawn0326 shawn0326 released this 27 Sep 06:40
· 9 commits to dev since this release

迁移指南

把t3d从v0.2.x升级到v0.3.x,主要注意以下接口变更,否则可能会导致升级后项目运行失败:

着色器规则变更

  • 新增alphaTest_pars_frag,如果您使用了alphaTest_frag注意要和新片段配合使用。并且ALPHATEST 的宏不再携带 alphaTest 的值,alphaTest 的值使用 u_AlphaTestuniform 的形式传入
  • 新增 diffuseMap_pars_vertdiffuseMap_vert 着色器片段,如果您的自定义着色器中使用了 diffuseMap_pars_fragdiffuseMap_frag,请注意必须要和新片段搭配使用。
  • 宏定义USE_DIFFUSE_MAPUSE_ALPHA_MAPUSE_EMISSIVEMAPUSE_AOMAP中不再包含UV通道信息,您可以在DIFFUSEMAP_UVALPHAMAP_UVEMISSIVEMAP_UVAOMAP_UV中获取该信息。在新版本中,这四种贴图可以默认支持设置任意0-8的UV通道。

接口兼容移除

  • 移除针对带 WebGL 前缀的枚举兼容代码,包括: WEBGL_PIXEL_FORMAT, WEBGL_PIXEL_TYPE, WEBGL_TEXTURE_FILTER, WEBGL_TEXTURE_WRAP, WEBGL_COMPARE_FUNC, WEBGL_OP
  • 移除针对 WebGLRenderer 上旧属性的兼容代码,包括:renderTargetstatevertexArrayBindings
  • 移除针对 WebGLRenderPass 类的兼容代码
  • 移除针对 WebGLProperties 类的兼容代码
  • 移除针对 MatcapMaterial 类的兼容代码,新代码已转移到 addons
  • 移除 GLTFUtils.sanitizeNodeName

接口新增告警

  • CubeGeometry 类新增废弃告警
  • Group 类新增废弃告警
  • WebGLRenderer.gl 接口新增废弃告警
  • WebGLRenderer.render() 接口新增废弃告警
  • Renderer.renderPass 接口新增废弃告警
  • PMREM 新增废弃告警,请使用 PMREMGenerator 代替
  • GeometryUtils.mergeBufferAttributes() 接口新增废弃告警,请使用 GeometryUtils.mergeAttributes() 代替

变更日志

特性:添加 PIXEL_FORMAT.R11F_G11F_B10F
特性:为 fromArraytoArray 方法添加 denormalizenormalize 参数
特性:引入 MathUtils
修复:将 afterRender 回调上下文设置为 renderer
重构:移除已弃用的代码
重构:增加对更多 UV 通道的支持
重构:将材质 alphaTestdefine 移动到 uniform
特性(插件):添加 CircleGeometry
特性(插件):引入 Timer
特性(插件):引入 GradientSky
特性(插件):引入 PlanarReflectionProbe
特性(插件):为 GLTFLoader 添加 EXT_mesh_gpu_instancing 扩展
特性(插件):引入 PolyhedronBuilder
修复(插件):限制 TransformControls 中的指针事件仅响应左键
重构(插件):优化 GLTFLoader 扩展处理
特性(示例):添加 webgl_query_occlusion_tester 示例

Migration Guide

When upgrading t3d from v0.2.x to v0.3.x, pay attention to the following interface changes to avoid potential project failures after the upgrade:

Shader Rule Changes

  • Added alphaTest_pars_frag. If you use alphaTest_frag, make sure to use it with the new fragment. Additionally, the ALPHATEST macro no longer carries the alphaTest value. The alphaTest value is now passed as a uniform named u_AlphaTest.
  • New shader chunks diffuseMap_pars_vert and diffuseMap_vert have been added. If your custom shaders use diffuseMap_pars_frag or diffuseMap_frag, ensure they are used in conjunction with the new chunks.
  • The macros USE_DIFFUSE_MAP, USE_ALPHA_MAP, USE_EMISSIVEMAP, and USE_AOMAP no longer include UV channel information. You can obtain this information from DIFFUSEMAP_UV, ALPHAMAP_UV, EMISSIVEMAP_UV, and AOMAP_UV. In the new version, these four types of maps can support any UV channel from 0 to 8 by default.

Interface Compatibility Removal

  • Removed compatibility code for enums with the WebGL prefix, including: WEBGL_PIXEL_FORMAT, WEBGL_PIXEL_TYPE, WEBGL_TEXTURE_FILTER, WEBGL_TEXTURE_WRAP, WEBGL_COMPARE_FUNC, WEBGL_OP.
  • Removed compatibility code for old properties on WebGLRenderer, including: renderTarget, state, vertexArrayBindings.
  • Removed compatibility code for the WebGLRenderPass class.
  • Removed compatibility code for the WebGLProperties class.
  • Removed compatibility code for the MatcapMaterial class. The new code has been moved to addons.
  • Removed GLTFUtils.sanitizeNodeName.

New Deprecation Warnings

  • Added deprecation warning for the CubeGeometry class.
  • Added deprecation warning for the Group class.
  • Added deprecation warning for the WebGLRenderer.gl interface.
  • Added deprecation warning for the WebGLRenderer.render() interface.
  • Added deprecation warning for the Renderer.renderPass interface.
  • Added deprecation warning for PMREM. Please use PMREMGenerator instead.
  • Added deprecation warning for GeometryUtils.mergeBufferAttributes(). Please use GeometryUtils.mergeAttributes() instead.

Changelog

  • feat: add PIXEL_FORMAT.R11F_G11F_B10F
  • feat: add denormalize and normalize parameters to fromArray and toArray methods
  • feat: introduce MathUtils
  • fix: set afterRender callback context to renderer
  • refactor: remove deprecated code
  • refactor: add support for more uv coords
  • refactor: move material alpha test from define to uniform
  • feat(addons): add CircleGeometry
  • feat(addons): introduce Timer
  • feat(addons): introduce GradientSky
  • feat(addons): introduce PlanarReflectionProbe
  • feat(addons): add EXT_mesh_gpu_instancing extension for GLTFLoader
  • feat(addons): introduce PolyhedronBuilder
  • fix(addons): restrict pointer event to left button in TransformControls
  • refactor(addons): optimize GLTFLoader extensions handling
  • feat(examples): add webgl_query_occlusion_tester example

Full Changelog: v0.2.8...v0.3.0