diff --git a/.github/workflows/build-problem-matcher.json b/.github/workflows/build-problem-matcher.json
index 3244c39f7f..90cf3caba6 100644
--- a/.github/workflows/build-problem-matcher.json
+++ b/.github/workflows/build-problem-matcher.json
@@ -2,7 +2,7 @@
{
"problemMatcher": [
{
- "owner": "circular-reference-check",
+ "owner": " build",
"pattern": [
{
"regexp": "^Circular dependency: (.*)$",
diff --git a/.vscode/launch.json b/.vscode/launch.json
index 4d2e6e6087..23f1727d5e 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -56,7 +56,8 @@
"program": "${workspaceFolder}/node_modules/jest/bin/jest.js"
},
"args": [
- "${fileBasenameNoExtension}"
+ "--runTestsByPath",
+ "${relativeFileDirname}/${fileBasename}"
],
"cwd": "${workspaceFolder}",
"console": "integratedTerminal",
diff --git a/cocos/2d/assembler/graphics/webgl/graphics-assembler.ts b/cocos/2d/assembler/graphics/webgl/graphics-assembler.ts
index 88bb73b940..5a0a3ec9c1 100644
--- a/cocos/2d/assembler/graphics/webgl/graphics-assembler.ts
+++ b/cocos/2d/assembler/graphics/webgl/graphics-assembler.ts
@@ -22,12 +22,6 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-
-/**
- * @packageDocumentation
- * @module ui-assembler
- */
-
import { Color, Vec3 } from '../../../../core/math';
import { IAssembler } from '../../../renderer/base';
import { MeshRenderData } from '../../../renderer/render-data';
diff --git a/cocos/2d/assembler/index.ts b/cocos/2d/assembler/index.ts
index b422354fb5..54f5a8c8e4 100644
--- a/cocos/2d/assembler/index.ts
+++ b/cocos/2d/assembler/index.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui
- */
-
import './utils';
export * from './graphics';
diff --git a/cocos/2d/assembler/label/bmfont.ts b/cocos/2d/assembler/label/bmfont.ts
index 4bb3e1722f..009183dc53 100644
--- a/cocos/2d/assembler/label/bmfont.ts
+++ b/cocos/2d/assembler/label/bmfont.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui-assembler
- */
-
import { SpriteFrame } from '../../assets/sprite-frame';
import * as js from '../../../core/utils/js';
import { Color, Rect } from '../../../core/math';
diff --git a/cocos/2d/assembler/label/index.ts b/cocos/2d/assembler/label/index.ts
index 92ec7af9f0..c466369f85 100644
--- a/cocos/2d/assembler/label/index.ts
+++ b/cocos/2d/assembler/label/index.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui-assembler
- */
-
import { BitmapFont } from '../../assets';
import { Label } from '../../components';
import { IAssemblerManager } from '../../renderer/base';
diff --git a/cocos/2d/assembler/label/letter.ts b/cocos/2d/assembler/label/letter.ts
index 5dceee06f0..2550a369b3 100644
--- a/cocos/2d/assembler/label/letter.ts
+++ b/cocos/2d/assembler/label/letter.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui-assembler
- */
-
import { addon } from '../../../core/utils/js';
import { IBatcher } from '../../renderer/i-batcher';
import { Label } from '../../components/label';
diff --git a/cocos/2d/assembler/mask/index.ts b/cocos/2d/assembler/mask/index.ts
index f59ed5f4f4..ae2cf72dc9 100644
--- a/cocos/2d/assembler/mask/index.ts
+++ b/cocos/2d/assembler/mask/index.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { maskAssembler as mask, maskEndAssembler as maskEnd } from './mask-assembler';
export {
diff --git a/cocos/2d/assembler/mask/mask-assembler.ts b/cocos/2d/assembler/mask/mask-assembler.ts
index f2a12b5812..9373ac2307 100644
--- a/cocos/2d/assembler/mask/mask-assembler.ts
+++ b/cocos/2d/assembler/mask/mask-assembler.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui-assembler
- */
-
import { IBatcher } from '../../renderer/i-batcher';
import { Mask, MaskType } from '../../components/mask';
import { IAssembler, IAssemblerManager } from '../../renderer/base';
diff --git a/cocos/2d/assembler/sprite/bar-filled.ts b/cocos/2d/assembler/sprite/bar-filled.ts
index ee94de7533..8c4bbd3df4 100644
--- a/cocos/2d/assembler/sprite/bar-filled.ts
+++ b/cocos/2d/assembler/sprite/bar-filled.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui-assembler
- */
-
import { Color, Mat4, Vec3 } from '../../../core/math';
import { IRenderData, RenderData } from '../../renderer/render-data';
import { IBatcher } from '../../renderer/i-batcher';
diff --git a/cocos/2d/assembler/sprite/radial-filled.ts b/cocos/2d/assembler/sprite/radial-filled.ts
index 153846db63..94360df02a 100644
--- a/cocos/2d/assembler/sprite/radial-filled.ts
+++ b/cocos/2d/assembler/sprite/radial-filled.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui-assembler
- */
-
import { SpriteFrame } from '../../assets';
import { Color, Mat4, Vec2, Vec3 } from '../../../core/math';
import { IRenderData, RenderData } from '../../renderer/render-data';
diff --git a/cocos/2d/assembler/sprite/simple.ts b/cocos/2d/assembler/sprite/simple.ts
index 99cd370c6f..d773c944f0 100644
--- a/cocos/2d/assembler/sprite/simple.ts
+++ b/cocos/2d/assembler/sprite/simple.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui-assembler
- */
-
import { Vec3 } from '../../../core/math';
import { IAssembler } from '../../renderer/base';
import { IRenderData, RenderData } from '../../renderer/render-data';
diff --git a/cocos/2d/assembler/sprite/sliced.ts b/cocos/2d/assembler/sprite/sliced.ts
index c1ab2d260b..37b11f1d00 100644
--- a/cocos/2d/assembler/sprite/sliced.ts
+++ b/cocos/2d/assembler/sprite/sliced.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui-assembler
- */
-
import { Mat4, Vec3 } from '../../../core/math';
import { IRenderData, RenderData } from '../../renderer/render-data';
import { IBatcher } from '../../renderer/i-batcher';
diff --git a/cocos/2d/assembler/utils.ts b/cocos/2d/assembler/utils.ts
index 3471a8a056..e67ee93aeb 100644
--- a/cocos/2d/assembler/utils.ts
+++ b/cocos/2d/assembler/utils.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { Color, Mat4, Vec3 } from '../../core/math';
import { RenderData } from '../renderer/render-data';
import { IBatcher } from '../renderer/i-batcher';
diff --git a/cocos/2d/assets/bitmap-font.ts b/cocos/2d/assets/bitmap-font.ts
index 9081038b48..ecbda85704 100644
--- a/cocos/2d/assets/bitmap-font.ts
+++ b/cocos/2d/assets/bitmap-font.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module asset
- */
-
import { ccclass, type, serializable, editable } from 'cc.decorator';
import { Font } from './font';
import { SpriteFrame } from './sprite-frame';
diff --git a/cocos/2d/assets/font.ts b/cocos/2d/assets/font.ts
index b57a343e2a..77bb1aa523 100644
--- a/cocos/2d/assets/font.ts
+++ b/cocos/2d/assets/font.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module asset
- */
-
import { ccclass } from 'cc.decorator';
import { Asset } from '../../core/assets';
import { legacyCC } from '../../core/global-exports';
diff --git a/cocos/2d/assets/index.ts b/cocos/2d/assets/index.ts
index c7ca8ccf53..23f063af1d 100644
--- a/cocos/2d/assets/index.ts
+++ b/cocos/2d/assets/index.ts
@@ -1,7 +1,4 @@
-/**
- * @packageDocumentation
- * @module asset
- */
+
export * from './sprite-frame';
export { SpriteAtlas } from './sprite-atlas';
diff --git a/cocos/2d/assets/label-atlas.ts b/cocos/2d/assets/label-atlas.ts
index dc9cde306a..339c480c18 100644
--- a/cocos/2d/assets/label-atlas.ts
+++ b/cocos/2d/assets/label-atlas.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module asset
- */
-
import { ccclass } from 'cc.decorator';
import { BitmapFont } from './bitmap-font';
import { legacyCC } from '../../core/global-exports';
diff --git a/cocos/2d/assets/sprite-atlas.ts b/cocos/2d/assets/sprite-atlas.ts
index 5262870b5e..b62b556166 100644
--- a/cocos/2d/assets/sprite-atlas.ts
+++ b/cocos/2d/assets/sprite-atlas.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module asset
- */
-
import { EDITOR, TEST } from 'internal:constants';
import { ccclass, serializable, editable } from 'cc.decorator';
import * as js from '../../core/utils/js';
diff --git a/cocos/2d/assets/sprite-frame.ts b/cocos/2d/assets/sprite-frame.ts
index cb245ce598..791954b03e 100644
--- a/cocos/2d/assets/sprite-frame.ts
+++ b/cocos/2d/assets/sprite-frame.ts
@@ -25,11 +25,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module asset
- */
-
import { ccclass } from 'cc.decorator';
import { EDITOR, TEST, BUILD } from 'internal:constants';
import { Rect, Size, Vec2 } from '../../core/math';
@@ -239,8 +234,8 @@ export class SpriteFrame extends Asset {
}
/**
- * @en
- * @zh
+ * @en uv update event
+ * @zh uv 更新事件
*/
public static EVENT_UV_UPDATED = 'uv_updated';
@@ -661,7 +656,7 @@ export class SpriteFrame extends Asset {
}
/**
- * @en Gets the related GFX [[Texture]] resource
+ * @en Gets the related GFX [[gfx.Texture]] resource
* @zh 获取渲染贴图的 GFX 资源
*/
public getGFXTexture () {
diff --git a/cocos/2d/assets/ttf-font.ts b/cocos/2d/assets/ttf-font.ts
index 542eb50e7c..6e1c7ad23e 100644
--- a/cocos/2d/assets/ttf-font.ts
+++ b/cocos/2d/assets/ttf-font.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module asset
- */
-
import { ccclass, string, override, serializable } from 'cc.decorator';
import { extname } from '../../core/utils/path';
import { Font } from './font';
diff --git a/cocos/2d/components/deprecated.ts b/cocos/2d/components/deprecated.ts
index 9d0edd1588..e482fb9edf 100644
--- a/cocos/2d/components/deprecated.ts
+++ b/cocos/2d/components/deprecated.ts
@@ -23,10 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui
- */
import { Mask } from './mask';
import { Label } from './label';
import { LabelOutline } from './label-outline';
diff --git a/cocos/2d/components/graphics.ts b/cocos/2d/components/graphics.ts
index b1da8b81f3..91f39aa852 100644
--- a/cocos/2d/components/graphics.ts
+++ b/cocos/2d/components/graphics.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui
- */
-
import { ccclass, help, executionOrder, menu, tooltip, type, visible, override, editable, serializable } from 'cc.decorator';
import { builtinResMgr } from '../../core/builtin';
import { InstanceMaterialType, UIRenderer } from '../framework/ui-renderer';
@@ -299,8 +294,10 @@ export class Graphics extends UIRenderer {
* @zh
* 移动路径起点到坐标(x, y)。
*
- * @param x - 移动坐标 x 轴。
- * @param y - 移动坐标 y 轴。
+ * @param x @en The x-axis coordinate of the target position.
+ * @zh 目标位置的 X 轴坐标。
+ * @param y @en The y-axis coordinate of the target position.
+ * @zh 目标位置的 y 轴坐标。
*/
public moveTo (x: number, y: number) {
if (!this.impl) {
@@ -317,8 +314,10 @@ export class Graphics extends UIRenderer {
* @zh
* 绘制直线路径。
*
- * @param x - 绘制路径坐标 x 轴。
- * @param y - 绘制路径坐标 y 轴。
+ * @param x @en The x-axis coordinate of the target position.
+ * @zh 目标位置的 x 轴坐标。
+ * @param y @en The x-axis coordinate of the target position.
+ * @zh 目标位置的 y 轴坐标。
*/
public lineTo (x: number, y: number) {
if (!this.impl) {
@@ -335,12 +334,18 @@ export class Graphics extends UIRenderer {
* @zh
* 绘制三次贝赛尔曲线路径。
*
- * @param c1x - 第一个控制点的坐标 x 轴。
- * @param c1y - 第一个控制点的坐标 y 轴。
- * @param c2x - 第二个控制点的坐标 x 轴。
- * @param c2y - 第二个控制点的坐标 y 轴。
- * @param x - 最后一个控制点的坐标 x 轴。
- * @param y - 最后一个控制点的坐标 y 轴。
+ * @param c1x @en The x-axis coordinate of the first control point.
+ * @zh 第一个控制点的 x 轴坐标。
+ * @param c1y @en The y-axis coordinate of the first control point.
+ * @zh 第一个控制点的 y 轴坐标。
+ * @param c2x @en The x-axis coordinate of the second control point.
+ * @zh 第二个控制点的 x 轴坐标。
+ * @param c2y @en The y-axis coordinate of the second control point.
+ * @zh 第二个控制点的 y 轴坐标。
+ * @param x @en The x-axis coordinate of the last control point.
+ * @zh 最后一个控制点的 x 轴坐标。
+ * @param y @en The y-axis coordinate of the last control point.
+ * @zh 最后一个控制点的 y 轴坐标。
*/
public bezierCurveTo (c1x: number, c1y: number, c2x: number, c2y: number, x: number, y: number) {
if (!this.impl) {
@@ -357,10 +362,14 @@ export class Graphics extends UIRenderer {
* @zh
* 绘制二次贝赛尔曲线路径。
*
- * @param cx - 起始控制点的坐标 x 轴。
- * @param cy - 起始控制点的坐标 y 轴。
- * @param x - 终点控制点的坐标 x 轴。
- * @param y - 终点控制点的坐标 x 轴。
+ * @param cx @en The x-axis coordinate of the starting control point.
+ * @zh 起始控制点的 x 轴坐标。
+ * @param cy @en The y-axis coordinate of the starting control point.
+ * @zh 起始控制点的 y 轴坐标。
+ * @param x @en The x-axis coordinates of the endpoint control point.
+ * @zh 终点控制点的 x 轴坐标。
+ * @param y @en The y-axis coordinates of the endpoint control point.
+ * @zh 终点控制点的 x 轴坐标。
*/
public quadraticCurveTo (cx: number, cy: number, x: number, y: number) {
if (!this.impl) {
@@ -378,12 +387,18 @@ export class Graphics extends UIRenderer {
* @zh
* 绘制圆弧路径。圆弧路径的圆心在 (cx, cy) 位置,半径为 r ,根据 counterclockwise (默认为false)指定的方向从 startAngle 开始绘制,到 endAngle 结束。
*
- * @param cx - 中心控制点的坐标 x 轴。
- * @param cy - 中心控制点的坐标 y 轴。
- * @param r - 圆弧弧度。
- * @param startAngle - 开始弧度,从正 x 轴顺时针方向测量。
- * @param endAngle - 结束弧度,从正 x 轴顺时针方向测量。
- * @param counterclockwise 如果为真,在两个角度之间逆时针绘制。默认顺时针。
+ * @param cx @en The coordinate x-axis of the central control point.
+ * @zh 中心控制点的坐标 x 轴。
+ * @param cy @en The coordinate y-axis of the central control point.
+ * @zh 中心控制点的坐标 y 轴。
+ * @param r @en Angle in Radian.
+ * @zh 圆弧弧度。
+ * @param startAngle @en The starting angle in radian, measured clockwise from the positive x-axis.
+ * @zh 弧度起点,从正 x 轴顺时针方向测量。
+ * @param endAngle @en The ending angle in radian, measured clockwise from the positive x-axis.
+ * @zh 弧度终点,从正 x 轴顺时针方向测量。
+ * @param counterclockwise @en If true, draws counterclockwise between the two angles. Default is clockwise.
+ * @zh 如果为真,在两个角度之间逆时针绘制。默认顺时针。
*/
public arc (cx: number, cy: number, r: number, startAngle: number, endAngle: number, counterclockwise: boolean) {
if (!this.impl) {
@@ -400,10 +415,14 @@ export class Graphics extends UIRenderer {
* @zh
* 绘制椭圆路径。
*
- * @param cx - 中心点的坐标 x 轴。
- * @param cy - 中心点的坐标 y 轴。
- * @param rx - 椭圆 x 轴半径。
- * @param ry - 椭圆 y 轴半径。
+ * @param cx @en The x-axis coordinates of the center point.
+ * @zh 中心点的 x 轴坐标。
+ * @param cy @en The y-axis coordinates of the center point.
+ * @zh 中心点的 y 轴坐标。
+ * @param rx @en The radius of the x-axis of the ellipse.
+ * @zh 椭圆 x 轴半径。
+ * @param ry @en The radius of the y-axis of the ellipse.
+ * @zh 椭圆 y 轴半径。
*/
public ellipse (cx: number, cy: number, rx: number, ry: number) {
if (!this.impl) {
@@ -420,9 +439,12 @@ export class Graphics extends UIRenderer {
* @zh
* 绘制圆形路径。
*
- * @param cx - 中心点的坐标 x 轴。
- * @param cy - 中心点的坐标 y 轴。
- * @param r - 圆半径。
+ * @param cx @en The x-axis coordinates of the center point.
+ * @zh 中心点的 x 轴坐标。
+ * @param cy @en The y-axis coordinates of the center point.
+ * @zh 中心点的 y 轴坐标。
+ * @param r @en Radius.
+ * @zh 圆半径。
*/
public circle (cx: number, cy: number, r: number) {
if (!this.impl) {
@@ -439,10 +461,14 @@ export class Graphics extends UIRenderer {
* @zh
* 绘制矩形路径。
*
- * @param x - 矩形起始坐标 x 轴。
- * @param y - 矩形起始坐标 y 轴。
- * @param w - 矩形宽度。
- * @param h - 矩形高度。
+ * @param x @en The x-axis coordinate of the top left point of the rectangle.
+ * @zh 矩形起始 x 轴坐标。
+ * @param y @en The y-axis coordinate of the top left point of the rectangle.
+ * @zh 矩形起始 y 轴坐标。
+ * @param w @en The width of the rectangle.
+ * @zh 矩形宽度。
+ * @param h @en The height of the rectangle.
+ * @zh 矩形高度。
*/
public rect (x: number, y: number, w: number, h: number) {
if (!this.impl) {
@@ -459,11 +485,16 @@ export class Graphics extends UIRenderer {
* @zh
* 绘制圆角矩形路径。
*
- * @param x - 矩形起始坐标 x 轴。
- * @param y - 矩形起始坐标 y 轴。
- * @param w - 矩形宽度。
- * @param h - 矩形高度。
- * @param r - 矩形圆角半径。
+ * @param x @en The x-axis coordinate of the top left point of the rectangle.
+ * @zh 矩形起始 x 轴坐标。
+ * @param y @en The y-axis coordinate of the top left point of the rectangle.
+ * @zh 矩形起始 y 轴坐标。
+ * @param w @en The width of the rectangle.
+ * @zh 矩形宽度。
+ * @param h @en The height of the rectangle.
+ * @zh 矩形高度。
+ * @param r @en Radius of rectangular rounded corners.
+ * @zh 矩形圆角半径。
*/
public roundRect (x: number, y: number, w: number, h: number, r: number) {
if (!this.impl) {
@@ -480,10 +511,14 @@ export class Graphics extends UIRenderer {
* @zh
* 绘制填充矩形。
*
- * @param x - 矩形起始坐标 x 轴。
- * @param y - 矩形起始坐标 y 轴。
- * @param w - 矩形宽度。
- * @param h - 矩形高度。
+ * @param x @en The x-axis coordinate of the top left point of the rectangle.
+ * @zh 矩形起始 x 轴坐标。
+ * @param y @en The y-axis coordinate of the top left point of the rectangle.
+ * @zh 矩形起始 y 轴坐标。
+ * @param w @en The width of the rectangle.
+ * @zh 矩形宽度。
+ * @param h @en The height of the rectangle.
+ * @zh 矩形高度。
*/
public fillRect (x, y, w, h) {
this.rect(x, y, w, h);
diff --git a/cocos/2d/components/label-outline.ts b/cocos/2d/components/label-outline.ts
index 68ff79713f..ddeb4e526f 100644
--- a/cocos/2d/components/label-outline.ts
+++ b/cocos/2d/components/label-outline.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui
- */
-
import { ccclass, help, executionOrder, menu, tooltip, requireComponent, executeInEditMode, serializable } from 'cc.decorator';
import { Component } from '../../core/components/component';
import { Color } from '../../core/math';
diff --git a/cocos/2d/components/label-shadow.ts b/cocos/2d/components/label-shadow.ts
index 9e094173b3..b56c31dfd7 100644
--- a/cocos/2d/components/label-shadow.ts
+++ b/cocos/2d/components/label-shadow.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui
- */
-
import { ccclass, help, executionOrder, menu, tooltip, requireComponent, executeInEditMode, serializable } from 'cc.decorator';
import { Component } from '../../core/components/component';
import { Color, Vec2 } from '../../core/math';
diff --git a/cocos/2d/components/label.ts b/cocos/2d/components/label.ts
index 404ce7e451..1097f9ba30 100644
--- a/cocos/2d/components/label.ts
+++ b/cocos/2d/components/label.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui
- */
-
import { ccclass, help, executionOrder, menu, tooltip, displayOrder, visible, multiline, type, serializable, editable } from 'cc.decorator';
import { BYTEDANCE, EDITOR } from 'internal:constants';
import { minigame } from 'pal/minigame';
diff --git a/cocos/2d/components/mask.ts b/cocos/2d/components/mask.ts
index 7466563a28..122672c010 100644
--- a/cocos/2d/components/mask.ts
+++ b/cocos/2d/components/mask.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui
- */
-
import { ccclass, help, executionOrder, menu, tooltip, displayOrder, type, visible, override, serializable, range, slide } from 'cc.decorator';
import { InstanceMaterialType, UIRenderer } from '../framework/ui-renderer';
import { clamp, Color, Mat4, Vec2, Vec3 } from '../../core/math';
diff --git a/cocos/2d/components/rich-text.ts b/cocos/2d/components/rich-text.ts
index 990d655506..8d59472278 100644
--- a/cocos/2d/components/rich-text.ts
+++ b/cocos/2d/components/rich-text.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui
- */
-
import { ccclass, executeInEditMode, executionOrder, help, menu, tooltip, multiline, type, displayOrder, serializable } from 'cc.decorator';
import { DEV, EDITOR } from 'internal:constants';
import { Font, SpriteAtlas, TTFFont, SpriteFrame } from '../assets';
@@ -114,6 +109,7 @@ function getSegmentByPool (type: string, content: string | SpriteFrame) {
seg.comp.string = content as string;
seg.comp.horizontalAlign = HorizontalTextAlignment.LEFT;
seg.comp.verticalAlign = VerticalTextAlignment.TOP;
+ seg.comp.underlineHeight = 2;
}
node.setPosition(0, 0, 0);
const trans = node._uiProps.uiTransformComp!;
diff --git a/cocos/2d/components/sprite.ts b/cocos/2d/components/sprite.ts
index b199c018c3..ef1787056c 100644
--- a/cocos/2d/components/sprite.ts
+++ b/cocos/2d/components/sprite.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui
- */
-
import { ccclass, help, executionOrder, menu, tooltip, displayOrder, type, range, editable, serializable, visible } from 'cc.decorator';
import { EDITOR } from 'internal:constants';
import { SpriteAtlas } from '../assets/sprite-atlas';
diff --git a/cocos/2d/components/ui-mesh-renderer.ts b/cocos/2d/components/ui-mesh-renderer.ts
index dfc50e8549..cc147e34ca 100644
--- a/cocos/2d/components/ui-mesh-renderer.ts
+++ b/cocos/2d/components/ui-mesh-renderer.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui
- */
-
import { ccclass, help, executionOrder, menu, executeInEditMode } from 'cc.decorator';
import { ModelRenderer } from '../../core/components/model-renderer';
import { RenderPriority } from '../../core/pipeline/define';
@@ -41,11 +36,11 @@ import { legacyCC } from '../../core/global-exports';
* @en
* The component of model.
* When you place particles or models in the UI, you must add this component to render.
- * The component must be placed on a node with the [[MeshRenderer]] or the [[Particle]].
+ * The component must be placed on a node with the [[MeshRenderer]] or the [[ParticleSystem]].
*
* @zh
* UI 模型基础组件。
- * 当你在 UI 中放置模型或者粒子的时候,必须添加该组件才能渲染。该组件必须放置在带有 [[MeshRenderer]] 或者 [[Particle]] 组件的节点上。
+ * 当你在 UI 中放置模型或者粒子的时候,必须添加该组件才能渲染。该组件必须放置在带有 [[MeshRenderer]] 或者 [[ParticleSystem]] 组件的节点上。
*/
@ccclass('cc.UIMeshRenderer')
@help('i18n:cc.UIMeshRenderer')
diff --git a/cocos/2d/components/ui-opacity.ts b/cocos/2d/components/ui-opacity.ts
index 0bfcea196f..37d20d8e46 100644
--- a/cocos/2d/components/ui-opacity.ts
+++ b/cocos/2d/components/ui-opacity.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui
- */
-
import { ccclass, disallowMultiple, editable, executeInEditMode, executionOrder, help, menu, serializable, tooltip } from 'cc.decorator';
import { Component } from '../../core/components/component';
import { clampf } from '../../core/utils/misc';
diff --git a/cocos/2d/components/ui-static-batch.ts b/cocos/2d/components/ui-static-batch.ts
index 7a889f3e79..cbaaa6f7da 100644
--- a/cocos/2d/components/ui-static-batch.ts
+++ b/cocos/2d/components/ui-static-batch.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui
- */
-
import { ccclass, help, menu, executionOrder, visible, override } from 'cc.decorator';
import { UIRenderer } from '../framework/ui-renderer';
import { IBatcher } from '../renderer/i-batcher';
diff --git a/cocos/2d/framework/canvas.ts b/cocos/2d/framework/canvas.ts
index 1863e6d2c8..98e831135d 100644
--- a/cocos/2d/framework/canvas.ts
+++ b/cocos/2d/framework/canvas.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui
- */
-
import { ccclass, help, disallowMultiple, executeInEditMode,
executionOrder, menu, tooltip, type, serializable } from 'cc.decorator';
import { EDITOR } from 'internal:constants';
@@ -82,7 +77,7 @@ export class Canvas extends RenderRoot2D {
* intersperse 下可以指定 Canvas 与场景中的相机的渲染顺序,overlay 下 Canvas 会在所有场景相机渲染完成后渲染。
* 注意:场景里的相机(包括 Canvas 内置的相机)必须有一个的 ClearFlag 选择 SOLID_COLOR,否则在移动端可能会出现闪屏。
*
- * @deprecated since v3.0, please use [[cameraComponent.priority]] to control overlapping between cameras.
+ * @deprecated since v3.0, please use [[Camera.priority]] to control overlapping between cameras.
*/
get renderMode () {
return this._renderMode;
diff --git a/cocos/2d/framework/deprecated.ts b/cocos/2d/framework/deprecated.ts
index fb89db4cc7..69223363d9 100644
--- a/cocos/2d/framework/deprecated.ts
+++ b/cocos/2d/framework/deprecated.ts
@@ -24,11 +24,6 @@
*/
/* eslint-disable @typescript-eslint/no-unsafe-return */
-/**
- * @packageDocumentation
- * @module ui
- */
-
import { markAsWarning, removeProperty, replaceProperty } from '../../core/utils';
import { UIComponent } from './ui-component';
import { UITransform } from './ui-transform';
diff --git a/cocos/2d/framework/render-root-2d.ts b/cocos/2d/framework/render-root-2d.ts
index 049fb2abd1..839dcc64dd 100644
--- a/cocos/2d/framework/render-root-2d.ts
+++ b/cocos/2d/framework/render-root-2d.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui
- */
-
import { ccclass, disallowMultiple, executeInEditMode,
executionOrder, menu, requireComponent } from 'cc.decorator';
import { Component } from '../../core/components/component';
diff --git a/cocos/2d/framework/ui-component.ts b/cocos/2d/framework/ui-component.ts
index f726b57709..7aee8f2910 100644
--- a/cocos/2d/framework/ui-component.ts
+++ b/cocos/2d/framework/ui-component.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui
- */
-
import { ccclass, disallowMultiple, executeInEditMode, executionOrder, requireComponent } from 'cc.decorator';
import { IBatcher } from '../renderer/i-batcher';
import { Component } from '../../core/components/component';
@@ -37,9 +32,9 @@ import { Stage } from '../renderer/stencil-manager';
/**
* @en Legacy 2D base class for rendering component, please use [[Renderable2D]] instead.
- * This component will setup [[NodeUIProperties.uiComp]] in its owner [[Node]]
+ * This component will setup NodeUIProperties.uiComp in its owner [[Node]]
* @zh 旧的 2D 渲染组件基类,请使用 [[Renderable2D]] 替代。
- * 这个组件会设置 [[Node]] 上的 [[NodeUIProperties.uiComp]]。
+ * 这个组件会设置 [[Node]] 上的 NodeUIProperties.uiComp。
* @deprecated since v3.4.1
*/
@ccclass('cc.UIComponent')
diff --git a/cocos/2d/framework/ui-renderer.ts b/cocos/2d/framework/ui-renderer.ts
index 7412cd1571..40c8b4f004 100644
--- a/cocos/2d/framework/ui-renderer.ts
+++ b/cocos/2d/framework/ui-renderer.ts
@@ -101,10 +101,10 @@ export enum InstanceMaterialType {
/**
* @en Base class for UI components which supports rendering features.
- * This component will setup [[NodeUIProperties.uiComp]] in its owner [[Node]]
+ * This component will setup NodeUIProperties.uiComp in its owner [[Node]]
*
* @zh 所有支持渲染的 UI 组件的基类。
- * 这个组件会设置 [[Node]] 上的 [[NodeUIProperties.uiComp]]。
+ * 这个组件会设置 [[Node]] 上的 NodeUIProperties.uiComp。
*/
@ccclass('cc.UIRenderer')
@requireComponent(UITransform)
@@ -114,7 +114,7 @@ export class UIRenderer extends Renderer {
/**
* @en The blend factor enums
* @zh 混合模式枚举类型
- * @see [[BlendFactor]]
+ * @see [[gfx.BlendFactor]]
*/
public static BlendState = BlendFactor;
/**
diff --git a/cocos/2d/framework/ui-transform.ts b/cocos/2d/framework/ui-transform.ts
index 9d4eb8409f..6f0e90814e 100644
--- a/cocos/2d/framework/ui-transform.ts
+++ b/cocos/2d/framework/ui-transform.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui
- */
-
import { ccclass, help, executeInEditMode, executionOrder, menu, tooltip, displayOrder, serializable, disallowMultiple } from 'cc.decorator';
import { EDITOR } from 'internal:constants';
import { Component } from '../../core/components';
@@ -367,8 +362,10 @@ export class UITransform extends Component {
* 默认的锚点是(0.5,0.5),因此它开始于节点的中心位置。
* 注意:Creator 中的锚点仅用于定位所在的节点,子节点的定位不受影响。
*
- * @param point - 节点锚点或节点 x 轴锚。
- * @param y - 节点 y 轴锚。
+ * @param point @en Node anchor point or node x-axis anchor.
+ * @zh 节点锚点或节点 x 轴锚。
+ * @param y @en The y-axis anchor of the node.
+ * @zh 节点 y 轴锚。
* @example
* ```ts
* import { Vec2 } from 'cc';
@@ -401,7 +398,8 @@ export class UITransform extends Component {
}
/**
- * Hit test with point in UI Space.
+ * @zh UI 空间中的点击测试。
+ * @en Hit test with point in UI Space.
*
* @param uiPoint point in UI Space.
* @deprecated since v3.5.0, please use `uiTransform.hitTest(screenPoint: Vec2)` instead.
@@ -447,13 +445,13 @@ export class UITransform extends Component {
return false;
}
-
/**
- * Hit test with point in Screen Space.
+ * @zh 屏幕空间中的点击测试。
+ * @en Hit test with point in Screen Space.
*
* @param screenPoint point in Screen Space.
*/
- public hitTest (screenPoint: Vec2) {
+ public hitTest (screenPoint: Vec2) {
const w = this._contentSize.width;
const h = this._contentSize.height;
const v3WorldPt = _vec3a;
@@ -529,9 +527,12 @@ export class UITransform extends Component {
* 将一个 UI 节点世界坐标系下点转换到另一个 UI 节点 (局部) 空间坐标系,这个坐标系以锚点为原点。
* 非 UI 节点转换到 UI 节点(局部) 空间坐标系,请走 Camera 的 `convertToUINode`。
*
- * @param worldPoint - 世界坐标点。
- * @param out - 转换后坐标。
- * @returns - 返回与目标节点的相对位置。
+ * @param worldPoint @en Point in world space.
+ * @zh 世界坐标点。
+ * @param out @en Point in local space.
+ * @zh 转换后坐标。
+ * @returns @en Return the relative position to the target node.
+ * @zh 返回与目标节点的相对位置。
* @example
* ```ts
* const newVec3 = uiTransform.convertToNodeSpaceAR(cc.v3(100, 100, 0));
@@ -554,9 +555,12 @@ export class UITransform extends Component {
* @zh
* 将距当前节点坐标系下的一个点转换到世界坐标系。
*
- * @param nodePoint - 节点坐标。
- * @param out - 转换后坐标。
- * @returns - 返回 UI 世界坐标系。
+ * @param nodePoint @en Point in local space.
+ * @zh 节点坐标。
+ * @param out @en Point in world space.
+ * @zh 转换后坐标。
+ * @returns @en Returns the coordinates in the UI world coordinate system.
+ * @zh 返回 UI 世界坐标系。
* @example
* ```ts
* const newVec3 = uiTransform.convertToWorldSpaceAR(3(100, 100, 0));
@@ -629,7 +633,8 @@ export class UITransform extends Component {
* @zh
* 返回包含当前包围盒及其子节点包围盒的最小包围盒。
*
- * @param parentMat - 父节点矩阵。
+ * @param parentMat @en The parent node matrix.
+ * @zh 父节点矩阵。
* @returns
*/
public getBoundingBoxTo (parentMat: Mat4) {
diff --git a/cocos/2d/renderer/batcher-2d.ts b/cocos/2d/renderer/batcher-2d.ts
index 10f5a93e27..221ef04204 100644
--- a/cocos/2d/renderer/batcher-2d.ts
+++ b/cocos/2d/renderer/batcher-2d.ts
@@ -148,7 +148,8 @@ export class Batcher2D implements IBatcher {
* @zh
* 添加屏幕组件管理。
*
- * @param comp - 屏幕组件。
+ * @param comp @en The render root of 2d.
+ * @zh 2d 渲染入口组件。
*/
public addScreen (comp: RenderRoot2D) {
this._screens.push(comp);
@@ -159,7 +160,8 @@ export class Batcher2D implements IBatcher {
* @zh
* Removes the Canvas from the list.
*
- * @param comp - 被移除的屏幕。
+ * @param comp @en The target to removed.
+ * @zh 被移除的屏幕。
*/
public removeScreen (comp: RenderRoot2D) {
const idx = this._screens.indexOf(comp);
@@ -273,8 +275,9 @@ export class Batcher2D implements IBatcher {
}
/**
- * Switch the mesh buffer for corresponding vertex layout if necessary.
- * @param attributes use [[VertexFormat.vfmtPosUvColor]] by default
+ * @zh 如果有必要,为相应的顶点布局切换网格缓冲区。
+ * @en Switch the mesh buffer for corresponding vertex layout if necessary.
+ * @param attributes use VertexFormat.vfmtPosUvColor by default
*/
public switchBufferAccessor (attributes: Attribute[] = vfmtPosUvColor) {
const strideBytes = attributes === vfmtPosUvColor ? 36 /* 9x4 */ : getAttributeStride(attributes);
@@ -368,12 +371,12 @@ export class Batcher2D implements IBatcher {
/**
* @en
- * Render component data submission process for individual [[InputAssembler]]
+ * Render component data submission process for individual [[gfx.InputAssembler]]
* @zh
- * 渲染组件中针对独立 [[InputAssembler]] 的提交流程
+ * 渲染组件中针对独立 [[gfx.InputAssembler]] 的提交流程
* 例如:Spine 和 DragonBones 等包含动态数据和材质的组件在内部管理 IA 并提交批次
* @param comp - The committed renderable component
- * @param ia - The committed [[InputAssembler]]
+ * @param ia - The committed [[gfx.InputAssembler]]
* @param tex - The texture used
* @param mat - The material used
* @param [transform] - The related node transform if the render data is based on node's local coordinates
@@ -489,7 +492,8 @@ export class Batcher2D implements IBatcher {
*
* @zh
* 提交独立渲染数据.
- * @param comp 静态组件
+ * @param comp @en The UIStaticBatch component.
+ * @zh 静态组件
*/
public commitStaticBatch (comp: UIStaticBatch) {
this._batches.concat(comp.drawBatchList);
@@ -577,8 +581,10 @@ export class Batcher2D implements IBatcher {
* @zh
* 强行修改当前批次数据并合并。
*
- * @param material - 当前批次的材质。
- * @param sprite - 当前批次的精灵帧。
+ * @param material @en The material of the current batch.
+ * @zh 当前批次的材质。
+ * @param sprite @en Sprite frame of current batch.
+ * @zh 当前批次的精灵帧。
*/
public forceMergeBatches (material: Material, frame: TextureBase | SpriteFrame | null, renderComp: UIRenderer) {
this._currMaterial = material;
diff --git a/cocos/2d/renderer/buffer-accessor.ts b/cocos/2d/renderer/buffer-accessor.ts
index c5979e7d9f..1e6794a5e6 100644
--- a/cocos/2d/renderer/buffer-accessor.ts
+++ b/cocos/2d/renderer/buffer-accessor.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui
- */
-
import { Attribute, Device } from '../../core/gfx';
import type { MeshBuffer } from './mesh-buffer';
import { getComponentPerVertex } from './vertex-format';
diff --git a/cocos/2d/renderer/linear-buffer-accessor.ts b/cocos/2d/renderer/linear-buffer-accessor.ts
index 1af212e838..8b26bd871f 100644
--- a/cocos/2d/renderer/linear-buffer-accessor.ts
+++ b/cocos/2d/renderer/linear-buffer-accessor.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui
- */
-
import { InputAssembler, Device, Attribute } from '../../core/gfx';
import { MeshBuffer } from './mesh-buffer';
import { BufferAccessor } from './buffer-accessor';
diff --git a/cocos/2d/renderer/mesh-buffer.ts b/cocos/2d/renderer/mesh-buffer.ts
index 5177e0d048..36efd84712 100644
--- a/cocos/2d/renderer/mesh-buffer.ts
+++ b/cocos/2d/renderer/mesh-buffer.ts
@@ -23,10 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui
- */
import { Device, BufferUsageBit, MemoryUsageBit, Attribute, Buffer, BufferInfo, InputAssembler, InputAssemblerInfo } from '../../core/gfx';
import { getComponentPerVertex } from './vertex-format';
import { getError, warnID } from '../../core/platform/debug';
@@ -137,7 +133,7 @@ export class MeshBuffer {
}
public checkCapacity (vertexCount: number, indexCount: number) {
- const maxVertex = this.vertexOffset + vertexCount;
+ const maxVertex = (this.vertexOffset + vertexCount) * this._floatsPerVertex;
const maxIndex = this.indexOffset + indexCount;
if (maxVertex > this._initVDataCount || maxIndex > this._initIDataCount) {
return false;
diff --git a/cocos/2d/renderer/render-data.ts b/cocos/2d/renderer/render-data.ts
index 042647e692..df3b976bdb 100644
--- a/cocos/2d/renderer/render-data.ts
+++ b/cocos/2d/renderer/render-data.ts
@@ -36,6 +36,9 @@ import { getAttributeStride, vfmtPosUvColor } from './vertex-format';
import { Buffer, BufferInfo, BufferUsageBit, Device, InputAssembler, InputAssemblerInfo, MemoryUsageBit } from '../../core/gfx';
import { assertIsTrue } from '../../core/data/utils/asserts';
+/**
+ * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
+ */
export interface IRenderData {
x: number;
y: number;
@@ -58,6 +61,9 @@ const _dataPool = new Pool(() => ({
let _pool: RecyclePool = null!;
+/**
+ * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
+ */
export class BaseRenderData {
public material: Material | null = null;
get vertexCount () {
@@ -96,6 +102,9 @@ export class BaseRenderData {
}
}
+/**
+ * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
+ */
export class RenderData extends BaseRenderData {
public static add (vertexFormat = vfmtPosUvColor, accessor?: StaticVBAccessor) {
if (!_pool) {
@@ -305,6 +314,9 @@ export class RenderData extends BaseRenderData {
}
}
+/**
+ * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
+ */
export class MeshRenderData extends BaseRenderData {
public static add (vertexFormat = vfmtPosUvColor) {
const rd = _meshDataPool.add();
diff --git a/cocos/2d/renderer/static-vb-accessor.ts b/cocos/2d/renderer/static-vb-accessor.ts
index aafc4defd9..191b6b20a7 100644
--- a/cocos/2d/renderer/static-vb-accessor.ts
+++ b/cocos/2d/renderer/static-vb-accessor.ts
@@ -23,12 +23,10 @@
THE SOFTWARE.
*/
-
-
import { Device, Attribute } from '../../core/gfx';
import { MeshBuffer } from './mesh-buffer';
import { BufferAccessor } from './buffer-accessor';
-import { assertID, warnID } from '../../core/platform/debug';
+import { assertID, errorID } from '../../core/platform/debug';
import { assertIsTrue } from '../../core/data/utils/asserts';
import { Pool } from '../../core/memop/pool';
import { macro } from '../../core/platform/macro';
@@ -170,7 +168,7 @@ export class StaticVBAccessor extends BufferAccessor {
return new StaticVBChunk(this, bid, buf, vertexOffset, vb, indexCount);
} else {
- warnID(9004, byteLength);
+ errorID(9004, byteLength);
return null;
}
}
diff --git a/cocos/2d/renderer/stencil-manager.ts b/cocos/2d/renderer/stencil-manager.ts
index 751aa7529a..75a253ac99 100644
--- a/cocos/2d/renderer/stencil-manager.ts
+++ b/cocos/2d/renderer/stencil-manager.ts
@@ -23,7 +23,6 @@
THE SOFTWARE.
*/
-
import { ComparisonFunc, StencilOp, DepthStencilState } from '../../core/gfx';
import { Mask } from '../components/mask';
import { Material } from '../../core';
diff --git a/cocos/2d/utils/dynamic-atlas/atlas-manager.ts b/cocos/2d/utils/dynamic-atlas/atlas-manager.ts
index d2d7423108..7eb651a10a 100644
--- a/cocos/2d/utils/dynamic-atlas/atlas-manager.ts
+++ b/cocos/2d/utils/dynamic-atlas/atlas-manager.ts
@@ -1,7 +1,3 @@
-/**
- * @packageDocumentation
- */
-
import { EDITOR } from 'internal:constants';
import { Filter } from '../../../core/assets/asset-enum';
import { legacyCC } from '../../../core/global-exports';
diff --git a/cocos/2d/utils/dynamic-atlas/atlas.ts b/cocos/2d/utils/dynamic-atlas/atlas.ts
index ebb580b312..6e7f29b5a2 100644
--- a/cocos/2d/utils/dynamic-atlas/atlas.ts
+++ b/cocos/2d/utils/dynamic-atlas/atlas.ts
@@ -1,7 +1,3 @@
-/**
- * @packageDocumentation
- */
-
import { PixelFormat } from '../../../core/assets/asset-enum';
import { ImageAsset } from '../../../core/assets/image-asset';
import { Texture2D } from '../../../core/assets/texture-2d';
diff --git a/cocos/2d/utils/font-loader.ts b/cocos/2d/utils/font-loader.ts
index d2550456ed..71d77ff2d1 100644
--- a/cocos/2d/utils/font-loader.ts
+++ b/cocos/2d/utils/font-loader.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { warnID } from '../../core/platform/debug';
import { safeMeasureText } from './text-utils';
import { CompleteCallback, IDownloadParseOptions } from '../../core/asset-manager/shared';
diff --git a/cocos/2d/utils/html-text-parser.ts b/cocos/2d/utils/html-text-parser.ts
index 23b3bec0d3..50658368ee 100644
--- a/cocos/2d/utils/html-text-parser.ts
+++ b/cocos/2d/utils/html-text-parser.ts
@@ -28,19 +28,23 @@ import { TEST } from 'internal:constants';
import { legacyCC } from '../../core/global-exports';
/**
- *
+ * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
*/
const eventRegx = /^(click)(\s)*=|(param)(\s)*=/;
const imageAttrReg = /(\s)*src(\s)*=|(\s)*height(\s)*=|(\s)*width(\s)*=|(\s)*align(\s)*=|(\s)*offset(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/;
+
/**
* A utils class for parsing HTML texts. The parsed results will be an object array.
+ * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
*/
-
export interface IHtmlTextParserResultObj{
text?: string;
style?: IHtmlTextParserStack;
}
+/**
+ * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
+ */
export interface IHtmlTextParserStack{
color?: string;
size?: number;
@@ -58,6 +62,9 @@ export interface IHtmlTextParserStack{
outline?: { color: string, width: number };
}
+/**
+ * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
+ */
export class HtmlTextParser {
private _specialSymbolArray: Array<[RegExp, string]> = [];
private _stack: IHtmlTextParserStack[] = [];
@@ -165,6 +172,7 @@ export class HtmlTextParser {
header = /^(img(\s)*src(\s)*=[^>]+\/)/.exec(attribute);
let remainingArgument = '';
+ let rightQuot = -1;
if (header && header[0].length > 0) {
tagName = header[0].trim();
if (tagName.startsWith('img') && tagName[tagName.length - 1] === '/') {
@@ -177,7 +185,10 @@ export class HtmlTextParser {
tagName = attribute.substr(0, header[0].length);
// remove space and = character
remainingArgument = attribute.substring(tagName.length).trim();
- nextSpace = remainingArgument.indexOf(' ');
+
+ rightQuot = this.getRightQuotationIndex(remainingArgument);
+
+ nextSpace = remainingArgument.indexOf(' ', rightQuot + 1 >= remainingArgument.length ? -1 : rightQuot + 1);
tagValue = (nextSpace > -1) ? remainingArgument.substr(0, nextSpace) : remainingArgument;
tagName = tagName.replace(/[^a-zA-Z]/g, '').trim();
@@ -301,6 +312,21 @@ export class HtmlTextParser {
return obj;
}
+ private getRightQuotationIndex (remainingArgument: string) {
+ let leftQuot = -1;
+ let rightQuot = -1;
+ // Skip a pair of quotations for avoiding spaces in image name are detected.
+ leftQuot = remainingArgument.indexOf('\'');
+ if (leftQuot > -1) {
+ rightQuot = remainingArgument.indexOf('\'', leftQuot + 1 >= remainingArgument.length ? -1 : leftQuot + 1);
+ } else {
+ leftQuot = remainingArgument.indexOf('"');
+ rightQuot = remainingArgument.indexOf('"', leftQuot + 1 >= remainingArgument.length ? -1 : leftQuot + 1);
+ }
+
+ return rightQuot;
+ }
+
private _processEventHandler (eventString: string) {
const obj = {};
let index = 0;
diff --git a/cocos/2d/utils/text-utils.ts b/cocos/2d/utils/text-utils.ts
index ff4ec37c3a..6c2fe47d36 100644
--- a/cocos/2d/utils/text-utils.ts
+++ b/cocos/2d/utils/text-utils.ts
@@ -160,9 +160,9 @@ const measureCache = new LRUCache(MAX_CACHE_SIZE);
const WORD_REG = /([a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûа-яА-ЯЁё]+|\S)/;
// eslint-disable-next-line no-useless-escape
const SYMBOL_REG = /^[!,.:;'}\]%\?>、‘“》?。,!]/;
-const LAST_WORD_REG = /([a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁё]+|\S)$/;
-const LAST_ENGLISH_REG = /[a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁё]+$/;
-const FIRST_ENGLISH_REG = /^[a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁё]/;
+const LAST_WORD_REG = /([a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]+|\S)$/;
+const LAST_ENGLISH_REG = /[a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]+$/;
+const FIRST_ENGLISH_REG = /^[a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]/;
const WRAP_INSPECTION = true;
// The unicode standard will never assign a character from code point 0xD800 to 0xDFFF
// high surrogate (0xD800-0xDBFF) and low surrogate(0xDC00-0xDFFF) combines to a character on the Supplementary Multilingual Plane
diff --git a/cocos/3d/assets/index.ts b/cocos/3d/assets/index.ts
index bcf222903b..233c1d6ce2 100644
--- a/cocos/3d/assets/index.ts
+++ b/cocos/3d/assets/index.ts
@@ -28,3 +28,4 @@ import './deprecated';
export { Mesh } from './mesh';
export { Skeleton } from './skeleton';
+export type { Morph, MorphTarget, SubMeshMorph } from './morph';
diff --git a/cocos/3d/assets/mesh.ts b/cocos/3d/assets/mesh.ts
index 2928a12d6d..cb060de249 100644
--- a/cocos/3d/assets/mesh.ts
+++ b/cocos/3d/assets/mesh.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module asset
- */
-
import { ccclass, serializable } from 'cc.decorator';
import { Asset } from '../../core/assets/asset';
import { IDynamicGeometry } from '../../primitive/define';
@@ -45,7 +40,8 @@ import {
FormatInfos, FormatType, MemoryUsageBit, PrimitiveMode, getTypedArrayConstructor, DrawInfo,
} from '../../core/gfx';
import { Mat4, Quat, Vec3 } from '../../core/math';
-import { Morph, MorphRendering, createMorphRendering } from './morph';
+import { Morph } from './morph';
+import { MorphRendering, createMorphRendering } from './morph-rendering';
function getIndexStrideCtor (stride: number) {
switch (stride) {
@@ -669,8 +665,9 @@ export class Mesh extends Asset {
}
/**
- * @en Get [[AABB]] bounds in the skeleton's bone space
- * @zh 获取骨骼变换空间内下的 [[AABB]] 包围盒
+ * @en Get [[geometry.AABB]] bounds in the skeleton's bone space
+ * @zh 获取骨骼变换空间内下的 [[geometry.AABB]] 包围盒
+ * @param skeleton @en skeleton data @zh 骨骼信息
* @param skeleton @en skeleton data @zh 骨骼信息
*/
public getBoneSpaceBounds (skeleton: Skeleton) {
diff --git a/cocos/3d/assets/morph-rendering.ts b/cocos/3d/assets/morph-rendering.ts
index c0c4852bfc..0a87f7cc6b 100644
--- a/cocos/3d/assets/morph-rendering.ts
+++ b/cocos/3d/assets/morph-rendering.ts
@@ -23,11 +23,8 @@
THE SOFTWARE.
*/
-
-
import {
- AttributeName, Buffer, BufferUsageBit, Device, Feature, MemoryUsageBit, DescriptorSet, BufferInfo,
- FormatFeatureBit, Format,
+ AttributeName, Buffer, BufferUsageBit, Device, MemoryUsageBit, DescriptorSet, BufferInfo, FormatFeatureBit, Format,
} from '../../core/gfx';
import { Mesh } from './mesh';
import { Texture2D } from '../../core/assets/texture-2d';
@@ -35,7 +32,7 @@ import { ImageAsset } from '../../core/assets/image-asset';
import { UBOMorph, UNIFORM_NORMAL_MORPH_TEXTURE_BINDING,
UNIFORM_POSITION_MORPH_TEXTURE_BINDING, UNIFORM_TANGENT_MORPH_TEXTURE_BINDING } from '../../core/pipeline/define';
import { warn } from '../../core/platform/debug';
-import { Morph, MorphRendering, MorphRenderingInstance, SubMeshMorph } from './morph';
+import { Morph, SubMeshMorph } from './morph';
import { assertIsNonNullable, assertIsTrue } from '../../core/data/utils/asserts';
import { log2, nextPow2 } from '../../core/math/bits';
import { IMacroPatch } from '../../core/renderer';
@@ -44,13 +41,67 @@ import { PixelFormat } from '../../core/assets/asset-enum';
/**
* True if force to use cpu computing based sub-mesh rendering.
+ * Only customizable by modify the internal engine code.
*/
const preferCpuComputing = false;
/**
- * Standard morph rendering.
- * The standard morph rendering renders each of sub-mesh morph separately.
- * Sub-mesh morph rendering may select different technique according sub-mesh morph itself.
+ * @en Interface for classes which control the rendering of morph resources.
+ * @zh 支持形变网格渲染的基类。
+ */
+export interface MorphRendering {
+ createInstance (): MorphRenderingInstance;
+}
+
+/**
+ * @en The instance of [[MorphRendering]] for dedicated control in the mesh renderer.
+ * The root [[MorphRendering]] is owned by [[Mesh]] asset, each [[MeshRenderer]] can have its own morph rendering instance.
+ * @zh 用于网格渲染器中独立控制 [[MorphRendering]] 的实例。原始 [[MorphRendering]] 被 [[Mesh]] 资源持有,每个 [[MeshRenderer]] 都持有自己的形变网格渲染实例。
+ */
+export interface MorphRenderingInstance {
+ /**
+ * Sets weights of targets of specified sub mesh.
+ * @param subMeshIndex
+ * @param weights
+ */
+ setWeights (subMeshIndex: number, weights: number[]): void;
+
+ /**
+ * Adapts pipeline state to do the rendering.
+ * @param subMeshIndex
+ * @param pipelineState
+ */
+ adaptPipelineState (subMeshIndex: number, descriptorSet: DescriptorSet): void;
+
+ /**
+ * Acquire the define overrides needed to do the rendering.
+ */
+ requiredPatches (subMeshIndex: number): IMacroPatch[] | null;
+
+ /**
+ * Destroy the rendering instance.
+ */
+ destroy (): void;
+}
+
+/**
+ * @en Create morph rendering from mesh which contains morph targets data.
+ * @zh 从包含形变对象的网格资源中创建形变网格渲染对象。
+ * @param mesh @en The mesh to create morph rendering from. @zh 用于创建形变网格渲染对象的原始网格资源。
+ * @param gfxDevice @en The device instance acquired from [[Root]]. @zh 设备对象实例,可以从 [[Root]] 获取。
+ */
+export function createMorphRendering (mesh: Mesh, gfxDevice: Device): MorphRendering {
+ return new StdMorphRendering(mesh, gfxDevice);
+}
+
+/**
+ * @en Standard morph rendering class, it supports both GPU and CPU based morph blending.
+ * If sub mesh morph targets count is less than [[pipeline.UBOMorph.MAX_MORPH_TARGET_COUNT]], then GPU based blending is enabled.
+ * Each of the sub-mesh morph has its own [[MorphRenderingInstance]],
+ * its morph target weights, render pipeline state and strategy of morph blending are controlled separately.
+ * @zh 标准形变网格渲染类,它同时支持 CPU 和 GPU 的形变混合计算。
+ * 如果子网格形变目标数量少于 [[pipeline.UBOMorph.MAX_MORPH_TARGET_COUNT]],那么就会使用基于 GPU 的形变混合计算。
+ * 每个子网格形变都使用自己独立的 [[MorphRenderingInstance]],它的形变目标权重、渲染管线状态和形变混合计算策略都是独立控制的。
*/
export class StdMorphRendering implements MorphRendering {
private _mesh: Mesh;
@@ -138,7 +189,8 @@ export class StdMorphRendering implements MorphRendering {
}
/**
- * Describes how to render a sub-mesh morph.
+ * @en Sub-mesh morph rendering describes how to render a sub-mesh morph.
+ * @zh 子网格形变渲染定义如何渲染一个子网格形变。
*/
interface SubMeshMorphRendering {
/**
@@ -148,7 +200,9 @@ interface SubMeshMorphRendering {
}
/**
- * The instance of once sub-mesh morph rendering.
+ * @en The instance of sub-mesh morph rendering, each sub-mesh have its own instance
+ * for controlling its morph target weights, render pipeline state and strategy of morph blending.
+ * @zh 子网格形变渲染的实例,每个子网格都拥有自己独立的子网格形变渲染实例,用于独立控制形变目标权重、渲染管线状态和形变混合计算策略。
*/
interface SubMeshMorphRenderingInstance {
/**
@@ -467,11 +521,6 @@ class MorphUniforms {
}
}
-/**
- *
- * @param gfxDevice
- * @param vec4Capacity Capacity of vec4.
- */
function createVec4TextureFactory (gfxDevice: Device, vec4Capacity: number) {
const hasFeatureFloatTexture = gfxDevice.getFormatFeatures(Format.RGBA32F) & FormatFeatureBit.SAMPLED_TEXTURE;
@@ -563,12 +612,8 @@ function createVec4TextureFactory (gfxDevice: Device, vec4Capacity: number) {
type MorphTexture = ReturnType['create']>;
/**
- * When use vertex-texture-fetch technique, we do need
- * `gl_vertexId` when we sample per-vertex data.
+ * When use vertex-texture-fetch technique, we do need `gl_vertexId` when we sample per-vertex data.
* WebGL 1.0 does not have `gl_vertexId`; WebGL 2.0, however, does.
- * @param mesh
- * @param subMeshIndex
- * @param gfxDevice
*/
function enableVertexId (mesh: Mesh, subMeshIndex: number, gfxDevice: Device) {
mesh.renderingSubMeshes[subMeshIndex].enableVertexIdChannel(gfxDevice);
diff --git a/cocos/3d/assets/morph.ts b/cocos/3d/assets/morph.ts
index 7611da99af..9ba9877fca 100644
--- a/cocos/3d/assets/morph.ts
+++ b/cocos/3d/assets/morph.ts
@@ -23,31 +23,13 @@
THE SOFTWARE.
*/
-
-
-import { AttributeName, Device, DescriptorSet } from '../../core/gfx';
+import { AttributeName } from '../../core/gfx';
import { Mesh } from './mesh';
-import { StdMorphRendering } from './morph-rendering';
-import { IMacroPatch } from '../../core/renderer';
-
-export interface Morph {
- /**
- * Morph data of each sub-mesh.
- */
- subMeshMorphs: (SubMeshMorph | null)[];
-
- /**
- * Common initial weights of each sub-mesh.
- */
- weights?: number[];
-
- /**
- * Name of each target of each sub-mesh morph.
- * This field is only meaningful if every sub-mesh has the same number of targets.
- */
- targetNames?: string[];
-}
+/**
+ * @en Morph target contains all displacements data of each vertex attribute like position and normal.
+ * @zh 形变目标数据包含网格顶点属性在形变下的变化值,可能包含位移、法线等属性
+ */
export interface MorphTarget {
/**
* Displacement of each target attribute.
@@ -55,6 +37,11 @@ export interface MorphTarget {
displacements: Mesh.IBufferView[];
}
+/**
+ * @en Sub mesh morph data describes all morph targets for one sub mesh,
+ * including attributes in each morph target, morph targets data and weights corresponding each targets.
+ * @zh 子网格形变数据描述一个子网格下所有的形变目标数据,包含顶点形变属性,形变目标数据和对应每个形变目标的权重。
+ */
export interface SubMeshMorph {
/**
* Attributes to morph.
@@ -72,39 +59,28 @@ export interface SubMeshMorph {
weights?: number[];
}
-export function createMorphRendering (mesh: Mesh, gfxDevice: Device): MorphRendering | null {
- return new StdMorphRendering(mesh, gfxDevice);
-}
-
/**
- * Class which control rendering of a morph resource.
+ * @en Mesh morph data structure to describe the sub meshes data of all sub meshes,
+ * it also contains all sub mesh morphs, global weights configuration and target names.
+ * Normally the global weights configuration should be identical to the sub mesh morph weights,
+ * but if not, the global weights in morph is less prioritized.
+ * @zh 网格的形变数据结构,包含所有子网格形变数据,全局的权重配置和所有形变目标名称。
+ * 一般来说,全局权重配置和子网格形变数据中保持一致,但如果有差异,以子网格形变数据中的权重配置为准。
*/
-export interface MorphRendering {
- createInstance (): MorphRenderingInstance;
-}
-
-/**
- * This rendering instance of a morph resource.
- */
-export interface MorphRenderingInstance {
- /**
- * Sets weights of targets of specified sub mesh.
- * @param subMeshIndex
- * @param weights
- */
- setWeights (subMeshIndex: number, weights: number[]): void;
-
- /**
- * Adapts pipeline state to do the rendering.
- * @param subMeshIndex
- * @param pipelineState
- */
- adaptPipelineState (subMeshIndex: number, descriptorSet: DescriptorSet): void;
-
- requiredPatches (subMeshIndex: number): IMacroPatch[] | null;
-
- /**
- * Destroy the rendering instance.
- */
- destroy (): void;
+export interface Morph {
+ /**
+ * Morph data of each sub-mesh.
+ */
+ subMeshMorphs: (SubMeshMorph | null)[];
+
+ /**
+ * Common initial weights of each sub-mesh.
+ */
+ weights?: number[];
+
+ /**
+ * Name of each target of each sub-mesh morph.
+ * This field is only meaningful if every sub-mesh has the same number of targets.
+ */
+ targetNames?: string[];
}
diff --git a/cocos/3d/assets/skeleton.ts b/cocos/3d/assets/skeleton.ts
index 39871a6c1f..fea8cbe7fa 100644
--- a/cocos/3d/assets/skeleton.ts
+++ b/cocos/3d/assets/skeleton.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module asset
- */
-
import { ccclass, type, serializable } from 'cc.decorator';
import { CCString } from '../../core/data/utils/attribute';
import { Mat4 } from '../../core/math';
@@ -119,6 +114,11 @@ export class Skeleton extends Asset {
return super.destroy();
}
+ /**
+ * @en Check whether the skeleton is validate which means it has both joints and bindposes data.
+ * @zh 检查当前骨骼对象是否是有效的,取决于它是否包含关节路径和绑定姿势数据。
+ * @returns @en Whether the skeleton is valid or not @zh 此骨骼是否有效
+ */
public validate () {
return this.joints.length > 0 && this.bindposes.length > 0;
}
diff --git a/cocos/3d/framework/mesh-renderer.ts b/cocos/3d/framework/mesh-renderer.ts
index 6f677da303..84a4d244bd 100644
--- a/cocos/3d/framework/mesh-renderer.ts
+++ b/cocos/3d/framework/mesh-renderer.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module model
- */
-
import { ccclass, help, executeInEditMode, executionOrder, menu, tooltip, visible, type,
formerlySerializedAs, serializable, editable, disallowAnimation } from 'cc.decorator';
import { Texture2D } from '../../core/assets';
@@ -41,7 +36,7 @@ import { TransformBit } from '../../core/scene-graph/node-enum';
import { Enum } from '../../core/value-types';
import { builtinResMgr } from '../../core/builtin';
import { ModelRenderer } from '../../core/components/model-renderer';
-import { MorphRenderingInstance } from '../assets/morph';
+import { MorphRenderingInstance } from '../assets/morph-rendering';
import { legacyCC } from '../../core/global-exports';
import { assertIsTrue } from '../../core/data/utils/asserts';
import { CCFloat } from '../../core/data/utils/attribute';
@@ -70,19 +65,19 @@ const ModelShadowCastingMode = Enum({
*/
const ModelShadowReceivingMode = Enum({
/**
- * @en Disable shadow projection.
+ * @en Disable shadow receiving.
* @zh 不接收阴影。
*/
OFF: 0,
/**
- * @en Enable shadow projection.
+ * @en Enable shadow receiving.
* @zh 开启阴影投射。
*/
ON: 1,
});
/**
- * @en model light map settings.
+ * @en Model's light map settings.
* @zh 模型光照图设置
*/
@ccclass('cc.ModelLightmapSettings')
@@ -101,8 +96,10 @@ class ModelLightmapSettings {
protected _lightmapSize = 64;
/**
- * @en bakeable.
- * @zh 是否可烘培。
+ * @en Whether the model is static and bake-able with light map.
+ * Notice: the model's vertex data must have the second UV attribute to enable light map baking.
+ * @zh 模型是否是静态的并可以烘培光照贴图。
+ * 注意:模型顶点数据必须包含第二套 UV 属性来支持光照贴图烘焙。
*/
@editable
get bakeable () {
@@ -114,8 +111,8 @@ class ModelLightmapSettings {
}
/**
- * @en cast shadow.
- * @zh 是否投射阴影。
+ * @en Whether to cast shadow in light map baking.
+ * @zh 在光照贴图烘焙中是否投射阴影。
*/
@editable
get castShadow () {
@@ -127,8 +124,8 @@ class ModelLightmapSettings {
}
/**
- * @en receive shadow.
- * @zh 是否接受阴影。
+ * @en Whether to receive shadow in light map baking.
+ * @zh 在光照贴图烘焙中是否接受阴影。
*/
@editable
get receiveShadow () {
@@ -140,8 +137,8 @@ class ModelLightmapSettings {
}
/**
- * @en lightmap size.
- * @zh 光照图大小
+ * @en The lightmap size.
+ * @zh 光照图大小。
*/
@editable
get lightmapSize () {
@@ -154,8 +151,10 @@ class ModelLightmapSettings {
}
/**
- * @en Mesh renderer component
- * @zh 网格渲染器组件。
+ * @en Mesh renderer component for general 3d model rendering, it generates and link to a Model in the render scene.
+ * It supports real time lighting and shadow, baked light map, and morph rendering.
+ * @zh 用于通用模型渲染的网格渲染器组件,会创建并关联一个渲染场景中的模型对象。
+ * 该组件支持实时光照和阴影,预烘焙光照贴图和形变网格渲染。
*/
@ccclass('cc.MeshRenderer')
@help('i18n:cc.MeshRenderer')
@@ -163,9 +162,21 @@ class ModelLightmapSettings {
@menu('Mesh/MeshRenderer')
@executeInEditMode
export class MeshRenderer extends ModelRenderer {
+ /**
+ * @en Shadow projection mode enumeration.
+ * @zh 阴影投射方式枚举。
+ */
public static ShadowCastingMode = ModelShadowCastingMode;
+ /**
+ * @en Shadow receive mode enumeration.
+ * @zh 阴影接收方式枚举。
+ */
public static ShadowReceivingMode = ModelShadowReceivingMode;
+ /**
+ * @en The settings for light map baking
+ * @zh 光照贴图烘焙的配置
+ */
@serializable
@editable
@disallowAnimation
@@ -180,18 +191,18 @@ export class MeshRenderer extends ModelRenderer {
@serializable
protected _shadowReceivingMode = ModelShadowReceivingMode.ON;
- // @serializable
- private _subMeshShapesWeights: number[][] = [];
-
@serializable
protected _shadowBias = 0;
@serializable
protected _shadowNormalBias = 0;
+ // @serializable
+ private _subMeshShapesWeights: number[][] = [];
+
/**
- * @en local shadow bias.
- * @zh 模型局部的阴影偏移。
+ * @en Local shadow bias for real time lighting.
+ * @zh 实时光照下模型局部的阴影偏移。
*/
@type(CCFloat)
@tooltip('i18n:model.shadow_bias')
@@ -208,8 +219,8 @@ export class MeshRenderer extends ModelRenderer {
}
/**
- * @en local shadow normal bias.
- * @zh 模型局部的阴影法线偏移。
+ * @en local shadow normal bias for real time lighting.
+ * @zh 实时光照下模型局部的阴影法线偏移。
*/
@type(CCFloat)
@tooltip('i18n:model.shadow_normal_bias')
@@ -227,7 +238,7 @@ export class MeshRenderer extends ModelRenderer {
/**
* @en Shadow projection mode.
- * @zh 阴影投射方式。
+ * @zh 实时光照下阴影投射方式。
*/
@type(ModelShadowCastingMode)
@tooltip('i18n:model.shadow_casting_model')
@@ -244,7 +255,7 @@ export class MeshRenderer extends ModelRenderer {
/**
* @en receive shadow.
- * @zh 是否接受阴影。
+ * @zh 实时光照下是否接受阴影。
*/
@type(ModelShadowReceivingMode)
@tooltip('i18n:model.shadow_receiving_model')
@@ -261,9 +272,9 @@ export class MeshRenderer extends ModelRenderer {
/**
* @en Gets or sets the mesh of the model.
- * Note, when set, all shape's weights would be reset to zero.
+ * Note, when set, all morph targets' weights would be reset to zero.
* @zh 获取或设置模型的网格数据。
- * 注意,设置时,所有形状的权重都将归零。
+ * 注意,设置时,所有形变目标的权重都将归零。
*/
@type(Mesh)
@tooltip('i18n:model.mesh')
@@ -286,10 +297,18 @@ export class MeshRenderer extends ModelRenderer {
this._updateReceiveShadow();
}
+ /**
+ * @en Gets the model in [[RenderScene]].
+ * @zh 获取渲染场景 [[RenderScene]] 中对应的模型。
+ */
get model () {
return this._model;
}
+ /**
+ * @en Whether to enable morph rendering.
+ * @zh 是否启用形变网格渲染。
+ */
// eslint-disable-next-line func-names
@visible(function (this: MeshRenderer) {
return !!(
@@ -384,10 +403,10 @@ export class MeshRenderer extends ModelRenderer {
}
/**
- * @zh 获取子网格指定外形的权重。
- * @en Gets the weight at specified shape of specified sub mesh.
+ * @zh 获取子网格指定形变目标的权重。
+ * @en Gets the weight at specified morph target of the specified sub mesh.
* @param subMeshIndex Index to the sub mesh.
- * @param shapeIndex Index to the shape of the sub mesh.
+ * @param shapeIndex Index to the morph target of the sub mesh.
* @returns The weight.
*/
public getWeight (subMeshIndex: number, shapeIndex: number) {
@@ -400,13 +419,11 @@ export class MeshRenderer extends ModelRenderer {
/**
* @zh
- * 设置子网格所有外形的权重。
- * `subMeshIndex` 是无效索引或 `weights` 的长度不匹配子网格的外形数量时,此方法不会生效。
+ * 设置子网格所有形变目标的权重。
+ * `subMeshIndex` 是无效索引或 `weights` 的长度不匹配子网格的形变目标数量时,此方法不会生效。
* @en
- * Sets weights of each shape of specified sub mesh.
- * If takes no effect if
- * `subMeshIndex` out of bounds or
- * `weights` has a different length with shapes count of the sub mesh.
+ * Sets weights of each morph target of the specified sub mesh.
+ * If takes no effect if `subMeshIndex` is out of bounds or if `weights` has a different length with morph targets count of the sub mesh.
* @param weights The weights.
* @param subMeshIndex Index to the sub mesh.
*/
@@ -739,6 +756,14 @@ export class MeshRenderer extends ModelRenderer {
}
export declare namespace MeshRenderer {
+ /**
+ * @en Shadow projection mode.
+ * @zh 阴影投射方式。
+ */
export type ShadowCastingMode = EnumAlias;
+ /**
+ * @en Shadow receive mode.
+ * @zh 阴影接收方式。
+ */
export type ShadowReceivingMode = EnumAlias;
}
diff --git a/cocos/3d/lights/deprecated.ts b/cocos/3d/lights/deprecated.ts
index d533d5b347..e9c901cac8 100644
--- a/cocos/3d/lights/deprecated.ts
+++ b/cocos/3d/lights/deprecated.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module component
- */
-
import { Light } from './light-component';
import { SpotLight } from './spot-light-component';
import { SphereLight } from './sphere-light-component';
diff --git a/cocos/3d/lights/directional-light-component.ts b/cocos/3d/lights/directional-light-component.ts
index 2d0e1e35d7..9d15b60fd0 100644
--- a/cocos/3d/lights/directional-light-component.ts
+++ b/cocos/3d/lights/directional-light-component.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module component/light
- */
-
import { ccclass, range, slide, type, editable, visible, help, executeInEditMode,
menu, tooltip, serializable, formerlySerializedAs } from 'cc.decorator';
import { Light } from './light-component';
@@ -39,6 +34,10 @@ import { property } from '../../core/data/class-decorator';
import { CCBoolean, CCFloat } from '../../core/data/utils/attribute';
import { clamp } from '../../core';
+/**
+ * @en The directional light component, only one real time directional light is permitted in one scene, it act as the main light of the scene.
+ * @zh 平行光源组件,一个场景只允许存在一个实时的平行光源,作为场景的主光源存在。
+ */
@ccclass('cc.DirectionalLight')
@help('i18n:cc.DirectionalLight')
@menu('Light/DirectionalLight')
@@ -83,10 +82,8 @@ export class DirectionalLight extends Light {
protected _light: scene.DirectionalLight | null = null;
/**
- * @en
- * The light source intensity.
- * @zh
- * 光源强度。
+ * @en The light source intensity.
+ * @zh 光源强度。
*/
@tooltip('i18n:lights.illuminance')
get illuminance () {
@@ -109,8 +106,8 @@ export class DirectionalLight extends Light {
}
/**
- * @en Whether activate shadow
- * @zh 是否启用阴影?
+ * @en Whether activate real time shadow.
+ * @zh 是否启用实时阴影?
*/
@visible(() => (legacyCC.director.root as Root).pipeline.pipelineSceneData.shadows.type === ShadowType.ShadowMap)
@property({ group: { name: 'DynamicShadowSettings', displayOrder: 1 } })
@@ -127,8 +124,8 @@ export class DirectionalLight extends Light {
}
/**
- * @en get or set shadow pcf.
- * @zh 获取或者设置阴影pcf等级。
+ * @en The shadow pcf for real time shadow.
+ * @zh 实时阴影计算中的阴影 pcf 等级。
*/
@visible(() => (legacyCC.director.root as Root).pipeline.pipelineSceneData.shadows.type === ShadowType.ShadowMap)
@property({ group: { name: 'DynamicShadowSettings', displayOrder: 5 } })
@@ -145,8 +142,8 @@ export class DirectionalLight extends Light {
}
/**
- * @en get or set shadow map sampler offset
- * @zh 获取或者设置阴影纹理偏移值
+ * @en The shadow map sampler offset for real time shadow.
+ * @zh 实时阴影计算中的阴影纹理偏移值。
*/
@visible(() => (legacyCC.director.root as Root).pipeline.pipelineSceneData.shadows.type === ShadowType.ShadowMap)
@property({ group: { name: 'DynamicShadowSettings', displayOrder: 6 } })
@@ -163,8 +160,8 @@ export class DirectionalLight extends Light {
}
/**
- * @en get or set normal bias.
- * @zh 设置或者获取法线偏移。
+ * @en The global normal bias for real time shadow.
+ * @zh 实时阴影计算中的法线偏移。
*/
@visible(() => (legacyCC.director.root as Root).pipeline.pipelineSceneData.shadows.type === ShadowType.ShadowMap)
@property({ group: { name: 'DynamicShadowSettings', displayOrder: 7 } })
@@ -181,8 +178,8 @@ export class DirectionalLight extends Light {
}
/**
- * @en Shadow color saturation
- * @zh 阴影颜色饱和度
+ * @en The shadow color saturation for real time shadow.
+ * @zh 实时阴影计算中的阴影颜色饱和度。
*/
@visible(() => (legacyCC.director.root as Root).pipeline.pipelineSceneData.shadows.type === ShadowType.ShadowMap)
@property({ group: { name: 'DynamicShadowSettings', displayOrder: 8 } })
@@ -202,8 +199,8 @@ export class DirectionalLight extends Light {
}
/**
- * @en get or set shadow camera far
- * @zh 获取或者设置潜在阴影产生的范围
+ * @en The potential shadow distance from the camera for real time shadow.
+ * @zh 实时阴影计算中潜在阴影产生的范围
*/
@visible(function (this: DirectionalLight) {
return (legacyCC.director.root as Root).pipeline.pipelineSceneData.shadows.type
@@ -226,8 +223,8 @@ export class DirectionalLight extends Light {
}
/**
- * @en get or set shadow camera far
- * @zh 获取或者设置潜在阴影产生的范围
+ * @en The occlusion range for real time shadow.
+ * @zh 实时阴影计算中剔除阴影的范围
*/
@visible(function (this: DirectionalLight) {
return (legacyCC.director.root as Root).pipeline.pipelineSceneData.shadows.type
@@ -250,8 +247,8 @@ export class DirectionalLight extends Light {
}
/**
- * @en get or set fixed area shadow
- * @zh 是否是固定区域阴影
+ * @en Whether to use fixed area shadow in real time shadow.
+ * @zh 实时阴影计算中是否使用固定区域阴影。
*/
@visible(() => (legacyCC.director.root as Root).pipeline.pipelineSceneData.shadows.type === ShadowType.ShadowMap)
@property({ group: { name: 'DynamicShadowSettings', displayOrder: 11 } })
@@ -268,8 +265,8 @@ export class DirectionalLight extends Light {
}
/**
- * @en get or set shadow camera near
- * @zh 获取或者设置阴影相机近裁剪面
+ * @en The near clip plane of the shadow camera for fixed area shadow
+ * @zh 固定区域阴影设置中阴影相机近裁剪面
*/
@visible(function (this: DirectionalLight) {
return (legacyCC.director.root as Root).pipeline.pipelineSceneData.shadows.type
@@ -289,8 +286,8 @@ export class DirectionalLight extends Light {
}
/**
- * @en get or set shadow camera far
- * @zh 获取或者设置阴影相机远裁剪面
+ * @en The far clip plane of the shadow camera for fixed area shadow.
+ * @zh 固定区域阴影设置中阴影相机远裁剪面。
*/
@visible(function (this: DirectionalLight) {
return (legacyCC.director.root as Root).pipeline.pipelineSceneData.shadows.type
@@ -310,8 +307,8 @@ export class DirectionalLight extends Light {
}
/**
- * @en get or set shadow camera orthoSize
- * @zh 获取或者设置阴影相机正交大小
+ * @en The orthogonal size of the shadow camera for fixed area shadow.
+ * @zh 固定区域阴影设置中阴影相机的正交尺寸
*/
@visible(function (this: DirectionalLight) {
return (legacyCC.director.root as Root).pipeline.pipelineSceneData.shadows.type
diff --git a/cocos/3d/lights/index.ts b/cocos/3d/lights/index.ts
index 702e96c7c0..67d85771f6 100644
--- a/cocos/3d/lights/index.ts
+++ b/cocos/3d/lights/index.ts
@@ -24,7 +24,6 @@
THE SOFTWARE.
*/
-
export { DirectionalLight } from './directional-light-component';
export { Light } from './light-component';
export { SphereLight } from './sphere-light-component';
diff --git a/cocos/3d/lights/light-component.ts b/cocos/3d/lights/light-component.ts
index 95141a7d5e..1b7ba90699 100644
--- a/cocos/3d/lights/light-component.ts
+++ b/cocos/3d/lights/light-component.ts
@@ -23,27 +23,27 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module component/light
- */
-
import { ccclass, tooltip, range, slide, type, displayOrder, serializable, editable } from 'cc.decorator';
import { Component } from '../../core/components/component';
import { Color, Vec3 } from '../../core/math';
import { Enum } from '../../core/value-types';
-
import { scene } from '../../core/renderer';
import { Root } from '../../core/root';
import { legacyCC } from '../../core/global-exports';
+const _color_tmp = new Vec3();
+
+/**
+ * @en The physical term used for light.
+ * @zh 光源所使用的物理计量单位。
+ */
export const PhotometricTerm = Enum({
LUMINOUS_FLUX: 0,
LUMINANCE: 1,
});
-const _color_tmp = new Vec3();
+
/**
- * @en static light settings.
+ * @en Static light settings.
* @zh 静态灯光设置
*/
@ccclass('cc.StaticLightSettings')
@@ -58,7 +58,7 @@ class StaticLightSettings {
protected _castShadow = false;
/**
- * @en editor only.
+ * @en Whether the light is editor only.
* @zh 是否只在编辑器里生效。
*/
@editable
@@ -70,7 +70,8 @@ class StaticLightSettings {
}
/**
- * bake state
+ * @en Whether the light is baked
+ * @zh 光源是否被烘焙
*/
get baked () {
return this._baked;
@@ -81,8 +82,8 @@ class StaticLightSettings {
}
/**
- * @en bakeable.
- * @zh 是否可烘培。
+ * @en Whether the light is bake-able.
+ * @zh 光源是否可烘培。
*/
@editable
get bakeable () {
@@ -94,8 +95,8 @@ class StaticLightSettings {
}
/**
- * @en cast shadow.
- * @zh 是否投射阴影。
+ * @en Whether the light will cast shadow during baking process.
+ * @zh 光源在烘焙时是否投射阴影。
*/
@editable
get castShadow () {
@@ -112,9 +113,21 @@ export declare namespace Light {
export type PhotometricTerm = EnumAlias;
}
+/**
+ * @en The base class of all light components, contains basic light settings for both real time light and baked light.
+ * @zh 光源组件基类,包含实时光源和烘焙光源的基本配置信息。
+ */
@ccclass('cc.Light')
export class Light extends Component {
+ /**
+ * @en The light type enumeration.
+ * @zh 光源类型枚举。
+ */
public static Type = scene.LightType;
+ /**
+ * @en The physical term used for light.
+ * @zh 光源所使用的物理计量单位。
+ */
public static PhotometricTerm = PhotometricTerm;
@serializable
@@ -131,10 +144,8 @@ export class Light extends Component {
protected _light: scene.Light | null = null;
/**
- * @en
- * Color of the light.
- * @zh
- * 光源颜色。
+ * @en The color of the light.
+ * @zh 光源颜色。
*/
@tooltip('i18n:lights.color')
get color (): Readonly {
@@ -200,17 +211,16 @@ export class Light extends Component {
}
/**
- * @en
- * The light type.
- * @zh
- * 光源类型。
+ * @en The light type.
+ * @zh 光源类型。
*/
get type () {
return this._type;
}
/**
- * bake state
+ * @en Whether the light is baked
+ * @zh 光源是否被烘焙
*/
get baked () {
return this.staticSettings.baked;
diff --git a/cocos/3d/lights/sphere-light-component.ts b/cocos/3d/lights/sphere-light-component.ts
index 71a87fc32d..1db1b4893d 100644
--- a/cocos/3d/lights/sphere-light-component.ts
+++ b/cocos/3d/lights/sphere-light-component.ts
@@ -22,10 +22,6 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module component/light
- */
import { ccclass, help, executeInEditMode, menu, tooltip, type, displayOrder, serializable, formerlySerializedAs } from 'cc.decorator';
import { scene } from '../../core/renderer';
@@ -34,6 +30,10 @@ import { legacyCC } from '../../core/global-exports';
import { Camera } from '../../core/renderer/scene';
import { Root } from '../../core/root';
+/**
+ * @en The sphere light component, multiple sphere lights can be added to one scene.
+ * @zh 球面光源组件,场景中可以添加多个球面光源。
+ */
@ccclass('cc.SphereLight')
@help('i18n:cc.SphereLight')
@menu('Light/SphereLight')
diff --git a/cocos/3d/lights/spot-light-component.ts b/cocos/3d/lights/spot-light-component.ts
index bf1b6b622e..b79fdc0d9b 100644
--- a/cocos/3d/lights/spot-light-component.ts
+++ b/cocos/3d/lights/spot-light-component.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module component/light
- */
-
import { ccclass, range, slide, type, editable, displayOrder, help, executeInEditMode,
menu, tooltip, serializable, formerlySerializedAs, visible } from 'cc.decorator';
import { toRadian } from '../../core/math';
@@ -39,6 +34,10 @@ import { Camera, PCFType, ShadowType } from '../../core/renderer/scene';
import { property } from '../../core/data/class-decorator';
import { CCBoolean, CCFloat } from '../../core/data/utils/attribute';
+/**
+ * @en The spot light component, multiple spot lights can be added to one scene.
+ * @zh 聚光灯光源组件,场景中可以添加多个聚光灯光源。
+ */
@ccclass('cc.SpotLight')
@help('i18n:cc.SpotLight')
@menu('Light/SpotLight')
@@ -215,8 +214,8 @@ export class SpotLight extends Light {
}
/**
- * @en get or set shadow pcf.
- * @zh 获取或者设置阴影pcf等级。
+ * @en The pcf level of the shadow generation.
+ * @zh 获取或者设置阴影 pcf 等级。
*/
@visible(() => (legacyCC.director.root as Root).pipeline.pipelineSceneData.shadows.type === ShadowType.ShadowMap)
@property({ group: { name: 'DynamicShadowSettings', displayOrder: 2 } })
@@ -233,8 +232,8 @@ export class SpotLight extends Light {
}
/**
- * @en get or set shadow map sampler offset
- * @zh 获取或者设置阴影纹理偏移值
+ * @en The depth offset of shadow to avoid moire pattern artifacts
+ * @zh 阴影的深度偏移, 可以减弱跨像素导致的条纹状失真
*/
@visible(() => (legacyCC.director.root as Root).pipeline.pipelineSceneData.shadows.type === ShadowType.ShadowMap)
@property({ group: { name: 'DynamicShadowSettings', displayOrder: 3 } })
@@ -251,7 +250,7 @@ export class SpotLight extends Light {
}
/**
- * @en get or set normal bias.
+ * @en The normal bias of the shadow map.
* @zh 设置或者获取法线偏移。
*/
@visible(() => (legacyCC.director.root as Root).pipeline.pipelineSceneData.shadows.type === ShadowType.ShadowMap)
diff --git a/cocos/3d/misc/batch-utils.ts b/cocos/3d/misc/batch-utils.ts
index c67a489102..3887c9095d 100644
--- a/cocos/3d/misc/batch-utils.ts
+++ b/cocos/3d/misc/batch-utils.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module core
- */
-
import { MeshRenderer } from '../framework/mesh-renderer';
import { Mesh } from '../assets/mesh';
import { Mat4 } from '../../core/math/mat4';
@@ -52,12 +47,19 @@ function checkMaterialisSame (comp1: MeshRenderer, comp2: MeshRenderer): boolean
*/
export class BatchingUtility {
/**
+ * @en
* Collect the Models under `staticModelRoot`,
* merge all the meshes statically into one (while disabling each component),
* and attach it to a new Model on `batchedRoot`.
* The world transform of each model is guaranteed to be preserved.
*
* For a more fine-grained control over the process, use `Mesh.merge` directly.
+ * @zh
+ * 在`staticModelRoot`下收集模型。
+ * 将所有的网格静态地合并成一个(同时禁用每个组件)。
+ * 并将其附加到 `batchedRoot` 上的一个新模型。
+ * 每个模型的世界变换都被保证保留下来。
+ * 如果要对这个过程进行更精细的控制,可以直接使用 `Mesh.merge`。
* @param staticModelRoot root of all the static models to be batched
* @param batchedRoot the target output node
*/
@@ -96,7 +98,10 @@ export class BatchingUtility {
}
/**
+ * @en
* Undoes everything `batchStaticModel` did.
+ * @zh
+ * 回退 `batchStaticModel` 做的工作
*
* @param staticModelRoot root of all the static models to be batched
* @param batchedRoot the target output node
diff --git a/cocos/3d/misc/ppm.ts b/cocos/3d/misc/ppm.ts
index 22bb9a0202..d87753b1d9 100644
--- a/cocos/3d/misc/ppm.ts
+++ b/cocos/3d/misc/ppm.ts
@@ -24,7 +24,13 @@
*/
/**
+ * @en
* save a color buffer to a PPM file
+ * @zh
+ * 保存一个颜色缓冲到 PPM 文件中
+ * @param buffer color buffer
+ * @param w width
+ * @param h height
*/
export function toPPM (buffer: Uint8Array, w: number, h: number) {
return `P3 ${w} ${h} 255\n${buffer.filter((e, i) => i % 4 < 3).toString()}\n`;
diff --git a/cocos/3d/models/baked-skinning-model.ts b/cocos/3d/models/baked-skinning-model.ts
index 4c2936de55..8103bbe9c6 100644
--- a/cocos/3d/models/baked-skinning-model.ts
+++ b/cocos/3d/models/baked-skinning-model.ts
@@ -53,11 +53,15 @@ const myPatches = [
/**
* @en
- * The skinning model that is using baked animation.
+ * The skinning model that is using GPU baked animation.
* @zh
- * 预烘焙动画的蒙皮模型。
+ * GPU 预烘焙动画的蒙皮模型。
*/
export class BakedSkinningModel extends MorphModel {
+ /**
+ * @en The animation clip that have been uploaded
+ * @zh 已被上传的动画片段
+ */
public uploadedAnim: AnimationClip | null | undefined = undefined; // uninitialized
private _jointsMedium: IJointsInfo;
@@ -87,6 +91,7 @@ export class BakedSkinningModel extends MorphModel {
super.destroy();
}
+ // Override
public bindSkeleton (skeleton: Skeleton | null = null, skinningRoot: Node | null = null, mesh: Mesh | null = null) {
this._skeleton = skeleton;
this._mesh = mesh;
@@ -104,6 +109,7 @@ export class BakedSkinningModel extends MorphModel {
}
}
+ // Override
public updateTransform (stamp: number) {
super.updateTransform(stamp);
@@ -118,7 +124,7 @@ export class BakedSkinningModel extends MorphModel {
}
}
- // update fid buffer only when visible
+ // Override, update fid buffer only when visible
public updateUBOs (stamp: number) {
super.updateUBOs(stamp);
@@ -134,6 +140,21 @@ export class BakedSkinningModel extends MorphModel {
return true;
}
+ // Override
+ public getMacroPatches (subModelIndex: number): IMacroPatch[] | null {
+ const patches = super.getMacroPatches(subModelIndex);
+ return patches ? patches.concat(myPatches) : myPatches;
+ }
+
+ /**
+ * @en Pre-simulate and store the frames data of the given animation clip to a joint texture and upload it to GPU.
+ * Normally, it's automatically managed by [[SkeletalAnimationState]].
+ * But user can also use Joint Texture Layout Settings in the editor to manually organize the joint textures.
+ * @zh 预计算并存储一个指定动画片段的完整帧数据到一张骨骼贴图上,并将其上传到 GPU。
+ * 一般情况下 [[SkeletalAnimationState]] 会自动管理所有骨骼贴图,但用户也可以使用编辑器的骨骼贴图布局设置面板来手动管理所有骨骼贴图。
+ * @param anim @en The animation clip to be uploaded to the joint texture. @zh 需要上传到骨骼贴图上的动画片段。
+ * @returns void
+ */
public uploadAnimation (anim: AnimationClip | null) {
if (!this._skeleton || !this._mesh || this.uploadedAnim === anim) { return; }
this.uploadedAnim = anim;
@@ -146,7 +167,7 @@ export class BakedSkinningModel extends MorphModel {
} else {
texture = resMgr.jointTexturePool.getDefaultPoseTexture(this._skeleton, this._mesh, this.transform);
this._jointsMedium.boundsInfo = null;
- this._modelBounds = texture && texture.bounds.get(this._mesh.hash)![0];
+ this._modelBounds = texture && texture.bounds.get(this._mesh.hash)![0];
}
this._applyJointTexture(texture);
}
@@ -171,11 +192,6 @@ export class BakedSkinningModel extends MorphModel {
}
}
- public getMacroPatches (subModelIndex: number): IMacroPatch[] | null {
- const patches = super.getMacroPatches(subModelIndex);
- return patches ? patches.concat(myPatches) : myPatches;
- }
-
protected _updateLocalDescriptors (submodelIdx: number, descriptorSet: DescriptorSet) {
super._updateLocalDescriptors(submodelIdx, descriptorSet);
const { buffer, texture, animInfo } = this._jointsMedium;
diff --git a/cocos/3d/models/morph-model.ts b/cocos/3d/models/morph-model.ts
index 94b43eac48..ddab4f223e 100644
--- a/cocos/3d/models/morph-model.ts
+++ b/cocos/3d/models/morph-model.ts
@@ -24,27 +24,47 @@
*/
import { Model } from '../../core/renderer/scene/model';
-import { MorphRenderingInstance } from '../assets/morph';
+import { MorphRenderingInstance } from '../assets/morph-rendering';
import { Material } from '../../core/assets/material';
import { RenderingSubMesh } from '../../core/assets/rendering-sub-mesh';
import { DescriptorSet } from '../../core/gfx';
import { IMacroPatch } from '../../core/renderer';
+/**
+ * @en
+ * The model that support morph target rendering.
+ * @zh
+ * 支持渲染蒙皮形变的模型。
+ */
export class MorphModel extends Model {
private _morphRenderingInstance: MorphRenderingInstance | null = null;
private _usedMaterials = new Set();
+ /**
+ * @en Acquire the material's macro patches for the given sub model.
+ * @zh 获取指定子模型的材质宏组合。
+ * @param subModelIndex @en The index for the requested sub model. @zh 子模型的序号。
+ * @returns @en The macro patches. @zh 材质宏组合
+ */
public getMacroPatches (subModelIndex: number) : IMacroPatch[] | null {
const superMacroPatches = super.getMacroPatches(subModelIndex);
if (this._morphRenderingInstance) {
const morphInstanceMacroPatches = this._morphRenderingInstance.requiredPatches(subModelIndex);
if (morphInstanceMacroPatches) {
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
return morphInstanceMacroPatches.concat(superMacroPatches ?? []);
}
}
return superMacroPatches;
}
+ /**
+ * @en Initialize a sub model with the sub mesh data and the material.
+ * @zh 用子网格数据和材质初始化一个子模型。
+ * @param idx @en The index of the sub model @zh 子模型的序号
+ * @param subMeshData @en The sub mesh data to be set @zh 需要设置的子网格
+ * @param mat sub material
+ */
public initSubModel (subModelIndex: number, subMeshData: RenderingSubMesh, material: Material) {
return super.initSubModel(
subModelIndex,
@@ -58,10 +78,25 @@ export class MorphModel extends Model {
this._morphRenderingInstance = null;
}
+ /**
+ * @en Sets the material for a given sub model.
+ * @zh 给指定的子模型设置材质。
+ * @param subModelIndex @en The index of the sub model @zh 子模型的序号
+ * @param material @en The material to be set @zh 需要设置的材质
+ * @returns void
+ */
public setSubModelMaterial (subModelIndex: number, material: Material) {
return super.setSubModelMaterial(subModelIndex, this._launderMaterial(material));
}
+ /**
+ * Sets morph rendering instance for the model, it's managed by the MeshRenderer
+ * @internal
+ */
+ public setMorphRendering (morphRendering: MorphRenderingInstance) {
+ this._morphRenderingInstance = morphRendering;
+ }
+
protected _updateLocalDescriptors (submodelIdx: number, descriptorSet: DescriptorSet) {
super._updateLocalDescriptors(submodelIdx, descriptorSet);
@@ -81,8 +116,4 @@ export class MorphModel extends Model {
// return material;
// }
}
-
- public setMorphRendering (morphRendering: MorphRenderingInstance) {
- this._morphRenderingInstance = morphRendering;
- }
}
diff --git a/cocos/3d/models/skinning-model.ts b/cocos/3d/models/skinning-model.ts
index 14f0c2285f..267d8d12ba 100644
--- a/cocos/3d/models/skinning-model.ts
+++ b/cocos/3d/models/skinning-model.ts
@@ -80,8 +80,6 @@ const ab_1 = new AABB();
* 实时计算动画的蒙皮模型。
*/
export class SkinningModel extends MorphModel {
- public uploadAnimation = null;
-
private _buffers: Buffer[] = [];
private _dataArray: Float32Array[] = [];
private _joints: IJointInfo[] = [];
@@ -102,6 +100,20 @@ export class SkinningModel extends MorphModel {
super.destroy();
}
+ /**
+ * @en Abstract function for [[BakedSkinningModel]], empty implementation.
+ * @zh 由 [[BakedSkinningModel]] 继承的空函数。
+ */
+ public uploadAnimation () {}
+
+ /**
+ * @en Bind the skeleton with its skinning root node and the mesh data.
+ * @zh 在模型中绑定一个骨骼,需要提供骨骼的蒙皮根节点和蒙皮网格数据。
+ * @param skeleton @en The skeleton to be bound @zh 要绑定的骨骼
+ * @param skinningRoot @en The skinning root of the skeleton @zh 骨骼的蒙皮根节点
+ * @param mesh @en The mesh @zh 蒙皮网格
+ * @returns void
+ */
public bindSkeleton (skeleton: Skeleton | null = null, skinningRoot: Node | null = null, mesh: Mesh | null = null) {
for (let i = 0; i < this._joints.length; i++) {
deleteTransform(this._joints[i].target);
@@ -126,6 +138,11 @@ export class SkinningModel extends MorphModel {
}
}
+ /**
+ * @en Update world transform and bounding boxes for the model
+ * @zh 更新模型的世界矩阵和包围盒
+ * @param stamp @en The update time stamp @zh 更新的时间戳
+ */
public updateTransform (stamp: number) {
const root = this.transform;
// @ts-expect-error TS2445
@@ -153,6 +170,12 @@ export class SkinningModel extends MorphModel {
}
}
+ /**
+ * @en Update uniform buffer objects for rendering.
+ * @zh 更新用于渲染的 UBO
+ * @param stamp @en The update time stamp @zh 更新的时间戳
+ * @returns @en successful or not @zh 更新是否成功
+ */
public updateUBOs (stamp: number) {
super.updateUBOs(stamp);
for (let i = 0; i < this._joints.length; i++) {
@@ -168,6 +191,13 @@ export class SkinningModel extends MorphModel {
return true;
}
+ /**
+ * @en Initialize sub model with the sub mesh data and the material
+ * @zh 用子网格数据和材质初始化一个子模型
+ * @param idx @en The index of the sub model to be initialized @zh 需要初始化的子模型序号
+ * @param subMeshData @en The sub mesh data @zh 子网格数据
+ * @param mat @en The material @zh 子模型材质
+ */
public initSubModel (idx: number, subMeshData: RenderingSubMesh, mat: Material) {
const original = subMeshData.vertexBuffers;
const iaInfo = subMeshData.iaInfo;
@@ -176,6 +206,7 @@ export class SkinningModel extends MorphModel {
iaInfo.vertexBuffers = original;
}
+ // override
public getMacroPatches (subModelIndex: number): IMacroPatch[] | null {
const superMacroPatches = super.getMacroPatches(subModelIndex);
diff --git a/cocos/3d/skeletal-animation/data-pool-manager.ts b/cocos/3d/skeletal-animation/data-pool-manager.ts
index 89e6c77953..165812b5b5 100644
--- a/cocos/3d/skeletal-animation/data-pool-manager.ts
+++ b/cocos/3d/skeletal-animation/data-pool-manager.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import type { AnimationClip } from '../../core/animation/animation-clip';
import type { Skeleton } from '../assets';
import { Device } from '../../core/gfx';
diff --git a/cocos/3d/skeletal-animation/index.ts b/cocos/3d/skeletal-animation/index.ts
index fbdecc71e9..bb11159cb2 100644
--- a/cocos/3d/skeletal-animation/index.ts
+++ b/cocos/3d/skeletal-animation/index.ts
@@ -23,7 +23,6 @@
THE SOFTWARE.
*/
-
import './data-pool-manager';
export * from './skeletal-animation-data-hub';
diff --git a/cocos/3d/skeletal-animation/skeletal-animation-blending.ts b/cocos/3d/skeletal-animation/skeletal-animation-blending.ts
index 3de11f2919..b2ab97e4f6 100644
--- a/cocos/3d/skeletal-animation/skeletal-animation-blending.ts
+++ b/cocos/3d/skeletal-animation/skeletal-animation-blending.ts
@@ -24,10 +24,10 @@
*/
import { DEBUG } from 'internal:constants';
-import { Vec3, Quat, approx } from '../../core/math';
+import { Vec3, Quat } from '../../core/math';
import { Node } from '../../core/scene-graph';
import { RuntimeBinding } from '../../core/animation/tracks/track';
-import { assertIsNonNullable, assertIsTrue } from '../../core/data/utils/asserts';
+import { assertIsTrue } from '../../core/data/utils/asserts';
import { MAX_ANIMATION_LAYER } from './limits';
export abstract class BlendStateBuffer<
diff --git a/cocos/3d/skeletal-animation/skeletal-animation-data-hub.ts b/cocos/3d/skeletal-animation/skeletal-animation-data-hub.ts
index 107b929176..0564780e09 100644
--- a/cocos/3d/skeletal-animation/skeletal-animation-data-hub.ts
+++ b/cocos/3d/skeletal-animation/skeletal-animation-data-hub.ts
@@ -31,8 +31,10 @@ import { BAKE_SKELETON_CURVE_SYMBOL } from '../../core/animation/internal-symbol
type BakeData = ReturnType;
/**
- * @en The data conversion tool for skeleton animation
- * @zh 骨骼动画数据转换中心。
+ * @en
+ * The data conversion tool for skeleton animation
+ * @zh
+ * 骨骼动画数据转换中心。
* @internal
*/
export class SkelAnimDataHub {
diff --git a/cocos/3d/skeletal-animation/skeletal-animation-state.ts b/cocos/3d/skeletal-animation/skeletal-animation-state.ts
index 4b7727ee99..8535d475ab 100644
--- a/cocos/3d/skeletal-animation/skeletal-animation-state.ts
+++ b/cocos/3d/skeletal-animation/skeletal-animation-state.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module animation
- */
-
import { Mat4, Quat, Vec3 } from '../../core/math';
import { IAnimInfo, JointAnimationInfo } from './skeletal-animation-utils';
import { Node } from '../../core/scene-graph/node';
@@ -52,6 +47,10 @@ interface ISocketData {
frames: ITransform[];
}
+/**
+ * @en The animation state for skeletal animations.
+ * @zh 骨骼动画的动画状态控制对象。
+ */
export class SkeletalAnimationState extends AnimationState {
protected _frames = 1;
@@ -104,6 +103,12 @@ export class SkeletalAnimationState extends AnimationState {
}
}
+ /**
+ * @en Rebuild animation curves and register the socket transforms per frame to the sockets. It will replace the internal sockets list.
+ * @zh 为所有指定挂点更新动画曲线运算结果,并存储所有挂点的逐帧变换矩阵。这个方法会用传入的挂点更新取代内部挂点列表。
+ * @param sockets @en The sockets need update @zh 需要重建的挂点列表
+ * @returns void
+ */
public rebuildSocketCurves (sockets: Socket[]) {
this._sockets.length = 0;
if (!this._targetNode) { return; }
diff --git a/cocos/3d/skeletal-animation/skeletal-animation-utils.ts b/cocos/3d/skeletal-animation/skeletal-animation-utils.ts
index 519423162b..b78ffb4bb6 100644
--- a/cocos/3d/skeletal-animation/skeletal-animation-utils.ts
+++ b/cocos/3d/skeletal-animation/skeletal-animation-utils.ts
@@ -139,6 +139,10 @@ export interface ICustomJointTextureLayout {
// For (Infinity - Infinity) evaluates to NaN
const Inf = Number.MAX_SAFE_INTEGER;
+/**
+ * The pool for joint textures.
+ * @internal
+ */
export class JointTexturePool {
private _device: Device;
diff --git a/cocos/3d/skeletal-animation/skeletal-animation.ts b/cocos/3d/skeletal-animation/skeletal-animation.ts
index caa1283269..14e8c7b7d7 100644
--- a/cocos/3d/skeletal-animation/skeletal-animation.ts
+++ b/cocos/3d/skeletal-animation/skeletal-animation.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module animation
- */
-
import {
ccclass, executeInEditMode, executionOrder, help, menu, tooltip, type, serializable, editable,
} from 'cc.decorator';
@@ -46,6 +41,10 @@ import type { AnimationState } from '../../core/animation/animation-state';
import { assertIsTrue } from '../../core/data/utils/asserts';
import { getGlobalAnimationManager } from '../../core/animation/global-animation-manager';
+/**
+ * @en The socket to synchronize transform from skeletal joint to target node.
+ * @zh 骨骼动画的挂点,用于将骨骼树的挂点节点变化矩阵同步到目标节点上
+ */
@ccclass('cc.SkeletalAnimation.Socket')
export class Socket {
/**
@@ -217,6 +216,11 @@ export class SkeletalAnimation extends Animation {
}
}
+ /**
+ * @en Query all socket paths
+ * @zh 获取所有挂点的骨骼路径
+ * @returns @en All socket paths @zh 所有挂点的骨骼路径
+ */
public querySockets () {
const animPaths = (this._defaultClip && Object.keys(SkelAnimDataHub.getOrExtract(this._defaultClip).joints).sort()
.reduce((acc, cur) => (cur.startsWith(acc[acc.length - 1]) ? acc : (acc.push(cur), acc)), [] as string[])) || [];
@@ -232,6 +236,10 @@ export class SkeletalAnimation extends Animation {
return out;
}
+ /**
+ * @en Rebuild animations to synchronize immediately all sockets to their target node.
+ * @zh 重建动画并立即同步所有挂点的转换矩阵到它们的目标节点上。
+ */
public rebuildSocketAnimations () {
for (const socket of this._sockets) {
const joint = this.node.getChildByPath(socket.path);
@@ -250,6 +258,14 @@ export class SkeletalAnimation extends Animation {
}
}
+ /**
+ * @en Create or get the target node from a socket.
+ * If a socket haven't been created for the corresponding path, this function will register a new socket.
+ * @zh 创建或获取一个挂点的同步目标节点。
+ * 如果对应路径还没有创建挂点,这个函数会创建一个新的挂点。
+ * @param path @en Path of the target joint. @zh 此挂点的骨骼路径。
+ * @returns @en The target node of the socket. @zh 挂点的目标节点
+ */
public createSocket (path: string) {
const socket = this._sockets.find((s) => s.path === path);
if (socket) { return socket.target; }
@@ -286,7 +302,7 @@ export class SkeletalAnimation extends Animation {
* @internal This method only friends to skinned mesh renderer.
*/
public notifySkinnedMeshRemoved (skinnedMeshRenderer: SkinnedMeshRenderer) {
- assertIsTrue(skinnedMeshRenderer.associatedAnimation === this);
+ assertIsTrue(skinnedMeshRenderer.associatedAnimation === this || skinnedMeshRenderer.associatedAnimation === null);
skinnedMeshRenderer.setUseBakedAnimation(false);
skinnedMeshRenderer.associatedAnimation = null;
this._users.delete(skinnedMeshRenderer);
diff --git a/cocos/3d/skinned-mesh-renderer/deprecated.ts b/cocos/3d/skinned-mesh-renderer/deprecated.ts
index 6f251d7816..f4780bd92d 100644
--- a/cocos/3d/skinned-mesh-renderer/deprecated.ts
+++ b/cocos/3d/skinned-mesh-renderer/deprecated.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module component
- */
-
import { SkinnedMeshRenderer } from './skinned-mesh-renderer';
import { SkinnedMeshBatchRenderer, SkinnedMeshUnit } from './skinned-mesh-batch-renderer';
import { js } from '../../core/utils/js';
diff --git a/cocos/3d/skinned-mesh-renderer/skinned-mesh-batch-renderer.ts b/cocos/3d/skinned-mesh-renderer/skinned-mesh-batch-renderer.ts
index 0cbcd2b2a3..2bf278e24d 100644
--- a/cocos/3d/skinned-mesh-renderer/skinned-mesh-batch-renderer.ts
+++ b/cocos/3d/skinned-mesh-renderer/skinned-mesh-batch-renderer.ts
@@ -22,11 +22,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module model
- */
-
import { EDITOR } from 'internal:constants';
import {
ccclass, help, executeInEditMode, executionOrder, menu, tooltip, type, visible, override, serializable, editable,
@@ -73,6 +68,8 @@ export class SkinnedMeshUnit {
public material: Material | null = null;
/**
+ * @en Local transform matrix
+ * @zh 本地变换矩阵
* @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
*/
@serializable
diff --git a/cocos/3d/skinned-mesh-renderer/skinned-mesh-renderer.ts b/cocos/3d/skinned-mesh-renderer/skinned-mesh-renderer.ts
index 75f5791b97..1ad50a176d 100644
--- a/cocos/3d/skinned-mesh-renderer/skinned-mesh-renderer.ts
+++ b/cocos/3d/skinned-mesh-renderer/skinned-mesh-renderer.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module model
- */
-
import {
ccclass, executeInEditMode, executionOrder, help, menu, tooltip, type,
} from 'cc.decorator';
@@ -77,7 +72,7 @@ export class SkinnedMeshRenderer extends MeshRenderer {
/**
* @en The skinning root. (The node where the controlling Animation is located)
- * 骨骼根节点的引用,对应控制此模型的动画组件所在节点。
+ * @zh 骨骼根节点的引用,对应控制此模型的动画组件所在节点。
*/
@type(Node)
@tooltip('i18n:model.skinning_root')
diff --git a/cocos/audio/audio-clip.ts b/cocos/audio/audio-clip.ts
index e21b5bdb90..e1c50c6c84 100644
--- a/cocos/audio/audio-clip.ts
+++ b/cocos/audio/audio-clip.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module component/audio
- */
-
import {
ccclass, type, serializable, override,
} from 'cc.decorator';
diff --git a/cocos/audio/audio-source.ts b/cocos/audio/audio-source.ts
index d483e8663d..f1af9b19a7 100644
--- a/cocos/audio/audio-source.ts
+++ b/cocos/audio/audio-source.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module component/audio
- */
-
import { AudioPlayer } from 'pal/audio';
import { ccclass, help, menu, tooltip, type, range, serializable } from 'cc.decorator';
import { AudioState } from '../../pal/audio/type';
diff --git a/cocos/audio/deprecated.ts b/cocos/audio/deprecated.ts
index b733daa73a..d305e82548 100644
--- a/cocos/audio/deprecated.ts
+++ b/cocos/audio/deprecated.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { AudioSource } from './audio-source';
import { replaceProperty, markAsWarning } from '../core/utils/x-deprecated';
import { AudioClip } from './audio-clip';
diff --git a/cocos/audio/index.ts b/cocos/audio/index.ts
index 10dd1eb83a..34e040ace9 100644
--- a/cocos/audio/index.ts
+++ b/cocos/audio/index.ts
@@ -23,8 +23,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-
-
import './audio-downloader';
import { AudioSource } from './audio-source';
diff --git a/cocos/core/animation/animation-clip.ts b/cocos/core/animation/animation-clip.ts
index 221b4c37b3..bef5ea8afc 100644
--- a/cocos/core/animation/animation-clip.ts
+++ b/cocos/core/animation/animation-clip.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module animation
- */
-
import { ccclass, serializable } from 'cc.decorator';
import { Asset } from '../assets/asset';
import { SpriteFrame } from '../../2d/assets/sprite-frame';
@@ -63,7 +58,7 @@ export declare namespace AnimationClip {
}
/**
- * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
+ * @internal
*/
export type { legacy as _legacy };
}
@@ -144,8 +139,7 @@ export class AnimationClip extends Asset {
/**
* Sets if node TRS curves in this animation can be blended.
* Normally this flag is enabled for model animation and disabled for other case.
- * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
- * This is an internal slot. Never use it in your code.
+ * @internal This is an internal slot. Never use it in your code.
*/
@serializable
public enableTrsBlending = false;
@@ -163,14 +157,20 @@ export class AnimationClip extends Asset {
}
/**
+ * @en
* Gets the count of tracks this animation owns.
+ * @zh
+ * 获取此动画中的轨道数量。
*/
get tracksCount () {
return this._tracks.length;
}
/**
+ * @en
* Gets an iterable to tracks.
+ * @zh
+ * 获取可用于迭代轨道的对象。
*/
get tracks (): Iterable
+ * @en ResolutionPolicy class is the root strategy class of scale strategy,
+ * its main task is to maintain the compatibility with Cocos2d-x.
+ *
+ * @zh ResolutionPolicy 类是适配策略的根策略类,它的主要任务是保持与 Cocos2d-x 的兼容性。
*/
export class ResolutionPolicy {
/**
- * The entire application is visible in the specified area without trying to preserve the original aspect ratio.
+ * @en The entire application is visible in the specified area without trying to preserve the original aspect ratio.
* Distortion can occur, and the application may appear stretched or compressed.
+ *
+ * @zh 整个应用程序在指定区域可见,无需尝试保留原始纵横比,
+ * 可能会发生变形,出现画面拉伸或压缩。
*/
public static EXACT_FIT = 0;
/**
- * The entire application fills the specified area, without distortion but possibly with some cropping,
+ * @en The entire application fills the specified area, without distortion but possibly with some cropping,
* while maintaining the original aspect ratio of the application.
+ *
+ * @zh 整个应用程序填充指定区域,没有变形,但可能有一些裁剪,
+ * 同时保持画面的原始纵横比。
*/
public static NO_BORDER = 1;
/**
- * The entire application is visible in the specified area without distortion while maintaining the original
+ * @en The entire application is visible in the specified area without distortion while maintaining the original
* aspect ratio of the application. Borders can appear on two sides of the application.
+ *
+ * @zh 整个应用程序在指定区域可见,没有变形,同时保持原始纵横比,
+ * 边框可能出现在画面的旁侧。
*/
public static SHOW_ALL = 2;
/**
- * The application takes the height of the design resolution size and modifies the width of the internal
- * canvas so that it fits the aspect ratio of the device
- * no distortion will occur however you must make sure your application works on different
+ * @en The application takes the height of the design resolution size and modifies the width of the internal
+ * canvas so that it fits the aspect ratio of the device
+ * no distortion will occur however you must make sure your application works on different
* aspect ratios
+ *
+ * @zh 该应用程序采用设计分辨率大小的高度并修改内部画布的宽度,使其适合设备的纵横比,不会发生变形,
+ * 但是您必须确保您的应用程序在不同的纵横比的设备下工作。
*/
public static FIXED_HEIGHT = 3;
/**
- * The application takes the width of the design resolution size and modifies the height of the internal
- * canvas so that it fits the aspect ratio of the device
- * no distortion will occur however you must make sure your application works on different
+ * @en The application takes the width of the design resolution size and modifies the height of the internal
+ * canvas so that it fits the aspect ratio of the device
+ * no distortion will occur however you must make sure your application works on different
* aspect ratios
+ *
+ * @zh 该应用程序采用设计分辨率大小的宽度并修改内部画布的高度,使其适合设备的纵横比,不会发生变形
+ * 但是您必须确保您的应用程序在不同的纵横比的设备下工作。
*/
public static FIXED_WIDTH = 4;
/**
- * Unknown policy
+ * @en Unknown policy
+ *
+ * @zh 未知的策略
*/
public static UNKNOWN = 5;
public static ContainerStrategy: typeof ContainerStrategy = ContainerStrategy;
diff --git a/cocos/core/platform/visible-rect.ts b/cocos/core/platform/visible-rect.ts
index 6ef4460747..d66ffd3848 100644
--- a/cocos/core/platform/visible-rect.ts
+++ b/cocos/core/platform/visible-rect.ts
@@ -24,8 +24,6 @@
THE SOFTWARE.
*/
-
-
import { Rect } from '../math';
import { legacyCC } from '../global-exports';
diff --git a/cocos/core/renderer/config.ts b/cocos/core/renderer/config.ts
index 0984cfb415..4b1a9bba57 100644
--- a/cocos/core/renderer/config.ts
+++ b/cocos/core/renderer/config.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
let _stageOffset = 0;
const _name2stageID = {};
diff --git a/cocos/core/renderer/core/constants.ts b/cocos/core/renderer/core/constants.ts
index e210a47ac0..c3bdb5ac45 100644
--- a/cocos/core/renderer/core/constants.ts
+++ b/cocos/core/renderer/core/constants.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
export enum RenderQueue {
OPAQUE = 0,
TRANSPARENT = 1,
diff --git a/cocos/core/renderer/core/material-instance.ts b/cocos/core/renderer/core/material-instance.ts
index 9107a69ba9..b9e027f1d4 100644
--- a/cocos/core/renderer/core/material-instance.ts
+++ b/cocos/core/renderer/core/material-instance.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module material
- */
-
import { Material } from '../../assets/material';
import { PassInstance } from './pass-instance';
import { MacroRecord } from './pass-utils';
diff --git a/cocos/core/renderer/core/native-pools.jsb.ts b/cocos/core/renderer/core/native-pools.jsb.ts
index 49b79129e0..82cacca2a8 100644
--- a/cocos/core/renderer/core/native-pools.jsb.ts
+++ b/cocos/core/renderer/core/native-pools.jsb.ts
@@ -23,7 +23,6 @@
THE SOFTWARE.
*/
-
declare const jsb: any;
export const NativeBufferPool = jsb.NativeBufferPool;
diff --git a/cocos/core/renderer/core/native-pools.ts b/cocos/core/renderer/core/native-pools.ts
index e87cf8f57e..b846ae14fc 100644
--- a/cocos/core/renderer/core/native-pools.ts
+++ b/cocos/core/renderer/core/native-pools.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
export class NativeBufferPool {
private _arrayBuffers: ArrayBuffer[] = [];
private _chunkSize: number;
diff --git a/cocos/core/renderer/core/pass-instance.ts b/cocos/core/renderer/core/pass-instance.ts
index c428265233..f5c063d262 100644
--- a/cocos/core/renderer/core/pass-instance.ts
+++ b/cocos/core/renderer/core/pass-instance.ts
@@ -23,19 +23,14 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module material
- */
-
import { EffectAsset } from '../../assets/effect-asset';
import { MaterialInstance } from './material-instance';
import { BatchingSchemes, Pass, PassOverrides } from './pass';
import { overrideMacros, MacroRecord } from './pass-utils';
/**
- * @en A pass instance defines an variant version of the [[Pass]]
- * @zh 表示 [[Pass]] 的一种特殊实例
+ * @en A pass instance defines an variant version of the [[renderer.Pass]]
+ * @zh 表示 [[renderer.Pass]] 的一种特殊实例
*/
export class PassInstance extends Pass {
/**
diff --git a/cocos/core/renderer/core/pass-utils.ts b/cocos/core/renderer/core/pass-utils.ts
index d65e226f9a..48f38709c8 100644
--- a/cocos/core/renderer/core/pass-utils.ts
+++ b/cocos/core/renderer/core/pass-utils.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module material
- */
-
import { Type } from '../../gfx';
import { Color, Mat3, Mat4, Vec2, Vec3, Vec4, Quat, IVec2Like, IVec3Like, IVec4Like, IMat3Like, IMat4Like } from '../../math';
diff --git a/cocos/core/renderer/core/pass.ts b/cocos/core/renderer/core/pass.ts
index 65ec4d8032..458aecc3b2 100644
--- a/cocos/core/renderer/core/pass.ts
+++ b/cocos/core/renderer/core/pass.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module material
- */
-
import { EDITOR } from 'internal:constants';
import { Root } from '../../root';
import { TextureBase } from '../../assets/texture-base';
@@ -147,8 +142,8 @@ export class Pass {
}
/**
- * @en Get pass hash value by [[Pass]] hash information.
- * @zh 根据 [[Pass]] 的哈希信息获取哈希值。
+ * @en Get pass hash value by [[renderer.Pass]] hash information.
+ * @zh 根据 [[renderer.Pass]] 的哈希信息获取哈希值。
*
* @param hPass Handle of the pass info used to compute hash value.
*/
@@ -302,8 +297,8 @@ export class Pass {
}
/**
- * @en Bind a GFX [[Texture]] the the given uniform binding
- * @zh 绑定实际 GFX [[Texture]] 到指定 binding。
+ * @en Bind a GFX [[gfx.Texture]] the the given uniform binding
+ * @zh 绑定实际 GFX [[gfx.Texture]] 到指定 binding。
* @param binding The binding for target uniform of texture type
* @param value Target texture
*/
@@ -312,8 +307,8 @@ export class Pass {
}
/**
- * @en Bind a GFX [[Sampler]] the the given uniform binding
- * @zh 绑定实际 GFX [[Sampler]] 到指定 binding。
+ * @en Bind a GFX [[gfx.Sampler]] the the given uniform binding
+ * @zh 绑定实际 GFX [[gfx.Sampler]] 到指定 binding。
* @param binding The binding for target uniform of sampler type
* @param value Target sampler
*/
diff --git a/cocos/core/renderer/core/program-lib.ts b/cocos/core/renderer/core/program-lib.ts
index 26aa1ea199..ded9863292 100644
--- a/cocos/core/renderer/core/program-lib.ts
+++ b/cocos/core/renderer/core/program-lib.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module material
- */
-
import { EffectAsset } from '../../assets/effect-asset';
import { SetIndex, IDescriptorSetLayoutInfo, globalDescriptorSetLayout, localDescriptorSetLayout } from '../../pipeline/define';
import { PipelineRuntime } from '../../pipeline/custom/pipeline';
diff --git a/cocos/core/renderer/core/render-window.ts b/cocos/core/renderer/core/render-window.ts
index 3f82a0fdfd..13fe6c5e59 100644
--- a/cocos/core/renderer/core/render-window.ts
+++ b/cocos/core/renderer/core/render-window.ts
@@ -54,8 +54,8 @@ const orientationMap: Record = {
export class RenderWindow {
/**
* @en Get window width. Pre-rotated (i.e. rotationally invariant, always in identity/portrait mode) if possible.
- * If you want to get oriented size instead, you should use [[Camera.width]] which corresponds to the current screen rotation.
- * @zh 获取窗口宽度。如果支持交换链预变换,返回值将始终处于单位旋转(竖屏)坐标系下。如果需要获取旋转后的尺寸,请使用 [[Camera.width]]。
+ * If you want to get oriented size instead, you should use [[renderer.scene.Camera.width]] which corresponds to the current screen rotation.
+ * @zh 获取窗口宽度。如果支持交换链预变换,返回值将始终处于单位旋转(竖屏)坐标系下。如果需要获取旋转后的尺寸,请使用 [[renderer.scene.Camera.width]]。
*/
get width (): number {
return this._width;
@@ -63,8 +63,8 @@ export class RenderWindow {
/**
* @en Get window height. Pre-rotated (i.e. rotationally invariant, always in identity/portrait mode) if possible.
- * If you want to get oriented size instead, you should use [[Camera.width]] which corresponds to the current screen rotation.
- * @zh 获取窗口高度。如果支持交换链预变换,返回值将始终处于单位旋转(竖屏)坐标系下。如果需要获取旋转后的尺寸,请使用 [[Camera.height]]。
+ * If you want to get oriented size instead, you should use [[renderer.scene.Camera.width]] which corresponds to the current screen rotation.
+ * @zh 获取窗口高度。如果支持交换链预变换,返回值将始终处于单位旋转(竖屏)坐标系下。如果需要获取旋转后的尺寸,请使用 [[renderer.scene.Camera.height]]。
*/
get height (): number {
return this._height;
diff --git a/cocos/core/renderer/core/texture-buffer-pool.ts b/cocos/core/renderer/core/texture-buffer-pool.ts
index 0fe05ef773..4f6adbd65b 100644
--- a/cocos/core/renderer/core/texture-buffer-pool.ts
+++ b/cocos/core/renderer/core/texture-buffer-pool.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { getTypedArrayConstructor, Format, FormatInfos, TextureType, TextureUsageBit,
TextureFlagBit, Texture, TextureInfo, Device, BufferTextureCopy } from '../../gfx';
import { debug } from '../../platform/debug';
diff --git a/cocos/core/renderer/deprecated.ts b/cocos/core/renderer/deprecated.ts
index bbacfa09c6..76ff0dc3a1 100644
--- a/cocos/core/renderer/deprecated.ts
+++ b/cocos/core/renderer/deprecated.ts
@@ -30,6 +30,7 @@ import { legacyCC } from '../global-exports';
import { Pass } from './core/pass';
import { Camera } from './scene/camera';
import { Shadows } from './scene/shadows';
+import { SpotLight } from './scene';
removeProperty(RenderScene.prototype, 'RenderScene.prototype', [
{ name: 'raycastUI2DNode' },
@@ -224,3 +225,9 @@ removeProperty(Shadows.prototype, 'Shadows.prototype', [
name: 'saturation',
},
]);
+
+removeProperty(SpotLight.prototype, 'SpotLight.prototype', [
+ {
+ name: 'aspect',
+ },
+]);
diff --git a/cocos/core/renderer/scene/ambient.ts b/cocos/core/renderer/scene/ambient.ts
index 9c568352ef..6e99d0c8d3 100644
--- a/cocos/core/renderer/scene/ambient.ts
+++ b/cocos/core/renderer/scene/ambient.ts
@@ -27,8 +27,22 @@ import { Vec4 } from '../../math';
import { legacyCC } from '../../global-exports';
import { AmbientInfo } from '../../scene-graph/scene-globals';
+/**
+ * @en Ambient lighting representation in the render scene.
+ * The initial data is setup in [[SceneGlobals.ambient]].
+ * @zh 渲染场景中的环境光照设置。
+ * 初始值是由 [[SceneGlobals.ambient]] 设置的。
+ */
export class Ambient {
+ /**
+ * @en Default sun illuminance
+ * @zh 默认太阳亮度
+ */
public static SUN_ILLUM = 65000.0;
+ /**
+ * @en Default sky illuminance
+ * @zh 默认天空亮度
+ */
public static SKY_ILLUM = 20000.0;
/**
@@ -53,7 +67,6 @@ export class Ambient {
return this._skyColorLDR;
}
}
-
set skyColor (color: Vec4) {
const isHDR = (legacyCC.director.root).pipeline.pipelineSceneData.isHDR;
if (isHDR) {
@@ -75,7 +88,6 @@ export class Ambient {
return this._skyIllumLDR;
}
}
-
set skyIllum (illum: number) {
const isHDR = (legacyCC.director.root).pipeline.pipelineSceneData.isHDR;
if (isHDR) {
@@ -96,7 +108,6 @@ export class Ambient {
return this._groundAlbedoLDR;
}
}
-
set groundAlbedo (color: Vec4) {
const isHDR = (legacyCC.director.root).pipeline.pipelineSceneData.isHDR;
if (isHDR) {
@@ -106,14 +117,6 @@ export class Ambient {
}
}
- get mipmapCount (): number {
- return this._mipmapCount;
- }
-
- set mipmapCount (count : number) {
- this._mipmapCount = count;
- }
-
protected _groundAlbedoHDR = new Vec4(0.2, 0.2, 0.2, 1.0);
protected _skyColorHDR = new Vec4(0.2, 0.5, 0.8, 1.0);
protected _skyIllumHDR = 0;
diff --git a/cocos/core/renderer/scene/camera.ts b/cocos/core/renderer/scene/camera.ts
index 4d11875e40..a9b8fabbc9 100644
--- a/cocos/core/renderer/scene/camera.ts
+++ b/cocos/core/renderer/scene/camera.ts
@@ -117,8 +117,409 @@ export const SKYBOX_FLAG = ClearFlagBit.STENCIL << 1;
const correctionMatrices: Mat4[] = [];
+/**
+ * @en The render camera representation in the render scene, it's managed by [[Camera]]
+ * @zh 渲染场景中的相机对象,由项目层的 [[Camera]] 管理。
+ */
export class Camera {
+ /**
+ * @en This exposure value corresponding to default standard camera exposure parameters.
+ * @zh 默认相机的曝光值。
+ */
+ public static get standardExposureValue () {
+ return 1.0 / 38400.0;
+ }
+
+ /**
+ * @en The luminance unit scale used by area lights.
+ * @zh 默认局部光源使用的亮度单位缩放。
+ */
+ public static get standardLightMeterScale () {
+ return 10000.0;
+ }
+
+ /**
+ * @en The name of the camera
+ * @zh 相机的名称
+ */
+ get name () {
+ return this._name;
+ }
+
+ /**
+ * @en The render scene to which the camera is attached
+ * @zh 相机所挂载的场景
+ */
+ get scene () {
+ return this._scene;
+ }
+
+ /**
+ * @en The node of the camera which determines its transform in world space.
+ * @zh 相机绑定的节点,决定了它在世界空间的变换矩阵
+ */
+ set node (val: Node) {
+ this._node = val;
+ }
+ get node () {
+ return this._node!;
+ }
+
+ /**
+ * @en The render window of the camera
+ * @zh 相机关联的渲染窗口
+ */
+ set window (val) {
+ this._window = val;
+ }
+ get window () {
+ return this._window!;
+ }
+
+ /**
+ * @en Whether the camera is enabled, a disabled camera won't be processed in the render pipeline.
+ * @zh 相机是否启用,未启用的相机不会被渲染
+ */
+ set enabled (val) {
+ this._enabled = val;
+ }
+ get enabled () {
+ return this._enabled;
+ }
+
+ /**
+ * @en Visibility mask of the camera, declaring a set of node layers that will be visible to this camera.
+ * @zh 相机的可见性掩码,声明在当前相机中可见的节点层级集合。
+ */
+ set visibility (vis: number) {
+ this._visibility = vis;
+ }
+ get visibility (): number {
+ return this._visibility;
+ }
+
+ /**
+ * @en Render priority of the camera. Cameras with higher depth are rendered after cameras with lower depth.
+ * @zh 相机的渲染优先级,值越小越优先渲染。
+ */
+ get priority (): number {
+ return this._priority;
+ }
+
+ set priority (val: number) {
+ this._priority = val;
+ }
+
+ /**
+ * @en The width of the camera's view size
+ * @zh 相机的视图宽度
+ */
+ get width () {
+ return this._width;
+ }
+
+ /**
+ * @en The height of the camera's view size
+ * @zh 相机的视图高度
+ */
+ get height () {
+ return this._height;
+ }
+
+ /**
+ * @en The world position of the camera
+ * @zh 相机的世界坐标
+ */
+ set position (val) {
+ this._position = val;
+ }
+ get position () {
+ return this._position;
+ }
+
+ /**
+ * @en The forward vector of the camera's look direction
+ * @zh 指向相机观察方向的向量
+ */
+ set forward (val) {
+ this._forward = val;
+ }
+ get forward () {
+ return this._forward;
+ }
+
+ /**
+ * @en Camera aperture, controls the exposure parameter.
+ * @zh 相机光圈,影响相机的曝光参数。
+ */
+ set aperture (val: CameraAperture) {
+ this._aperture = val;
+ this._apertureValue = FSTOPS[this._aperture];
+ this.updateExposure();
+ }
+ get aperture (): CameraAperture {
+ return this._aperture;
+ }
+
+ /**
+ * @en Camera aperture value.
+ * @zh 相机光圈值。
+ */
+ get apertureValue (): number {
+ return this._apertureValue;
+ }
+
+ /**
+ * @en Camera shutter, controls the exposure parameter.
+ * @zh 相机快门,影响相机的曝光参数。
+ */
+ set shutter (val: CameraShutter) {
+ this._shutter = val;
+ this._shutterValue = SHUTTERS[this._shutter];
+ this.updateExposure();
+ }
+ get shutter (): CameraShutter {
+ return this._shutter;
+ }
+
+ /**
+ * @en Camera shutter value.
+ * @zh 相机快门值。
+ */
+ get shutterValue (): number {
+ return this._shutterValue;
+ }
+
+ /**
+ * @en Camera ISO, controls the exposure parameter.
+ * @zh 相机感光度,影响相机的曝光参数。
+ */
+ set iso (val: CameraISO) {
+ this._iso = val;
+ this._isoValue = ISOS[this._iso];
+ this.updateExposure();
+ }
+ get iso (): CameraISO {
+ return this._iso;
+ }
+
+ /**
+ * @en Camera ISO value.
+ * @zh 相机感光度值。
+ */
+ get isoValue (): number {
+ return this._isoValue;
+ }
+
+ /**
+ * @en The calculated exposure of the camera
+ * @zh 相机的曝光参数
+ */
+ get exposure (): number {
+ return this._exposure;
+ }
+
+ /**
+ * @en Clearing flags of the camera, specifies which part of the framebuffer will be actually cleared every frame.
+ * @zh 相机的缓冲清除标志位,指定帧缓冲的哪部分要每帧清除。
+ */
+ get clearFlag () : ClearFlags {
+ return this._clearFlag;
+ }
+ set clearFlag (flag: ClearFlags) {
+ this._clearFlag = flag;
+ }
+
+ /**
+ * @en Clearing color of the camera.
+ * @zh 相机的颜色缓冲默认值。
+ */
+ set clearColor (val) {
+ this._clearColor.x = val.x;
+ this._clearColor.y = val.y;
+ this._clearColor.z = val.z;
+ this._clearColor.w = val.w;
+ }
+ get clearColor () {
+ return this._clearColor as IVec4Like;
+ }
+
+ /**
+ * @en Clearing depth of the camera.
+ * @zh 相机的深度缓冲默认值。
+ */
+ get clearDepth () : number {
+ return this._clearDepth;
+ }
+ set clearDepth (depth: number) {
+ this._clearDepth = depth;
+ }
+
+ /**
+ * @en Clearing stencil of the camera.
+ * @zh 相机的模板缓冲默认值。
+ */
+ get clearStencil () : number {
+ return this._clearStencil;
+ }
+ set clearStencil (stencil: number) {
+ this._clearStencil = stencil;
+ }
+
+ /**
+ * @en The projection type of the camera.
+ * @zh 相机的投影类型。
+ */
+ set projectionType (val) {
+ this._proj = val;
+ this._isProjDirty = true;
+ }
+ get projectionType () {
+ return this._proj;
+ }
+
+ /**
+ * @en The aspect ratio of the camera
+ * @zh 相机视图的长宽比
+ */
+ get aspect () {
+ return this._aspect;
+ }
+
+ /**
+ * @en The viewport height of the orthogonal type camera.
+ * @zh 正交相机的视角高度。
+ */
+ set orthoHeight (val) {
+ this._orthoHeight = val;
+ this._isProjDirty = true;
+ }
+ get orthoHeight () {
+ return this._orthoHeight;
+ }
+
+ /**
+ * @en The axis on which the FOV would be fixed regardless of screen aspect changes.
+ * @zh 指定视角的固定轴向,在此轴上不会跟随屏幕长宽比例变化。
+ */
+ set fovAxis (axis) {
+ this._fovAxis = axis;
+ this._isProjDirty = true;
+ }
+ get fovAxis () {
+ return this._fovAxis;
+ }
+
+ /**
+ * @en Field of view of the camera.
+ * @zh 相机的视角大小。
+ */
+ set fov (fov) {
+ this._fov = fov;
+ this._isProjDirty = true;
+ }
+ get fov () {
+ return this._fov;
+ }
+
+ /**
+ * @en Near clipping distance of the camera, should be as large as possible within acceptable range.
+ * @zh 相机的近裁剪距离,应在可接受范围内尽量取最大。
+ */
+ set nearClip (nearClip) {
+ this._nearClip = nearClip;
+ this._isProjDirty = true;
+ }
+ get nearClip () {
+ return this._nearClip;
+ }
+
+ /**
+ * @en Far clipping distance of the camera, should be as small as possible within acceptable range.
+ * @zh 相机的远裁剪距离,应在可接受范围内尽量取最小。
+ */
+ set farClip (farClip) {
+ this._farClip = farClip;
+ this._isProjDirty = true;
+ }
+ get farClip () {
+ return this._farClip;
+ }
+
+ /**
+ * @en The viewport rect of the camera, pre-rotated (i.e. always in identity/portrait mode) if possible.
+ * @zh 相机的视口矩形,如果设备允许的话,这个视口会永远保持竖屏状态,由渲染流程保障旋转的正确。
+ */
+ get viewport () {
+ return this._viewport;
+ }
+ set viewport (val) {
+ warnID(8302);
+ this.setViewportInOrientedSpace(val);
+ }
+
+ /**
+ * @en The view frustum of the camera
+ * @zh 相机的视锥体
+ */
+ set frustum (val) {
+ this._frustum = val;
+ }
+ get frustum () {
+ return this._frustum;
+ }
+
+ /**
+ * @en The view matrix of the camera
+ * @zh 相机的视图矩阵
+ */
+ get matView () {
+ return this._matView;
+ }
+
+ /**
+ * @en The projection matrix of the camera
+ * @zh 相机的投影矩阵
+ */
+ get matProj () {
+ return this._matProj;
+ }
+
+ /**
+ * @en The inverse of the projection matrix of the camera
+ * @zh 相机的逆投影矩阵
+ */
+ get matProjInv () {
+ return this._matProjInv;
+ }
+
+ /**
+ * @en The view projection matrix of the camera
+ * @zh 相机的视图投影矩阵
+ */
+ get matViewProj () {
+ return this._matViewProj;
+ }
+
+ /**
+ * @en The inverse of the view projection matrix of the camera
+ * @zh 相机的逆视图投影矩阵
+ */
+ get matViewProjInv () {
+ return this._matViewProjInv;
+ }
+
+ /**
+ * @en Whether the camera is fixed size or matching the window size.
+ * @zh 相机是固定尺寸还是跟随屏幕尺寸
+ */
public isWindowSize = true;
+
+ /**
+ * @en Scale of the internal buffer size,
+ * set to 1 to keep the same with the canvas size.
+ * @zh 相机内部缓冲尺寸的缩放值, 1 为与 canvas 尺寸相同。
+ */
public screenScale: number;
private _device: Device;
@@ -153,7 +554,6 @@ export class Camera {
private _shutterValue = 0.0;
private _iso: CameraISO = CameraISO.ISO100;
private _isoValue = 0.0;
- private _ec = 0.0;
private _window: RenderWindow | null = null;
private _width = 1;
private _height = 1;
@@ -195,19 +595,9 @@ export class Camera {
}
/**
- * this exposure value corresponding to default standard camera exposure parameters
+ * @en Initialize the camera, normally you shouldn't invoke this function, it's managed automatically.
+ * @zh 初始化相机,开发者通常不应该使用这个方法,初始化流程是自动管理的。
*/
- public static get standardExposureValue () {
- return 1.0 / 38400.0;
- }
-
- /**
- * luminance unit scale used by area lights
- */
- public static get standardLightMeterScale () {
- return 10000.0;
- }
-
public initialize (info: ICameraInfo) {
this.node = info.node;
this._width = 1;
@@ -223,6 +613,10 @@ export class Camera {
this.changeTargetWindow(info.window);
}
+ /**
+ * @en Destroy the camera, you shouldn't invoke this function, it's managed by the render scene.
+ * @zh 销毁相机,开发者不应该使用这个方法,销毁流程是由 RenderScene 管理的。
+ */
public destroy () {
if (this._window) {
this._window.detachCamera(this);
@@ -232,17 +626,32 @@ export class Camera {
this._geometryRenderer?.destroy();
}
+ /**
+ * @en Attach the camera to the given render scene so that it will be rendered in it.
+ * @zh 将相机添加到相关的渲染场景中,以便可以被渲染器渲染。
+ * @param scene @en The render scene @zh 渲染场景
+ */
public attachToScene (scene: RenderScene) {
this._enabled = true;
this._scene = scene;
}
+ /**
+ * @en Detach the camera from previously attached render scene. It will no longer be rendered.
+ * @zh 将相机从之前设置的渲染场景移除,之后将不会再被渲染。
+ */
public detachFromScene () {
this._enabled = false;
this._scene = null;
}
- public resize (width: number, height: number) {
+ /**
+ * @en Resize the view size of the camera.
+ * @zh 重置相机视图尺寸
+ * @param width The width of the view size
+ * @param height The height of the view size
+ */
+ public resize (width: number, height: number): void {
if (!this._window) return;
this._width = width;
@@ -252,6 +661,12 @@ export class Camera {
this._isProjDirty = true;
}
+ /**
+ * @en Set a fixed size for the camera view.
+ * @zh 设置固定相机视图尺寸
+ * @param width The width of the view size
+ * @param height The height of the view size
+ */
public setFixedSize (width: number, height: number) {
this._width = width;
this._height = height;
@@ -259,7 +674,10 @@ export class Camera {
this.isWindowSize = false;
}
- // Editor specific gizmo camera logic
+ /**
+ * Editor specific gizmo camera logic
+ * @internal
+ */
public syncCameraEditor (camera) {
if (EDITOR) {
this.position = camera.position;
@@ -271,7 +689,12 @@ export class Camera {
}
}
- public update (forceUpdate = false) { // for lazy eval situations like the in-editor preview
+ /**
+ * @en Update the camera's builtin matrixes
+ * @zh 更新相机的视图、投影等矩阵
+ * @param forceUpdate If force update, then dirty flag will be ignored
+ */
+ public update (forceUpdate = false): void { // for lazy eval situations like the in-editor preview
if (!this._node) return;
let viewProjDirty = false;
@@ -314,105 +737,13 @@ export class Camera {
}
}
- set node (val: Node) {
- this._node = val;
- }
-
- get node () {
- return this._node!;
- }
-
- set enabled (val) {
- this._enabled = val;
- }
-
- get enabled () {
- return this._enabled;
- }
-
- set orthoHeight (val) {
- this._orthoHeight = val;
- this._isProjDirty = true;
- }
-
- get orthoHeight () {
- return this._orthoHeight;
- }
-
- set projectionType (val) {
- this._proj = val;
- this._isProjDirty = true;
- }
-
- get projectionType () {
- return this._proj;
- }
-
- set fovAxis (axis) {
- this._fovAxis = axis;
- this._isProjDirty = true;
- }
-
- get fovAxis () {
- return this._fovAxis;
- }
-
- set fov (fov) {
- this._fov = fov;
- this._isProjDirty = true;
- }
-
- get fov () {
- return this._fov;
- }
-
- set nearClip (nearClip) {
- this._nearClip = nearClip;
- this._isProjDirty = true;
- }
-
- get nearClip () {
- return this._nearClip;
- }
-
- set farClip (farClip) {
- this._farClip = farClip;
- this._isProjDirty = true;
- }
-
- get farClip () {
- return this._farClip;
- }
-
- get surfaceTransform() {
+ get surfaceTransform () {
return this._curTransform;
}
- set clearColor (val) {
- this._clearColor.x = val.x;
- this._clearColor.y = val.y;
- this._clearColor.z = val.z;
- this._clearColor.w = val.w;
- }
-
- get clearColor () {
- return this._clearColor as IVec4Like;
- }
-
/**
- * Pre-rotated (i.e. always in identity/portrait mode) if possible.
- */
- get viewport () {
- return this._viewport;
- }
-
- set viewport (val) {
- warnID(8302);
- this.setViewportInOrientedSpace(val);
- }
-
- /**
- * Set the viewport in oriented space (local to screen rotations)
+ * @en Set the viewport in oriented space (equal to the actual screen rotation)
+ * @zh 在目标朝向空间(实际屏幕朝向)内设置相机视口
*/
public setViewportInOrientedSpace (val: Rect) {
const { x, width, height } = val;
@@ -457,175 +788,15 @@ export class Camera {
this.resize(this.width, this.height);
}
- get scene () {
- return this._scene;
- }
-
- get name () {
- return this._name;
- }
-
- get width () {
- return this._width;
- }
-
- get height () {
- return this._height;
- }
-
- get aspect () {
- return this._aspect;
- }
-
- get matView () {
- return this._matView;
- }
-
- get matProj () {
- return this._matProj;
- }
-
- get matProjInv () {
- return this._matProjInv;
- }
-
- get matViewProj () {
- return this._matViewProj;
- }
-
- get matViewProjInv () {
- return this._matViewProjInv;
- }
-
- set frustum (val) {
- this._frustum = val;
- }
-
- get frustum () {
- return this._frustum;
- }
-
- set window (val) {
- this._window = val;
- }
-
- get window () {
- return this._window!;
- }
-
- set forward (val) {
- this._forward = val;
- }
-
- get forward () {
- return this._forward;
- }
-
- set position (val) {
- this._position = val;
- }
-
- get position () {
- return this._position;
- }
-
- set visibility (vis: number) {
- this._visibility = vis;
- }
- get visibility (): number {
- return this._visibility;
- }
-
- get priority (): number {
- return this._priority;
- }
-
- set priority (val: number) {
- this._priority = val;
- }
-
- set aperture (val: CameraAperture) {
- this._aperture = val;
- this._apertureValue = FSTOPS[this._aperture];
- this.updateExposure();
- }
-
- get aperture (): CameraAperture {
- return this._aperture;
- }
-
- get apertureValue (): number {
- return this._apertureValue;
- }
-
- set shutter (val: CameraShutter) {
- this._shutter = val;
- this._shutterValue = SHUTTERS[this._shutter];
- this.updateExposure();
- }
-
- get shutter (): CameraShutter {
- return this._shutter;
- }
-
- get shutterValue (): number {
- return this._shutterValue;
- }
-
- set iso (val: CameraISO) {
- this._iso = val;
- this._isoValue = ISOS[this._iso];
- this.updateExposure();
- }
-
- get iso (): CameraISO {
- return this._iso;
- }
-
- get isoValue (): number {
- return this._isoValue;
- }
-
- set ec (val: number) {
- this._ec = val;
- }
-
- get ec (): number {
- return this._ec;
- }
-
- get exposure (): number {
- return this._exposure;
- }
-
- get clearFlag () : ClearFlags {
- return this._clearFlag;
- }
-
- set clearFlag (flag: ClearFlags) {
- this._clearFlag = flag;
- }
-
- get clearDepth () : number {
- return this._clearDepth;
- }
-
- set clearDepth (depth: number) {
- this._clearDepth = depth;
- }
-
- get clearStencil () : number {
- return this._clearStencil;
- }
-
- set clearStencil (stencil: number) {
- this._clearStencil = stencil;
- }
-
get geometryRenderer () {
return this._geometryRenderer;
}
+ /**
+ * @en Change the target render window to another one
+ * @zh 修改相机的目标渲染窗口
+ * @param window The target render window, could be null
+ */
public changeTargetWindow (window: RenderWindow | null = null) {
if (this._window) {
this._window.detachCamera(this);
@@ -643,6 +814,10 @@ export class Camera {
}
}
+ /**
+ * @en Detach camera from the render window
+ * @zh 将 camera 从渲染窗口移除
+ */
public detachCamera () {
if (this._window) {
this._window.detachCamera(this);
@@ -650,7 +825,12 @@ export class Camera {
}
/**
- * transform a screen position (in oriented space) to a world space ray
+ * @en Transform a screen position (in oriented space) to a world space ray
+ * @zh 将一个屏幕空间(在实际朝向下)点转换到世界空间的射线
+ * @param out the resulting ray
+ * @param x the screen x of the position
+ * @param y the screen y of the position
+ * @returns the resulting ray
*/
public screenPointToRay (out: Ray, x: number, y: number): Ray {
if (!this._node) return null!;
@@ -685,7 +865,11 @@ export class Camera {
}
/**
- * transform a screen position (in oriented space) to world space
+ * @en Transform a screen position (in oriented space) to world space
+ * @zh 将一个屏幕空间(在实际朝向下)位置转换到世界空间
+ * @param out the resulting vector
+ * @param screenPos the screen position to be transformed
+ * @returns the resulting vector
*/
public screenToWorld (out: Vec3, screenPos: Vec3): Vec3 {
const width = this.width;
@@ -731,7 +915,11 @@ export class Camera {
}
/**
- * transform a world space position to screen space
+ * @en Transform a world space position to screen space rendered by the camera
+ * @zh 将一个世界空间位置转换到相机渲染后的屏幕空间
+ * @param out the resulting vector
+ * @param worldPos the world position to be transformed
+ * @returns the resulting vector
*/
public worldToScreen (out: Vec3, worldPos: Vec3 | Readonly): Vec3 {
const ySign = this._device.capabilities.clipSpaceSignY;
@@ -758,12 +946,13 @@ export class Camera {
}
/**
- * transform a world space matrix to screen space
- * @param {Mat4} out the resulting vector
- * @param {Mat4} worldMatrix the world space matrix to be transformed
- * @param {number} width framebuffer width
- * @param {number} height framebuffer height
- * @returns {Mat4} the resulting vector
+ * @en Transform a world space matrix to screen space rendered by the camera
+ * @zh 将一个世界空间矩阵转换到相机渲染后的屏幕空间
+ * @param out the resulting matrix
+ * @param worldMatrix the world space matrix to be transformed
+ * @param width framebuffer width
+ * @param height framebuffer height
+ * @returns the resulting matrix
*/
public worldMatrixToScreen (out: Mat4, worldMatrix: Mat4, width: number, height: number) {
Mat4.multiply(out, this._matViewProj, worldMatrix);
@@ -780,6 +969,11 @@ export class Camera {
return out;
}
+ /**
+ * @en Set exposure with actual value.
+ * @zh 设置相机的曝光值
+ * @param ev100
+ */
protected setExposure (ev100) {
this._exposure = 0.833333 / (2.0 ** ev100);
}
diff --git a/cocos/core/renderer/scene/directional-light.ts b/cocos/core/renderer/scene/directional-light.ts
index 0c3793fcd6..e36ce0691e 100644
--- a/cocos/core/renderer/scene/directional-light.ts
+++ b/cocos/core/renderer/scene/directional-light.ts
@@ -32,6 +32,11 @@ import { PCFType, Shadows } from './shadows';
const _forward = new Vec3(0, 0, -1);
const _v3 = new Vec3();
+/**
+ * @en The directional light representation in the render scene, it acts as the main light source in a scene.
+ * As main light, only one directional light can be created in a scene, it can generate realtime shadows with configuration.
+ * @zh 渲染场景中的方向光抽象,这是场景中的主光源。作为主光源,每个场景只能有一个方向光,它也包含阴影配置,用来生成实时阴影。
+ */
export class DirectionalLight extends Light {
protected _dir: Vec3 = new Vec3(1.0, -1.0, -1.0);
protected _illuminanceHDR: number = Ambient.SUN_ILLUM;
@@ -54,6 +59,10 @@ export class DirectionalLight extends Light {
protected _shadowFar = 10.0;
protected _shadowOrthoSize = 5;
+ /**
+ * @en The direction vector of the light
+ * @zh 光源的方向
+ */
set direction (dir: Vec3) {
Vec3.normalize(this._dir, dir);
}
@@ -62,7 +71,10 @@ export class DirectionalLight extends Light {
return this._dir;
}
- // in Lux(lx)
+ /**
+ * @en The illuminance of the light in Lux(lx)
+ * @zh 光源的辐照度,单位是 Lux(lx)
+ */
get illuminance (): number {
const isHDR = (legacyCC.director.root).pipeline.pipelineSceneData.isHDR;
if (isHDR) {
@@ -80,6 +92,10 @@ export class DirectionalLight extends Light {
}
}
+ /**
+ * @en The illuminance of the light in HDR mode
+ * @zh HDR 模式下光源的辐照度
+ */
get illuminanceHDR () {
return this._illuminanceHDR;
}
@@ -87,6 +103,10 @@ export class DirectionalLight extends Light {
this._illuminanceHDR = value;
}
+ /**
+ * @en The illuminance of the light in LDR mode
+ * @zh LDR 模式下光源的辐照度
+ */
get illuminanceLDR () {
return this._illuminanceLDR;
}
@@ -106,9 +126,9 @@ export class DirectionalLight extends Light {
}
/**
- * @en get or set shadow pcf.
- * @zh 获取或者设置阴影pcf等级。
- */
+ * @en get or set shadow pcf.
+ * @zh 获取或者设置阴影pcf等级。
+ */
get shadowPcf () {
return this._shadowPcf;
}
@@ -117,9 +137,9 @@ export class DirectionalLight extends Light {
}
/**
- * @en get or set shadow map sampler offset
- * @zh 获取或者设置阴影纹理偏移值
- */
+ * @en get or set shadow map sampler offset
+ * @zh 获取或者设置阴影纹理偏移值
+ */
get shadowBias () {
return this._shadowBias;
}
@@ -128,9 +148,9 @@ export class DirectionalLight extends Light {
}
/**
- * @en get or set normal bias.
- * @zh 设置或者获取法线偏移。
- */
+ * @en get or set normal bias.
+ * @zh 设置或者获取法线偏移。
+ */
get shadowNormalBias () {
return this._shadowNormalBias;
}
@@ -150,9 +170,9 @@ export class DirectionalLight extends Light {
}
/**
- * @en get or set shadow camera far
- * @zh 获取或者设置潜在阴影产生的范围
- */
+ * @en get or set shadow camera far
+ * @zh 获取或者设置潜在阴影产生的范围
+ */
get shadowDistance () {
return this._shadowDistance;
}
@@ -161,8 +181,8 @@ export class DirectionalLight extends Light {
}
/**
- * @en get or set shadow camera far
- * @zh 获取或者设置潜在阴影产生的范围
+ * @en get or set shadow camera far
+ * @zh 获取或者设置潜在阴影产生的范围
*/
get shadowInvisibleOcclusionRange () {
return this._shadowInvisibleOcclusionRange;
@@ -172,9 +192,9 @@ export class DirectionalLight extends Light {
}
/**
- * @en get or set fixed area shadow
- * @zh 是否是固定区域阴影
- */
+ * @en get or set fixed area shadow
+ * @zh 是否是固定区域阴影
+ */
get shadowFixedArea () {
return this._shadowFixedArea;
}
@@ -183,9 +203,9 @@ export class DirectionalLight extends Light {
}
/**
- * @en get or set shadow camera near
- * @zh 获取或者设置阴影相机近裁剪面
- */
+ * @en The near clip plane of the shadow camera
+ * @zh 获取或者设置阴影相机近裁剪面
+ */
get shadowNear () {
return this._shadowNear;
}
@@ -194,9 +214,9 @@ export class DirectionalLight extends Light {
}
/**
- * @en get or set shadow camera far
- * @zh 获取或者设置阴影相机远裁剪面
- */
+ * @en The far clip plane of the shadow camera
+ * @zh 获取或者设置阴影相机远裁剪面
+ */
get shadowFar () {
return this._shadowFar;
}
@@ -205,9 +225,9 @@ export class DirectionalLight extends Light {
}
/**
- * @en get or set shadow camera orthoSize
- * @zh 获取或者设置阴影相机正交大小
- */
+ * @en get or set shadow camera orthoSize
+ * @zh 获取或者设置阴影相机正交大小
+ */
get shadowOrthoSize () {
return this._shadowOrthoSize;
}
@@ -227,6 +247,10 @@ export class DirectionalLight extends Light {
this.direction = new Vec3(1.0, -1.0, -1.0);
}
+ /**
+ * @en Update the direction
+ * @zh 更新方向
+ */
public update () {
if (this._node && this._node.hasChangedFlags) {
this.direction = Vec3.transformQuat(_v3, _forward, this._node.worldRotation);
diff --git a/cocos/core/renderer/scene/fog.ts b/cocos/core/renderer/scene/fog.ts
index 51670cda92..928c8ce952 100644
--- a/cocos/core/renderer/scene/fog.ts
+++ b/cocos/core/renderer/scene/fog.ts
@@ -76,6 +76,10 @@ export const FogType = Enum({
const FOG_TYPE_NONE = FogType.LAYERED + 1;
+/**
+ * @en The fog representation in the render scene.
+ * @zh 渲染场景中的全局雾效配置
+ */
export class Fog {
/**
* @zh 是否启用全局雾效
diff --git a/cocos/core/renderer/scene/light.ts b/cocos/core/renderer/scene/light.ts
index ed502320ca..a345172ab5 100644
--- a/cocos/core/renderer/scene/light.ts
+++ b/cocos/core/renderer/scene/light.ts
@@ -55,6 +55,10 @@ export function ColorTemperatureToRGB (rgb: Vec3, kelvin: number) {
rgb.z = 0.0556434 * X + -0.2040259 + 1.0572252 * Z;
}
+/**
+ * @en The light type enumeration.
+ * @zh 光源类型枚举。
+ */
export enum LightType {
DIRECTIONAL,
SPHERE,
@@ -64,7 +68,15 @@ export enum LightType {
export const nt2lm = (size: number) => 4 * Math.PI * Math.PI * size * size;
+/**
+ * @en The abstract light class of the render scene
+ * @zh 渲染场景中的光源基类
+ */
export class Light {
+ /**
+ * @en Whether it's a baked light source, baked light will be ignored in real time lighting pass
+ * @zh 是否是烘焙光源,烘焙光源会在实时光照计算中被忽略
+ */
get baked () {
return this._baked;
}
@@ -73,6 +85,10 @@ export class Light {
this._baked = val;
}
+ /**
+ * @en The color of the light
+ * @zh 光源的颜色
+ */
set color (color: Vec3) {
this._color.set(color);
}
@@ -81,6 +97,10 @@ export class Light {
return this._color;
}
+ /**
+ * @en Whether to use color temperature
+ * @zh 是否使用光源的色温
+ */
set useColorTemperature (enable: boolean) {
this._useColorTemperature = enable;
}
@@ -89,6 +109,10 @@ export class Light {
return this._useColorTemperature;
}
+ /**
+ * @en The color temperature of the light
+ * @zh 光源的色温
+ */
set colorTemperature (val: number) {
this._colorTemp = val;
ColorTemperatureToRGB(this._colorTempRGB, this._colorTemp);
@@ -98,6 +122,10 @@ export class Light {
return this._colorTemp;
}
+ /**
+ * @en The float RGB value of the color temperature, each channel is from 0 to 1
+ * @zh 色温的浮点数颜色值,每个通道都是从 0 到 1
+ */
get colorTemperatureRGB (): Vec3 {
return this._colorTempRGB;
}
@@ -109,14 +137,26 @@ export class Light {
}
}
+ /**
+ * @en The node which owns the light source
+ * @zh 光源归属的节点
+ */
get node () {
return this._node;
}
+ /**
+ * @en The type of the light source, e.g. directional light, spot light, etc
+ * @zh 光源的类型,比如方向光、聚光灯等
+ */
get type () : LightType {
return this._type;
}
+ /**
+ * @en The name of the light source
+ * @zh 光源的名字
+ */
get name () {
return this._name;
}
@@ -125,6 +165,10 @@ export class Light {
this._name = n;
}
+ /**
+ * @en The render scene which owns the current light
+ * @zh 光源所属的渲染场景
+ */
get scene () {
return this._scene;
}
@@ -152,10 +196,19 @@ export class Light {
this.colorTemperature = 6550.0;
}
+ /**
+ * @en Attach the light to a render scene
+ * @zh 将光源挂载到渲染场景上
+ * @param scene @en The render scene @zh 渲染场景
+ */
public attachToScene (scene: RenderScene) {
this._scene = scene;
}
+ /**
+ * @en Detach the light from the render scene
+ * @zh 将光源从渲染场景上移除
+ */
public detachFromScene () {
this._scene = null;
}
diff --git a/cocos/core/renderer/scene/model.ts b/cocos/core/renderer/scene/model.ts
index def92d9075..cedea79069 100644
--- a/cocos/core/renderer/scene/model.ts
+++ b/cocos/core/renderer/scene/model.ts
@@ -46,6 +46,10 @@ const shadowMapPatches: IMacroPatch[] = [
{ name: 'CC_RECEIVE_SHADOW', value: true },
];
+const lightMapPatches: IMacroPatch[] = [
+ { name: 'CC_USE_LIGHTMAP', value: true },
+];
+
export interface IInstancedAttributeBlock {
buffer: Uint8Array;
views: TypedArray[];
@@ -86,41 +90,86 @@ const lightmapSamplerWithMipHash = new SamplerInfo(
);
/**
- * A representation of a model
+ * @en A representation of a model instance
+ * The base model class, which is the core component of [[MeshRenderer]],
+ * adds its own Model to the rendered scene for rendering submissions when [[MeshRenderer]] is enabled.
+ * This type of object represents a rendering instance in a scene, and it can contain multiple sub models,
+ * each of which corresponds to a material. These sub models share the same location and form a complete object.
+ * Each sub model references a sub mesh resource, which provides vertex and index buffers for rendering.
+ * @zh 代表一个模型实例
+ * 基础模型类,它是 [[MeshRenderer]] 的核心组成部分,在 [[MeshRenderer]] 启用时会将自己的 Model 添加到渲染场景中用于提交渲染。
+ * 此类型对象代表一个场景中的渲染实例,它可以包含多个子模型,每个子模型对应一个材质。这些子模型共享同样的位置,组成一个完整的物体。
+ * 每个子模型引用一个子网格资源,后者提供渲染所用的顶点与索引缓冲。
*/
export class Model {
+ /**
+ * @en Sub models of the current model
+ * @zh 获取所有子模型
+ */
get subModels () {
return this._subModels;
}
+ /**
+ * @en Whether the model is initialized
+ * @zh 是否初始化
+ */
get inited (): boolean {
return this._inited;
}
+ /**
+ * @en The axis-aligned bounding box of the model in the world space
+ * @zh 获取世界空间包围盒
+ */
get worldBounds () {
return this._worldBounds!;
}
+ /**
+ * @en The axis-aligned bounding box of the model in the model space
+ * @zh 获取模型空间包围盒
+ */
get modelBounds () {
return this._modelBounds;
}
+ /**
+ * @en The ubo buffer of the model
+ * @zh 获取模型的 ubo 缓冲
+ */
get localBuffer () {
return this._localBuffer;
}
+ /**
+ * @en The world bound ubo buffer
+ * @zh 获取世界包围盒 ubo 缓冲
+ */
get worldBoundBuffer () {
return this._worldBoundBuffer;
}
+ /**
+ * @en The time stamp of last update
+ * @zh 获取上次更新时间戳
+ */
get updateStamp () {
return this._updateStamp;
}
+ /**
+ * @en Whether GPU instancing is enabled for the current model
+ * @zh 是否开启实例化渲染
+ */
get isInstancingEnabled () {
return this._instMatWorldIdx >= 0;
}
+ /**
+ * @en Model level shadow bias
+ * @zh 阴影偏移值
+ */
get shadowBias () {
return this._shadowBias;
}
@@ -129,6 +178,10 @@ export class Model {
this._shadowBias = val;
}
+ /**
+ * @en Model level shadow normal bias
+ * @zh 阴影法线偏移值
+ */
get shadowNormalBias () {
return this._shadowNormalBias;
}
@@ -137,6 +190,10 @@ export class Model {
this._shadowNormalBias = val;
}
+ /**
+ * @en Whether the model should receive shadow
+ * @zh 是否接收阴影
+ */
get receiveShadow () {
return this._receiveShadow;
}
@@ -146,6 +203,10 @@ export class Model {
this.onMacroPatchesStateChanged();
}
+ /**
+ * @en Whether the model should cast shadow
+ * @zh 是否投射阴影
+ */
get castShadow () {
return this._castShadow;
}
@@ -154,6 +215,10 @@ export class Model {
this._castShadow = val;
}
+ /**
+ * @en The node to which the model belongs
+ * @zh 模型所在的节点
+ */
get node () : Node {
return this._node;
}
@@ -162,6 +227,10 @@ export class Model {
this._node = n;
}
+ /**
+ * @en Model's transform
+ * @zh 模型的变换
+ */
get transform () : Node {
return this._transform;
}
@@ -170,6 +239,13 @@ export class Model {
this._transform = n;
}
+ /**
+ * @en Model's visibility tag
+ * Model's visibility flags, it's different from [[Node.layer]],
+ * but it will also be compared with [[Camera.visibility]] during culling process.
+ * @zh 模型的可见性标志
+ * 模型的可见性标志与 [[Node.layer]] 不同,它会在剔除阶段与 [[Camera.visibility]] 进行比较
+ */
get visFlags () : number {
return this._visFlags;
}
@@ -178,6 +254,10 @@ export class Model {
this._visFlags = val;
}
+ /**
+ * @en Whether the model is enabled in the render scene so that it will be rendered
+ * @zh 模型是否在渲染场景中启用并被渲染
+ */
get enabled () : boolean {
return this._enabled;
}
@@ -186,45 +266,175 @@ export class Model {
this._enabled = val;
}
+ /**
+ * @en The type of the model
+ * @zh 模型类型
+ */
public type = ModelType.DEFAULT;
+
+ /**
+ * @en The render scene to which the model belongs
+ * @zh 模型所在的场景
+ */
public scene: RenderScene | null = null;
+
+ /**
+ * @en Whether dynamic batching is enabled for model
+ * @zh 是否动态合批
+ */
public isDynamicBatching = false;
+
+ /**
+ * @en The instance attributes
+ * @zh 实例化属性
+ */
public instancedAttributes: IInstancedAttributeBlock = { buffer: null!, views: [], attributes: [] };
+ /**
+ * @en The world axis-aligned bounding box
+ * @zh 世界空间包围盒
+ */
protected _worldBounds: AABB | null = null;
+
+ /**
+ * @en The model axis-aligned bounding box
+ * @zh 模型空间包围盒
+ */
protected _modelBounds: AABB | null = null;
+
+ /**
+ * @en Sub models
+ * @zh 子模型
+ */
protected _subModels: SubModel[] = [];
+
+ /**
+ * @en The node to which the model belongs
+ * @zh 模型所在的节点
+ */
protected _node: Node = null!;
+
+ /**
+ * @en Model's transform
+ * @zh 子模型的变换
+ */
protected _transform: Node = null!;
+ /**
+ * @en Current gfx device
+ * @zh 当前 GFX 设备
+ */
protected _device: Device;
+
+ /**
+ * @en Whether the model is initialized
+ * @zh 是否初始化过
+ */
protected _inited = false;
+
+ /**
+ * @en Descriptor set count
+ * @zh 描述符集合个数
+ */
protected _descriptorSetCount = 1;
+
+ /**
+ * @en Time stamp for last update
+ * @zh 更新时间戳
+ */
protected _updateStamp = -1;
+
+ /**
+ * @en Local ubo data dirty flag
+ * @zh 本地 ubo 数据是否修改过
+ */
protected _localDataUpdated = true;
+ /**
+ * @en Local ubo data
+ * @zh 本地 ubo 数据
+ */
protected _localData = new Float32Array(UBOLocal.COUNT);
+
+ /**
+ * @en Local ubo buffer
+ * @zh 本地 ubo 缓冲
+ */
protected _localBuffer: Buffer | null = null;
+
+ /**
+ * @en Instance matrix id
+ * @zh 实例矩阵索引
+ */
private _instMatWorldIdx = -1;
private _lightmap: Texture2D | null = null;
private _lightmapUVParam: Vec4 = new Vec4();
+ /**
+ * @en World AABB buffer
+ * @zh 世界空间包围盒缓冲
+ */
protected _worldBoundBuffer: Buffer | null = null;
+ /**
+ * @en Whether the model should receive shadow
+ * @zh 是否接收阴影
+ */
protected _receiveShadow = false;
+
+ /**
+ * @en Whether the model should cast shadow
+ * @zh 是否投射阴影
+ */
protected _castShadow = false;
+
+ /**
+ * @en Shadow bias
+ * @zh 阴影偏移
+ */
protected _shadowBias = 0;
+
+ /**
+ * @en Shadow normal bias
+ * @zh 阴影法线偏移
+ */
protected _shadowNormalBias = 0;
+
+ /**
+ * @en Whether the model is enabled in the render scene so that it will be rendered
+ * @zh 模型是否在渲染场景中启用并被渲染
+ */
protected _enabled = true;
+
+ /**
+ * @en The visibility flags
+ * @zh 可见性标志位
+ */
protected _visFlags = Layers.Enum.NONE;
/**
- * Setup a default empty model
+ * @internal
+ * @en native object
+ * @zh 原生对象
+ */
+
+ /**
+ * @internal
+ * @en return native object
+ * @zh 返回原生对象
+ */
+ /**
+ * @en Constructor to create an empty model
+ * @zh 创建一个空模型
*/
constructor () {
this._device = legacyCC.director.root.device;
}
+ /**
+ * @en Initialize the model
+ * @zh 初始化模型
+ */
public initialize () {
if (this._inited) {
return;
@@ -236,6 +446,10 @@ export class Model {
this._inited = true;
}
+ /**
+ * @en Destroy the model
+ * @zh 销毁模型
+ */
public destroy () {
const subModels = this._subModels;
for (let i = 0; i < subModels.length; i++) {
@@ -259,15 +473,29 @@ export class Model {
this.isDynamicBatching = false;
}
+ /**
+ * @en Attach the model to a [[renderer.RenderScene]]
+ * @zh 添加模型到渲染场景 [[renderer.RenderScene]] 中
+ * @param scene destination scene
+ */
public attachToScene (scene: RenderScene) {
this.scene = scene;
this._localDataUpdated = true;
}
+ /**
+ * @en Detach the model from its render scene
+ * @zh 移除场景中的模型
+ */
public detachFromScene () {
this.scene = null;
}
+ /**
+ * @en Update the model's transform
+ * @zh 更新模型的变换
+ * @param stamp time stamp
+ */
public updateTransform (stamp: number) {
const node = this.transform;
// @ts-expect-error TS2445
@@ -282,6 +510,10 @@ export class Model {
}
}
+ /**
+ * @en Update the model's world AABB
+ * @zh 更新模型的世界空间包围盒
+ */
public updateWorldBound () {
const node = this.transform;
if (node !== null) {
@@ -295,6 +527,11 @@ export class Model {
}
}
+ /**
+ * @en Update the model's ubo
+ * @zh 更新模型的 ubo
+ * @param stamp time stamp
+ */
public updateUBOs (stamp: number) {
const subModels = this._subModels;
for (let i = 0; i < subModels.length; i++) {
@@ -321,9 +558,10 @@ export class Model {
}
/**
- * Create the bounding shape of this model
- * @param minPos the min position of the model
- * @param maxPos the max position of the model
+ * @en Create the model's AABB
+ * @zh 创建模型的包围盒
+ * @param minPos min position of the AABB
+ * @param maxPos max position of the AABB
*/
public createBoundingShape (minPos?: Vec3, maxPos?: Vec3) {
if (!minPos || !maxPos) { return; }
@@ -335,6 +573,13 @@ export class Model {
return new SubModel();
}
+ /**
+ * @en Initialize a sub model with the sub mesh data and the material.
+ * @zh 用子网格数据和材质初始化一个子模型。
+ * @param idx sub model's index
+ * @param subMeshData sub mesh
+ * @param mat sub material
+ */
public initSubModel (idx: number, subMeshData: RenderingSubMesh, mat: Material) {
this.initialize();
@@ -355,17 +600,33 @@ export class Model {
this._updateAttributesAndBinding(idx);
}
+ /**
+ * @en Set material for a given sub model
+ * @zh 为指定的子模型设置材质
+ * @param idx sub model's index
+ * @param subMesh sub mesh
+ */
public setSubModelMesh (idx: number, subMesh: RenderingSubMesh) {
if (!this._subModels[idx]) { return; }
this._subModels[idx].subMesh = subMesh;
}
+ /**
+ * @en Set a sub material
+ * @zh 设置一个子材质
+ * @param idx sub model's index
+ * @param mat sub material
+ */
public setSubModelMaterial (idx: number, mat: Material) {
if (!this._subModels[idx]) { return; }
this._subModels[idx].passes = mat.passes;
this._updateAttributesAndBinding(idx);
}
+ /**
+ * @en Pipeline changed callback
+ * @zh 管线更新回调
+ */
public onGlobalPipelineStateChanged () {
const subModels = this._subModels;
for (let i = 0; i < subModels.length; i++) {
@@ -373,6 +634,10 @@ export class Model {
}
}
+ /**
+ * @en Shader macro changed callback
+ * @zh Shader 宏更新回调
+ */
public onMacroPatchesStateChanged () {
const subModels = this._subModels;
for (let i = 0; i < subModels.length; i++) {
@@ -387,12 +652,20 @@ export class Model {
}
}
+ /**
+ * @en Update the light map
+ * @zh 更新光照贴图
+ * @param texture light map
+ * @param uvParam uv coordinate
+ */
public updateLightingmap (texture: Texture2D | null, uvParam: Vec4) {
Vec4.toArray(this._localData, uvParam, UBOLocal.LIGHTINGMAP_UVPARAM);
this._localDataUpdated = true;
this._lightmap = texture;
this._lightmapUVParam = uvParam;
+ this.onMacroPatchesStateChanged();
+
if (texture === null) {
texture = builtinResMgr.get('empty-texture');
}
@@ -403,8 +676,6 @@ export class Model {
const subModels = this._subModels;
for (let i = 0; i < subModels.length; i++) {
const { descriptorSet } = subModels[i];
- // TODO: should manage lightmap macro switches automatically
- // USE_LIGHTMAP -> CC_USE_LIGHTMAP
descriptorSet.bindTexture(UNIFORM_LIGHTMAP_TEXTURE_BINDING, gfxTexture);
descriptorSet.bindSampler(UNIFORM_LIGHTMAP_TEXTURE_BINDING, sampler);
descriptorSet.update();
@@ -412,6 +683,10 @@ export class Model {
}
}
+ /**
+ * @en Update the shadow bias
+ * @zh 更新阴影偏移
+ */
public updateLocalShadowBias () {
const sv = this._localData;
sv[UBOLocal.LOCAL_SHADOW_BIAS + 0] = this._shadowBias;
@@ -421,8 +696,17 @@ export class Model {
this._localDataUpdated = true;
}
+ /**
+ * @en Return shader's macro patches
+ * @zh 获取 shader 宏
+ * @param subModelIndex sub model's index
+ */
public getMacroPatches (subModelIndex: number): IMacroPatch[] | null {
- return this.receiveShadow ? shadowMapPatches : null;
+ let patches = this.receiveShadow ? shadowMapPatches : null;
+ if (this._lightmap != null) {
+ patches = patches ? patches.concat(lightMapPatches) : lightMapPatches;
+ }
+ return patches;
}
protected _updateAttributesAndBinding (subModelIndex: number) {
diff --git a/cocos/core/renderer/scene/octree.ts b/cocos/core/renderer/scene/octree.ts
index 65cb838427..4f67dd7970 100644
--- a/cocos/core/renderer/scene/octree.ts
+++ b/cocos/core/renderer/scene/octree.ts
@@ -26,9 +26,13 @@
import { Vec3 } from '../../math/vec3';
import { OctreeInfo } from '../../scene-graph/scene-globals';
+/**
+ * @en The octree culling configuration of the render scene
+ * @zh 渲染场景的八叉树剔除配置
+ */
export class Octree {
/**
- * @en enable octree
+ * @en Whether octree culling is enabled in the render scene
* @zh 是否开启八叉树加速剔除
*/
set enabled (val: boolean) {
@@ -39,7 +43,7 @@ export class Octree {
}
/**
- * @en min pos of scene bounding box
+ * @en Minimum position of the scene's bounding box
* @zh 场景包围盒最小值
*/
get minPos (): Vec3 {
@@ -50,7 +54,7 @@ export class Octree {
}
/**
- * @en max pos of scene bounding box
+ * @en Maximum position of the scene's bounding box
* @zh 场景包围盒最大值
*/
get maxPos (): Vec3 {
@@ -61,7 +65,7 @@ export class Octree {
}
/**
- * @en depth of octree
+ * @en The depth of the octree
* @zh 八叉树深度
*/
get depth (): number {
diff --git a/cocos/core/renderer/scene/shadows.ts b/cocos/core/renderer/scene/shadows.ts
index 9b161cddac..77df409c7e 100644
--- a/cocos/core/renderer/scene/shadows.ts
+++ b/cocos/core/renderer/scene/shadows.ts
@@ -122,6 +122,10 @@ export const PCFType = Enum({
const SHADOW_TYPE_NONE = ShadowType.ShadowMap + 1;
+/**
+ * @en The global shadow's configuration of the render scene
+ * @zh 渲染场景的全局阴影配置
+ */
export class Shadows {
/**
* @en MAX_FAR. This is shadow camera max far.
@@ -218,6 +222,10 @@ export class Shadows {
this._shadowMapDirty = val;
}
+ /**
+ * @en The transform matrix of the light source
+ * @zh 光源的变换矩阵
+ */
public get matLight () {
return this._matLight;
}
@@ -243,9 +251,28 @@ export class Shadows {
public maxReceived = 4;
// local set
+ /**
+ * @internal
+ */
+ /**
+ * @en The far clip plane of the shadow camera
+ * @zh 阴影相机的远裁剪平面
+ */
public shadowCameraFar = 0;
+ /**
+ * @en Shadow camera's view matrix
+ * @zh 阴影相机的视图矩阵
+ */
public matShadowView = new Mat4();
+ /**
+ * @en Shadow camera's projection matrix
+ * @zh 阴影相机的投影矩阵
+ */
public matShadowProj = new Mat4();
+ /**
+ * @en Shadow camera's view projection matrix
+ * @zh 阴影相机的视图投影矩阵
+ */
public matShadowViewProj = new Mat4();
protected _matLight = new Mat4();
protected _material: Material | null = null;
@@ -260,6 +287,12 @@ export class Shadows {
protected _size: Vec2 = new Vec2(512, 512);
protected _shadowMapDirty = false;
+ /**
+ * @en Get the shader for the planar shadow with macro patches
+ * @zh 通过指定宏获取平面阴影的 Shader 对象
+ * @param patches The macro patches for the shader
+ * @returns The shader for the planar shadow
+ */
public getPlanarShader (patches: IMacroPatch[] | null): Shader | null {
if (!this._material) {
this._material = new Material();
@@ -269,6 +302,12 @@ export class Shadows {
return this._material.passes[0].getShaderVariant(patches);
}
+ /**
+ * @en Get the shader which support instancing draw for the planar shadow with macro patches
+ * @zh 通过指定宏获取支持实例化渲染的平面阴影的 Shader 对象
+ * @param patches The macro patches for the shader
+ * @returns The shader for the planar shadow
+ */
public getPlanarInstanceShader (patches: IMacroPatch[] | null): Shader | null {
if (!this._instancingMaterial) {
this._instancingMaterial = new Material();
diff --git a/cocos/core/renderer/scene/skybox.ts b/cocos/core/renderer/scene/skybox.ts
index de273f99fe..c467cfaab0 100644
--- a/cocos/core/renderer/scene/skybox.ts
+++ b/cocos/core/renderer/scene/skybox.ts
@@ -67,7 +67,16 @@ export const EnvironmentLightingType = Enum({
DIFFUSEMAP_WITH_REFLECTION: 2,
});
+/**
+ * @en The skybox configuration of the render scene,
+ * currently some rendering options like hdr and ibl lighting configuration is also here.
+ * @zh 渲染场景的天空盒配置,目前一些渲染配置,比如 HDR 模式和环境光照配置也在 Skybox 中。
+ */
export class Skybox {
+ /**
+ * @en The Model object of the skybox
+ * @zh 天空盒的 Model 对象
+ */
get model (): Model | null {
return this._model;
}
@@ -84,8 +93,9 @@ export class Skybox {
this._enabled = val;
if (val) this.activate(); else this._updatePipeline();
}
+
/**
- * @en HDR
+ * @en Whether HDR mode is enabled
* @zh 是否启用HDR?
*/
get useHDR (): boolean {
@@ -98,7 +108,7 @@ export class Skybox {
}
/**
- * @en Whether use IBL
+ * @en Whether use image based lighting for PBR materials
* @zh 是否启用IBL?
*/
get useIBL (): boolean {
@@ -200,6 +210,7 @@ export class Skybox {
protected _useDiffuseMap = false;
protected _editableMaterial: MaterialInstance | null = null;
+
public initialize (skyboxInfo: SkyboxInfo) {
this._enabled = skyboxInfo.enabled;
this._useIBL = skyboxInfo.useIBL;
@@ -207,24 +218,26 @@ export class Skybox {
this._useHDR = skyboxInfo.useHDR;
}
+ /**
+ * @en Set the environment maps for HDR and LDR mode
+ * @zh 为 HDR 和 LDR 模式设置环境贴图
+ * @param envmapHDR @en Environment map for HDR mode @zh HDR 模式下的环境贴图
+ * @param envmapLDR @en Environment map for LDR mode @zh LDR 模式下的环境贴图
+ */
public setEnvMaps (envmapHDR: TextureCube | null, envmapLDR: TextureCube | null) {
this._envmapHDR = envmapHDR;
this._envmapLDR = envmapLDR;
- const root = legacyCC.director.root as Root;
- const isHDR = root.pipeline.pipelineSceneData.isHDR;
- if (isHDR) {
- if (envmapHDR) {
- root.pipeline.pipelineSceneData.ambient.mipmapCount = envmapHDR.mipmapLevel;
- }
- } else if (envmapLDR) {
- root.pipeline.pipelineSceneData.ambient.mipmapCount = envmapLDR.mipmapLevel;
- }
-
this._updateGlobalBinding();
this._updatePipeline();
}
+ /**
+ * @en Set the diffuse maps
+ * @zh 设置环境光漫反射贴图
+ * @param diffuseMapHDR @en Diffuse map for HDR mode @zh HDR 模式下的漫反射贴图
+ * @param diffuseMapLDR @en Diffuse map for LDR mode @zh LDR 模式下的漫反射贴图
+ */
public setDiffuseMaps (diffuseMapHDR: TextureCube | null, diffuseMapLDR: TextureCube | null) {
this._diffuseMapHDR = diffuseMapHDR;
this._diffuseMapLDR = diffuseMapLDR;
diff --git a/cocos/core/renderer/scene/sphere-light.ts b/cocos/core/renderer/scene/sphere-light.ts
index 26f6230eed..f87ce08692 100644
--- a/cocos/core/renderer/scene/sphere-light.ts
+++ b/cocos/core/renderer/scene/sphere-light.ts
@@ -28,11 +28,24 @@ import { legacyCC } from '../../global-exports';
import { Vec3 } from '../../math';
import { Light, LightType, nt2lm } from './light';
+/**
+ * @en The sphere light representation in the render scene, it will light up a spherical area in the scene.
+ * It doesn't support shadow generation currently.
+ * @zh 渲染场景中的球面光抽象,可以照亮场景中的一个球形区域,目前还不支持生成阴影。
+ */
export class SphereLight extends Light {
+ /**
+ * @en The world position of the light source
+ * @zh 光源中心点的世界坐标
+ */
get position () {
return this._pos;
}
+ /**
+ * @en The size of the light source
+ * @zh 球面光源的尺寸
+ */
set size (size: number) {
this._size = size;
}
@@ -41,6 +54,10 @@ export class SphereLight extends Light {
return this._size;
}
+ /**
+ * @en The lighting range of the light source
+ * @zh 球面光源的光照范围
+ */
set range (range: number) {
this._range = range;
@@ -51,6 +68,10 @@ export class SphereLight extends Light {
return this._range;
}
+ /**
+ * @en The luminance of the light source
+ * @zh 光源的亮度
+ */
get luminance (): number {
const isHDR = (legacyCC.director.root).pipeline.pipelineSceneData.isHDR;
if (isHDR) {
@@ -68,6 +89,10 @@ export class SphereLight extends Light {
}
}
+ /**
+ * @en The luminance of the light source in HDR mode
+ * @zh HDR 模式下光源的亮度
+ */
get luminanceHDR () {
return this._luminanceHDR;
}
@@ -75,10 +100,18 @@ export class SphereLight extends Light {
this._luminanceHDR = value;
}
+ /**
+ * @en The luminance of the light source in LDR mode
+ * @zh LDR 模式下光源的亮度
+ */
set luminanceLDR (value: number) {
this._luminanceLDR = value;
}
+ /**
+ * @en The AABB bounding box of the lighting area
+ * @zh 受光源影响范围的 AABB 包围盒
+ */
get aabb () {
return this._aabb;
}
@@ -108,6 +141,10 @@ export class SphereLight extends Light {
this.luminanceLDR = 1.0;
}
+ /**
+ * @en Update the lighting area
+ * @zh 更新光源影响范围
+ */
public update () {
if (this._node && (this._node.hasChangedFlags || this._needUpdate)) {
this._node.getWorldPosition(this._pos);
diff --git a/cocos/core/renderer/scene/spot-light.ts b/cocos/core/renderer/scene/spot-light.ts
index 1ff2100037..ca1fbe3501 100644
--- a/cocos/core/renderer/scene/spot-light.ts
+++ b/cocos/core/renderer/scene/spot-light.ts
@@ -36,15 +36,15 @@ const _matProj = new Mat4();
const _matViewProj = new Mat4();
const _matViewProjInv = new Mat4();
+/**
+ * @en The spot light representation in the render scene, it will light up a cone area in the direction of the light, it supports shadow generation.
+ * @zh 渲染场景中的聚光灯抽象,可以照亮光源方向上的一个锥形区域,支持生成阴影。
+ */
export class SpotLight extends Light {
protected _dir: Vec3 = new Vec3(1.0, -1.0, -1.0);
protected _range = 5.0;
- /**
- * @en Cached uniform variables.
- * @zh 缓存下来的 uniform 变量。
- */
protected _spotAngle: number = Math.cos(Math.PI / 6);
protected _pos: Vec3;
@@ -67,18 +67,24 @@ export class SpotLight extends Light {
protected _luminanceLDR = 0;
- protected _aspect = 0;
-
// Shadow map properties
protected _shadowEnabled = false;
protected _shadowPcf = PCFType.HARD;
protected _shadowBias = 0.00001;
protected _shadowNormalBias = 0.0;
+ /**
+ * @en The world position of the light source
+ * @zh 光源的世界坐标
+ */
get position () {
return this._pos;
}
+ /**
+ * @en The size of the spot light source
+ * @zh 聚光灯的光源尺寸
+ */
set size (size: number) {
this._size = size;
}
@@ -87,6 +93,10 @@ export class SpotLight extends Light {
return this._size;
}
+ /**
+ * @en The lighting range of the spot light
+ * @zh 聚光灯的光照范围
+ */
set range (range: number) {
this._range = range;
@@ -97,6 +107,10 @@ export class SpotLight extends Light {
return this._range;
}
+ /**
+ * @en The luminance of the light source
+ * @zh 光源的亮度
+ */
get luminance (): number {
const isHDR = (legacyCC.director.root).pipeline.pipelineSceneData.isHDR;
if (isHDR) {
@@ -114,6 +128,10 @@ export class SpotLight extends Light {
}
}
+ /**
+ * @en The luminance of the light source in HDR mode
+ * @zh HDR 模式下光源的亮度
+ */
get luminanceHDR () {
return this._luminanceHDR;
}
@@ -121,6 +139,10 @@ export class SpotLight extends Light {
this._luminanceHDR = value;
}
+ /**
+ * @en The luminance of the light source in LDR mode
+ * @zh LDR 模式下光源的亮度
+ */
get luminanceLDR () {
return this._luminanceLDR;
}
@@ -128,16 +150,25 @@ export class SpotLight extends Light {
this._luminanceLDR = value;
}
+ /**
+ * @en The direction of the spot light
+ * @zh 聚光灯的照明方向
+ */
get direction (): Vec3 {
return this._dir;
}
- // 获取 cache 下来的 cos(angle / 2) 属性值,uniform 里需要
+ /**
+ * @en The setter will take the value as the cone angle,
+ * but the getter will give you the cosine value of the half cone angle: `cos(angle / 2)`.
+ * As the in-consistence is not acceptable for a property, please do not use it.
+ * @zh 赋值时这个属性会把输入值当做聚光灯光照区域的锥角,但是获取时返回的是 cos(angle / 2)。
+ * 由于这种不一致性,请不要使用这个属性。
+ * @internal
+ */
get spotAngle () {
return this._spotAngle;
}
-
- // 设置用户指定的全角弧度,同时计算 cache 下来的 cos(angle / 2) 属性值,uniform 里需要。
set spotAngle (val: number) {
this._angle = val;
this._spotAngle = Math.cos(val * 0.5);
@@ -145,30 +176,28 @@ export class SpotLight extends Light {
this._needUpdate = true;
}
+ /**
+ * @en The cone angle of the lighting area
+ * @zh 聚光灯锥角
+ */
get angle () {
return this._angle;
}
- set aspect (val: number) {
- this._aspect = val;
-
- this._needUpdate = true;
- }
-
- get aspect (): number {
- return this._aspect;
- }
-
get aabb () {
return this._aabb;
}
+ /**
+ * @en The frustum of the lighting area
+ * @zh 受光源影响范围的截椎体
+ */
get frustum () {
return this._frustum;
}
/**
- * @en Whether activate shadow
+ * @en Whether shadow casting is enabled
* @zh 是否启用阴影?
*/
get shadowEnabled () {
@@ -179,9 +208,9 @@ export class SpotLight extends Light {
}
/**
- * @en get or set shadow pcf.
- * @zh 获取或者设置阴影pcf等级。
- */
+ * @en The pcf level of the shadow generation.
+ * @zh 获取或者设置阴影 pcf 等级。
+ */
get shadowPcf () {
return this._shadowPcf;
}
@@ -190,9 +219,9 @@ export class SpotLight extends Light {
}
/**
- * @en get or set shadow map sampler offset
- * @zh 获取或者设置阴影纹理偏移值
- */
+ * @en The depth offset of shadow to avoid moire pattern artifacts
+ * @zh 阴影的深度偏移, 可以减弱跨像素导致的条纹状失真
+ */
get shadowBias () {
return this._shadowBias;
}
@@ -201,7 +230,7 @@ export class SpotLight extends Light {
}
/**
- * @en get or set normal bias.
+ * @en The normal bias of the shadow map.
* @zh 设置或者获取法线偏移。
*/
get shadowNormalBias () {
@@ -224,7 +253,6 @@ export class SpotLight extends Light {
const size = 0.15;
this.size = size;
- this.aspect = 1.0;
this.luminanceHDR = 1700 / nt2lm(size);
this.luminanceLDR = 1.0;
this.range = Math.cos(Math.PI / 6);
diff --git a/cocos/core/renderer/scene/submodel.ts b/cocos/core/renderer/scene/submodel.ts
index 3fec87adec..42fcaab37c 100644
--- a/cocos/core/renderer/scene/submodel.ts
+++ b/cocos/core/renderer/scene/submodel.ts
@@ -37,12 +37,10 @@ const _dsInfo = new DescriptorSetInfo(null!);
const MAX_PASS_COUNT = 8;
/**
- * @en A representation of a sub model
- * A model can contain multiple sub-models, each sub-model corresponds to a material and corresponds to a sub-mesh resource.
- * Each submodel is a drawing unit, and in non-batch mode, a submodel makes one draw call.
- * @zh 代表一个子模型
- * 一个模型可以包含多个子模型,每个子模型对应一个材质,并对应一个子网格资源。
- * 每个子模型是一个绘制单位,非合批模式下,一个子模型进行一次绘制调用。
+ * @en A sub part of the model, it describes how to render a specific sub mesh.
+ * It contains geometry information in [[RenderingSubMesh]] and all sort of rendering configuration like shaders, macro patches, passes etc.
+ * @zh 组成模型对象的子模型,它用来描述如何渲染模型的一个子网格。
+ * 它包含 [[RenderingSubMesh]] 代表的几何网格信息和所有渲染需要的数据,比如着色器程序,着色器宏定义,渲染 pass,等。
*/
export class SubModel {
protected _device: Device | null = null;
@@ -66,6 +64,10 @@ export class SubModel {
* 子模型的 passes
* @param passes @en The passes @zh 设置的 passes
*/
+ /**
+ * @en Render passes for the sub-model
+ * @zh 子模型的渲染 pass
+ */
set passes (passes) {
const passLengh = passes.length;
if (passLengh > MAX_PASS_COUNT) {
@@ -91,22 +93,16 @@ export class SubModel {
}
/**
- * @en
- * sub model's shaders
- * @zh
- * 子模型的着色器
- * @returns @en The shaders @zh 返回的着色器
+ * @en Shaders for the sub-model, each shader corresponds to one of the [[passes]]
+ * @zh 子模型的着色器程序列表,每个着色器程序对应其中一个渲染 [[passes]]
*/
get shaders (): Shader[] {
return this._shaders!;
}
/**
- * @en
- * sub model's sub mesh
- * @zh
- * 子模型的子网格资源
- * @param subMesh @en The sub mesh @zh 设置的子网格
+ * @en The rendering sub mesh for the sub-model, each sub-model can only have one sub mesh.
+ * @zh 用于渲染的子网格对象,每个子模型只能包含一个子网格。
*/
set subMesh (subMesh) {
this._inputAssembler!.destroy();
@@ -120,11 +116,8 @@ export class SubModel {
}
/**
- * @en
- * sub model's rendering proirity
- * @zh
- * 子模型的渲染优先级
- * @param val @en The rendering priority @zh 设置的渲染优先级
+ * @en The rendering priority of the sub-model
+ * @zh 子模型的渲染优先级
*/
set priority (val) {
this._priority = val;
@@ -135,66 +128,48 @@ export class SubModel {
}
/**
- * @en
- * sub model's input assembler
- * @zh
- * 子模型的输入汇集器
- * @returns @en The input assembler @zh 返回的输入汇集器
+ * @en The low level input assembler which contains geometry data
+ * @zh 底层渲染用的输入汇集器,包含几何信息
*/
get inputAssembler (): InputAssembler {
return this._inputAssembler!;
}
/**
- * @en
- * sub model's descriptor set
- * @zh
- * 子模型的描述符集合
- * @returns @en The descriptor set @zh 返回的描述符集合
+ * @en The descriptor set used for sub-model rendering
+ * @zh 底层渲染子模型用的描述符集组
*/
get descriptorSet (): DescriptorSet {
return this._descriptorSet!;
}
/**
- * @en
- * sub model's world bound descriptor set
- * @zh
- * 子模型的世界包围盒描述符集合
- * @returns @en The world bound descriptor set @zh 返回的世界包围盒描述符集合
+ * @en The descriptor set for world bound
+ * @zh 用于存储世界包围盒的描述符集组
*/
get worldBoundDescriptorSet (): DescriptorSet {
return this._worldBoundDescriptorSet!;
}
/**
- * @en
- * shader's macro
- * @zh
- * 着色器的宏定义
- * @returns @en The shader's macro @zh 返回的着色器宏定义
+ * @en The macro patches for the shaders
+ * @zh 着色器程序所用的宏定义组合
*/
get patches (): IMacroPatch[] | null {
return this._patches;
}
/**
- * @en
- * planar instance's shader
- * @zh
- * 平面投影实例化的着色器
- * @returns @en The planar instance's shader @zh 返回的平面投影实例化着色器
+ * @en The shader for rendering the planar shadow, instancing draw version.
+ * @zh 用于渲染平面阴影的着色器,适用于实例化渲染(instancing draw)
*/
get planarInstanceShader (): Shader | null {
return this._planarInstanceShader;
}
/**
- * @en
- * planar's shader
- * @zh
- * 平面投影的着色器
- * @returns @en The planar's shader @zh 返回的平面投影着色器
+ * @en The shader for rendering the planar shadow.
+ * @zh 用于渲染平面阴影的着色器。
*/
get planarShader (): Shader | null {
return this._planarShader;
@@ -288,6 +263,9 @@ export class SubModel {
* @zh
* 平面阴影实例着色器初始化
*/
+ /**
+ * @internal
+ */
public initPlanarShadowInstanceShader () {
const pipeline = (legacyCC.director.root as Root).pipeline;
const shadowInfo = pipeline.pipelineSceneData.shadows;
@@ -339,10 +317,8 @@ export class SubModel {
}
/**
- * @en
- * pipeline state changed callback
- * @zh
- * 管线状态改变后的回调
+ * @en Pipeline changed callback
+ * @zh 管线更新回调
*/
public onPipelineStateChanged (): void {
const passes = this._passes;
@@ -358,12 +334,9 @@ export class SubModel {
this._flushPassInfo();
}
- /**
- * @en
- * macro changed callback
- * @zh
- * 着色器宏设置改变后的回调
- * @param patches @en The shader's macro @zh 着色器的宏定义
+ /**
+ * @en Shader macro changed callback
+ * @zh Shader 宏更新回调
*/
public onMacroPatchesStateChanged (patches: IMacroPatch[] | null): void {
this._patches = patches;
diff --git a/cocos/core/root.ts b/cocos/core/root.ts
index 9b3c654eb8..c84464b462 100644
--- a/cocos/core/root.ts
+++ b/cocos/core/root.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module core
- */
-
import { builtinResMgr } from './builtin';
import { Pool } from './memop';
import { RenderPipeline, createDefaultPipeline, DeferredPipeline } from './pipeline';
diff --git a/cocos/core/scene-graph/base-node-dev.ts b/cocos/core/scene-graph/base-node-dev.ts
index bccb8ed588..0377b84386 100644
--- a/cocos/core/scene-graph/base-node-dev.ts
+++ b/cocos/core/scene-graph/base-node-dev.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { EDITOR, DEV, TEST } from 'internal:constants';
import { CCObject } from '../data/object';
import * as js from '../utils/js';
diff --git a/cocos/core/scene-graph/base-node.ts b/cocos/core/scene-graph/base-node.ts
index 99f98e79c4..e9b5659fb7 100644
--- a/cocos/core/scene-graph/base-node.ts
+++ b/cocos/core/scene-graph/base-node.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module scene-graph
- */
-
import { ccclass, editable, serializable } from 'cc.decorator';
import { DEV, DEBUG, EDITOR } from 'internal:constants';
import { Component } from '../components/component';
@@ -219,14 +214,24 @@ export class BaseNode extends CCObject implements ISchedulable {
return this._eventProcessor;
}
+ /**
+ * @internal
+ */
protected static idGenerator = idGenerator;
- // For walk
+ /**
+ * for walk
+ * @internal
+ */
protected static _stacks: Array> = [[]];
+ /**
+ * @internal
+ */
protected static _stackId = 0;
/**
* Call `_updateScene` of specified node.
+ * @internal
* @param node The node.
*/
protected static _setScene (node: BaseNode) {
@@ -332,7 +337,10 @@ export class BaseNode extends CCObject implements ISchedulable {
protected _siblingIndex = 0;
/**
+ * @en
* record scene's id when set this node as persist node
+ * @zh
+ * 当设置节点为常驻节点时记录场景的 id
* @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
*/
public _originalSceneId = '';
@@ -340,6 +348,7 @@ export class BaseNode extends CCObject implements ISchedulable {
/**
* Set `_scene` field of this node.
* The derived `Scene` overrides this method to behavior differently.
+ * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
*/
protected _updateScene () {
if (this._parent == null) {
@@ -1403,7 +1412,10 @@ export class BaseNode extends CCObject implements ISchedulable {
protected _onSiblingIndexChanged? (siblingIndex: number): void;
/**
+ * @en
* Ensures that this node has already had the specified component(s). If not, this method throws.
+ * @zh
+ * 检查节点已经包含对应的组件,如果没有,则抛出异常
* @param constructor Constructor of the component.
* @throws If one or more component of same type have been existed in this node.
*/
diff --git a/cocos/core/scene-graph/component-scheduler.ts b/cocos/core/scene-graph/component-scheduler.ts
index 139c47cbf1..88b74e7cca 100644
--- a/cocos/core/scene-graph/component-scheduler.ts
+++ b/cocos/core/scene-graph/component-scheduler.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module scene-graph
- */
-
import { EDITOR, SUPPORT_JIT, DEV, TEST } from 'internal:constants';
import { CCObject } from '../data/object';
import { MutableForwardIterator } from '../utils/array';
diff --git a/cocos/core/scene-graph/find.ts b/cocos/core/scene-graph/find.ts
index f24a598568..9d5f244fc1 100644
--- a/cocos/core/scene-graph/find.ts
+++ b/cocos/core/scene-graph/find.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module scene-graph
- */
-
import { DEV } from 'internal:constants';
import { warnID } from '../platform/debug';
import { Node } from './node';
diff --git a/cocos/core/scene-graph/index.ts b/cocos/core/scene-graph/index.ts
index a85d2b48f7..21c82d7227 100644
--- a/cocos/core/scene-graph/index.ts
+++ b/cocos/core/scene-graph/index.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module scene-graph
- */
-
import './node-event-processor';
import './deprecated';
@@ -36,5 +31,6 @@ export { Node } from './node';
export { Scene } from './scene';
export { Layers } from './layers';
export { find } from './find';
+export * from './scene-globals';
export * from './deprecated';
export { default as NodeActivator } from './node-activator';
diff --git a/cocos/core/scene-graph/layers.ts b/cocos/core/scene-graph/layers.ts
index b794c883af..570894ecb0 100644
--- a/cocos/core/scene-graph/layers.ts
+++ b/cocos/core/scene-graph/layers.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module scene-graph
- */
-
import { BitMask, Enum } from '../value-types';
import { legacyCC } from '../global-exports';
import { log2 } from '../math/bits';
diff --git a/cocos/core/scene-graph/node-activator.ts b/cocos/core/scene-graph/node-activator.ts
index 3bcbb1f4a2..45ac0d4fe3 100644
--- a/cocos/core/scene-graph/node-activator.ts
+++ b/cocos/core/scene-graph/node-activator.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module scene-graph
- */
-
import { EDITOR, DEV, TEST, SUPPORT_JIT, DEBUG } from 'internal:constants';
import { CCObject, isValid } from '../data/object';
import { array, Pool } from '../utils/js';
diff --git a/cocos/core/scene-graph/node-enum.ts b/cocos/core/scene-graph/node-enum.ts
index 8d365f6c0e..b087a9c002 100644
--- a/cocos/core/scene-graph/node-enum.ts
+++ b/cocos/core/scene-graph/node-enum.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module scene-graph
- */
-
import { legacyCC } from '../global-exports';
/**
diff --git a/cocos/core/scene-graph/node-event-processor.ts b/cocos/core/scene-graph/node-event-processor.ts
index b6bdb106e0..89b72b5622 100644
--- a/cocos/core/scene-graph/node-event-processor.ts
+++ b/cocos/core/scene-graph/node-event-processor.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { CallbacksInvoker } from '../event/callbacks-invoker';
import { Event, EventMouse, EventTouch } from '../../input/types';
import { Vec2 } from '../math/vec2';
@@ -37,7 +35,7 @@ import { InputEventType, SystemEventTypeUnion } from '../../input/types/event-en
const _cachedArray = new Array(16);
let _currentHovered: BaseNode | null = null;
-let pos = new Vec2();
+const pos = new Vec2();
const _touchEvents = [
NodeEventType.TOUCH_START,
@@ -67,8 +65,8 @@ export enum DispatcherEventType {
}
/**
- * @zh
- * 节点事件类。
+ * @en The event processor for Node
+ * @zh 节点事件类。
*/
export class NodeEventProcessor {
public static _maskComp: Constructor | null = null;
diff --git a/cocos/core/scene-graph/node-event.ts b/cocos/core/scene-graph/node-event.ts
index 5f86ba748d..dd08cd665c 100644
--- a/cocos/core/scene-graph/node-event.ts
+++ b/cocos/core/scene-graph/node-event.ts
@@ -115,10 +115,10 @@ export enum NodeEventType {
/**
* @en
- * The event type for position, rotation, scale changed.Use the type parameter as [[Node.TransformBit]] to check which part is changed
+ * The event type for position, rotation, scale changed.Use the type parameter as `Node.TransformBit` to check which part is changed
*
* @zh
- * 节点改变位置、旋转或缩放事件。如果具体需要判断是哪一个事件,可通过判断回调的第一个参数类型是 [[Node.TransformBit]] 中的哪一个来获取
+ * 节点改变位置、旋转或缩放事件。如果具体需要判断是哪一个事件,可通过判断回调的第一个参数类型是 `Node.TransformBit` 中的哪一个来获取
* @example
* ```
* this.node.on(Node.EventType.TRANSFORM_CHANGED, (type)=>{
diff --git a/cocos/core/scene-graph/node-ui-properties.ts b/cocos/core/scene-graph/node-ui-properties.ts
index 10847815c5..abddab4560 100644
--- a/cocos/core/scene-graph/node-ui-properties.ts
+++ b/cocos/core/scene-graph/node-ui-properties.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module scene-graph
- */
-
import { JSB } from 'internal:constants';
import { UIRenderer } from '../../2d/framework/ui-renderer';
import { UITransform } from '../../2d/framework/ui-transform';
diff --git a/cocos/core/scene-graph/node.ts b/cocos/core/scene-graph/node.ts
index 6c8cee215d..05efdb72a2 100644
--- a/cocos/core/scene-graph/node.ts
+++ b/cocos/core/scene-graph/node.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module scene-graph
- */
-
import {
ccclass, editable, serializable, type,
} from 'cc.decorator';
@@ -441,6 +436,9 @@ export class Node extends BaseNode implements CustomSerializable {
this._hasChangedFlagsChunk[this._hasChangedFlagsOffset] = val;
}
+ /**
+ * @internal
+ */
public [serializeTag] (serializationOutput: SerializationOutput, context: SerializationContext) {
if (!EDITOR) {
serializationOutput.writeThis();
diff --git a/cocos/core/scene-graph/scene-globals.ts b/cocos/core/scene-graph/scene-globals.ts
index 01a0e9de09..4844eac6db 100644
--- a/cocos/core/scene-graph/scene-globals.ts
+++ b/cocos/core/scene-graph/scene-globals.ts
@@ -19,11 +19,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module scene-graph
- */
-
import { ccclass, visible, type, displayOrder, readOnly, slide, range, rangeStep, editable, serializable, rangeMin, tooltip, formerlySerializedAs, displayName } from 'cc.decorator';
import { BAIDU } from 'internal:constants';
import { TextureCube } from '../assets/texture-cube';
diff --git a/cocos/core/scene-graph/scene.ts b/cocos/core/scene-graph/scene.ts
index a2947551c8..eeff271e40 100644
--- a/cocos/core/scene-graph/scene.ts
+++ b/cocos/core/scene-graph/scene.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module scene-graph
- */
-
import { ccclass, serializable, editable } from 'cc.decorator';
import { EDITOR, TEST } from 'internal:constants';
import { CCObject } from '../data/object';
@@ -170,92 +165,146 @@ export class Scene extends BaseNode {
// transform helpers
/**
+ * @en
* Refer to [[Node.getPosition]]
+ * @zh
+ * 参考 [[Node.getPosition]]
*/
public getPosition (out?: Vec3): Vec3 { return Vec3.copy(out || new Vec3(), Vec3.ZERO); }
/**
+ * @en
* Refer to [[Node.getRotation]]
+ * @zh
+ * 参考 [[Node.getRotation]]
*/
public getRotation (out?: Quat): Quat { return Quat.copy(out || new Quat(), Quat.IDENTITY); }
/**
+ * @en
* Refer to [[Node.getScale]]
+ * @zh
+ * 参考 [[Node.getScale]]
*/
public getScale (out?: Vec3): Vec3 { return Vec3.copy(out || new Vec3(), Vec3.ONE); }
/**
+ * @en
* Refer to [[Node.getWorldPosition]]
+ * @zh
+ * 参考 [[Node.getWorldPosition]]
*/
public getWorldPosition (out?: Vec3) { return Vec3.copy(out || new Vec3(), Vec3.ZERO); }
/**
+ * @en
* Refer to [[Node.getWorldRotation]]
+ * @zh
+ * 参考 [[Node.getWorldRotation]]
*/
public getWorldRotation (out?: Quat) { return Quat.copy(out || new Quat(), Quat.IDENTITY); }
/**
+ * @en
* Refer to [[Node.getWorldScale]]
+ * @zh
+ * 参考 [[Node.getWorldScale]]
*/
public getWorldScale (out?: Vec3) { return Vec3.copy(out || new Vec3(), Vec3.ONE); }
/**
+ * @en
* Refer to [[Node.getWorldMatrix]]
+ * @zh
+ * 参考 [[Node.getWorldMatrix]]
*/
public getWorldMatrix (out?: Mat4): Mat4 { return Mat4.copy(out || new Mat4(), Mat4.IDENTITY); }
/**
+ * @en
* Refer to [[Node.getWorldRS]]
+ * @zh
+ * 参考 [[Node.getWorldRS]]
*/
public getWorldRS (out?: Mat4): Mat4 { return Mat4.copy(out || new Mat4(), Mat4.IDENTITY); }
/**
+ * @en
* Refer to [[Node.getWorldRT]]
+ * @zh
+ * 参考 [[Node.getWorldRT]]
*/
public getWorldRT (out?: Mat4): Mat4 { return Mat4.copy(out || new Mat4(), Mat4.IDENTITY); }
/**
+ * @en
* Refer to [[Node.position]]
+ * @zh
+ * 参考 [[Node.position]]
*/
public get position (): Readonly { return Vec3.ZERO; }
/**
+ * @en
* Refer to [[Node.worldPosition]]
+ * @zh
+ * 参考 [[Node.worldPosition]]
*/
public get worldPosition (): Readonly { return Vec3.ZERO; }
/**
+ * @en
* Refer to [[Node.rotation]]
+ * @zh
+ * 参考 [[Node.rotation]]
*/
public get rotation (): Readonly { return Quat.IDENTITY; }
/**
+ * @en
* Refer to [[Node.worldRotation]]
+ * @zh
+ * 参考 [[Node.worldRotation]]
*/
public get worldRotation (): Readonly { return Quat.IDENTITY; }
/**
+ * @en
* Refer to [[Node.scale]]
+ * @zh
+ * 参考 [[Node.scale]]
*/
public get scale (): Readonly { return Vec3.ONE; }
/**
+ * @en
* Refer to [[Node.worldScale]]
+ * @zh
+ * 参考 [[Node.worldScale]]
*/
public get worldScale (): Readonly { return Vec3.ONE; }
/**
+ * @en
* Refer to [[Node.eulerAngles]]
+ * @zh
+ * 参考 [[Node.eulerAngles]]
*/
public get eulerAngles (): Readonly { return Vec3.ZERO; }
/**
+ * @en
* Refer to [[Node.worldMatrix]]
+ * @zh
+ * 参考 [[Node.worldMatrix]]
*/
public get worldMatrix (): Readonly { return Mat4.IDENTITY; }
/**
+ * @en
* Refer to [[Node.updateWorldTransform]]
+ * @zh
+ * 参考 [[Node.updateWorldTransform]]
*/
public updateWorldTransform () {}
diff --git a/cocos/core/scheduler.ts b/cocos/core/scheduler.ts
index e6187f1f53..c14fc4bdc2 100644
--- a/cocos/core/scheduler.ts
+++ b/cocos/core/scheduler.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module core
- */
-
import IdGenerator from './utils/id-generator';
import { createMap } from './utils/js';
import System from './components/system';
diff --git a/cocos/core/splash-screen.ts b/cocos/core/splash-screen.ts
index ca8c264c28..116892a4d5 100644
--- a/cocos/core/splash-screen.ts
+++ b/cocos/core/splash-screen.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import * as easing from './easing/easing';
import { Material } from './assets/material';
import { clamp01 } from './math/utils';
diff --git a/cocos/core/utils/array.ts b/cocos/core/utils/array.ts
index a1b51e4f2e..2c597e8bed 100644
--- a/cocos/core/utils/array.ts
+++ b/cocos/core/utils/array.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module core
- */
-
import { logID } from '../platform/debug';
export { default as MutableForwardIterator } from './mutable-forward-iterator';
diff --git a/cocos/core/utils/coordinates-converts-utils.ts b/cocos/core/utils/coordinates-converts-utils.ts
index 6783091989..3e44ab9722 100644
--- a/cocos/core/utils/coordinates-converts-utils.ts
+++ b/cocos/core/utils/coordinates-converts-utils.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module core
- */
-
import { Camera } from '../components/camera-component';
import { Vec3 } from '../math';
import { Node } from '../scene-graph';
@@ -41,11 +36,11 @@ const _vec3 = new Vec3();
* Conversion of non-UI nodes to UI Node (Local) Space coordinate system.
* @zh
* 非 UI 节点转换到 UI 节点(局部) 空间坐标系。
- * @deprecated 将在 1.2 移除,请使用 Camera 的 `convertToUINode`。
- * @param mainCamera 主相机。
- * @param wpos 世界空间位置。
- * @param uiNode UI节点。
- * @param out 返回局部坐标。
+ * @deprecated since Cocos Creator 3D v1.2, please use [[Camera.convertToUINode]]
+ * @param mainCamera @en The main camera @zh 主相机
+ * @param wpos @en The world space location. @zh 世界空间位置。
+ * @param uiNode @en The UI node. @zh UI 节点。
+ * @param out @en The output local position in UI @zh 返回 UI 节点局部坐标。
*/
export function WorldNode3DToLocalNodeUI (mainCamera: Camera, wpos: Vec3, uiNode: Node, out?: Vec3) {
if (!out) {
@@ -62,11 +57,11 @@ export function WorldNode3DToLocalNodeUI (mainCamera: Camera, wpos: Vec3, uiNode
* @en
* Conversion of non-UI nodes to UI Node (World) Space coordinate system.
* @zh
- * 非 UI 节点转换到 UI 节点(世界) 空间坐标系。
- * @deprecated 将在 1.2 移除,请使用 Camera 的 `convertToUINode`。
- * @param mainCamera 主相机。
- * @param wpos 世界空间位置。
- * @param out 返回世界坐标。
+ * 非 UI 节点转换到 UI 节点(世界)空间坐标系。
+ * @deprecated since Cocos Creator 3D v1.2, please use [[Camera.convertToUINode]]
+ * @param mainCamera @en The main camera @zh 主相机
+ * @param wpos @en The world space location. @zh 世界空间位置。
+ * @param out @en The output world position in UI @zh 返回 UI 空间世界坐标。
*/
export function WorldNode3DToWorldNodeUI (mainCamera: Camera, wpos: Vec3, out?: Vec3) {
if (!out) {
@@ -82,7 +77,7 @@ export function WorldNode3DToWorldNodeUI (mainCamera: Camera, wpos: Vec3, out?:
/**
* @en It will be removed in v1.2. Please use [[Camera.convertToUINode]]。
* @zh 将在 v1.2 移除,请使用 Camera 的 `convertToUINode`。
- * @deprecated
+ * @deprecated since Cocos Creator 3D v1.2
*/
const convertUtils = {
WorldNode3DToLocalNodeUI,
@@ -102,6 +97,7 @@ replaceProperty(legacyCC.pipelineUtils, 'cc.pipelineUtils', [
const out = args[3] || _vec3;
camera.convertToUINode(args[1], args[2], out);
out.add(args[2].position);
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
return args[3] || out.clone();
},
},
diff --git a/cocos/core/utils/decode-uuid.ts b/cocos/core/utils/decode-uuid.ts
index 9e3f63282f..4d21bd16da 100644
--- a/cocos/core/utils/decode-uuid.ts
+++ b/cocos/core/utils/decode-uuid.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module core
- */
-
import { TEST } from 'internal:constants';
import { BASE64_VALUES } from './misc';
import { legacyCC } from '../global-exports';
diff --git a/cocos/core/utils/id-generator.ts b/cocos/core/utils/id-generator.ts
index 87c5aa1406..a584ccf9c4 100644
--- a/cocos/core/utils/id-generator.ts
+++ b/cocos/core/utils/id-generator.ts
@@ -23,22 +23,25 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module core
- */
-
import { EDITOR } from 'internal:constants';
const NonUuidMark = '.';
/**
+ * @en
* ID generator for runtime.
+ *
+ * @zh
+ * 运行时 ID 生成器
*/
export default class IDGenerator {
- /*
+ /**
+ * @en
* The global id generator might have a conflict problem once every 365 days,
* if the game runs at 60 FPS and each frame 4760273 counts of new id are requested.
+ *
+ * @zh
+ * 全局的 id 生成器,如果游戏以 60 FPS 运行,每帧获取 4760273 个新 id, 则可能在 365 天后发生冲突。
*/
public static global = new IDGenerator('global');
@@ -47,7 +50,10 @@ export default class IDGenerator {
public prefix: string;
/**
- * @param [category] You can specify a unique category to avoid id collision with other instance of IdGenerator.
+ * @en Construct a new id generator
+ * @zh 构造一个新的 id 生成器
+ *
+ * @param [category] @en You can specify a unique category to avoid id collision with other instance of IdGenerator. @zh 你能指定一个唯一的标识用于避免与其他 id 生成器冲突
*/
constructor (category?: string) {
// Tnit with a random id to emphasize that the returns id should not be stored in persistence data.
diff --git a/cocos/core/utils/js-typed.ts b/cocos/core/utils/js-typed.ts
index 165703c12a..e5b2e8e148 100644
--- a/cocos/core/utils/js-typed.ts
+++ b/cocos/core/utils/js-typed.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module core
- */
-
import { EDITOR, DEV, TEST } from 'internal:constants';
import { warnID, error, errorID } from '../platform/debug';
import IDGenerator from './id-generator';
@@ -39,25 +34,38 @@ const classNameTag = '__classname__';
const classIdTag = '__cid__';
/**
+ * @en
* Check the object whether is number or not
* If a number is created by using 'new Number(10086)', the typeof it will be "object"...
* Then you can use this function if you care about this case.
+ * @zh
+ * 检查对象是否是 number 类型,如果通过 'new Number(10086)' 创建了一个数字,则使用 typeof 判断此数字时,将返回 'object' 类型,此时你可以通过此方法来进行判断
+ * @param object object to be checked
+ * @return whether this object is number or not
*/
export function isNumber (object: any) {
return typeof object === 'number' || object instanceof Number;
}
/**
+ * @en
* Check the object whether is string or not.
* If a string is created by using 'new String("blabla")', the typeof it will be "object"...
* Then you can use this function if you care about this case.
+ * @zh
+ * 检查对象是否是 string 类型,如果通过 'new String("blabla")' 创建了一个字符串,则使用 typeof 判断此字符串时,将返回 'object' 类型,此时你可以通过此方法来进行判断
+ * @param object object to be checked
+ * @return whether this object is string or not
*/
export function isString (object: any) {
return typeof object === 'string' || object instanceof String;
}
/**
+ * @en
* Checks if the object `obj` does not have one or more enumerable properties (including properties from proto chain).
+ * @zh
+ * 检查此对象是否为空对象
* @param obj The object.
* @returns The result. Note that if the `obj` is not of type `'object'`, `true` is returned.
*/
@@ -69,8 +77,12 @@ export function isEmptyObject (obj: any) {
}
/**
+ * @en
* Define value, just help to call Object.defineProperty.
* The configurable will be true.
+ * @zh
+ * 定义值,帮助调用 Object.defineProperty.
+ * 该属性默认可读写
* @param [writable=false]
* @param [enumerable=false]
*/
@@ -91,7 +103,10 @@ export const value = (() => {
})();
/**
+ * @en
* Define get set accessor, just help to call Object.defineProperty(...).
+ * @zh
+ * 定义 get set 访问器,帮助调用 Object.defineProperty()
* @param [setter=null]
* @param [enumerable=false]
* @param [configurable=false]
@@ -118,7 +133,10 @@ export const getset = (() => {
})();
/**
+ * @en
* Define get accessor, just help to call Object.defineProperty(...).
+ * @zh
+ * 定义 get 访问器,帮助调用 Object.defineProperty()
* @param [enumerable=false]
* @param [configurable=false]
*/
@@ -138,7 +156,10 @@ export const get = (() => {
})();
/**
- * Define set accessor, just help to call Object.defineProperty(...).
+ * @en
+ * Define set accessor, just help to call Object.defineProperty(...)
+ * @zh
+ * 定义 set 访问器,帮助调用 Object.defineProperty
* @param [enumerable=false]
* @param [configurable=false]
*/
@@ -186,8 +207,11 @@ export function createMap (forceDictMode?: boolean): any {
}
/**
+ * @en
* Get class name of the object, if object is just a {} (and which class named 'Object'), it will return "".
* (modified from the code from this stackoverflow post)
+ * @zh
+ * 获取对象的类型名称,如果对象是 {} 字面量,将会返回 ""
* @param objOrCtor instance or constructor
*/
export function getClassName (objOrCtor: any): string {
@@ -208,11 +232,11 @@ export function getClassName (objOrCtor: any): string {
if (str.charAt(0) === '[') {
// str is "[object objectClass]"
// eslint-disable-next-line @typescript-eslint/prefer-regexp-exec
- arr = str.match(/\[\w+\s*(\w+)\]/);
+ arr = /\[\w+\s*(\w+)\]/.exec(str);
} else {
// str is function objectClass () {} for IE Firefox
// eslint-disable-next-line @typescript-eslint/prefer-regexp-exec
- arr = str.match(/function\s*(\w+)/);
+ arr = /function\s*(\w+)/.exec(str);
}
if (arr && arr.length === 2) {
retval = arr[1];
@@ -226,7 +250,10 @@ export function getClassName (objOrCtor: any): string {
}
/**
+ * @en
* Defines a polyfill field for obsoleted codes.
+ * @zh
+ * 为废弃代码定义一个填充字段
* @param object - YourObject or YourClass.prototype
* @param obsoleted - "OldParam" or "YourClass.OldParam"
* @param newExpr - "NewParam" or "YourClass.NewParam"
@@ -257,7 +284,10 @@ export function obsolete (object: any, obsoleted: string, newExpr: string, writa
}
/**
+ * @en
* Defines all polyfill fields for obsoleted codes corresponding to the enumerable properties of props.
+ * @zh
+ * 为所有可废弃属性定义填充字段
* @param obj - YourObject or YourClass.prototype
* @param objName - "YourObject" or "YourClass"
* @param props
@@ -274,7 +304,10 @@ const REGEXP_NUM_OR_STR = /(%d)|(%s)/;
const REGEXP_STR = /%s/;
/**
+ * @en
* A string tool to construct a string with format string.
+ * @zh
+ * 通过格式字符串构造一个字符串
* @param msg - A JavaScript string containing zero or more substitution strings (%s).
* @param subst - JavaScript objects with which to replace substitution strings within msg.
* This gives you additional control over the format of the output.
@@ -357,7 +390,10 @@ export function copyAllProperties (source: any, target: any, excepts: Array, ...sources: any[])
}
/**
+ * @en
* Copy all properties from arguments[1...n] to object.
+ * @zh
+ * 拷贝源对象所有属性到目标对象上,如果有属性冲突,则以源对象为准
* @return The result object.
*/
export function mixin (object?: Record, ...sources: any[]) {
@@ -401,9 +440,13 @@ export function mixin (object?: Record, ...sources: any[])
}
/**
+ * @en
* Derive the class from the supplied base class.
* Both classes are just native javascript constructors, not created by `Class`, so
- * usually you will want to inherit using [[Class]] instead.
+ * usually you will want to inherit using [[CCClass]] instead.
+ * @zh
+ * 将一个类型继承另一个类型
+ * 两个类型都需要是 javascript 的构建函数,而不是 `Class`, 所以你通常可以用 [[CCClass]] 来代替
* @param base The baseclass to inherit.
* @return The result class.
*/
@@ -436,7 +479,10 @@ export function extend (cls: Function, base: Function) {
}
/**
+ * @en
* Get super class.
+ * @zh
+ * 获取父类
* @param constructor The constructor of subclass.
*/
// eslint-disable-next-line @typescript-eslint/ban-types
@@ -448,7 +494,13 @@ export function getSuper (constructor: Function) {
}
/**
+ * @en
* Checks whether subclass is child of superclass or equals to superclass.
+ * @zh
+ * 判断一类型是否是另一类型的子类或本身
+ * @param subclass sub class to be checked
+ * @param superclass super class to be checked
+ * @return whether subclass is child of superclass
*/
export function isChildClassOf (subclass: unknown, superclass: unknown) {
if (subclass && superclass) {
@@ -479,7 +531,10 @@ export function isChildClassOf (subclass: unknown, superclass: unknown) {
}
/**
+ * @en
* Removes all enumerable properties from object.
+ * @zh
+ * 移除对象中所有可枚举属性
*/
export function clear (object: Record) {
for (const key of Object.keys(object)) {
@@ -532,7 +587,10 @@ js.unregisterClass to remove the id of unused class';
}
/**
+ * @en
* Register the class by specified id, if its classname is not defined, the class name will also be set.
+ * @zh
+ * 通过 id 注册类型
* @method _setClassId
* @param classId
* @param constructor
@@ -543,7 +601,10 @@ export const _setClassId = setup('__cid__', _idToClass);
const doSetClassName = setup('__classname__', _nameToClass);
/**
+ * @en
* Register the class by specified name manually
+ * @zh
+ * 通过指定的名称手动注册类型
* @method setClassName
* @param className
* @param constructor
@@ -598,10 +659,14 @@ export function setClassAlias (target: Constructor, alias: string) {
}
/**
- * Unregister a class from fireball.
+ * @en
+ * Unregister a class from cocos.
*
- * If you dont need a registered class anymore, you should unregister the class so that Fireball will not keep its reference anymore.
+ * If you dont need a registered class anymore, you should unregister the class so that cocos will not keep its reference anymore.
* Please note that its still your responsibility to free other references to the class.
+ * @zh
+ * 取消注册类型,如果你不再需要一个注册的类,你应该取消注册这个类,这样 cocos 就不会再保留它的引用。
+ * 请注意,你仍然有责任释放对该类的其他引用。
*
* @param ...constructor - the class you will want to unregister, any number of classes can be added
*/
@@ -629,7 +694,10 @@ export function unregisterClass (...constructors: Function[]) {
}
/**
+ * @en
* Get the registered class by id
+ * @zh
+ * 通过 id 获取已注册的类型
* @param classId
* @return constructor
* @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
@@ -639,7 +707,10 @@ export function _getClassById (classId) {
}
/**
+ * @en
* Get the registered class by name
+ * @zh
+ * 通过名字获取已注册的类型
* @param classname
* @return constructor of the class
*/
@@ -648,7 +719,10 @@ export function getClassByName (classname) {
}
/**
+ * @en
* Get class id of the object
+ * @zh
+ * 获取对象的 class id
* @param obj - instance or constructor
* @param [allowTempId = true] - can return temp id in editor
* @return
diff --git a/cocos/core/utils/misc.ts b/cocos/core/utils/misc.ts
index 4566ce0f33..31bdf6d601 100644
--- a/cocos/core/utils/misc.ts
+++ b/cocos/core/utils/misc.ts
@@ -24,8 +24,6 @@
THE SOFTWARE.
*/
-
-
/* eslint-disable no-new-func */
import { EDITOR, DEV } from 'internal:constants';
@@ -45,6 +43,7 @@ for (let i = 0; i < 64; ++i) { values[BASE64_KEYS.charCodeAt(i)] = i; }
export const BASE64_VALUES = values;
/**
+ * @engineInternal
* @param ctor
* @param sameNameGetSets
* @param diffNameGetSets
@@ -159,15 +158,18 @@ export function isPlainEmptyObj_DEV (obj) {
}
/**
- * @en Clamp a value between from and to.
+ * @en Clamp a value between from and to.
+ * if the original value is larger than max_inclusive, return max_inclusive.
+ * if the original value is smaller than min_inclusive, return min_inclusive.
+ * else return the original value.
* @zh 限定浮点数的最大最小值。
* 数值大于 max_inclusive 则返回 max_inclusive。
* 数值小于 min_inclusive 则返回 min_inclusive。
* 否则返回自身。
- * @param value 目标值
- * @param min_inclusive 最小值
- * @param max_inclusive 最大值
- * @return {Number}
+ * @param value @en Original value @zh 初始值
+ * @param min_inclusive @en Minimum value in between @zh 最小值
+ * @param max_inclusive @en Maximum value in between @zh 最大值
+ * @return {Number} @en The value clamped @zh 目标值
* @example
* var v1 = clampf(20, 0, 20); // 20;
* var v2 = clampf(-1, 0, 20); // 0;
@@ -185,8 +187,8 @@ export function clampf (value: number, min_inclusive: number, max_inclusive: num
/**
* @en converts degrees to radians
* @zh 角度转弧度
- * @param angle 角度
- * @return {Number}
+ * @param angle @en The degree to convert @zh 角度
+ * @return {Number} The radian. @zh 弧度
*/
export function degreesToRadians (angle: number) {
return angle * macro.RAD;
@@ -195,8 +197,8 @@ export function degreesToRadians (angle: number) {
/**
* @en converts radians to degrees
* @zh 弧度转角度
- * @param angle 弧度
- * @return {Number}
+ * @param angle @en The radian to convert @zh 弧度
+ * @return {Number} @en The degree @zh 角度
*/
export function radiansToDegrees (angle) {
return angle * macro.DEG;
diff --git a/cocos/core/utils/murmurhash2_gc.ts b/cocos/core/utils/murmurhash2_gc.ts
index 5465c92b27..18824abd12 100644
--- a/cocos/core/utils/murmurhash2_gc.ts
+++ b/cocos/core/utils/murmurhash2_gc.ts
@@ -36,8 +36,6 @@
* @return {number} 32-bit positive integer hash
*/
-
-
const getUint8ForString = String.prototype.charCodeAt;
function getUint8ForArray (this: Uint8Array, idx: number) { return this[idx]; }
diff --git a/cocos/core/utils/mutable-forward-iterator.ts b/cocos/core/utils/mutable-forward-iterator.ts
index 0c7760513c..f324c709e2 100644
--- a/cocos/core/utils/mutable-forward-iterator.ts
+++ b/cocos/core/utils/mutable-forward-iterator.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module core
- */
-
/**
* @example
* ```
diff --git a/cocos/core/utils/path.ts b/cocos/core/utils/path.ts
index 725e0d0299..cdc452d327 100644
--- a/cocos/core/utils/path.ts
+++ b/cocos/core/utils/path.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module core
- */
-
import { systemInfo } from 'pal/system-info';
import { OS } from '../../../pal/system-info/enum-type';
diff --git a/cocos/core/utils/pool.ts b/cocos/core/utils/pool.ts
index 313b099d29..7a75264bfa 100644
--- a/cocos/core/utils/pool.ts
+++ b/cocos/core/utils/pool.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module core
- */
-
type CleanUpFunction = (value: T) => boolean | void;
/**
diff --git a/cocos/core/utils/prefab/prefab-info.ts b/cocos/core/utils/prefab/prefab-info.ts
index c2d937ba5c..36ca3fcc47 100644
--- a/cocos/core/utils/prefab/prefab-info.ts
+++ b/cocos/core/utils/prefab/prefab-info.ts
@@ -107,6 +107,7 @@ export class MountedComponentsInfo {
/**
* Prefab实例类
+ * @internal
*/
@ccclass('cc.PrefabInstance')
export class PrefabInstance {
diff --git a/cocos/core/utils/prefab/utils.ts b/cocos/core/utils/prefab/utils.ts
index e140b49b6c..3654e68850 100644
--- a/cocos/core/utils/prefab/utils.ts
+++ b/cocos/core/utils/prefab/utils.ts
@@ -24,8 +24,6 @@
THE SOFTWARE.
*/
-
-
import { EDITOR, SUPPORT_JIT } from 'internal:constants';
import { legacyCC } from '../../global-exports';
import type { Node } from '../../scene-graph/node';
diff --git a/cocos/core/value-types/bitmask.ts b/cocos/core/value-types/bitmask.ts
index f81741cce2..acacd57a41 100644
--- a/cocos/core/value-types/bitmask.ts
+++ b/cocos/core/value-types/bitmask.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module core/value-types
- */
-
import { EDITOR, TEST } from 'internal:constants';
import { value } from '../utils/js';
import { legacyCC } from '../global-exports';
@@ -38,8 +33,10 @@ import { errorID } from '../platform/debug';
* Define an BitMask type.
* @zh
* 定义一个位掩码类型。
- * @param obj A JavaScript literal object containing BitMask names and values
- * @return The defined BitMask type
+ * @param obj
+ * @en A JavaScript literal object containing BitMask names and values.
+ * @zh 包含 BitMask 名称和值的 JavaScript 文字对象。
+ * @return @en The defined BitMask type @zh 定义的位掩码类型。
*/
export function BitMask (obj: T): T {
if ('__bitmask__' in obj) {
diff --git a/cocos/core/value-types/enum.ts b/cocos/core/value-types/enum.ts
index 9b40a4a47d..9d53f730a2 100644
--- a/cocos/core/value-types/enum.ts
+++ b/cocos/core/value-types/enum.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module core/value-types
- */
-
import { EDITOR, TEST, DEV } from 'internal:constants';
import { value } from '../utils/js';
import { legacyCC } from '../global-exports';
@@ -45,8 +40,10 @@ import { assertIsTrue } from '../data/utils/asserts';
* 定义一个枚举类型。
* 用户可以把枚举值设为任意的整数,如果设为 -1,系统将会分配为上一个枚举值 + 1。
*
- * @param obj - a JavaScript literal object containing enum names and values, or a TypeScript enum type
- * @return the defined enum type
+ * @param obj
+ * @en A JavaScript literal object containing enum names and values, or a TypeScript enum type.
+ * @zh 包含枚举名和值的 JavaScript literal 对象,或者是一个 TypeScript enum 类型。
+ * @return @en The defined enum type. @zh 定义的枚举类型。
*/
export function Enum (obj: T): T {
if ('__enums__' in obj) {
@@ -61,7 +58,7 @@ export function Enum (obj: T): T {
* Update the enum object properties.
* @zh
* 更新枚举对象的属性列表。
- * @param obj
+ * @param obj @en The enum object to update. @zh 需要更新的枚举对象。
*/
Enum.update = (obj: T): T => {
let lastIndex = -1;
@@ -115,7 +112,7 @@ interface EnumExtras {
/**
* Determines if the object is an enum type.
- * @param enumType The object to judge.
+ * @param enumType @en The object to judge. @zh 需要判断的对象。
*/
Enum.isEnum = (enumType: EnumT) => enumType && enumType.hasOwnProperty('__enums__');
@@ -125,7 +122,7 @@ function assertIsEnum (enumType: EnumT): asserts enumType is
/**
* Get the enumerators from the enum type.
- * @param enumType An enum type.
+ * @param enumType @en An enum type. @zh 枚举类型。
*/
Enum.getList = (enumType: EnumT): readonly Enum.Enumerator[] => {
assertIsEnum(enumType);
@@ -139,7 +136,7 @@ Enum.getList = (enumType: EnumT): readonly Enum.Enumerator (enumType: EnumT): readonly Enum.Enumerator[] {
@@ -176,7 +173,9 @@ if (DEV) {
* Formally, as a result of invocation on this function with enum type `enumType`:
* - `Enum.isEnum(enumType)` returns `true`;
* - `Enum.getList(enumType)` returns the enumerators of `enumType`.
- * @param enumType An enum type, eg, a kind of type with similar semantic defined by TypeScript.
+ * @param
+ * @en enumType An enum type, eg, a kind of type with similar semantic defined by TypeScript.
+ * @zh 枚举类型,例如 TypeScript 中定义的类型。
*/
export function ccenum (enumType: EnumT) {
if (!('__enums__' in enumType)) {
diff --git a/cocos/core/value-types/index.ts b/cocos/core/value-types/index.ts
index a79dbb7e4b..364cfe807f 100644
--- a/cocos/core/value-types/index.ts
+++ b/cocos/core/value-types/index.ts
@@ -24,8 +24,6 @@
THE SOFTWARE.
*/
-
-
export { BitMask } from './bitmask';
export { Enum, ccenum } from './enum';
export { ValueType } from './value-type';
diff --git a/cocos/core/value-types/value-type.ts b/cocos/core/value-types/value-type.ts
index c51809b105..530002a576 100644
--- a/cocos/core/value-types/value-type.ts
+++ b/cocos/core/value-types/value-type.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module core/value-types
- */
-
import { errorID } from '../platform/debug';
import * as js from '../utils/js';
import { legacyCC } from '../global-exports';
@@ -40,14 +35,15 @@ import { legacyCC } from '../global-exports';
export class ValueType {
/**
* @en
- * Clone the current object. The clone result of the object should be equal to the current object, i.e. satisfy `this.equals(this, value.clone())`.
+ * Clone the current object. The clone result of the object should be equal to the current object,
+ * i.e. satisfy `this.equals(this, value.clone())`.
* The base version of this method do nothing and returns `this'.
* The derived class **must** rewrite this method and the returned object should not be `this`, i.e. satisfy `this !== this.clone()`.
* @zh
* 克隆当前值。克隆的结果值应与当前值相等,即满足 `this.equals(this, value.clone())`。
* 本方法的基类版本简单地返回 `this`;
* 派生类**必须**重写本方法,并且返回的对象不应当为 `this`,即满足 `this !== this.clone()`。
- * @returns The cloned object
+ * @returns @en The cloned object. @zh 克隆的对象。
*/
public clone (): ValueType {
errorID(100, `${js.getClassName(this)}.clone`);
@@ -62,8 +58,8 @@ export class ValueType {
* @zh
* 判断当前值是否与指定值相等。此判断应当具有交换性,即满足 `this.equals(other) === other.equals(this)`。
* 本方法的基类版本简单地返回 `false`。
- * @param other 相比较的值。
- * @returns 相等则返回 `true`,否则返回 `false`。
+ * @param other @en The other object @zh 指定值。
+ * @returns @en `true` if equal, otherwise returns `false` @zh 如果相等,则返回 `true`,否则返回 `false`。
*/
public equals (other: this) {
// errorID(100, js.getClassName(this) + '.equals');
@@ -77,7 +73,7 @@ export class ValueType {
* @zh
* 赋值当前值使其与指定值相等。
* 本方法的基类版本简单地返回 `this`,派生类**必须**重写本方法。
- * @param other The other object
+ * @param other @en The other object. @zh 指定值。
*/
public set (other: this) {
errorID(100, `${js.getClassName(this)}.set`);
@@ -90,10 +86,10 @@ export class ValueType {
* @zh
* 返回当前值的字符串表示。
* 本方法的基类版本返回空字符串。
- * @returns The string representation of the current object
+ * @returns @en The string representation of the current value. @zh 当前值的字符串表示。
*/
public toString () {
- return `${{}}`;
+ return `${''}`;
}
}
js.setClassName('cc.ValueType', ValueType);
diff --git a/cocos/dragon-bones/ArmatureCache.ts b/cocos/dragon-bones/ArmatureCache.ts
index 1485a57c0e..67ecf6457f 100644
--- a/cocos/dragon-bones/ArmatureCache.ts
+++ b/cocos/dragon-bones/ArmatureCache.ts
@@ -1,6 +1,26 @@
-/**
- * @packageDocumentation
- * @module dragonBones
+/*
+ Copyright (c) 2020-2022 Xiamen Yaji Software Co., Ltd.
+
+ https://www.cocos.com/
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated engine source code (the "Software"), a limited,
+ worldwide, royalty-free, non-assignable, revocable and non-exclusive license
+ to use Cocos Creator solely to develop games on your target platforms. You shall
+ not use Cocos Creator software for developing other software or tools that's
+ used for developing games. You are not granted to publish, distribute,
+ sublicense, and/or sell copies of Cocos Creator.
+
+ The software or tools in this License Agreement are licensed, not sold.
+ Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
*/
import { Armature, BlendMode, Matrix } from '@cocos/dragonbones-js';
diff --git a/cocos/dragon-bones/ArmatureDisplay.ts b/cocos/dragon-bones/ArmatureDisplay.ts
index cb716fcaf9..277ed87a84 100644
--- a/cocos/dragon-bones/ArmatureDisplay.ts
+++ b/cocos/dragon-bones/ArmatureDisplay.ts
@@ -1,6 +1,26 @@
-/**
- * @packageDocumentation
- * @module dragonBones
+/*
+ Copyright (c) 2020-2022 Xiamen Yaji Software Co., Ltd.
+
+ https://www.cocos.com/
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated engine source code (the "Software"), a limited,
+ worldwide, royalty-free, non-assignable, revocable and non-exclusive license
+ to use Cocos Creator solely to develop games on your target platforms. You shall
+ not use Cocos Creator software for developing other software or tools that's
+ used for developing games. You are not granted to publish, distribute,
+ sublicense, and/or sell copies of Cocos Creator.
+
+ The software or tools in this License Agreement are licensed, not sold.
+ Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
*/
import { EDITOR } from 'internal:constants';
@@ -367,19 +387,6 @@ export class ArmatureDisplay extends UIRenderer {
this._debugBones = value;
this._updateDebugDraw();
}
- /**
- * @en Enabled batch model, if skeleton is complex, do not enable batch, or will lower performance.
- * @zh 开启合批,如果渲染大量相同纹理,且结构简单的骨骼动画,开启合批可以降低drawcall,否则请不要开启,cpu消耗会上升。
- * @property {Boolean} enableBatch
- * @default false
- */
- // @editable
- // @tooltip('i18n:COMPONENT.dragon_bones.enabled_batch')
- // get enableBatch () { return this._enableBatch; }
- // set enableBatch (value) {
- // this._enableBatch = value;
- // this._updateBatch();
- // }
/**
* @en
@@ -437,12 +444,6 @@ export class ArmatureDisplay extends UIRenderer {
protected _debugBones = false;
/* protected */ _debugDraw: Graphics | null = null;
- /**
- * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
- */
- @serializable
- public _enableBatch = false;
-
// DragonBones data store key.
/**
* @internal
@@ -610,37 +611,6 @@ export class ArmatureDisplay extends UIRenderer {
}
}
- // if change use batch mode, just clear material cache
- _updateBatch () {
- // const baseMaterial = this.getMaterial(0);
- // if (baseMaterial) {
- // baseMaterial.define('CC_USE_MODEL', !this.enableBatch);
- // }
- this._materialCache = {};
- this.markForUpdateRenderData();
- }
-
- // override base class _updateMaterial to set define value and clear material cache
- _updateMaterial () {
- // const baseMaterial = this.getMaterial(0);
- // if (baseMaterial) {
- // baseMaterial.define('CC_USE_MODEL', !this.enableBatch);
- // baseMaterial.define('USE_TEXTURE', true);
-
- // const srcBlendFactor = this.premultipliedAlpha ? cc.gfx.BLEND_ONE : cc.gfx.BLEND_SRC_ALPHA;
- // const dstBlendFactor = cc.gfx.BLEND_ONE_MINUS_SRC_ALPHA;
-
- // baseMaterial.setBlend(
- // true,
- // ccBLEND_FUNC_ADD,
- // srcBlendFactor, srcBlendFactor,
- // cc.gfx.BLEND_FUNC_ADD,
- // dstBlendFactor, dstBlendFactor
- // );
- // }
- this.markForUpdateRenderData();
- }
-
__preload () {
super.__preload();
this._init();
@@ -945,8 +915,6 @@ export class ArmatureDisplay extends UIRenderer {
const aabb = armatureData.aabb;
this.node._uiProps.uiTransformComp!.setContentSize(aabb.width, aabb.height);
}
-
- this._updateBatch();
this.attachUtil.init(this);
if (this.animationName) {
diff --git a/cocos/dragon-bones/ArmatureSystem.ts b/cocos/dragon-bones/ArmatureSystem.ts
index f14e016e43..3d6ae5b3fe 100644
--- a/cocos/dragon-bones/ArmatureSystem.ts
+++ b/cocos/dragon-bones/ArmatureSystem.ts
@@ -1,8 +1,32 @@
+/*
+ Copyright (c) 2020-2022 Xiamen Yaji Software Co., Ltd.
+
+ https://www.cocos.com/
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated engine source code (the "Software"), a limited,
+ worldwide, royalty-free, non-assignable, revocable and non-exclusive license
+ to use Cocos Creator solely to develop games on your target platforms. You shall
+ not use Cocos Creator software for developing other software or tools that's
+ used for developing games. You are not granted to publish, distribute,
+ sublicense, and/or sell copies of Cocos Creator.
+
+ The software or tools in this License Agreement are licensed, not sold.
+ Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ */
+
import { director } from '../core/director';
import { System } from '../core/components';
import { ArmatureDisplay } from './ArmatureDisplay';
import { legacyCC } from '../core/global-exports';
-import { errorID } from '../core';
export class ArmatureSystem extends System {
/**
diff --git a/cocos/dragon-bones/AttachUtil.ts b/cocos/dragon-bones/AttachUtil.ts
index 4c002333d7..715286ee82 100644
--- a/cocos/dragon-bones/AttachUtil.ts
+++ b/cocos/dragon-bones/AttachUtil.ts
@@ -1,6 +1,26 @@
-/**
- * @packageDocumentation
- * @module dragonBones
+/*
+ Copyright (c) 2020-2022 Xiamen Yaji Software Co., Ltd.
+
+ https://www.cocos.com/
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated engine source code (the "Software"), a limited,
+ worldwide, royalty-free, non-assignable, revocable and non-exclusive license
+ to use Cocos Creator solely to develop games on your target platforms. You shall
+ not use Cocos Creator software for developing other software or tools that's
+ used for developing games. You are not granted to publish, distribute,
+ sublicense, and/or sell copies of Cocos Creator.
+
+ The software or tools in this License Agreement are licensed, not sold.
+ Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
*/
import { Armature, Matrix } from '@cocos/dragonbones-js';
diff --git a/cocos/dragon-bones/CCArmatureDisplay.ts b/cocos/dragon-bones/CCArmatureDisplay.ts
index 56ad1746d9..a41a164c93 100644
--- a/cocos/dragon-bones/CCArmatureDisplay.ts
+++ b/cocos/dragon-bones/CCArmatureDisplay.ts
@@ -1,18 +1,40 @@
/* eslint-disable @typescript-eslint/no-unsafe-return */
+/*
+ Copyright (c) 2020-2022 Xiamen Yaji Software Co., Ltd.
-/**
- * @packageDocumentation
- * @module dragonBones
+ https://www.cocos.com/
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated engine source code (the "Software"), a limited,
+ worldwide, royalty-free, non-assignable, revocable and non-exclusive license
+ to use Cocos Creator solely to develop games on your target platforms. You shall
+ not use Cocos Creator software for developing other software or tools that's
+ used for developing games. You are not granted to publish, distribute,
+ sublicense, and/or sell copies of Cocos Creator.
+
+ The software or tools in this License Agreement are licensed, not sold.
+ Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
*/
import { Armature, DisplayData, IEventDispatcher, Slot } from '@cocos/dragonbones-js';
import { ccclass } from '../core/data/class-decorator';
-import { Vec2, Node, Vec3 } from '../core';
+import { Node, Vec3 } from '../core';
import { EventTarget } from '../core/event';
// eslint-disable-next-line import/named
import { CCSlot } from './CCSlot';
import { ArmatureDisplay } from './ArmatureDisplay';
+/**
+* @deprecated since v3.5.1, this is an engine private interface that will be removed in the future.
+*/
@ccclass('dragonBones.CCArmatureDisplay')
export class CCArmatureDisplay extends DisplayData implements IEventDispatcher {
get node () { return this; }
diff --git a/cocos/dragon-bones/CCFactory.ts b/cocos/dragon-bones/CCFactory.ts
index a4fab5295b..6ba848c81e 100644
--- a/cocos/dragon-bones/CCFactory.ts
+++ b/cocos/dragon-bones/CCFactory.ts
@@ -1,6 +1,26 @@
-/**
- * @packageDocumentation
- * @module dragonBones
+/*
+ Copyright (c) 2020-2022 Xiamen Yaji Software Co., Ltd.
+
+ https://www.cocos.com/
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated engine source code (the "Software"), a limited,
+ worldwide, royalty-free, non-assignable, revocable and non-exclusive license
+ to use Cocos Creator solely to develop games on your target platforms. You shall
+ not use Cocos Creator software for developing other software or tools that's
+ used for developing games. You are not granted to publish, distribute,
+ sublicense, and/or sell copies of Cocos Creator.
+
+ The software or tools in this License Agreement are licensed, not sold.
+ Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
*/
import { EDITOR } from 'internal:constants';
@@ -17,17 +37,23 @@ import { CCArmatureDisplay } from './CCArmatureDisplay';
* DragonBones factory
* @class CCFactory
* @extends BaseFactory
+ * @deprecated since v3.5.1, this is an engine private interface that will be removed in the future.
*/
@ccclass('CCFactory')
export class CCFactory extends BaseFactory implements ISchedulable {
+ static _factory: CCFactory | null = null;
+
/**
+ * @en
+ * Get an CCFactory instance
+ * @zh
+ * 获取一个 CCFactory 实例
* @method getInstance
* @return {CCFactory}
* @static
* @example
* let factory = CCFactory.getInstance();
*/
- static _factory: CCFactory | null = null;
static getInstance () {
if (!CCFactory._factory) {
CCFactory._factory = new CCFactory();
diff --git a/cocos/dragon-bones/CCSlot.ts b/cocos/dragon-bones/CCSlot.ts
index 61f3e8bb2e..4c742628c5 100644
--- a/cocos/dragon-bones/CCSlot.ts
+++ b/cocos/dragon-bones/CCSlot.ts
@@ -1,6 +1,26 @@
-/**
- * @packageDocumentation
- * @module dragonBones
+/*
+ Copyright (c) 2020-2022 Xiamen Yaji Software Co., Ltd.
+
+ https://www.cocos.com/
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated engine source code (the "Software"), a limited,
+ worldwide, royalty-free, non-assignable, revocable and non-exclusive license
+ to use Cocos Creator solely to develop games on your target platforms. You shall
+ not use Cocos Creator software for developing other software or tools that's
+ used for developing games. You are not granted to publish, distribute,
+ sublicense, and/or sell copies of Cocos Creator.
+
+ The software or tools in this License Agreement are licensed, not sold.
+ Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
*/
import { BoneType, BinaryOffset, Slot } from '@cocos/dragonbones-js';
@@ -9,7 +29,9 @@ import { ccclass } from '../core/data/class-decorator';
import { CCTextureData } from './CCTextureData';
// @skipLibCheck
-
+/**
+* @deprecated since v3.5.1, this is an engine private interface that will be removed in the future.
+*/
@ccclass('dragonBones.CCSlot')
export class CCSlot extends Slot {
static toString () {
@@ -17,27 +39,38 @@ export class CCSlot extends Slot {
}
/**
+ * @en Vertices in local coordinate system.
+ * @zh 局部坐标顶点数据
* @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
*/
_localVertices: number[];
/**
+ * @en Indices array of vertex data
+ * @zh 顶点数组索引
* @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
*/
_indices: number[];
/**
+ * @en Local transformation matrix
+ * @zh 局部坐标系变换矩阵
* @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
*/
_matrix: Mat4;
/**
+ * @en World transformation matrix
+ * @zh 世界坐标系变换矩阵
* @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
*/
public _worldMatrix: Mat4;
+
protected _worldMatrixDirty: boolean;
/**
+ * @en Color setting on a slot
+ * @zh 设置在 Slot 上的颜色
* @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
*/
_color: Color;
diff --git a/cocos/dragon-bones/CCTextureData.ts b/cocos/dragon-bones/CCTextureData.ts
index 78762e6848..50f0e70e1d 100644
--- a/cocos/dragon-bones/CCTextureData.ts
+++ b/cocos/dragon-bones/CCTextureData.ts
@@ -1,15 +1,37 @@
-/**
- * @packageDocumentation
- * @module dragonBones
+/*
+ Copyright (c) 2020-2022 Xiamen Yaji Software Co., Ltd.
+
+ https://www.cocos.com/
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated engine source code (the "Software"), a limited,
+ worldwide, royalty-free, non-assignable, revocable and non-exclusive license
+ to use Cocos Creator solely to develop games on your target platforms. You shall
+ not use Cocos Creator software for developing other software or tools that's
+ used for developing games. You are not granted to publish, distribute,
+ sublicense, and/or sell copies of Cocos Creator.
+
+ The software or tools in this License Agreement are licensed, not sold.
+ Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
*/
import { BaseObject, TextureAtlasData, TextureData } from '@cocos/dragonbones-js';
-import { Size, Vec2 } from '../core';
import { SpriteFrame } from '../2d';
import { TextureBase } from '../core/assets/texture-base';
import { ccclass } from '../core/data/decorators';
import { Rect } from '../core/math/rect';
+/**
+* @deprecated since v3.5.1, this is an engine private interface that will be removed in the future.
+*/
@ccclass('dragonBones.CCTextureAtlasData')
export class CCTextureAtlasData extends TextureAtlasData {
get renderTexture () {
@@ -63,6 +85,9 @@ export class CCTextureAtlasData extends TextureAtlasData {
}
}
+/**
+* @deprecated since v3.5.1, this is an engine private interface that will be removed in the future.
+*/
@ccclass('dragonBones.CCTextureData')
export class CCTextureData extends TextureData {
spriteFrame: SpriteFrame | null = null
diff --git a/cocos/dragon-bones/DragonBonesAsset.ts b/cocos/dragon-bones/DragonBonesAsset.ts
index 99b6c8aaeb..9189f61516 100644
--- a/cocos/dragon-bones/DragonBonesAsset.ts
+++ b/cocos/dragon-bones/DragonBonesAsset.ts
@@ -1,18 +1,34 @@
-/* eslint-disable @typescript-eslint/no-unsafe-return */
+/*
+ Copyright (c) 2020-2022 Xiamen Yaji Software Co., Ltd.
-/**
- * @packageDocumentation
- * @module dragonBones
+ https://www.cocos.com/
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated engine source code (the "Software"), a limited,
+ worldwide, royalty-free, non-assignable, revocable and non-exclusive license
+ to use Cocos Creator solely to develop games on your target platforms. You shall
+ not use Cocos Creator software for developing other software or tools that's
+ used for developing games. You are not granted to publish, distribute,
+ sublicense, and/or sell copies of Cocos Creator.
+
+ The software or tools in this License Agreement are licensed, not sold.
+ Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
*/
import { EDITOR } from 'internal:constants';
-import { BinaryDataParser, DragonBonesData } from '@cocos/dragonbones-js';
import { Asset } from '../core/assets';
import { ccclass, serializable } from '../core/data/decorators';
import { ArmatureCache } from './ArmatureCache';
-import { Enum, JsonAsset, Node } from '../core';
+import { Enum, Node } from '../core';
import { CCFactory } from './CCFactory';
-import { property } from '../core/data/class-decorator';
import { legacyCC } from '../core/global-exports';
/**
@@ -24,8 +40,10 @@ import { legacyCC } from '../core/global-exports';
@ccclass('dragonBones.DragonBonesAsset')
export class DragonBonesAsset extends Asset {
/**
- * @en See http://developer.egret.com/cn/github/egret-docs/DB/dbLibs/dataFormat/index.html
- * @zh 可查看 DragonBones 官方文档 http://developer.egret.com/cn/github/egret-docs/DB/dbLibs/dataFormat/index.html
+ * @en
+ * See http://developer.egret.com/cn/github/egret-docs/DB/dbLibs/dataFormat/index.html
+ * @zh
+ * 可查看 DragonBones 官方文档 http://developer.egret.com/cn/github/egret-docs/DB/dbLibs/dataFormat/index.html
* @property {string} dragonBonesJson
*/
@serializable
diff --git a/cocos/dragon-bones/DragonBonesAtlasAsset.ts b/cocos/dragon-bones/DragonBonesAtlasAsset.ts
index 440a302c6e..bf6eeb5d4d 100644
--- a/cocos/dragon-bones/DragonBonesAtlasAsset.ts
+++ b/cocos/dragon-bones/DragonBonesAtlasAsset.ts
@@ -1,7 +1,28 @@
-/**
- * @packageDocumentation
- * @module dragonBones
+/*
+ Copyright (c) 2020-2022 Xiamen Yaji Software Co., Ltd.
+
+ https://www.cocos.com/
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated engine source code (the "Software"), a limited,
+ worldwide, royalty-free, non-assignable, revocable and non-exclusive license
+ to use Cocos Creator solely to develop games on your target platforms. You shall
+ not use Cocos Creator software for developing other software or tools that's
+ used for developing games. You are not granted to publish, distribute,
+ sublicense, and/or sell copies of Cocos Creator.
+
+ The software or tools in this License Agreement are licensed, not sold.
+ Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
*/
+
import { JSB } from 'internal:constants';
import { TextureAtlasData } from '@cocos/dragonbones-js';
import { Asset, Texture2D, Node } from '../core';
diff --git a/cocos/dragon-bones/assembler/index.ts b/cocos/dragon-bones/assembler/index.ts
index 37e90a9ffa..63e7c389e6 100644
--- a/cocos/dragon-bones/assembler/index.ts
+++ b/cocos/dragon-bones/assembler/index.ts
@@ -1,7 +1,4 @@
-/**
- * @packageDocumentation
- * @module dragonBones
- */
+
import { IAssemblerManager } from '../../2d/renderer/base';
import { ArmatureDisplay } from '../ArmatureDisplay';
diff --git a/cocos/dragon-bones/assembler/simple.ts b/cocos/dragon-bones/assembler/simple.ts
index f111751ae3..867c4b76e9 100644
--- a/cocos/dragon-bones/assembler/simple.ts
+++ b/cocos/dragon-bones/assembler/simple.ts
@@ -1,10 +1,30 @@
-/**
- * @packageDocumentation
- * @module dragonBones
+/*
+ Copyright (c) 2020-2022 Xiamen Yaji Software Co., Ltd.
+
+ https://www.cocos.com/
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated engine source code (the "Software"), a limited,
+ worldwide, royalty-free, non-assignable, revocable and non-exclusive license
+ to use Cocos Creator solely to develop games on your target platforms. You shall
+ not use Cocos Creator software for developing other software or tools that's
+ used for developing games. You are not granted to publish, distribute,
+ sublicense, and/or sell copies of Cocos Creator.
+
+ The software or tools in this License Agreement are licensed, not sold.
+ Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
*/
import { Armature, BlendMode } from '@cocos/dragonbones-js';
-import { Color, Mat4, Node, Texture2D, Vec3, director } from '../../core';
+import { Color, Mat4, Node, Texture2D, director } from '../../core';
import { BlendFactor } from '../../core/gfx';
import { TextureBase } from '../../core/assets/texture-base';
import { vfmtPosUvColor } from '../../2d/renderer/vertex-format';
@@ -12,7 +32,7 @@ import { MaterialInstance } from '../../core/renderer/core/material-instance';
import { IAssembler } from '../../2d/renderer/base';
import { Batcher2D } from '../../2d/renderer/batcher-2d';
import { ArmatureFrame } from '../ArmatureCache';
-import { ArmatureDisplay, ArmatureDisplayDrawData } from '../ArmatureDisplay';
+import { ArmatureDisplay } from '../ArmatureDisplay';
import { CCSlot } from '../CCSlot';
import { legacyCC } from '../../core/global-exports';
import { StaticVBAccessor } from '../../2d/renderer/static-vb-accessor';
@@ -94,8 +114,6 @@ function _getSlotMaterial (tex: TextureBase | null, blendMode: BlendMode) {
dst = BlendFactor.ONE_MINUS_SRC_ALPHA;
break;
}
-
- // const useModel = !_comp!.enableBatch;
_comp!.setBlendHash();
return _comp!.getMaterialForBlend(src, dst);
}
@@ -426,11 +444,6 @@ function updateComponentRenderData (comp: ArmatureDisplay, batcher: Batcher2D) {
}
let worldMat: Mat4 | undefined;
- if (_comp._enableBatch) {
- worldMat = _node.worldMatrix as Mat4;
- _mustFlush = false;
- _handleVal |= NEED_BATCH;
- }
_vertexFloatCount = 0;
_vertexOffset = 0;
diff --git a/cocos/dragon-bones/category.json b/cocos/dragon-bones/category.json
index 08bdb9836f..c99291e5bf 100644
--- a/cocos/dragon-bones/category.json
+++ b/cocos/dragon-bones/category.json
@@ -1,7 +1,7 @@
{
"title": {
- "zh": "Dragon Bones",
- "en": "Dragon Bones"
+ "zh": "DragonBones",
+ "en": "DragonBones"
},
"description": {
"zh": "ArmatureDisplay 组件可以对 DragonBones(龙骨)资源进行渲染和播放。",
diff --git a/cocos/dragon-bones/deprecated.ts b/cocos/dragon-bones/deprecated.ts
new file mode 100644
index 0000000000..f1e1704c1a
--- /dev/null
+++ b/cocos/dragon-bones/deprecated.ts
@@ -0,0 +1,34 @@
+/*
+ Copyright (c) 2020 Xiamen Yaji Software Co., Ltd.
+
+ https://www.cocos.com/
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated engine source code (the "Software"), a limited,
+ worldwide, royalty-free, non-assignable, revocable and non-exclusive license
+ to use Cocos Creator solely to develop games on your target platforms. You shall
+ not use Cocos Creator software for developing other software or tools that's
+ used for developing games. You are not granted to publish, distribute,
+ sublicense, and/or sell copies of Cocos Creator.
+
+ The software or tools in this License Agreement are licensed, not sold.
+ Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ */
+
+import { removeProperty } from '../core/utils/x-deprecated';
+import { ArmatureDisplay } from './ArmatureDisplay';
+
+removeProperty(ArmatureDisplay.prototype, 'ArmatureDisplay', [
+ {
+ name: '_enableBatch',
+ suggest: 'Not support batch render mode',
+ },
+]);
diff --git a/cocos/dragon-bones/index.jsb.ts b/cocos/dragon-bones/index.jsb.ts
index 47d2fa86de..193e2a6dfc 100644
--- a/cocos/dragon-bones/index.jsb.ts
+++ b/cocos/dragon-bones/index.jsb.ts
@@ -1,3 +1,28 @@
+/*
+ Copyright (c) 2020-2022 Xiamen Yaji Software Co., Ltd.
+
+ https://www.cocos.com/
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated engine source code (the "Software"), a limited,
+ worldwide, royalty-free, non-assignable, revocable and non-exclusive license
+ to use Cocos Creator solely to develop games on your target platforms. You shall
+ not use Cocos Creator software for developing other software or tools that's
+ used for developing games. You are not granted to publish, distribute,
+ sublicense, and/or sell copies of Cocos Creator.
+
+ The software or tools in this License Agreement are licensed, not sold.
+ Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ */
+
export enum ExtensionType {
FFD = 0,
AdjustColor = 10,
diff --git a/cocos/dragon-bones/index.ts b/cocos/dragon-bones/index.ts
index 8c1099d428..f61305b53b 100644
--- a/cocos/dragon-bones/index.ts
+++ b/cocos/dragon-bones/index.ts
@@ -1,45 +1,28 @@
-/**
- * @packageDocumentation
- * @module dragonBones
+/*
+ Copyright (c) 2020-2022 Xiamen Yaji Software Co., Ltd.
+
+ https://www.cocos.com/
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated engine source code (the "Software"), a limited,
+ worldwide, royalty-free, non-assignable, revocable and non-exclusive license
+ to use Cocos Creator solely to develop games on your target platforms. You shall
+ not use Cocos Creator software for developing other software or tools that's
+ used for developing games. You are not granted to publish, distribute,
+ sublicense, and/or sell copies of Cocos Creator.
+
+ The software or tools in this License Agreement are licensed, not sold.
+ Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
*/
-import { EDITOR } from 'internal:constants';
-
-/**
- * @en
- * The global time scale of DragonBones.
- * @zh
- * DragonBones 全局时间缩放率。
- * @example
- * dragonBones.timeScale = 0.8;
- */
-// const _timeScale = 1.0;
-
-// TODO timescale
-// Object.defineProperty(dragonBones, 'timeScale', {
-// get () {
-// return this._timeScale;
-// },
-// set (value) {
-// this._timeScale = value;
-// const factory = this.CCFactory.getInstance();
-// factory._dragonBones.clock.timeScale = value;
-// },
-// configurable: true,
-// });
-
-// export enum DisplayType {
-// Image = 0,
-// Armature = 1,
-// Mesh = 2
-// }
-
-// export enum ArmatureType {
-// Armature = 0,
-// MovieClip = 1,
-// Stage = 2
-// }
-
export enum ExtensionType {
FFD = 0,
AdjustColor = 10,
@@ -89,5 +72,6 @@ export * from './DragonBonesAtlasAsset';
export * from './ArmatureDisplay';
export * from './AttachUtil';
export * from './assembler';
+export * from './deprecated';
export * from '@cocos/dragonbones-js';
diff --git a/cocos/input/deprecated.ts b/cocos/input/deprecated.ts
index cb6a79ca0d..9b9f0c0c30 100644
--- a/cocos/input/deprecated.ts
+++ b/cocos/input/deprecated.ts
@@ -23,7 +23,6 @@
THE SOFTWARE.
*/
-
import { markAsWarning, replaceProperty } from '../core/utils/x-deprecated';
import { Event, EventKeyboard, EventMouse, EventTouch, SystemEventType } from './types';
import { SystemEvent } from './system-event';
diff --git a/cocos/input/input.ts b/cocos/input/input.ts
index feb294a8d2..1f1a86f92b 100644
--- a/cocos/input/input.ts
+++ b/cocos/input/input.ts
@@ -24,8 +24,6 @@
THE SOFTWARE.
*/
-
-
import { EDITOR, NATIVE } from 'internal:constants';
import { TouchInputSource, MouseInputSource, KeyboardInputSource, AccelerometerInputSource } from 'pal/input';
import { touchManager } from '../../pal/input/touch-manager';
diff --git a/cocos/input/system-event.ts b/cocos/input/system-event.ts
index 8c34b1d550..710d0a4337 100644
--- a/cocos/input/system-event.ts
+++ b/cocos/input/system-event.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module event
- */
-
import { EventTarget } from '../core/event';
import { EventAcceleration, EventKeyboard, EventMouse, EventTouch, SystemEventType, Touch } from './types';
import { input, Input } from './input';
diff --git a/cocos/input/types/event-enum.ts b/cocos/input/types/event-enum.ts
index e4a84d6ee4..9b74f9773f 100644
--- a/cocos/input/types/event-enum.ts
+++ b/cocos/input/types/event-enum.ts
@@ -23,10 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module event
- */
import { legacyCC } from '../../core/global-exports';
import { NodeEventType } from '../../core/scene-graph/node-event';
diff --git a/cocos/input/types/event/event-keyboard.ts b/cocos/input/types/event/event-keyboard.ts
index 77340bcd16..682cfd0c29 100644
--- a/cocos/input/types/event/event-keyboard.ts
+++ b/cocos/input/types/event/event-keyboard.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module event
- */
-
import { Event } from './event';
import { SystemEventTypeUnion, SystemEventType } from '../event-enum';
import { KeyCode } from '../key-code';
diff --git a/cocos/input/types/event/event.ts b/cocos/input/types/event/event.ts
index 550ef8e024..8361218363 100644
--- a/cocos/input/types/event/event.ts
+++ b/cocos/input/types/event/event.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module event
- */
-
import { legacyCC } from '../../../core/global-exports';
import { SystemEventTypeUnion } from '../event-enum';
diff --git a/cocos/input/types/touch.ts b/cocos/input/types/touch.ts
index ca8f675ce9..ad9c3b8944 100644
--- a/cocos/input/types/touch.ts
+++ b/cocos/input/types/touch.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module event
- */
-
import { Vec2 } from '../../core/math';
import { legacyCC } from '../../core/global-exports';
diff --git a/cocos/particle-2d/define.ts b/cocos/particle-2d/define.ts
index c1aac418a0..fd2b508e24 100644
--- a/cocos/particle-2d/define.ts
+++ b/cocos/particle-2d/define.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module particle2d
- */
-
import { Enum } from '../core/value-types';
/**
diff --git a/cocos/particle-2d/index.ts b/cocos/particle-2d/index.ts
index 2e76f65e12..609a833f94 100644
--- a/cocos/particle-2d/index.ts
+++ b/cocos/particle-2d/index.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module particle2d
- */
-
import { ParticleSystem2D } from './particle-system-2d';
import { MotionStreak } from './motion-streak-2d';
import { MotionStreakAssemblerManager } from './motion-streak-2d-assembler';
diff --git a/cocos/particle-2d/motion-streak-2d-assembler.ts b/cocos/particle-2d/motion-streak-2d-assembler.ts
index 35443128d6..1864d4a548 100644
--- a/cocos/particle-2d/motion-streak-2d-assembler.ts
+++ b/cocos/particle-2d/motion-streak-2d-assembler.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module particle2d
- */
-
import { IAssembler, IAssemblerManager } from '../2d/renderer/base';
import { MotionStreak } from './motion-streak-2d';
import { Vec2, Color } from '../core/math';
diff --git a/cocos/particle-2d/motion-streak-2d.ts b/cocos/particle-2d/motion-streak-2d.ts
index 8c582c3251..03dd77d497 100644
--- a/cocos/particle-2d/motion-streak-2d.ts
+++ b/cocos/particle-2d/motion-streak-2d.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module particle2d
- */
-
import { ccclass, executeInEditMode, serializable, playOnFocus, menu, help, editable, type } from 'cc.decorator';
import { EDITOR } from 'internal:constants';
import { UIRenderer } from '../2d/framework';
diff --git a/cocos/particle-2d/particle-asset.ts b/cocos/particle-2d/particle-asset.ts
index 9e6a246541..ee2eee667a 100644
--- a/cocos/particle-2d/particle-asset.ts
+++ b/cocos/particle-2d/particle-asset.ts
@@ -24,18 +24,14 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module asset
- */
-
import { ccclass, serializable, editable } from '../core/data/decorators';
import { Asset } from '../core/assets/asset';
import { SpriteFrame } from '../2d/assets/sprite-frame';
import { legacyCC } from '../core/global-exports';
/**
- * Class for particle asset handling.
+ * @en Class for 2D particle asset handling.
+ * @zh 2D 粒子资产
* @class ParticleAsset
* @extends Asset
*/
diff --git a/cocos/particle-2d/particle-simulator-2d.ts b/cocos/particle-2d/particle-simulator-2d.ts
index 05bfd0eaf6..b7663f60f0 100644
--- a/cocos/particle-2d/particle-simulator-2d.ts
+++ b/cocos/particle-2d/particle-simulator-2d.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module particle2d
- */
-
import { Vec2, Color } from '../core/math';
import Pool from '../core/utils/pool';
import { clampf, degreesToRadians, radiansToDegrees } from '../core/utils/misc';
diff --git a/cocos/particle-2d/particle-system-2d-assembler.ts b/cocos/particle-2d/particle-system-2d-assembler.ts
index ca898159f9..fc3f37f9a1 100644
--- a/cocos/particle-2d/particle-system-2d-assembler.ts
+++ b/cocos/particle-2d/particle-system-2d-assembler.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module particle2d
- */
-
import { IAssembler, IAssemblerManager } from '../2d/renderer/base';
import { ParticleSystem2D } from './particle-system-2d';
import { MeshRenderData } from '../2d/renderer/render-data';
diff --git a/cocos/particle-2d/particle-system-2d.ts b/cocos/particle-2d/particle-system-2d.ts
index 20eeeb6cc7..51ab06e00d 100644
--- a/cocos/particle-2d/particle-system-2d.ts
+++ b/cocos/particle-2d/particle-system-2d.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module particle2d
- */
-
import { ccclass, editable, type, displayOrder, menu,
executeInEditMode, serializable, playOnFocus, tooltip, visible, formerlySerializedAs } from 'cc.decorator';
import { EDITOR } from 'internal:constants';
@@ -143,43 +138,32 @@ function getParticleComponents (node): ParticleSystem2D[] {
}
/**
- * Particle System base class.
- * Attributes of a Particle System:
- * - emmision rate of the particles
- * - Gravity Mode (Mode A):
- * - gravity
- * - direction
- * - speed +- variance
- * - tangential acceleration +- variance
- * - radial acceleration +- variance
- * - Radius Mode (Mode B):
- * - startRadius +- variance
- * - endRadius +- variance
- * - rotate +- variance
- * - Properties common to all modes:
- * - life +- life variance
- * - start spin +- variance
- * - end spin +- variance
- * - start size +- variance
- * - end size +- variance
- * - start color +- variance
- * - end color +- variance
- * - life +- variance
- * - blending function
- * - texture
- * Cocos also supports particles generated by Particle Designer (http://particledesigner.71squared.com/).
- * 'Radius Mode' in Particle Designer uses a fixed emit rate of 30 hz. Since that can't be guaranteed in cocos,
- * cocos uses a another approach, but the results are almost identical.
- * cocos supports all the variables used by Particle Designer plus a bit more:
+ * @en Particle System base class.
+ * cocos2d also supports particles generated by Particle Designer (http://particledesigner.71squared.com/).
+ * 'Radius Mode' in Particle Designer uses a fixed emit rate of 30 hz. Since that can't be guarateed in cocos2d,
+ * cocos2d uses a another approach, but the results are almost identical.
+ * cocos2d supports all the variables used by Particle Designer plus a bit more:
* - spinning particles (supported when using ParticleSystem)
* - tangential acceleration (Gravity mode)
* - radial acceleration (Gravity mode)
* - radius direction (Radius mode) (Particle Designer supports outwards to inwards direction only)
* It is possible to customize any of the above mentioned properties in runtime. Example:
- *
- * @example
* emitter.radialAccel = 15;
* emitter.startSpin = 0;
+ *
+ * @zh 2D 粒子基础类型
+ * cocos2d 同样支 Particle Designer (http://particledesigner.71squared.com/) 生成的粒子
+ * 粒子设计器中的 半径模式 使用 30 hz 的固定发射率。由于 cocos2d 无法保证,
+ * cocos2d 使用了另一种方法,但结果几乎相同。
+ * cocos2d 支持 Particle Designer 使用的所有变量,还有:
+ * -旋转粒子(使用粒子系统时支持)
+ * -切向加速度(重力模式)
+ * -径向加速度(重力模式)
+ * -半径方向(半径模式)(Particle Designer 仅支持向外到向内的方向)
+ * 可以在运行时自定义上述任何属性。例如:
+ * emitter.radialAccel = 15;
+ * emitter.startSpin = 0;
+ *
*/
@ccclass('cc.ParticleSystem2D')
@menu('Effects/ParticleSystem2D')
@@ -698,11 +682,11 @@ export class ParticleSystem2D extends UIRenderer {
public aspectRatio = 1;
/**
* The temporary SpriteFrame object used for the renderer. Because there is no corresponding asset, it can't be serialized.
- * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
+ * @internal since v3.5.0, this is an engine private interface that will be removed in the future.
*/
public declare _renderSpriteFrame: SpriteFrame | null;
/**
- * @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
+ * @internal since v3.5.0, this is an engine private interface that will be removed in the future.
*/
public declare _simulator: Simulator;
diff --git a/cocos/particle-2d/png-reader.ts b/cocos/particle-2d/png-reader.ts
index 51d3624ffe..2e25d14e23 100644
--- a/cocos/particle-2d/png-reader.ts
+++ b/cocos/particle-2d/png-reader.ts
@@ -26,11 +26,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module particle2d
- */
-
import { getError } from '../core/platform/debug';
import zlib from '../../external/compression/zlib.min';
diff --git a/cocos/particle-2d/tiff-reader.ts b/cocos/particle-2d/tiff-reader.ts
index deaf428a61..1becc22e60 100644
--- a/cocos/particle-2d/tiff-reader.ts
+++ b/cocos/particle-2d/tiff-reader.ts
@@ -29,11 +29,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module particle2d
- */
-
import { getError, logID } from '../core/platform/debug';
interface IFile {
diff --git a/cocos/particle/animator/color-overtime.ts b/cocos/particle/animator/color-overtime.ts
index c28dce1c93..1e26c461b0 100644
--- a/cocos/particle/animator/color-overtime.ts
+++ b/cocos/particle/animator/color-overtime.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module particle
- */
-
import { ccclass, displayOrder, type, serializable } from 'cc.decorator';
import { pseudoRandom } from '../../core/math';
import { Particle, PARTICLE_MODULE_NAME, ParticleModuleBase } from '../particle';
diff --git a/cocos/particle/animator/curve-range.ts b/cocos/particle/animator/curve-range.ts
index 3dd2016fdf..88b93bdd89 100644
--- a/cocos/particle/animator/curve-range.ts
+++ b/cocos/particle/animator/curve-range.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { ccclass, type, serializable, editable, formerlySerializedAs } from 'cc.decorator';
import { EDITOR } from 'internal:constants';
import { lerp } from '../../core/math';
diff --git a/cocos/particle/animator/force-overtime.ts b/cocos/particle/animator/force-overtime.ts
index 8ea5277737..2b7d4fe05b 100644
--- a/cocos/particle/animator/force-overtime.ts
+++ b/cocos/particle/animator/force-overtime.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module particle
- */
-
import { ccclass, tooltip, displayOrder, range, type, serializable } from 'cc.decorator';
import { pseudoRandom, Quat, Vec3 } from '../../core/math';
import { Space, ModuleRandSeed } from '../enum';
diff --git a/cocos/particle/animator/gradient-range.ts b/cocos/particle/animator/gradient-range.ts
index e36b66d455..d0f38a0f8e 100644
--- a/cocos/particle/animator/gradient-range.ts
+++ b/cocos/particle/animator/gradient-range.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { ccclass, type, serializable, editable } from 'cc.decorator';
import { EDITOR } from 'internal:constants';
import { Color } from '../../core/math';
diff --git a/cocos/particle/animator/gradient.ts b/cocos/particle/animator/gradient.ts
index 17f9d89c07..7fa987bc72 100644
--- a/cocos/particle/animator/gradient.ts
+++ b/cocos/particle/animator/gradient.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { ccclass, serializable, editable } from 'cc.decorator';
import { CCClass } from '../../core/data/class';
import { Color, lerp, repeat } from '../../core/math';
diff --git a/cocos/particle/animator/limit-velocity-overtime.ts b/cocos/particle/animator/limit-velocity-overtime.ts
index d36e7b0bbe..75f8fe3c63 100644
--- a/cocos/particle/animator/limit-velocity-overtime.ts
+++ b/cocos/particle/animator/limit-velocity-overtime.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module particle
- */
-
import { ccclass, tooltip, displayOrder, range, type, serializable } from 'cc.decorator';
import { lerp, pseudoRandom, Vec3, Mat4, Quat } from '../../core/math';
import { Space, ModuleRandSeed } from '../enum';
diff --git a/cocos/particle/animator/optimized-curve.ts b/cocos/particle/animator/optimized-curve.ts
index 7442361073..88f996350c 100644
--- a/cocos/particle/animator/optimized-curve.ts
+++ b/cocos/particle/animator/optimized-curve.ts
@@ -23,14 +23,9 @@
THE SOFTWARE.
*/
-
-
-
import { repeat } from '../../core/math';
import { AnimationCurve, evalOptCurve, OptimizedKey } from '../../core/geometry/curve';
-
-
const CURVE_MODE_CONSTANT = 0;
const CURVE_MODE_RANDOM_CONSTANT = 1;
const CURVE_MODE_CURVE = 2;
diff --git a/cocos/particle/animator/rotation-overtime.ts b/cocos/particle/animator/rotation-overtime.ts
index 0e65acbc97..a827935f30 100644
--- a/cocos/particle/animator/rotation-overtime.ts
+++ b/cocos/particle/animator/rotation-overtime.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module particle
- */
-
import { ccclass, tooltip, displayOrder, range, type, radian, serializable } from 'cc.decorator';
import { Mat4, pseudoRandom, Quat, Vec4, Vec3 } from '../../core/math';
import { Particle, ParticleModuleBase, PARTICLE_MODULE_NAME } from '../particle';
diff --git a/cocos/particle/animator/size-overtime.ts b/cocos/particle/animator/size-overtime.ts
index c9f687a841..5547c1c84f 100644
--- a/cocos/particle/animator/size-overtime.ts
+++ b/cocos/particle/animator/size-overtime.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module particle
- */
-
import { ccclass, tooltip, displayOrder, type, serializable, range } from 'cc.decorator';
import { pseudoRandom, Vec3 } from '../../core/math';
import { Particle, ParticleModuleBase, PARTICLE_MODULE_NAME } from '../particle';
diff --git a/cocos/particle/animator/texture-animation.ts b/cocos/particle/animator/texture-animation.ts
index 8654b42954..c7402e0c1a 100644
--- a/cocos/particle/animator/texture-animation.ts
+++ b/cocos/particle/animator/texture-animation.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module particle
- */
-
import { ccclass, tooltip, displayOrder, type, formerlySerializedAs, serializable, range } from 'cc.decorator';
import { lerp, pseudoRandom, repeat } from '../../core/math';
import { Enum } from '../../core/value-types';
diff --git a/cocos/particle/animator/velocity-overtime.ts b/cocos/particle/animator/velocity-overtime.ts
index fb8b5350eb..d3dad9a701 100644
--- a/cocos/particle/animator/velocity-overtime.ts
+++ b/cocos/particle/animator/velocity-overtime.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module particle
- */
-
import { ccclass, tooltip, displayOrder, range, type, serializable } from 'cc.decorator';
import { Mat4, pseudoRandom, Quat, Vec3 } from '../../core/math';
import { Space, ModuleRandSeed } from '../enum';
diff --git a/cocos/particle/billboard.ts b/cocos/particle/billboard.ts
index b3f60b4571..da8bb4aa29 100644
--- a/cocos/particle/billboard.ts
+++ b/cocos/particle/billboard.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module particle
- */
-
import { ccclass, help, executeInEditMode, menu, tooltip, type, serializable } from 'cc.decorator';
import { builtinResMgr } from '../core/builtin';
import { createMesh } from '../3d/misc';
diff --git a/cocos/particle/burst.ts b/cocos/particle/burst.ts
index fb23c80453..f95b32531e 100644
--- a/cocos/particle/burst.ts
+++ b/cocos/particle/burst.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { ccclass, type, serializable, editable, range } from 'cc.decorator';
import { repeat } from '../core/math';
import CurveRange from './animator/curve-range';
diff --git a/cocos/particle/deprecated.ts b/cocos/particle/deprecated.ts
index d04d3e275f..d5f342d5df 100644
--- a/cocos/particle/deprecated.ts
+++ b/cocos/particle/deprecated.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module particle
- */
-
import { removeProperty, replaceProperty } from '../core/utils/x-deprecated';
import Burst from './burst';
import { ParticleSystem } from './particle-system';
diff --git a/cocos/particle/emitter/shape-module.ts b/cocos/particle/emitter/shape-module.ts
index 7faca14e74..0f94543073 100644
--- a/cocos/particle/emitter/shape-module.ts
+++ b/cocos/particle/emitter/shape-module.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module particle
- */
-
import { ccclass, tooltip, displayOrder, type, formerlySerializedAs, serializable, visible, range } from 'cc.decorator';
import { Mat4, Quat, Vec2, Vec3, clamp, pingPong, random, randomRange, repeat, toDegree, toRadian } from '../../core/math';
diff --git a/cocos/particle/index.ts b/cocos/particle/index.ts
index c79f7f9012..d741bb3165 100644
--- a/cocos/particle/index.ts
+++ b/cocos/particle/index.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { Billboard } from './billboard';
import { Line } from './line';
import { ParticleSystem } from './particle-system';
diff --git a/cocos/particle/line.ts b/cocos/particle/line.ts
index d7871742c4..c43627c142 100644
--- a/cocos/particle/line.ts
+++ b/cocos/particle/line.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module particle
- */
-
import { ccclass, help, executeInEditMode, menu, tooltip, displayOrder, type, serializable, range } from 'cc.decorator';
import { Material, Texture2D } from '../core/assets';
import { Component } from '../core/components';
@@ -103,7 +98,8 @@ export class Line extends Component {
private _positions = [];
/**
- * 每段折线的拐点坐标。
+ * @en Inflection point positions of each polyline
+ * @zh 每段折线的拐点坐标。
*/
@type([Vec3])
@displayOrder(2)
diff --git a/cocos/particle/models/line-model.ts b/cocos/particle/models/line-model.ts
index e429e374f8..88f81ca0f9 100644
--- a/cocos/particle/models/line-model.ts
+++ b/cocos/particle/models/line-model.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { RenderingSubMesh } from '../../core/assets/rendering-sub-mesh';
import { DRAW_INFO_SIZE, Buffer, IndirectBuffer, Attribute, BufferInfo, DrawInfo,
AttributeName, BufferUsageBit, Format, FormatInfos, MemoryUsageBit, PrimitiveMode } from '../../core/gfx';
diff --git a/cocos/particle/models/particle-batch-model.ts b/cocos/particle/models/particle-batch-model.ts
index 535d5c7412..7c0566f743 100644
--- a/cocos/particle/models/particle-batch-model.ts
+++ b/cocos/particle/models/particle-batch-model.ts
@@ -28,7 +28,6 @@
* @packageDocumentation
* @hidden
*/
-
import { Mesh } from '../../3d/assets/mesh';
import { AttributeName, BufferUsageBit, FormatInfos, MemoryUsageBit, PrimitiveMode,
Attribute, DRAW_INFO_SIZE, Buffer, IndirectBuffer, BufferInfo, DrawInfo, Feature } from '../../core/gfx';
@@ -620,9 +619,14 @@ export default class ParticleBatchModel extends scene.Model {
public doDestroy () {
this._vBuffer = null;
this._vdataF32 = null;
+ this._vdataUint32 = null;
this._insBuffers = [];
this._insIndices = null;
+
+ this._vertAttrs = null;
+ this._material = null;
+ this._mesh = null;
this.destroySubMeshData();
}
diff --git a/cocos/particle/particle-general-function.ts b/cocos/particle/particle-general-function.ts
index ad0c0550f6..c82a86f3db 100644
--- a/cocos/particle/particle-general-function.ts
+++ b/cocos/particle/particle-general-function.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { Mat4, Quat, random, randomRange, randomRangeInt, Vec2, Vec3 } from '../core/math';
import { sign } from '../core/math/bits';
import { Space } from './enum';
diff --git a/cocos/particle/particle-system.ts b/cocos/particle/particle-system.ts
index 986541f5a5..c3d62a307a 100644
--- a/cocos/particle/particle-system.ts
+++ b/cocos/particle/particle-system.ts
@@ -1,4 +1,3 @@
-/* eslint-disable max-len */
/*
Copyright (c) 2020 Xiamen Yaji Software Co., Ltd.
@@ -24,19 +23,12 @@
THE SOFTWARE.
*/
-// Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd.
-
-/**
- * @packageDocumentation
- * @module particle
- */
-
// eslint-disable-next-line max-len
import { ccclass, help, executeInEditMode, executionOrder, menu, tooltip, displayOrder, type, range, displayName, formerlySerializedAs, override, radian, serializable, inspector, boolean, visible } from 'cc.decorator';
import { EDITOR } from 'internal:constants';
import { ModelRenderer } from '../core/components/model-renderer';
import { Material } from '../core/assets/material';
-import { Mat4, pseudoRandom, Quat, randomRangeInt, Vec2, Vec3, Vec4 } from '../core/math';
+import { Mat4, pseudoRandom, Quat, randomRangeInt, Vec2, Vec3 } from '../core/math';
import { INT_MAX } from '../core/math/bits';
import { scene } from '../core/renderer';
import ColorOverLifetimeModule from './animator/color-overtime';
@@ -50,12 +42,12 @@ import TextureAnimationModule from './animator/texture-animation';
import VelocityOvertimeModule from './animator/velocity-overtime';
import Burst from './burst';
import ShapeModule from './emitter/shape-module';
-import { CullingMode, RenderMode, Space } from './enum';
+import { CullingMode, Space } from './enum';
import { particleEmitZAxis } from './particle-general-function';
import ParticleSystemRenderer from './renderer/particle-system-renderer-data';
import TrailModule from './renderer/trail';
import { IParticleSystemRenderer } from './renderer/particle-system-renderer-base';
-import { Particle, PARTICLE_MODULE_PROPERTY } from './particle';
+import { PARTICLE_MODULE_PROPERTY } from './particle';
import { legacyCC } from '../core/global-exports';
import { TransformBit } from '../core/scene-graph/node-enum';
import { AABB, intersect } from '../core/geometry';
@@ -718,6 +710,8 @@ export class ParticleSystem extends ModelRenderer {
private _subEmitters: any[]; // array of { emitter: ParticleSystem, type: 'birth', 'collision' or 'death'}
+ private _needAttach: boolean;
+
@serializable
private _prewarm = false;
@@ -743,6 +737,7 @@ export class ParticleSystem extends ModelRenderer {
this._isStopped = true;
this._isEmitting = false;
this._needRefresh = true;
+ this._needAttach = false;
this._time = 0.0; // playback position in seconds.
this._emitRateTimeCounter = 0.0;
@@ -844,7 +839,8 @@ export class ParticleSystem extends ModelRenderer {
// }
/**
- * 播放粒子效果。
+ * @en play particle system
+ * @zh 播放粒子效果。
*/
public play () {
if (this._isPaused) {
@@ -877,7 +873,8 @@ export class ParticleSystem extends ModelRenderer {
}
/**
- * 暂停播放粒子效果。
+ * @en pause particle system
+ * @zh 暂停播放粒子效果。
*/
public pause () {
if (this._isStopped) {
@@ -892,7 +889,8 @@ export class ParticleSystem extends ModelRenderer {
}
/**
- * 停止播放粒子。
+ * @en stop particle system
+ * @zh 停止播放粒子。
*/
public stop () {
if (this._isPlaying || this._isPaused) {
@@ -919,9 +917,9 @@ export class ParticleSystem extends ModelRenderer {
}
}
- // remove all particles from current particle system.
/**
- * 将所有粒子从粒子系统中清除。
+ * @en remove all particles from current particle system.
+ * @zh 将所有粒子从粒子系统中清除。
*/
public clear () {
if (this.enabledInHierarchy) {
@@ -1130,6 +1128,22 @@ export class ParticleSystem extends ModelRenderer {
if (this._trailModule && this._trailModule.enable) {
this._trailModule.updateRenderData();
}
+
+ if (this._needAttach) { // Check whether this particle model should be reattached
+ if (this.getParticleCount() > 0) {
+ if (!this._isCulled) {
+ if (!this.processor.getModel()?.scene) {
+ this.processor.attachToScene();
+ }
+ if (this._trailModule && this._trailModule.enable) {
+ if (!this._trailModule.getModel()?.scene) {
+ this._trailModule._attachToScene();
+ }
+ }
+ this._needAttach = false;
+ }
+ }
+ }
}
protected beforeRender () {
@@ -1138,6 +1152,18 @@ export class ParticleSystem extends ModelRenderer {
if (this._trailModule && this._trailModule.enable) {
this._trailModule.beforeRender();
}
+
+ if (this.getParticleCount() <= 0) {
+ if (this.processor.getModel()?.scene) {
+ this.processor.detachFromScene();
+ if (this._trailModule && this._trailModule.enable) {
+ this._trailModule._detachFromScene();
+ }
+ this._needAttach = false;
+ }
+ } else if (!this.processor.getModel()?.scene) {
+ this._needAttach = true;
+ }
}
protected _onVisibilityChange (val) {
diff --git a/cocos/particle/particle-utils.ts b/cocos/particle/particle-utils.ts
index a80c619e9b..2aef3a267f 100644
--- a/cocos/particle/particle-utils.ts
+++ b/cocos/particle/particle-utils.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { instantiate } from '../core/data';
import { CCObject } from '../core/data/object';
import { Director, director } from '../core/director';
@@ -34,7 +32,8 @@ import { ParticleSystem } from './particle-system';
export class ParticleUtils {
/**
- * instantiate
+ * @en instantiate particle system from prefab
+ * @zh 从 prefab 实例化粒子系统
*/
public static instantiate (prefab) {
if (!this.registeredSceneEvent) {
@@ -42,6 +41,7 @@ export class ParticleUtils {
this.registeredSceneEvent = true;
}
if (!this.particleSystemPool.has(prefab._uuid)) {
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
this.particleSystemPool.set(prefab._uuid, new Pool(() => instantiate(prefab) || new Node(), 1, (prefab) => prefab.destroy()));
}
return this.particleSystemPool.get(prefab._uuid)!.alloc();
diff --git a/cocos/particle/particle.ts b/cocos/particle/particle.ts
index 7ce67bd8a2..99988652a9 100644
--- a/cocos/particle/particle.ts
+++ b/cocos/particle/particle.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { Color, Vec3, Mat4, Quat } from '../core/math';
import { ParticleSystem } from './particle-system';
import { IParticleSystemRenderer } from './renderer/particle-system-renderer-base';
diff --git a/cocos/particle/renderer/particle-system-renderer-cpu.ts b/cocos/particle/renderer/particle-system-renderer-cpu.ts
index 2f9a55de5f..c7d2d9b375 100644
--- a/cocos/particle/renderer/particle-system-renderer-cpu.ts
+++ b/cocos/particle/renderer/particle-system-renderer-cpu.ts
@@ -208,6 +208,11 @@ export default class ParticleSystemRendererCPU extends ParticleSystemRendererBas
this.setVertexAttributes();
}
+ public onDestroy (): void {
+ this._particles?.destroy();
+ super.onDestroy();
+ }
+
public getFreeParticle (): Particle | null {
if (this._particles!.length >= this._particleSystem.capacity) {
return null;
diff --git a/cocos/particle/renderer/trail.ts b/cocos/particle/renderer/trail.ts
index f1c5a38a89..8e601e27aa 100644
--- a/cocos/particle/renderer/trail.ts
+++ b/cocos/particle/renderer/trail.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module particle
- */
-
import { ccclass, tooltip, displayOrder, type, serializable, range } from 'cc.decorator';
import { Material } from '../../core/assets/material';
import { RenderingSubMesh } from '../../core/assets/rendering-sub-mesh';
@@ -129,6 +124,7 @@ class TrailSegment {
return this.trailElements[newEleLoc];
}
+ // eslint-disable-next-line max-len
public iterateElement (target: TrailModule, f: (target: TrailModule, e: ITrailElement, p: Particle, dt: number) => boolean, p: Particle, dt: number) {
const end = this.start >= this.end ? this.end + this.trailElements.length : this.end;
for (let i = this.start; i < end; i++) {
@@ -306,6 +302,15 @@ export default class TrailModule {
@tooltip('i18n:trailSegment.colorOvertime')
public colorOvertime = new GradientRange();
+ /**
+ * @en Get trail model
+ * @zh 获取拖尾模型
+ * @return Model of this trail and type is scene.Model
+ */
+ public getModel () {
+ return this._trailModel;
+ }
+
/**
* 轨迹设定时的坐标系。
*/
diff --git a/cocos/physics-2d/framework/components/colliders/box-collider-2d.ts b/cocos/physics-2d/framework/components/colliders/box-collider-2d.ts
index 225ce71611..29eb2acb6d 100644
--- a/cocos/physics-2d/framework/components/colliders/box-collider-2d.ts
+++ b/cocos/physics-2d/framework/components/colliders/box-collider-2d.ts
@@ -1,7 +1,4 @@
-/**
- * @packageDocumentation
- * @module physics2d
- */
+
import { ccclass, property, menu } from '../../../../core/data/class-decorator';
import { Vec2, Size } from '../../../../core';
diff --git a/cocos/physics-2d/framework/components/colliders/circle-collider-2d.ts b/cocos/physics-2d/framework/components/colliders/circle-collider-2d.ts
index 9413ed66c5..4116e003da 100644
--- a/cocos/physics-2d/framework/components/colliders/circle-collider-2d.ts
+++ b/cocos/physics-2d/framework/components/colliders/circle-collider-2d.ts
@@ -1,7 +1,4 @@
-/**
- * @packageDocumentation
- * @module physics2d
- */
+
import { ccclass, property, menu } from '../../../../core/data/class-decorator';
import { Component, Vec2, Size } from '../../../../core';
diff --git a/cocos/physics-2d/framework/components/colliders/collider-2d.ts b/cocos/physics-2d/framework/components/colliders/collider-2d.ts
index 580d772451..8080cab44d 100644
--- a/cocos/physics-2d/framework/components/colliders/collider-2d.ts
+++ b/cocos/physics-2d/framework/components/colliders/collider-2d.ts
@@ -1,7 +1,4 @@
-/**
- * @packageDocumentation
- * @module physics2d
- */
+
import { EDITOR } from 'internal:constants';
diff --git a/cocos/physics-2d/framework/components/colliders/polygon-collider-2d.ts b/cocos/physics-2d/framework/components/colliders/polygon-collider-2d.ts
index bbbaa454f4..af8e27b76f 100644
--- a/cocos/physics-2d/framework/components/colliders/polygon-collider-2d.ts
+++ b/cocos/physics-2d/framework/components/colliders/polygon-collider-2d.ts
@@ -1,7 +1,4 @@
-/**
- * @packageDocumentation
- * @module physics2d
- */
+
import { ccclass, property, menu } from '../../../../core/data/class-decorator';
import { Component, Vec2, Size } from '../../../../core';
diff --git a/cocos/physics-2d/framework/components/joints/distance-joint-2d.ts b/cocos/physics-2d/framework/components/joints/distance-joint-2d.ts
index cfa5275d2c..88c7074bb4 100644
--- a/cocos/physics-2d/framework/components/joints/distance-joint-2d.ts
+++ b/cocos/physics-2d/framework/components/joints/distance-joint-2d.ts
@@ -1,7 +1,4 @@
-/**
- * @packageDocumentation
- * @module physics2d
- */
+
import { Joint2D } from './joint-2d';
import { ccclass, property, menu, type } from '../../../../core/data/class-decorator';
import { IDistanceJoint } from '../../../spec/i-physics-joint';
diff --git a/cocos/physics-2d/framework/components/joints/fixed-joint-2d.ts b/cocos/physics-2d/framework/components/joints/fixed-joint-2d.ts
index 883d25da5d..63e3b1decc 100644
--- a/cocos/physics-2d/framework/components/joints/fixed-joint-2d.ts
+++ b/cocos/physics-2d/framework/components/joints/fixed-joint-2d.ts
@@ -1,7 +1,4 @@
-/**
- * @packageDocumentation
- * @module physics2d
- */
+
import { Joint2D } from './joint-2d';
import { ccclass, property, menu, type } from '../../../../core/data/class-decorator';
import { IFixedJoint } from '../../../spec/i-physics-joint';
diff --git a/cocos/physics-2d/framework/components/joints/hinge-joint-2d.ts b/cocos/physics-2d/framework/components/joints/hinge-joint-2d.ts
index efd14ec174..16bf9874f3 100644
--- a/cocos/physics-2d/framework/components/joints/hinge-joint-2d.ts
+++ b/cocos/physics-2d/framework/components/joints/hinge-joint-2d.ts
@@ -1,7 +1,4 @@
-/**
- * @packageDocumentation
- * @module physics2d
- */
+
import { Joint2D } from './joint-2d';
import { ccclass, property, menu, type } from '../../../../core/data/class-decorator';
diff --git a/cocos/physics-2d/framework/components/joints/joint-2d.ts b/cocos/physics-2d/framework/components/joints/joint-2d.ts
index 72c531c377..93b0d4cd03 100644
--- a/cocos/physics-2d/framework/components/joints/joint-2d.ts
+++ b/cocos/physics-2d/framework/components/joints/joint-2d.ts
@@ -1,7 +1,4 @@
-/**
- * @packageDocumentation
- * @module physics2d
- */
+
import { EDITOR } from 'internal:constants';
import { Component, Vec2 } from '../../../../core';
diff --git a/cocos/physics-2d/framework/components/joints/mouse-joint-2d.ts b/cocos/physics-2d/framework/components/joints/mouse-joint-2d.ts
index 4eb0083860..267ea8d054 100644
--- a/cocos/physics-2d/framework/components/joints/mouse-joint-2d.ts
+++ b/cocos/physics-2d/framework/components/joints/mouse-joint-2d.ts
@@ -1,7 +1,4 @@
-/**
- * @packageDocumentation
- * @module physics2d
- */
+
import { Joint2D } from './joint-2d';
import { ccclass, property, menu, type } from '../../../../core/data/class-decorator';
diff --git a/cocos/physics-2d/framework/components/joints/relative-joint-2d.ts b/cocos/physics-2d/framework/components/joints/relative-joint-2d.ts
index cece817c06..76c711abb5 100644
--- a/cocos/physics-2d/framework/components/joints/relative-joint-2d.ts
+++ b/cocos/physics-2d/framework/components/joints/relative-joint-2d.ts
@@ -1,7 +1,4 @@
-/**
- * @packageDocumentation
- * @module physics2d
- */
+
import { Joint2D } from './joint-2d';
import { ccclass, property, menu, type } from '../../../../core/data/class-decorator';
diff --git a/cocos/physics-2d/framework/components/joints/slider-joint-2d.ts b/cocos/physics-2d/framework/components/joints/slider-joint-2d.ts
index dc0040685d..daec80b3d2 100644
--- a/cocos/physics-2d/framework/components/joints/slider-joint-2d.ts
+++ b/cocos/physics-2d/framework/components/joints/slider-joint-2d.ts
@@ -1,7 +1,4 @@
-/**
- * @packageDocumentation
- * @module physics2d
- */
+
import { Joint2D } from './joint-2d';
import { ccclass, property, menu, type } from '../../../../core/data/class-decorator';
diff --git a/cocos/physics-2d/framework/components/joints/spring-joint-2d.ts b/cocos/physics-2d/framework/components/joints/spring-joint-2d.ts
index ea6bb011dd..06e4b06790 100644
--- a/cocos/physics-2d/framework/components/joints/spring-joint-2d.ts
+++ b/cocos/physics-2d/framework/components/joints/spring-joint-2d.ts
@@ -1,7 +1,4 @@
-/**
- * @packageDocumentation
- * @module physics2d
- */
+
import { Joint2D } from './joint-2d';
import { ccclass, property, menu, type } from '../../../../core/data/class-decorator';
diff --git a/cocos/physics-2d/framework/components/joints/wheel-joint-2d.ts b/cocos/physics-2d/framework/components/joints/wheel-joint-2d.ts
index 2c95afcb30..c4a97248c3 100644
--- a/cocos/physics-2d/framework/components/joints/wheel-joint-2d.ts
+++ b/cocos/physics-2d/framework/components/joints/wheel-joint-2d.ts
@@ -1,7 +1,4 @@
-/**
- * @packageDocumentation
- * @module physics2d
- */
+
import { Joint2D } from './joint-2d';
import { ccclass, property, menu, type } from '../../../../core/data/class-decorator';
diff --git a/cocos/physics-2d/framework/components/rigid-body-2d.ts b/cocos/physics-2d/framework/components/rigid-body-2d.ts
index 1d0135103a..22ee8d47b4 100644
--- a/cocos/physics-2d/framework/components/rigid-body-2d.ts
+++ b/cocos/physics-2d/framework/components/rigid-body-2d.ts
@@ -1,7 +1,4 @@
-/**
- * @packageDocumentation
- * @module physics2d
- */
+
import { EDITOR } from 'internal:constants';
import { IRigidBody2D } from '../../spec/i-rigid-body';
diff --git a/cocos/physics-2d/framework/physics-system.ts b/cocos/physics-2d/framework/physics-system.ts
index 6cfc9e5c62..aca9dd63fe 100644
--- a/cocos/physics-2d/framework/physics-system.ts
+++ b/cocos/physics-2d/framework/physics-system.ts
@@ -1,7 +1,4 @@
-/**
- * @packageDocumentation
- * @module physics2d
- */
+
import { EDITOR, DEBUG } from 'internal:constants';
import { System, Vec2, director, Director, game, error, IVec2Like, Rect, Eventify, Enum } from '../../core';
diff --git a/cocos/physics-2d/framework/physics-types.ts b/cocos/physics-2d/framework/physics-types.ts
index 39ca0f34f5..9a2a1718fd 100644
--- a/cocos/physics-2d/framework/physics-types.ts
+++ b/cocos/physics-2d/framework/physics-types.ts
@@ -1,7 +1,4 @@
-/**
- * @packageDocumentation
- * @module physics2d
- */
+
import { Enum, Vec2 } from '../../core';
import { Collider2D } from './components/colliders/collider-2d';
diff --git a/cocos/physics-2d/spec/i-physics-contact.ts b/cocos/physics-2d/spec/i-physics-contact.ts
index 9d6eb6c70e..dd22d36b2f 100644
--- a/cocos/physics-2d/spec/i-physics-contact.ts
+++ b/cocos/physics-2d/spec/i-physics-contact.ts
@@ -1,7 +1,4 @@
-/**
- * @packageDocumentation
- * @module physics2d
- */
+
import { Vec2 } from '../../core';
import { Collider2D } from '../framework/components/colliders/collider-2d';
diff --git a/cocos/physics-2d/spec/i-physics-joint.ts b/cocos/physics-2d/spec/i-physics-joint.ts
index 5af415f0a9..d01d507047 100644
--- a/cocos/physics-2d/spec/i-physics-joint.ts
+++ b/cocos/physics-2d/spec/i-physics-joint.ts
@@ -1,7 +1,4 @@
-/**
- * @packageDocumentation
- * @module physics2d
- */
+
import { IVec2Like } from '../../core';
import { ILifecycle } from '../../physics/spec/i-lifecycle';
diff --git a/cocos/physics/bullet/bullet-cache.ts b/cocos/physics/bullet/bullet-cache.ts
index a036d6442c..4401224134 100644
--- a/cocos/physics/bullet/bullet-cache.ts
+++ b/cocos/physics/bullet/bullet-cache.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { Collider, TriggerEventType, CollisionEventType, IContactEquation } from '../../../exports/physics-framework';
import { Vec3, Quat } from '../../core';
import { bt } from './instantiated';
diff --git a/cocos/physics/bullet/bullet-contact-data.ts b/cocos/physics/bullet/bullet-contact-data.ts
index 0ecfe5a7f6..b371def21f 100644
--- a/cocos/physics/bullet/bullet-contact-data.ts
+++ b/cocos/physics/bullet/bullet-contact-data.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { IContactEquation, ICollisionEvent } from '../framework';
import { IVec3Like, Vec3, Quat } from '../../core';
import { BulletShape } from './shapes/bullet-shape';
diff --git a/cocos/physics/bullet/bullet-enum.ts b/cocos/physics/bullet/bullet-enum.ts
index 492be73950..83eaa26b57 100644
--- a/cocos/physics/bullet/bullet-enum.ts
+++ b/cocos/physics/bullet/bullet-enum.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
export enum EBtSharedBodyDirty {
BODY_RE_ADD = 1,
GHOST_RE_ADD = 2,
diff --git a/cocos/physics/bullet/bullet-env.ts b/cocos/physics/bullet/bullet-env.ts
index c92a64040f..0d6c22b729 100644
--- a/cocos/physics/bullet/bullet-env.ts
+++ b/cocos/physics/bullet/bullet-env.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
// Wasm Memory Page Size is 65536
export const pageSize = 65536; // 64KiB
diff --git a/cocos/physics/bullet/bullet-interface.ts b/cocos/physics/bullet/bullet-interface.ts
index 4689e8d3d1..d17692ab6a 100644
--- a/cocos/physics/bullet/bullet-interface.ts
+++ b/cocos/physics/bullet/bullet-interface.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { BulletShape } from './shapes/bullet-shape';
export interface IBulletBodyStruct {
diff --git a/cocos/physics/bullet/bullet-rigid-body.ts b/cocos/physics/bullet/bullet-rigid-body.ts
index 63915ee472..051fe085a4 100644
--- a/cocos/physics/bullet/bullet-rigid-body.ts
+++ b/cocos/physics/bullet/bullet-rigid-body.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { Vec3 } from '../../core';
import { BulletWorld } from './bullet-world';
import { cocos2BulletVec3, bullet2CocosVec3 } from './bullet-utils';
diff --git a/cocos/physics/bullet/bullet-shared-body.ts b/cocos/physics/bullet/bullet-shared-body.ts
index 9c0f0efde5..76b79bf111 100644
--- a/cocos/physics/bullet/bullet-shared-body.ts
+++ b/cocos/physics/bullet/bullet-shared-body.ts
@@ -38,8 +38,6 @@ import { fastRemoveAt } from '../../core/utils/array';
import { bt } from './instantiated';
import { BulletConstraint } from './constraints/bullet-constraint';
-
-
const v3_0 = CC_V3_0;
const quat_0 = CC_QUAT_0;
let IDCounter = 0;
diff --git a/cocos/physics/bullet/bullet-utils.ts b/cocos/physics/bullet/bullet-utils.ts
index 4948ef61e8..1a668b94b8 100644
--- a/cocos/physics/bullet/bullet-utils.ts
+++ b/cocos/physics/bullet/bullet-utils.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { IVec3Like, IQuatLike } from '../../core/math/type-define';
import { Mesh } from '../../3d';
import { PrimitiveMode } from '../../core/gfx';
diff --git a/cocos/physics/bullet/bullet-world.ts b/cocos/physics/bullet/bullet-world.ts
index 8115c5966c..fc7faff2d2 100644
--- a/cocos/physics/bullet/bullet-world.ts
+++ b/cocos/physics/bullet/bullet-world.ts
@@ -24,8 +24,6 @@
THE SOFTWARE.
*/
-
-
import { BulletSharedBody } from './bullet-shared-body';
import { BulletRigidBody } from './bullet-rigid-body';
import { BulletShape } from './shapes/bullet-shape';
diff --git a/cocos/physics/bullet/constraints/bullet-constraint.ts b/cocos/physics/bullet/constraints/bullet-constraint.ts
index 999823a769..853b8a4745 100644
--- a/cocos/physics/bullet/constraints/bullet-constraint.ts
+++ b/cocos/physics/bullet/constraints/bullet-constraint.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
/* eslint-disable new-cap */
import { IBaseConstraint } from '../../spec/i-physics-constraint';
import { Constraint, RigidBody } from '../../framework';
diff --git a/cocos/physics/bullet/constraints/bullet-hinge-constraint.ts b/cocos/physics/bullet/constraints/bullet-hinge-constraint.ts
index 251842450e..130ed292c4 100644
--- a/cocos/physics/bullet/constraints/bullet-hinge-constraint.ts
+++ b/cocos/physics/bullet/constraints/bullet-hinge-constraint.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
/* eslint-disable new-cap */
import { BulletConstraint } from './bullet-constraint';
import { IHingeConstraint } from '../../spec/i-physics-constraint';
diff --git a/cocos/physics/bullet/constraints/bullet-p2p-constraint.ts b/cocos/physics/bullet/constraints/bullet-p2p-constraint.ts
index eb1532535e..0c6b9e5a57 100644
--- a/cocos/physics/bullet/constraints/bullet-p2p-constraint.ts
+++ b/cocos/physics/bullet/constraints/bullet-p2p-constraint.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
/* eslint-disable new-cap */
import { BulletConstraint } from './bullet-constraint';
import { IPointToPointConstraint } from '../../spec/i-physics-constraint';
diff --git a/cocos/physics/bullet/instantiate.ts b/cocos/physics/bullet/instantiate.ts
index 0812a076f9..1b10041c33 100644
--- a/cocos/physics/bullet/instantiate.ts
+++ b/cocos/physics/bullet/instantiate.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { Game, game } from '../../core';
import { selector } from '../framework/physics-selector';
import { BulletRigidBody } from './bullet-rigid-body';
diff --git a/cocos/physics/bullet/shapes/bullet-box-shape.ts b/cocos/physics/bullet/shapes/bullet-box-shape.ts
index 0f69b07ea3..66f2af7174 100644
--- a/cocos/physics/bullet/shapes/bullet-box-shape.ts
+++ b/cocos/physics/bullet/shapes/bullet-box-shape.ts
@@ -24,8 +24,6 @@
THE SOFTWARE.
*/
-
-
import { BulletShape } from './bullet-shape';
import { Vec3 } from '../../../core';
import { BoxCollider, PhysicsSystem } from '../../../../exports/physics-framework';
diff --git a/cocos/physics/bullet/shapes/bullet-capsule-shape.ts b/cocos/physics/bullet/shapes/bullet-capsule-shape.ts
index c5da24b4ad..db7e6db079 100644
--- a/cocos/physics/bullet/shapes/bullet-capsule-shape.ts
+++ b/cocos/physics/bullet/shapes/bullet-capsule-shape.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { absMax } from '../../../core';
import { BulletShape } from './bullet-shape';
import { CapsuleCollider } from '../../../../exports/physics-framework';
diff --git a/cocos/physics/bullet/shapes/bullet-cone-shape.ts b/cocos/physics/bullet/shapes/bullet-cone-shape.ts
index c974d8539d..53ae7c4ca0 100644
--- a/cocos/physics/bullet/shapes/bullet-cone-shape.ts
+++ b/cocos/physics/bullet/shapes/bullet-cone-shape.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { BulletShape } from './bullet-shape';
import { ConeCollider } from '../../../../exports/physics-framework';
import { ICylinderShape } from '../../spec/i-physics-shape';
diff --git a/cocos/physics/bullet/shapes/bullet-cylinder-shape.ts b/cocos/physics/bullet/shapes/bullet-cylinder-shape.ts
index b649aa365e..ea39974116 100644
--- a/cocos/physics/bullet/shapes/bullet-cylinder-shape.ts
+++ b/cocos/physics/bullet/shapes/bullet-cylinder-shape.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { BulletShape } from './bullet-shape';
import { CylinderCollider } from '../../../../exports/physics-framework';
import { ICylinderShape } from '../../spec/i-physics-shape';
diff --git a/cocos/physics/bullet/shapes/bullet-plane-shape.ts b/cocos/physics/bullet/shapes/bullet-plane-shape.ts
index d519dad3ab..e940e80a96 100644
--- a/cocos/physics/bullet/shapes/bullet-plane-shape.ts
+++ b/cocos/physics/bullet/shapes/bullet-plane-shape.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { BulletShape } from './bullet-shape';
import { PlaneCollider } from '../../../../exports/physics-framework';
import { cocos2BulletVec3 } from '../bullet-utils';
diff --git a/cocos/physics/bullet/shapes/bullet-shape.ts b/cocos/physics/bullet/shapes/bullet-shape.ts
index 9d96d69aeb..c49f312cd0 100644
--- a/cocos/physics/bullet/shapes/bullet-shape.ts
+++ b/cocos/physics/bullet/shapes/bullet-shape.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { Vec3 } from '../../../core/math';
import { Collider, PhysicsMaterial, PhysicsSystem } from '../../../../exports/physics-framework';
import { BulletWorld } from '../bullet-world';
diff --git a/cocos/physics/bullet/shapes/bullet-simplex-shape.ts b/cocos/physics/bullet/shapes/bullet-simplex-shape.ts
index f996c6cba2..b873355f17 100644
--- a/cocos/physics/bullet/shapes/bullet-simplex-shape.ts
+++ b/cocos/physics/bullet/shapes/bullet-simplex-shape.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { BulletShape } from './bullet-shape';
import { SimplexCollider } from '../../../../exports/physics-framework';
import { cocos2BulletVec3 } from '../bullet-utils';
diff --git a/cocos/physics/bullet/shapes/bullet-terrain-shape.ts b/cocos/physics/bullet/shapes/bullet-terrain-shape.ts
index 83814e2b50..2621a19c79 100644
--- a/cocos/physics/bullet/shapes/bullet-terrain-shape.ts
+++ b/cocos/physics/bullet/shapes/bullet-terrain-shape.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { BulletShape } from './bullet-shape';
import { Vec3, warn } from '../../../core';
import { TerrainCollider } from '../../../../exports/physics-framework';
diff --git a/cocos/physics/bullet/shapes/bullet-trimesh-shape.ts b/cocos/physics/bullet/shapes/bullet-trimesh-shape.ts
index 4cf40dbfaa..f129d2ccbb 100644
--- a/cocos/physics/bullet/shapes/bullet-trimesh-shape.ts
+++ b/cocos/physics/bullet/shapes/bullet-trimesh-shape.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { BulletShape } from './bullet-shape';
import { warnID } from '../../../core';
import { Mesh } from '../../../3d/assets';
diff --git a/cocos/physics/cannon/cannon-contact-equation.ts b/cocos/physics/cannon/cannon-contact-equation.ts
index 3acea14a05..da77ad78fd 100644
--- a/cocos/physics/cannon/cannon-contact-equation.ts
+++ b/cocos/physics/cannon/cannon-contact-equation.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { IContactEquation, ICollisionEvent } from '../framework';
import { IVec3Like, Quat, Vec3 } from '../../core';
import { CannonShape } from './shapes/cannon-shape';
diff --git a/cocos/physics/cannon/cannon-rigid-body.ts b/cocos/physics/cannon/cannon-rigid-body.ts
index d6eec05f1c..ecb446bb42 100644
--- a/cocos/physics/cannon/cannon-rigid-body.ts
+++ b/cocos/physics/cannon/cannon-rigid-body.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import CANNON from '@cocos/cannon';
import { Vec3 } from '../../core/math';
import { IRigidBody } from '../spec/i-rigid-body';
diff --git a/cocos/physics/cannon/cannon-shared-body.ts b/cocos/physics/cannon/cannon-shared-body.ts
index 7784b3644c..b10d45fb69 100644
--- a/cocos/physics/cannon/cannon-shared-body.ts
+++ b/cocos/physics/cannon/cannon-shared-body.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import CANNON from '@cocos/cannon';
import { Quat, Vec3 } from '../../core/math';
import { ERigidBodyType, PhysicsGroup } from '../framework/physics-enum';
diff --git a/cocos/physics/cannon/cannon-util.ts b/cocos/physics/cannon/cannon-util.ts
index c79757871c..1f80015edc 100644
--- a/cocos/physics/cannon/cannon-util.ts
+++ b/cocos/physics/cannon/cannon-util.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import CANNON from '@cocos/cannon';
import { getWrap } from '../utils/util';
import { IBaseShape } from '../spec/i-physics-shape';
diff --git a/cocos/physics/cannon/cannon-world.ts b/cocos/physics/cannon/cannon-world.ts
index afd430b042..ddaf03419e 100644
--- a/cocos/physics/cannon/cannon-world.ts
+++ b/cocos/physics/cannon/cannon-world.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import CANNON from '@cocos/cannon';
import { Vec3, Quat } from '../../core/math';
import { fillRaycastResult, toCannonRaycastOptions } from './cannon-util';
diff --git a/cocos/physics/cannon/constraints/cannon-constraint.ts b/cocos/physics/cannon/constraints/cannon-constraint.ts
index 6052d0f682..7983727c39 100644
--- a/cocos/physics/cannon/constraints/cannon-constraint.ts
+++ b/cocos/physics/cannon/constraints/cannon-constraint.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import CANNON from '@cocos/cannon';
import { IBaseConstraint } from '../../spec/i-physics-constraint';
import { Constraint, RigidBody } from '../../framework';
diff --git a/cocos/physics/cannon/constraints/cannon-hinge-constraint.ts b/cocos/physics/cannon/constraints/cannon-hinge-constraint.ts
index e0591a26c3..ca8e8ff102 100644
--- a/cocos/physics/cannon/constraints/cannon-hinge-constraint.ts
+++ b/cocos/physics/cannon/constraints/cannon-hinge-constraint.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import CANNON from '@cocos/cannon';
import { CannonConstraint } from './cannon-constraint';
import { IHingeConstraint } from '../../spec/i-physics-constraint';
diff --git a/cocos/physics/cannon/constraints/cannon-point-to-point-constraint.ts b/cocos/physics/cannon/constraints/cannon-point-to-point-constraint.ts
index 1c0c34d389..8d3f1911f5 100644
--- a/cocos/physics/cannon/constraints/cannon-point-to-point-constraint.ts
+++ b/cocos/physics/cannon/constraints/cannon-point-to-point-constraint.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import CANNON from '@cocos/cannon';
import { CannonConstraint } from './cannon-constraint';
import { IPointToPointConstraint } from '../../spec/i-physics-constraint';
diff --git a/cocos/physics/cannon/instantiate.ts b/cocos/physics/cannon/instantiate.ts
index 7404a4f237..81ed3905cf 100644
--- a/cocos/physics/cannon/instantiate.ts
+++ b/cocos/physics/cannon/instantiate.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { selector } from '../framework/physics-selector';
import { CannonRigidBody } from './cannon-rigid-body';
diff --git a/cocos/physics/cannon/shapes/cannon-box-shape.ts b/cocos/physics/cannon/shapes/cannon-box-shape.ts
index 4250625894..0f820941ae 100644
--- a/cocos/physics/cannon/shapes/cannon-box-shape.ts
+++ b/cocos/physics/cannon/shapes/cannon-box-shape.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import CANNON from '@cocos/cannon';
import { clamp, Vec3 } from '../../../core/math';
import { commitShapeUpdates } from '../cannon-util';
diff --git a/cocos/physics/cannon/shapes/cannon-cone-shape.ts b/cocos/physics/cannon/shapes/cannon-cone-shape.ts
index 1895daa3e4..9f0e8161ca 100644
--- a/cocos/physics/cannon/shapes/cannon-cone-shape.ts
+++ b/cocos/physics/cannon/shapes/cannon-cone-shape.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import CANNON from '@cocos/cannon';
import { Vec3 } from '../../../core/math';
import { CannonShape } from './cannon-shape';
diff --git a/cocos/physics/cannon/shapes/cannon-cylinder-shape.ts b/cocos/physics/cannon/shapes/cannon-cylinder-shape.ts
index 9c00475d46..5f44172b8b 100644
--- a/cocos/physics/cannon/shapes/cannon-cylinder-shape.ts
+++ b/cocos/physics/cannon/shapes/cannon-cylinder-shape.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import CANNON from '@cocos/cannon';
import { Vec3 } from '../../../core/math';
import { CannonShape } from './cannon-shape';
diff --git a/cocos/physics/cannon/shapes/cannon-plane-shape.ts b/cocos/physics/cannon/shapes/cannon-plane-shape.ts
index 58187d976a..4f50ea5161 100644
--- a/cocos/physics/cannon/shapes/cannon-plane-shape.ts
+++ b/cocos/physics/cannon/shapes/cannon-plane-shape.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import CANNON from '@cocos/cannon';
import { Vec3, Quat } from '../../../core/math';
import { commitShapeUpdates } from '../cannon-util';
diff --git a/cocos/physics/cannon/shapes/cannon-shape.ts b/cocos/physics/cannon/shapes/cannon-shape.ts
index 57c3c70706..c66b52c413 100644
--- a/cocos/physics/cannon/shapes/cannon-shape.ts
+++ b/cocos/physics/cannon/shapes/cannon-shape.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import CANNON from '@cocos/cannon';
import { Vec3, Quat } from '../../../core/math';
import { getWrap, setWrap } from '../../utils/util';
diff --git a/cocos/physics/cannon/shapes/cannon-simplex-shape.ts b/cocos/physics/cannon/shapes/cannon-simplex-shape.ts
index 9ea4e177af..6530bc866d 100644
--- a/cocos/physics/cannon/shapes/cannon-simplex-shape.ts
+++ b/cocos/physics/cannon/shapes/cannon-simplex-shape.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
/* eslint-disable func-names */
import CANNON from '@cocos/cannon';
import { Vec3 } from '../../../core/math';
diff --git a/cocos/physics/cannon/shapes/cannon-sphere-shape.ts b/cocos/physics/cannon/shapes/cannon-sphere-shape.ts
index b8d056378a..6f7b7febc6 100644
--- a/cocos/physics/cannon/shapes/cannon-sphere-shape.ts
+++ b/cocos/physics/cannon/shapes/cannon-sphere-shape.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import CANNON from '@cocos/cannon';
import { absMaxComponent, clamp, Vec3 } from '../../../core/math';
import { commitShapeUpdates } from '../cannon-util';
diff --git a/cocos/physics/cannon/shapes/cannon-terrain-shape.ts b/cocos/physics/cannon/shapes/cannon-terrain-shape.ts
index 73c2ff69e4..2a0001bbcc 100644
--- a/cocos/physics/cannon/shapes/cannon-terrain-shape.ts
+++ b/cocos/physics/cannon/shapes/cannon-terrain-shape.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import CANNON from '@cocos/cannon';
import { CannonShape } from './cannon-shape';
import { TerrainCollider } from '../../framework';
diff --git a/cocos/physics/cannon/shapes/cannon-trimesh-shape.ts b/cocos/physics/cannon/shapes/cannon-trimesh-shape.ts
index d6ac57a845..2d0c8eafc2 100644
--- a/cocos/physics/cannon/shapes/cannon-trimesh-shape.ts
+++ b/cocos/physics/cannon/shapes/cannon-trimesh-shape.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import CANNON from '@cocos/cannon';
import { CannonShape } from './cannon-shape';
import { MeshCollider } from '../../framework';
diff --git a/cocos/physics/cocos/builtin-interface.ts b/cocos/physics/cocos/builtin-interface.ts
index 482463d26f..c424f9c9d6 100644
--- a/cocos/physics/cocos/builtin-interface.ts
+++ b/cocos/physics/cocos/builtin-interface.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { Mat4, Quat, Vec3 } from '../../core/math';
import { IVec3Like, IQuatLike } from '../../core/math/type-define';
diff --git a/cocos/physics/cocos/builtin-rigid-body.ts b/cocos/physics/cocos/builtin-rigid-body.ts
index 8ef6df1f20..e9e3383e19 100644
--- a/cocos/physics/cocos/builtin-rigid-body.ts
+++ b/cocos/physics/cocos/builtin-rigid-body.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { IRigidBody } from '../spec/i-rigid-body';
import { IVec3Like } from '../../core';
import { RigidBody, PhysicsSystem, ERigidBodyType } from '../framework';
diff --git a/cocos/physics/cocos/builtin-shared-body.ts b/cocos/physics/cocos/builtin-shared-body.ts
index 02a5bf529b..59ded5c221 100644
--- a/cocos/physics/cocos/builtin-shared-body.ts
+++ b/cocos/physics/cocos/builtin-shared-body.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { Mat4, Quat, Vec3 } from '../../core/math';
import { intersect } from '../../core/geometry';
import { BuiltInWorld } from './builtin-world';
diff --git a/cocos/physics/cocos/builtin-world.ts b/cocos/physics/cocos/builtin-world.ts
index bb13048c64..1956381f29 100644
--- a/cocos/physics/cocos/builtin-world.ts
+++ b/cocos/physics/cocos/builtin-world.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { Vec3 } from '../../core/math';
import { PhysicsRayResult } from '../framework/physics-ray-result';
import { BuiltinSharedBody } from './builtin-shared-body';
diff --git a/cocos/physics/cocos/instantiate.ts b/cocos/physics/cocos/instantiate.ts
index d0d7003959..af175938ab 100644
--- a/cocos/physics/cocos/instantiate.ts
+++ b/cocos/physics/cocos/instantiate.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { selector } from '../framework/physics-selector';
import { BuiltInWorld } from './builtin-world';
import { BuiltinRigidBody } from './builtin-rigid-body';
diff --git a/cocos/physics/cocos/object/builtin-object.ts b/cocos/physics/cocos/object/builtin-object.ts
index 15b0e052f1..1f08600bd5 100644
--- a/cocos/physics/cocos/object/builtin-object.ts
+++ b/cocos/physics/cocos/object/builtin-object.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { PhysicsSystem } from '../../framework';
export class BuiltinObject {
diff --git a/cocos/physics/framework/assets/physics-material.ts b/cocos/physics/framework/assets/physics-material.ts
index 0ff3fc7f67..f7250b2b21 100644
--- a/cocos/physics/framework/assets/physics-material.ts
+++ b/cocos/physics/framework/assets/physics-material.ts
@@ -25,11 +25,6 @@
// @ts-check
-/**
- * @packageDocumentation
- * @module physics
- */
-
import { ccclass, editable, serializable } from 'cc.decorator';
import { Asset } from '../../../core/assets/asset';
import { math } from '../../../core';
diff --git a/cocos/physics/framework/collision-matrix.ts b/cocos/physics/framework/collision-matrix.ts
index 344501f746..642aef313f 100644
--- a/cocos/physics/framework/collision-matrix.ts
+++ b/cocos/physics/framework/collision-matrix.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module physics
- */
-
import { PhysicsGroup } from './physics-enum';
export class CollisionMatrix {
diff --git a/cocos/physics/framework/components/colliders/box-collider.ts b/cocos/physics/framework/components/colliders/box-collider.ts
index 1e114abcc7..d8a0f34ba0 100644
--- a/cocos/physics/framework/components/colliders/box-collider.ts
+++ b/cocos/physics/framework/components/colliders/box-collider.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module physics
- */
-
import {
ccclass,
help,
diff --git a/cocos/physics/framework/components/colliders/capsule-collider.ts b/cocos/physics/framework/components/colliders/capsule-collider.ts
index ae2074501e..2bacea503d 100644
--- a/cocos/physics/framework/components/colliders/capsule-collider.ts
+++ b/cocos/physics/framework/components/colliders/capsule-collider.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module physics
- */
-
import {
ccclass,
help,
diff --git a/cocos/physics/framework/components/colliders/collider.ts b/cocos/physics/framework/components/colliders/collider.ts
index dc0e085828..77b8c62fe5 100644
--- a/cocos/physics/framework/components/colliders/collider.ts
+++ b/cocos/physics/framework/components/colliders/collider.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module physics
- */
-
import { ccclass, tooltip, displayOrder, displayName, readOnly, type, serializable } from 'cc.decorator';
import { EDITOR } from 'internal:constants';
import { Eventify } from '../../../../core/event';
@@ -149,7 +144,7 @@ export class Collider extends Eventify(Component) {
* @en
* Gets or sets the collider is trigger, this will be always trigger if using builtin.
* @zh
- * 获取或设置碰撞器是否为触发器。(builtin中无论真假都为触发器)
+ * 获取或设置碰撞器是否为触发器。(builtin 中无论真假都为触发器)
*/
@displayOrder(0)
@tooltip('i18n:physics3d.collider.isTrigger')
@@ -312,7 +307,7 @@ export class Collider extends Eventify(Component) {
* Gets the group value.
* @zh
* 获取分组值。
- * @returns 整数,范围为 2 的 0 次方 到 2 的 31 次方
+ * @returns @zh 分组值,为 32 位整数,范围为 [2^0, 2^31] @en Group value which is a 32-bits integer, the range is [2^0, 2^31]
*/
public getGroup (): number {
if (this._isInitialized) {
@@ -326,7 +321,7 @@ export class Collider extends Eventify(Component) {
* Sets the group value.
* @zh
* 设置分组值。
- * @param v - 整数,范围为 2 的 0 次方 到 2 的 31 次方
+ * @param v @zh 分组值,为 32 位整数,范围为 [2^0, 2^31] @en Group value which is a 32-bits integer, the range is [2^0, 2^31]
*/
public setGroup (v: number): void {
if (this._isInitialized) {
@@ -339,7 +334,7 @@ export class Collider extends Eventify(Component) {
* Add a grouping value to fill in the group you want to join.
* @zh
* 添加分组值,可填要加入的 group。
- * @param v - 整数,范围为 2 的 0 次方 到 2 的 31 次方
+ * @param v @zh 分组值,为 32 位整数,范围为 [2^0, 2^31] @en Group value which is a 32-bits integer, the range is [2^0, 2^31]
*/
public addGroup (v: number) {
if (this._isInitialized) {
@@ -352,7 +347,7 @@ export class Collider extends Eventify(Component) {
* Subtract the grouping value to fill in the group to be removed.
* @zh
* 减去分组值,可填要移除的 group。
- * @param v - 整数,范围为 2 的 0 次方 到 2 的 31 次方
+ * @param v @zh 分组值,为 32 位整数,范围为 [2^0, 2^31] @en Group value which is a 32-bits integer, the range is [2^0, 2^31]
*/
public removeGroup (v: number) {
if (this._isInitialized) {
@@ -365,7 +360,7 @@ export class Collider extends Eventify(Component) {
* Gets the mask value.
* @zh
* 获取掩码值。
- * @returns 整数,范围为 2 的 0 次方 到 2 的 31 次方
+ * @returns @zh 掩码值,为 32 位整数,范围为 [2^0, 2^31] @en Mask value which is a 32-bits integer, the range is [2^0, 2^31]
*/
public getMask (): number {
if (this._isInitialized) {
@@ -379,7 +374,7 @@ export class Collider extends Eventify(Component) {
* Sets the mask value.
* @zh
* 设置掩码值。
- * @param v - 整数,范围为 2 的 0 次方 到 2 的 31 次方
+ * @param v @zh 掩码值,为 32 位整数,范围为 [2^0, 2^31] @en Mask value which is a 32-bits integer, the range is [2^0, 2^31]
*/
public setMask (v: number) {
if (this._isInitialized) {
@@ -392,7 +387,7 @@ export class Collider extends Eventify(Component) {
* Add mask values to fill in groups that need to be checked.
* @zh
* 添加掩码值,可填入需要检查的 group。
- * @param v - 整数,范围为 2 的 0 次方 到 2 的 31 次方
+ * @param v @zh 掩码值,为 32 位整数,范围为 [2^0, 2^31] @en Mask value which is a 32-bits integer, the range is [2^0, 2^31]
*/
public addMask (v: number) {
if (this._isInitialized) {
@@ -405,7 +400,7 @@ export class Collider extends Eventify(Component) {
* Subtract the mask value to fill in the group that does not need to be checked.
* @zh
* 减去掩码值,可填入不需要检查的 group。
- * @param v - 整数,范围为 2 的 0 次方 到 2 的 31 次方
+ * @param v @zh 掩码值,为 32 位整数,范围为 [2^0, 2^31] @en Mask value which is a 32-bits integer, the range is [2^0, 2^31]
*/
public removeMask (v: number) {
if (this._isInitialized) {
diff --git a/cocos/physics/framework/components/colliders/cone-collider.ts b/cocos/physics/framework/components/colliders/cone-collider.ts
index ee4830a166..c4a1157a76 100644
--- a/cocos/physics/framework/components/colliders/cone-collider.ts
+++ b/cocos/physics/framework/components/colliders/cone-collider.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module physics
- */
-
import {
ccclass,
help,
diff --git a/cocos/physics/framework/components/colliders/cylinder-collider.ts b/cocos/physics/framework/components/colliders/cylinder-collider.ts
index 3c5595e737..83a917f0b2 100644
--- a/cocos/physics/framework/components/colliders/cylinder-collider.ts
+++ b/cocos/physics/framework/components/colliders/cylinder-collider.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module physics
- */
-
import {
ccclass,
help,
diff --git a/cocos/physics/framework/components/colliders/mesh-collider.ts b/cocos/physics/framework/components/colliders/mesh-collider.ts
index 01bf50f03f..daf7c09ec8 100644
--- a/cocos/physics/framework/components/colliders/mesh-collider.ts
+++ b/cocos/physics/framework/components/colliders/mesh-collider.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module physics
- */
-
import {
ccclass,
help,
diff --git a/cocos/physics/framework/components/colliders/plane-collider.ts b/cocos/physics/framework/components/colliders/plane-collider.ts
index d985735b7b..cf329e5ddd 100644
--- a/cocos/physics/framework/components/colliders/plane-collider.ts
+++ b/cocos/physics/framework/components/colliders/plane-collider.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module physics
- */
-
import {
ccclass,
help,
diff --git a/cocos/physics/framework/components/colliders/simplex-collider.ts b/cocos/physics/framework/components/colliders/simplex-collider.ts
index 5f9fd905b8..88a2735936 100644
--- a/cocos/physics/framework/components/colliders/simplex-collider.ts
+++ b/cocos/physics/framework/components/colliders/simplex-collider.ts
@@ -25,11 +25,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module physics
- */
-
import {
ccclass,
help,
diff --git a/cocos/physics/framework/components/colliders/sphere-collider.ts b/cocos/physics/framework/components/colliders/sphere-collider.ts
index b20f476487..c938d8b0ce 100644
--- a/cocos/physics/framework/components/colliders/sphere-collider.ts
+++ b/cocos/physics/framework/components/colliders/sphere-collider.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module physics
- */
-
import {
ccclass,
help,
diff --git a/cocos/physics/framework/components/colliders/terrain-collider.ts b/cocos/physics/framework/components/colliders/terrain-collider.ts
index 0def7a1c8e..5dcc6f9440 100644
--- a/cocos/physics/framework/components/colliders/terrain-collider.ts
+++ b/cocos/physics/framework/components/colliders/terrain-collider.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module physics
- */
-
import {
ccclass,
help,
diff --git a/cocos/physics/framework/components/constant-force.ts b/cocos/physics/framework/components/constant-force.ts
index 0f6fd8abbd..40470ab6e9 100644
--- a/cocos/physics/framework/components/constant-force.ts
+++ b/cocos/physics/framework/components/constant-force.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module physics
- */
-
import {
ccclass,
help,
diff --git a/cocos/physics/framework/components/constraints/constraint.ts b/cocos/physics/framework/components/constraints/constraint.ts
index 7af7ba655a..b515fc9bf0 100644
--- a/cocos/physics/framework/components/constraints/constraint.ts
+++ b/cocos/physics/framework/components/constraints/constraint.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module physics
- */
-
import { ccclass, requireComponent, displayOrder, type, readOnly, serializable } from 'cc.decorator';
import { EDITOR } from 'internal:constants';
import { Component } from '../../../../core';
diff --git a/cocos/physics/framework/components/constraints/hinge-constraint.ts b/cocos/physics/framework/components/constraints/hinge-constraint.ts
index dd0279d4fb..e27ebb819b 100644
--- a/cocos/physics/framework/components/constraints/hinge-constraint.ts
+++ b/cocos/physics/framework/components/constraints/hinge-constraint.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module physics
- */
-
import {
ccclass,
help,
diff --git a/cocos/physics/framework/components/constraints/point-to-point-constraint.ts b/cocos/physics/framework/components/constraints/point-to-point-constraint.ts
index 238e152b0e..6efde7fc6d 100644
--- a/cocos/physics/framework/components/constraints/point-to-point-constraint.ts
+++ b/cocos/physics/framework/components/constraints/point-to-point-constraint.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module physics
- */
-
import {
ccclass,
help,
diff --git a/cocos/physics/framework/components/rigid-body.ts b/cocos/physics/framework/components/rigid-body.ts
index 5479144ba3..4f2f6f116a 100644
--- a/cocos/physics/framework/components/rigid-body.ts
+++ b/cocos/physics/framework/components/rigid-body.ts
@@ -25,11 +25,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module physics
- */
-
import {
ccclass,
help,
@@ -440,8 +435,8 @@ export class RigidBody extends Component {
* Apply force to a world point. This could, for example, be a point on the Body surface.
* @zh
* 在世界空间中,相对于刚体的质心的某点上对刚体施加作用力。
- * @param force - 作用力
- * @param relativePoint - 作用点,相对于刚体的质心
+ * @param force @zh 作用力 @en The force applied
+ * @param relativePoint @zh 作用点,相对于刚体的质心 @en The point to apply the force on, relative to the center of mass of the rigid body
*/
public applyForce (force: Vec3, relativePoint?: Vec3) {
if (this._isInitialized) this._body!.applyForce(force, relativePoint);
@@ -452,8 +447,8 @@ export class RigidBody extends Component {
* Apply force to a local point. This could, for example, be a point on the Body surface.
* @zh
* 在本地空间中,相对于刚体的质心的某点上对刚体施加作用力。
- * @param force - 作用力
- * @param localPoint - 作用点
+ * @param force @zh 作用力 @en The force applied
+ * @param localPoint @zh 作用点 @en The point to apply the force on
*/
public applyLocalForce (force: Vec3, localPoint?: Vec3) {
if (this._isInitialized) this._body!.applyLocalForce(force, localPoint);
@@ -464,8 +459,8 @@ export class RigidBody extends Component {
* In world space, impulse is applied to the rigid body at some point relative to the center of mass of the rigid body.
* @zh
* 在世界空间中,相对于刚体的质心的某点上对刚体施加冲量。
- * @param impulse - 冲量
- * @param relativePoint - 作用点,相对于刚体的中心点
+ * @param impulse @zh 冲量 @en The impulse applied
+ * @param relativePoint @zh 作用点,相对于刚体的中心点 @en The point to apply the impulse, relative to the center of mass of the rigid body
*/
public applyImpulse (impulse: Vec3, relativePoint?: Vec3) {
if (this._isInitialized) this._body!.applyImpulse(impulse, relativePoint);
@@ -476,8 +471,8 @@ export class RigidBody extends Component {
* In local space, impulse is applied to the rigid body at some point relative to the center of mass of the rigid body.
* @zh
* 在本地空间中,相对于刚体的质心的某点上对刚体施加冲量。
- * @param impulse - 冲量
- * @param localPoint - 作用点
+ * @param impulse @zh 冲量 @en The impulse applied
+ * @param localPoint @zh 作用点 @en The point to apply the impulse
*/
public applyLocalImpulse (impulse: Vec3, localPoint?: Vec3) {
if (this._isInitialized) this._body!.applyLocalImpulse(impulse, localPoint);
@@ -488,7 +483,7 @@ export class RigidBody extends Component {
* In world space, torque is applied to the rigid body.
* @zh
* 在世界空间中,对刚体施加扭矩。
- * @param torque - 扭矩
+ * @param torque @zh 扭矩 @en The torque applied
*/
public applyTorque (torque: Vec3) {
if (this._isInitialized) this._body!.applyTorque(torque);
@@ -497,7 +492,9 @@ export class RigidBody extends Component {
/**
* @zh
* 在本地空间中,对刚体施加扭矩。
- * @param torque - 扭矩
+ * @zh
+ * In local space, torque is applied to the rigid body.
+ * @param torque @zh 扭矩 @en The torque applied
*/
public applyLocalTorque (torque: Vec3) {
if (this._isInitialized) this._body!.applyLocalTorque(torque);
@@ -558,7 +555,7 @@ export class RigidBody extends Component {
* Gets the linear velocity.
* @zh
* 获取线性速度。
- * @param out 速度 Vec3
+ * @param out @zh 速度向量 @en The velocity vector
*/
public getLinearVelocity (out: Vec3) {
if (this._isInitialized) this._body!.getLinearVelocity(out);
@@ -569,7 +566,7 @@ export class RigidBody extends Component {
* Sets the linear velocity.
* @zh
* 设置线性速度。
- * @param value 速度 Vec3
+ * @param value @zh 速度向量 @en The velocity vector
*/
public setLinearVelocity (value: Vec3): void {
if (this._isInitialized) this._body!.setLinearVelocity(value);
@@ -580,7 +577,7 @@ export class RigidBody extends Component {
* Gets the angular velocity.
* @zh
* 获取旋转速度。
- * @param out 速度 Vec3
+ * @param out @zh 角速度向量 @en The angular velocity vector
*/
public getAngularVelocity (out: Vec3) {
if (this._isInitialized) this._body!.getAngularVelocity(out);
@@ -591,7 +588,7 @@ export class RigidBody extends Component {
* Sets the angular velocity.
* @zh
* 设置旋转速度。
- * @param value 速度 Vec3
+ * @param value @zh 角速度向量 @en The angular velocity vector
*/
public setAngularVelocity (value: Vec3): void {
if (this._isInitialized) this._body!.setAngularVelocity(value);
@@ -604,7 +601,7 @@ export class RigidBody extends Component {
* Gets the group value.
* @zh
* 获取分组值。
- * @returns 整数,范围为 2 的 0 次方 到 2 的 31 次方
+ * @returns @zh 分组值,为 32 位整数,范围为 [2^0, 2^31] @en Group value which is a 32-bits integer, the range is [2^0, 2^31]
*/
public getGroup (): number {
if (this._isInitialized) return this._body!.getGroup();
@@ -616,7 +613,7 @@ export class RigidBody extends Component {
* Sets the group value.
* @zh
* 设置分组值。
- * @param v - 整数,范围为 2 的 0 次方 到 2 的 31 次方
+ * @param v @zh 分组值,为 32 位整数,范围为 [2^0, 2^31] @en Group value which is a 32-bits integer, the range is [2^0, 2^31]
*/
public setGroup (v: number): void {
if (this._isInitialized) this._body!.setGroup(v);
@@ -627,7 +624,7 @@ export class RigidBody extends Component {
* Add a grouping value to fill in the group you want to join.
* @zh
* 添加分组值,可填要加入的 group。
- * @param v - 整数,范围为 2 的 0 次方 到 2 的 31 次方
+ * @param v @zh 分组值,为 32 位整数,范围为 [2^0, 2^31] @en Group value which is a 32-bits integer, the range is [2^0, 2^31]
*/
public addGroup (v: number) {
if (this._isInitialized) this._body!.addGroup(v);
@@ -638,7 +635,7 @@ export class RigidBody extends Component {
* Subtract the grouping value to fill in the group to be removed.
* @zh
* 减去分组值,可填要移除的 group。
- * @param v - 整数,范围为 2 的 0 次方 到 2 的 31 次方
+ * @param v @zh 分组值,为 32 位整数,范围为 [2^0, 2^31] @en Group value which is a 32-bits integer, the range is [2^0, 2^31]
*/
public removeGroup (v: number) {
if (this._isInitialized) this._body!.removeGroup(v);
@@ -649,7 +646,7 @@ export class RigidBody extends Component {
* Gets the mask value.
* @zh
* 获取掩码值。
- * @returns 整数,范围为 2 的 0 次方 到 2 的 31 次方
+ * @returns {number} @zh 掩码值,为 32 位整数,范围为 [2^0, 2^31] @en Mask value which is a 32-bits integer, the range is [2^0, 2^31]
*/
public getMask (): number {
if (this._isInitialized) return this._body!.getMask();
@@ -661,7 +658,7 @@ export class RigidBody extends Component {
* Sets the mask value.
* @zh
* 设置掩码值。
- * @param v - 整数,范围为 2 的 0 次方 到 2 的 31 次方
+ * @param v @zh 掩码值,为 32 位整数,范围为 [2^0, 2^31] @en Mask value which is a 32-bits integer, the range is [2^0, 2^31]
*/
public setMask (v: number) {
if (this._isInitialized) this._body!.setMask(v);
@@ -672,7 +669,7 @@ export class RigidBody extends Component {
* Add mask values to fill in groups that need to be checked.
* @zh
* 添加掩码值,可填入需要检查的 group。
- * @param v - 整数,范围为 2 的 0 次方 到 2 的 31 次方
+ * @param v @zh 掩码值,为 32 位整数,范围为 [2^0, 2^31] @en Mask value which is a 32-bits integer, the range is [2^0, 2^31]
*/
public addMask (v: number) {
if (this._isInitialized) this._body!.addMask(v);
@@ -683,7 +680,7 @@ export class RigidBody extends Component {
* Subtract the mask value to fill in the group that does not need to be checked.
* @zh
* 减去掩码值,可填入不需要检查的 group。
- * @param v - 整数,范围为 2 的 0 次方 到 2 的 31 次方
+ * @param v @zh 掩码值,为 32 位整数,范围为 [2^0, 2^31] @en Mask value which is a 32-bits integer, the range is [2^0, 2^31]
*/
public removeMask (v: number) {
if (this._isInitialized) this._body!.removeMask(v);
diff --git a/cocos/physics/framework/deprecated.ts b/cocos/physics/framework/deprecated.ts
index 78a79e0188..b0e75b5517 100644
--- a/cocos/physics/framework/deprecated.ts
+++ b/cocos/physics/framework/deprecated.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module physics
- */
-
import { PhysicsSystem } from './physics-system';
import { replaceProperty, removeProperty } from '../../core/utils/x-deprecated';
import { BoxCollider } from './components/colliders/box-collider';
diff --git a/cocos/physics/framework/index.ts b/cocos/physics/framework/index.ts
index 8742da8740..530128cbd5 100644
--- a/cocos/physics/framework/index.ts
+++ b/cocos/physics/framework/index.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { PhysicsSystem } from './physics-system';
import { PhysicsMaterial } from './assets/physics-material';
import { PhysicsRayResult } from './physics-ray-result';
diff --git a/cocos/physics/framework/physics-config.ts b/cocos/physics/framework/physics-config.ts
index 3aced326d5..090262d963 100644
--- a/cocos/physics/framework/physics-config.ts
+++ b/cocos/physics/framework/physics-config.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { IVec3Like } from '../../core';
export interface ICollisionMatrix {
diff --git a/cocos/physics/framework/physics-enum.ts b/cocos/physics/framework/physics-enum.ts
index d02925c897..579de3f6d2 100644
--- a/cocos/physics/framework/physics-enum.ts
+++ b/cocos/physics/framework/physics-enum.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module physics
- */
-
import { Enum } from '../../core';
export enum ERigidBodyType {
diff --git a/cocos/physics/framework/physics-interface.ts b/cocos/physics/framework/physics-interface.ts
index 43291f3ce0..f785d31b07 100644
--- a/cocos/physics/framework/physics-interface.ts
+++ b/cocos/physics/framework/physics-interface.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module physics
- */
-
import { IVec3Like } from '../../core/math';
import { Collider } from './components/colliders/collider';
diff --git a/cocos/physics/framework/physics-ray-result.ts b/cocos/physics/framework/physics-ray-result.ts
index d53e0529e4..177afdceed 100644
--- a/cocos/physics/framework/physics-ray-result.ts
+++ b/cocos/physics/framework/physics-ray-result.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module physics
- */
-
import { Vec3 } from '../../core/math';
import { Collider } from '../../../exports/physics-framework';
import { IVec3Like } from '../../core/math/type-define';
diff --git a/cocos/physics/framework/physics-selector.ts b/cocos/physics/framework/physics-selector.ts
index 6682b9b925..284a98d27c 100644
--- a/cocos/physics/framework/physics-selector.ts
+++ b/cocos/physics/framework/physics-selector.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
/* eslint-disable import/no-mutable-exports */
/* eslint-disable @typescript-eslint/restrict-template-expressions */
/* eslint-disable @typescript-eslint/no-unsafe-return */
diff --git a/cocos/physics/framework/physics-system.ts b/cocos/physics/framework/physics-system.ts
index a1fe60ae68..6244217579 100644
--- a/cocos/physics/framework/physics-system.ts
+++ b/cocos/physics/framework/physics-system.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module physics
- */
-
import { EDITOR } from 'internal:constants';
import { Vec3 } from '../../core/math';
import { IRaycastOptions } from '../spec/i-physics-world';
@@ -408,11 +403,12 @@ export class PhysicsSystem extends System implements IWorldInitData {
* Collision detect all collider, and record all the detected results, through PhysicsSystem.Instance.RaycastResults access to the results.
* @zh
* 检测所有的碰撞盒,并记录所有被检测到的结果,通过 PhysicsSystem.instance.raycastResults 访问结果。
- * @param worldRay 世界空间下的一条射线
- * @param mask 掩码,默认为 0xffffffff
- * @param maxDistance 最大检测距离,默认为 10000000,目前请勿传入 Infinity 或 Number.MAX_VALUE
- * @param queryTrigger 是否检测触发器
- * @return boolean 表示是否有检测到碰撞盒
+ * @param worldRay @zh 世界空间下的一条射线 @en A ray in world space
+ * @param mask @zh 掩码,默认为 0xffffffff @en Mask, default value is 0xffffffff
+ * @param maxDistance @zh 最大检测距离,默认为 10000000,目前请勿传入 Infinity 或 Number.MAX_VALUE
+ * @en Maximum detection distance, default value is 10000000, do not pass Infinity or Number.MAX_VALUE for now
+ * @param queryTrigger @zh 是否检测触发器 @en Whether to detect triggers
+ * @return {boolean} @zh 表示是否有检测到碰撞 @en Indicates whether a collision has been detected
*/
raycast (worldRay: Ray, mask = 0xffffffff, maxDistance = 10000000, queryTrigger = true): boolean {
if (!this.physicsWorld) return false;
@@ -430,11 +426,12 @@ export class PhysicsSystem extends System implements IWorldInitData {
* by PhysicsSystem.Instance.RaycastClosestResult access to the results.
* @zh
* 检测所有的碰撞盒,并记录与射线距离最短的检测结果,通过 PhysicsSystem.instance.raycastClosestResult 访问结果。
- * @param worldRay 世界空间下的一条射线
- * @param mask 掩码,默认为 0xffffffff
- * @param maxDistance 最大检测距离,默认为 10000000,目前请勿传入 Infinity 或 Number.MAX_VALUE
- * @param queryTrigger 是否检测触发器
- * @return boolean 表示是否有检测到碰撞盒
+ * @param worldRay @zh 世界空间下的一条射线 @en A ray in world space
+ * @param mask @zh 掩码,默认为 0xffffffff @en Mask, default value is 0xffffffff
+ * @param maxDistance @zh 最大检测距离,默认为 10000000,目前请勿传入 Infinity 或 Number.MAX_VALUE
+ * @en Maximum detection distance, default value is 10000000, do not pass Infinity or Number.MAX_VALUE for now
+ * @param queryTrigger @zh 是否检测触发器 @en Whether to detect triggers
+ * @return {boolean} @zh 表示是否有检测到碰撞 @en Indicates whether a collision has been detected
*/
raycastClosest (worldRay: Ray, mask = 0xffffffff, maxDistance = 10000000, queryTrigger = true): boolean {
if (!this.physicsWorld) return false;
diff --git a/cocos/physics/physx/instantiate.jsb.ts b/cocos/physics/physx/instantiate.jsb.ts
index d8ba7b2fa8..f5325cc416 100644
--- a/cocos/physics/physx/instantiate.jsb.ts
+++ b/cocos/physics/physx/instantiate.jsb.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
/**
* hack for jsb, shoule be refactor in futrue
*/
diff --git a/cocos/physics/physx/instantiate.ts b/cocos/physics/physx/instantiate.ts
index 10856d1a60..2f8a01215b 100644
--- a/cocos/physics/physx/instantiate.ts
+++ b/cocos/physics/physx/instantiate.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { selector } from '../framework/physics-selector';
import { PhysXWorld } from './physx-world';
diff --git a/cocos/physics/physx/joints/physx-distance-joint.ts b/cocos/physics/physx/joints/physx-distance-joint.ts
index d006710098..743fb3777e 100644
--- a/cocos/physics/physx/joints/physx-distance-joint.ts
+++ b/cocos/physics/physx/joints/physx-distance-joint.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { IVec3Like, Quat, Vec3 } from '../../../core';
import { PointToPointConstraint } from '../../framework';
import { IPointToPointConstraint } from '../../spec/i-physics-constraint';
diff --git a/cocos/physics/physx/joints/physx-fixed-joint.ts b/cocos/physics/physx/joints/physx-fixed-joint.ts
index 2faa80ac1d..1af6df9159 100644
--- a/cocos/physics/physx/joints/physx-fixed-joint.ts
+++ b/cocos/physics/physx/joints/physx-fixed-joint.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { IVec3Like } from '../../../core';
import { PointToPointConstraint } from '../../framework';
import { IPointToPointConstraint } from '../../spec/i-physics-constraint';
diff --git a/cocos/physics/physx/joints/physx-joint.ts b/cocos/physics/physx/joints/physx-joint.ts
index 5d9e995cd5..53eddb1b8d 100644
--- a/cocos/physics/physx/joints/physx-joint.ts
+++ b/cocos/physics/physx/joints/physx-joint.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
/* eslint-disable @typescript-eslint/no-unsafe-return */
import { Constraint, RigidBody } from '../../framework';
import { IBaseConstraint } from '../../spec/i-physics-constraint';
diff --git a/cocos/physics/physx/joints/physx-revolute-joint.ts b/cocos/physics/physx/joints/physx-revolute-joint.ts
index 248a0fbc20..8110e588f2 100644
--- a/cocos/physics/physx/joints/physx-revolute-joint.ts
+++ b/cocos/physics/physx/joints/physx-revolute-joint.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { IVec3Like, Quat, Vec3 } from '../../../core';
import { HingeConstraint } from '../../framework';
import { IHingeConstraint } from '../../spec/i-physics-constraint';
diff --git a/cocos/physics/physx/physx-adapter.ts b/cocos/physics/physx/physx-adapter.ts
index ca00724b78..1fee301180 100644
--- a/cocos/physics/physx/physx-adapter.ts
+++ b/cocos/physics/physx/physx-adapter.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
/* eslint-disable import/no-mutable-exports */
/* eslint-disable no-console */
/* eslint-disable @typescript-eslint/restrict-template-expressions */
diff --git a/cocos/physics/physx/physx-contact-equation.ts b/cocos/physics/physx/physx-contact-equation.ts
index baa478cdf2..33016b59f7 100644
--- a/cocos/physics/physx/physx-contact-equation.ts
+++ b/cocos/physics/physx/physx-contact-equation.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { IVec3Like, Vec3, Quat } from '../../core';
import { IContactEquation, ICollisionEvent, Collider } from '../framework';
import { getContactNormal, getContactPosition } from './physx-adapter';
diff --git a/cocos/physics/physx/physx-enum.ts b/cocos/physics/physx/physx-enum.ts
index 8d52dae220..4b1cb94037 100644
--- a/cocos/physics/physx/physx-enum.ts
+++ b/cocos/physics/physx/physx-enum.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
/* eslint-disable max-len */
/* eslint-disable no-tabs */
diff --git a/cocos/physics/physx/physx-rigid-body.ts b/cocos/physics/physx/physx-rigid-body.ts
index 93746c7dad..3420a5f7ed 100644
--- a/cocos/physics/physx/physx-rigid-body.ts
+++ b/cocos/physics/physx/physx-rigid-body.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
/* eslint-disable @typescript-eslint/no-unsafe-return */
import { IVec3Like, Vec3 } from '../../core';
import { ERigidBodyType, PhysicsSystem, RigidBody } from '../framework';
diff --git a/cocos/physics/physx/physx-shared-body.ts b/cocos/physics/physx/physx-shared-body.ts
index 09b7611050..8dca8fb10a 100644
--- a/cocos/physics/physx/physx-shared-body.ts
+++ b/cocos/physics/physx/physx-shared-body.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
/* eslint-disable @typescript-eslint/no-unsafe-return */
import { Node, Quat, Vec3 } from '../../core';
import { PhysXRigidBody } from './physx-rigid-body';
diff --git a/cocos/physics/physx/physx-world.ts b/cocos/physics/physx/physx-world.ts
index 09ca294eae..c1bfe16614 100644
--- a/cocos/physics/physx/physx-world.ts
+++ b/cocos/physics/physx/physx-world.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
/* eslint-disable @typescript-eslint/no-unsafe-return */
import { Ray } from '../../core/geometry';
import { IPhysicsWorld, IRaycastOptions } from '../spec/i-physics-world';
diff --git a/cocos/physics/physx/physx.asmjs.ts b/cocos/physics/physx/physx.asmjs.ts
index 0fb16c86be..d01c92ab25 100644
--- a/cocos/physics/physx/physx.asmjs.ts
+++ b/cocos/physics/physx/physx.asmjs.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
/**
* export PhysX from internal module
*/
diff --git a/cocos/physics/physx/physx.null.ts b/cocos/physics/physx/physx.null.ts
index 0e42db1ac4..adb72452f7 100644
--- a/cocos/physics/physx/physx.null.ts
+++ b/cocos/physics/physx/physx.null.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
/**
* export null for module elimination
*/
diff --git a/cocos/physics/physx/shapes/physx-box-shape.ts b/cocos/physics/physx/shapes/physx-box-shape.ts
index 523409ce09..2f7413224e 100644
--- a/cocos/physics/physx/shapes/physx-box-shape.ts
+++ b/cocos/physics/physx/shapes/physx-box-shape.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { BoxCollider } from '../../framework';
import { absolute, VEC3_0 } from '../../utils/util';
import { IBoxShape } from '../../spec/i-physics-shape';
diff --git a/cocos/physics/physx/shapes/physx-capsule-shape.ts b/cocos/physics/physx/shapes/physx-capsule-shape.ts
index 57239c768e..81ae841e76 100644
--- a/cocos/physics/physx/shapes/physx-capsule-shape.ts
+++ b/cocos/physics/physx/shapes/physx-capsule-shape.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { absMax, Quat } from '../../../core';
import { CapsuleCollider, EAxisDirection } from '../../framework';
import { ICapsuleShape } from '../../spec/i-physics-shape';
diff --git a/cocos/physics/physx/shapes/physx-cone-shape.ts b/cocos/physics/physx/shapes/physx-cone-shape.ts
index 62d51ef88e..50ac6746f3 100644
--- a/cocos/physics/physx/shapes/physx-cone-shape.ts
+++ b/cocos/physics/physx/shapes/physx-cone-shape.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { Quat, Vec3 } from '../../../core';
import cylinder from '../../../primitive/cylinder';
import { ConeCollider, EAxisDirection } from '../../framework';
diff --git a/cocos/physics/physx/shapes/physx-cylinder-shape.ts b/cocos/physics/physx/shapes/physx-cylinder-shape.ts
index b12a830949..8fa0240212 100644
--- a/cocos/physics/physx/shapes/physx-cylinder-shape.ts
+++ b/cocos/physics/physx/shapes/physx-cylinder-shape.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { Quat, Vec3 } from '../../../core';
import cylinder from '../../../primitive/cylinder';
import { CylinderCollider, EAxisDirection } from '../../framework';
diff --git a/cocos/physics/physx/shapes/physx-plane-shape.ts b/cocos/physics/physx/shapes/physx-plane-shape.ts
index c0f06ad04d..28ea3e2f6f 100644
--- a/cocos/physics/physx/shapes/physx-plane-shape.ts
+++ b/cocos/physics/physx/shapes/physx-plane-shape.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { IVec3Like, Quat, Vec3 } from '../../../core';
import { PlaneCollider } from '../../framework';
import { IPlaneShape } from '../../spec/i-physics-shape';
diff --git a/cocos/physics/physx/shapes/physx-shape.ts b/cocos/physics/physx/shapes/physx-shape.ts
index a2b9cf2684..9f1cb4f9f0 100644
--- a/cocos/physics/physx/shapes/physx-shape.ts
+++ b/cocos/physics/physx/shapes/physx-shape.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
/* eslint-disable @typescript-eslint/no-unsafe-return */
import { IVec3Like, Quat, Vec3 } from '../../../core';
import { AABB, Sphere } from '../../../core/geometry';
diff --git a/cocos/physics/physx/shapes/physx-sphere-shape.ts b/cocos/physics/physx/shapes/physx-sphere-shape.ts
index 017cdbf5a7..2799023623 100644
--- a/cocos/physics/physx/shapes/physx-sphere-shape.ts
+++ b/cocos/physics/physx/shapes/physx-sphere-shape.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { absMaxComponent } from '../../../core';
import { SphereCollider } from '../../framework';
import { ISphereShape } from '../../spec/i-physics-shape';
diff --git a/cocos/physics/physx/shapes/physx-terrain-shape.ts b/cocos/physics/physx/shapes/physx-terrain-shape.ts
index 10c233f3a7..3a8fb9d4b4 100644
--- a/cocos/physics/physx/shapes/physx-terrain-shape.ts
+++ b/cocos/physics/physx/shapes/physx-terrain-shape.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { IVec3Like } from '../../../core';
import { PhysicsMaterial, TerrainCollider } from '../../framework';
import { ITerrainAsset } from '../../spec/i-external';
diff --git a/cocos/physics/physx/shapes/physx-trimesh-shape.ts b/cocos/physics/physx/shapes/physx-trimesh-shape.ts
index 780f4c07ea..51a049e05b 100644
--- a/cocos/physics/physx/shapes/physx-trimesh-shape.ts
+++ b/cocos/physics/physx/shapes/physx-trimesh-shape.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { IVec3Like, Quat, Vec3 } from '../../../core';
import { Mesh } from '../../../3d/assets';
diff --git a/cocos/physics/spec/i-external.ts b/cocos/physics/spec/i-external.ts
index 0b2a9a4634..7ce0bb3c8d 100644
--- a/cocos/physics/spec/i-external.ts
+++ b/cocos/physics/spec/i-external.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
export interface ITerrainAsset {
_uuid: string;
tileSize: number;
diff --git a/cocos/physics/spec/i-group-mask.ts b/cocos/physics/spec/i-group-mask.ts
index 0bbc11c7e4..439698f353 100644
--- a/cocos/physics/spec/i-group-mask.ts
+++ b/cocos/physics/spec/i-group-mask.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
export interface IGroupMask {
setGroup (v: number): void;
getGroup (): number;
diff --git a/cocos/physics/spec/i-lifecycle.ts b/cocos/physics/spec/i-lifecycle.ts
index 98322c5736..6b9c740925 100644
--- a/cocos/physics/spec/i-lifecycle.ts
+++ b/cocos/physics/spec/i-lifecycle.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
export interface ILifecycle {
/**
* @en Update is called every frame, if the Component is enabled.
diff --git a/cocos/physics/spec/i-physics-constraint.ts b/cocos/physics/spec/i-physics-constraint.ts
index 37c07964a1..8141bffa26 100644
--- a/cocos/physics/spec/i-physics-constraint.ts
+++ b/cocos/physics/spec/i-physics-constraint.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { ILifecycle } from './i-lifecycle';
import { Constraint, RigidBody } from '../framework';
import { IVec3Like } from '../../core';
diff --git a/cocos/physics/spec/i-physics-shape.ts b/cocos/physics/spec/i-physics-shape.ts
index 4875aa5d5f..8c218b1382 100644
--- a/cocos/physics/spec/i-physics-shape.ts
+++ b/cocos/physics/spec/i-physics-shape.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { ILifecycle } from './i-lifecycle';
import { IGroupMask } from './i-group-mask';
import { IVec3Like } from '../../core/math/type-define';
diff --git a/cocos/physics/spec/i-physics-world.ts b/cocos/physics/spec/i-physics-world.ts
index 722bcf1578..22544ffb57 100644
--- a/cocos/physics/spec/i-physics-world.ts
+++ b/cocos/physics/spec/i-physics-world.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { IVec3Like } from '../../core/math/type-define';
import { PhysicsRayResult } from '../framework/physics-ray-result';
import { Ray } from '../../core/geometry';
diff --git a/cocos/physics/spec/i-rigid-body.ts b/cocos/physics/spec/i-rigid-body.ts
index 1bf988460d..6300f27336 100644
--- a/cocos/physics/spec/i-rigid-body.ts
+++ b/cocos/physics/spec/i-rigid-body.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
import { ILifecycle } from './i-lifecycle';
import { IGroupMask } from './i-group-mask';
import { IVec3Like } from '../../core/math/type-define';
diff --git a/cocos/physics/utils/array-collision-matrix.ts b/cocos/physics/utils/array-collision-matrix.ts
index 0369b87f29..11e06373a1 100644
--- a/cocos/physics/utils/array-collision-matrix.ts
+++ b/cocos/physics/utils/array-collision-matrix.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
/**
* Collision "matrix". It's actually a triangular-shaped array of whether two bodies are touching this step, for reference next step
* @class ArrayCollisionMatrix
diff --git a/cocos/physics/utils/object-collision-matrix.ts b/cocos/physics/utils/object-collision-matrix.ts
index 723755ceaf..3272e226f4 100644
--- a/cocos/physics/utils/object-collision-matrix.ts
+++ b/cocos/physics/utils/object-collision-matrix.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
/**
* Records what objects are colliding with each other
* @class ObjectCollisionMatrix
diff --git a/cocos/physics/utils/tuple-dictionary.ts b/cocos/physics/utils/tuple-dictionary.ts
index ad491139fb..f89ff816b4 100644
--- a/cocos/physics/utils/tuple-dictionary.ts
+++ b/cocos/physics/utils/tuple-dictionary.ts
@@ -23,8 +23,6 @@
THE SOFTWARE.
*/
-
-
/**
* @class TupleDictionary
* @constructor
diff --git a/cocos/physics/utils/util.ts b/cocos/physics/utils/util.ts
index 03a2978bf1..c306656d06 100644
--- a/cocos/physics/utils/util.ts
+++ b/cocos/physics/utils/util.ts
@@ -23,7 +23,6 @@
THE SOFTWARE.
*/
-
import { equals, Vec3 } from '../../core';
import { IVec3Like, IQuatLike } from '../../core/math/type-define';
import { Collider, CollisionEventType, IContactEquation, TriggerEventType } from '../framework';
diff --git a/cocos/primitive/box.ts b/cocos/primitive/box.ts
index 8131865676..a0f9152ac1 100644
--- a/cocos/primitive/box.ts
+++ b/cocos/primitive/box.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module 3d/primitive
- */
-
import { Vec3 } from '../core/math';
import { IGeometry, IGeometryOptions } from './define';
diff --git a/cocos/primitive/capsule.ts b/cocos/primitive/capsule.ts
index d2047faa9d..54b98cb22d 100644
--- a/cocos/primitive/capsule.ts
+++ b/cocos/primitive/capsule.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module 3d/primitive
- */
-
import { Vec3 } from '../core/math';
/**
diff --git a/cocos/primitive/circle.ts b/cocos/primitive/circle.ts
index 56733c742e..0c30b4a0d3 100644
--- a/cocos/primitive/circle.ts
+++ b/cocos/primitive/circle.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module 3d/primitive
- */
-
import { PrimitiveMode } from '../core/gfx';
import { applyDefaultGeometryOptions, IGeometry, IGeometryOptions } from './define';
diff --git a/cocos/primitive/cone.ts b/cocos/primitive/cone.ts
index bfcf3160ef..9af308d4a9 100644
--- a/cocos/primitive/cone.ts
+++ b/cocos/primitive/cone.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module 3d/primitive
- */
-
import cylinder, { ICylinderOptions } from './cylinder';
import { IGeometry } from './define';
diff --git a/cocos/primitive/cylinder.ts b/cocos/primitive/cylinder.ts
index 7701d837ca..7d75a35666 100644
--- a/cocos/primitive/cylinder.ts
+++ b/cocos/primitive/cylinder.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module 3d/primitive
- */
-
import { Vec3 } from '../core/math';
import { IGeometry, IGeometryOptions } from './define';
@@ -38,10 +33,10 @@ import { IGeometry, IGeometryOptions } from './define';
* 圆柱参数选项。
*/
export interface ICylinderOptions extends IGeometryOptions {
- radialSegments: number;
- heightSegments: number;
- capped: boolean;
- arc: number;
+ radialSegments: number;
+ heightSegments: number;
+ capped: boolean;
+ arc: number;
}
const temp1 = new Vec3(0, 0, 0);
@@ -53,9 +48,10 @@ const temp2 = new Vec3(0, 0, 0);
* but may be repositioned through the `center` option.
* @zh
* 生成一个圆柱。
- * @param radiusTop 顶部半径。
- * @param radiusBottom 底部半径。
- * @param opts 圆柱参数选项。
+ * @param radiusTop @en Radius of top plane. @zh 顶部半径。
+ * @param radiusBottom @en Radius of bottom plane. @zh 底部半径。
+ * @param height @en The cylinder height. @zh 圆柱的高
+ * @param opts @en Options of cylinder. @zh 圆柱参数选项。
*/
export default function cylinder (radiusTop = 0.5, radiusBottom = 0.5, height = 2, opts: RecursivePartial = {}): IGeometry {
const halfHeight = height * 0.5;
diff --git a/cocos/primitive/define.ts b/cocos/primitive/define.ts
index e6a57a13ef..f45b70b78f 100644
--- a/cocos/primitive/define.ts
+++ b/cocos/primitive/define.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module 3d/primitive
- */
-
import { PrimitiveMode, Attribute } from '../core/gfx';
/**
diff --git a/cocos/primitive/index.ts b/cocos/primitive/index.ts
index baa6739a8b..77608aad3a 100644
--- a/cocos/primitive/index.ts
+++ b/cocos/primitive/index.ts
@@ -23,13 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @en A basic module for creating vertex data for 3D objects.
- * @zh 一个创建 3D 物体顶点数据的基础模块。
- * @packageDocumentation
- * @module 3d/primitive
- */
-
export * from './utils';
export * from './define';
export { default as box } from './box';
diff --git a/cocos/primitive/plane.ts b/cocos/primitive/plane.ts
index 9ba2558ae5..1a4c069f2a 100644
--- a/cocos/primitive/plane.ts
+++ b/cocos/primitive/plane.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module 3d/primitive
- */
-
import { Vec3 } from '../core/math';
import { applyDefaultGeometryOptions, IGeometry, IGeometryOptions } from './define';
diff --git a/cocos/primitive/primitive.ts b/cocos/primitive/primitive.ts
index 4c41c3d7b8..286c2b31d4 100644
--- a/cocos/primitive/primitive.ts
+++ b/cocos/primitive/primitive.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module 3d/primitive
- */
-
import { ccclass, type, serializable, editable } from 'cc.decorator';
import { createMesh } from '../3d/misc';
import { Mesh } from '../3d/assets/mesh';
diff --git a/cocos/primitive/quad.ts b/cocos/primitive/quad.ts
index af22fa826d..e286315b7a 100644
--- a/cocos/primitive/quad.ts
+++ b/cocos/primitive/quad.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module 3d/primitive
- */
-
import { applyDefaultGeometryOptions, IGeometry, IGeometryOptions } from './define';
/**
diff --git a/cocos/primitive/sphere.ts b/cocos/primitive/sphere.ts
index 254f95c416..678248ace2 100644
--- a/cocos/primitive/sphere.ts
+++ b/cocos/primitive/sphere.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module 3d/primitive
- */
-
import { Vec3 } from '../core/math';
import { IGeometry, IGeometryOptions } from './define';
@@ -44,8 +39,8 @@ interface ISphereOptions extends IGeometryOptions {
* Generate a shpere with radius 0.5.
* @zh
* 生成一个球。
- * @param radius 球半径。
- * @param options 参数选项。
+ * @param radius @en The radius. @zh 球半径。
+ * @param options @en The sphere creation options. @zh 参数选项。
*/
export default function sphere (radius = 0.5, opts: RecursivePartial = {}): IGeometry {
const segments = opts.segments !== undefined ? opts.segments : 32;
diff --git a/cocos/primitive/torus.ts b/cocos/primitive/torus.ts
index 03187c15b1..de5ca9cefe 100644
--- a/cocos/primitive/torus.ts
+++ b/cocos/primitive/torus.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module 3d/primitive
- */
-
import { Vec3 } from '../core/math';
import { IGeometryOptions } from './define';
@@ -36,9 +31,9 @@ import { IGeometryOptions } from './define';
* 环面参数选项。
*/
interface ITorusOptions extends IGeometryOptions {
- radialSegments: number;
- tubularSegments: number;
- arc: number;
+ radialSegments: number;
+ tubularSegments: number;
+ arc: number;
}
/**
diff --git a/cocos/primitive/transform.ts b/cocos/primitive/transform.ts
index 428e80ae6f..a808077d02 100644
--- a/cocos/primitive/transform.ts
+++ b/cocos/primitive/transform.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module 3d/primitive
- */
-
import { PrimitiveMode } from '../core/gfx';
import { IGeometry } from './define';
diff --git a/cocos/primitive/utils.ts b/cocos/primitive/utils.ts
index 0b7f200d4e..de5a311e6b 100644
--- a/cocos/primitive/utils.ts
+++ b/cocos/primitive/utils.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module 3d/primitive
- */
-
import { PrimitiveMode } from '../core/gfx';
import { IGeometry } from './define';
diff --git a/cocos/spine/assembler/simple.ts b/cocos/spine/assembler/simple.ts
index a5608d863a..d6d01ab854 100644
--- a/cocos/spine/assembler/simple.ts
+++ b/cocos/spine/assembler/simple.ts
@@ -1,4 +1,27 @@
+/*
+ Copyright (c) 2020-2022 Xiamen Yaji Software Co., Ltd.
+ https://www.cocos.com/
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated engine source code (the "Software"), a limited,
+ worldwide, royalty-free, non-assignable, revocable and non-exclusive license
+ to use Cocos Creator solely to develop games on your target platforms. You shall
+ not use Cocos Creator software for developing other software or tools that's
+ used for developing games. You are not granted to publish, distribute,
+ sublicense, and/or sell copies of Cocos Creator.
+
+ The software or tools in this License Agreement are licensed, not sold.
+ Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ */
import spine from '../lib/spine-core.js';
import { IAssembler } from '../../2d/renderer/base';
@@ -14,10 +37,8 @@ import { legacyCC } from '../../core/global-exports';
import { StaticVBAccessor, StaticVBChunk } from '../../2d/renderer/static-vb-accessor';
import { RenderData } from '../../2d/renderer/render-data';
-const FLAG_BATCH = 0x10;
const FLAG_TWO_COLOR = 0x01;
-let _handleVal = 0x00;
const _quadTriangles = [0, 1, 2, 2, 3, 0];
const _slotColor = new Color(0, 0, 255, 255);
const _boneColor = new Color(255, 0, 0, 255);
@@ -261,7 +282,6 @@ function updateComponentRenderData (comp: Skeleton, batcher: Batcher2D) {
_mustFlush = true;
_premultipliedAlpha = comp.premultipliedAlpha;
_multiplier = 1.0;
- _handleVal = 0x00;
_needColor = false;
_vertexEffect = comp._effectDelegate && comp._effectDelegate._vertexEffect as any;
@@ -269,23 +289,12 @@ function updateComponentRenderData (comp: Skeleton, batcher: Batcher2D) {
_needColor = true;
}
- if (_useTint) {
- _handleVal |= FLAG_TWO_COLOR;
- }
-
- let worldMat: Mat4 | undefined;
- if (_comp.enableBatch) {
- worldMat = _node.worldMatrix as Mat4;
- _mustFlush = false;
- _handleVal |= FLAG_BATCH;
- }
-
if (comp.isAnimationCached()) {
// Traverse input assembler.
- cacheTraverse(worldMat);
+ cacheTraverse();
} else {
if (_vertexEffect) _vertexEffect.begin(comp._skeleton);
- realTimeTraverse(batcher, worldMat);
+ realTimeTraverse(batcher);
if (_vertexEffect) _vertexEffect.end();
}
// Ensure mesh buffer update
@@ -454,7 +463,7 @@ function fillVertices (skeletonColor: spine.Color,
}
}
-function realTimeTraverse (batcher: Batcher2D, worldMat?: Mat4) {
+function realTimeTraverse (batcher: Batcher2D) {
const rd = _renderData!;
_vbuf = rd.chunk.vb;
_ibuf = rd.indices!;
@@ -637,21 +646,6 @@ function realTimeTraverse (batcher: Batcher2D, worldMat?: Mat4) {
for (let ii = _indexOffset, nn = _indexOffset + _indexCount; ii < nn; ii++) {
_ibuf[ii] += _vertexOffset + chunkOffset;
}
-
- if (worldMat) {
- _m00 = worldMat.m00;
- _m04 = worldMat.m04;
- _m12 = worldMat.m12;
- _m01 = worldMat.m01;
- _m05 = worldMat.m05;
- _m13 = worldMat.m13;
- for (let ii = _vertexFloatOffset, nn = _vertexFloatOffset + _vertexFloatCount; ii < nn; ii += _perVertexSize) {
- _x = _vbuf[ii];
- _y = _vbuf[ii + 1];
- _vbuf[ii] = _x * _m00 + _y * _m04 + _m12;
- _vbuf[ii + 1] = _x * _m01 + _y * _m05 + _m13;
- }
- }
}
_vertexFloatOffset += _vertexFloatCount;
_vertexOffset += _vertexCount;
@@ -694,7 +688,7 @@ function realTimeTraverse (batcher: Batcher2D, worldMat?: Mat4) {
}
}
-function cacheTraverse (worldMat?: Mat4) {
+function cacheTraverse () {
const frame = _comp!._curFrame;
if (!frame) return;
@@ -715,18 +709,6 @@ function cacheTraverse (worldMat?: Mat4) {
let frameVFOffset = 0;
let frameIndexOffset = 0;
let segVFCount = 0;
- if (worldMat) {
- _m00 = worldMat.m00;
- _m01 = worldMat.m01;
- _m04 = worldMat.m04;
- _m05 = worldMat.m05;
- _m12 = worldMat.m12;
- _m13 = worldMat.m13;
- }
-
- const justTranslate = _m00 === 1 && _m01 === 0 && _m04 === 0 && _m05 === 1;
- const needBatch = (_handleVal & FLAG_BATCH);
- const calcTranslate = needBatch && justTranslate;
const colors = frame.colors;
let colorOffset = 0;
@@ -769,21 +751,6 @@ function cacheTraverse (worldMat?: Mat4) {
segVFCount = segInfo.vfCount;
vbuf.set(vertices.subarray(frameVFOffset, frameVFOffset + segVFCount), frameVFOffset);
- // Update local position to world position
- if (calcTranslate) {
- for (let ii = frameVFOffset, il = frameVFOffset + segVFCount; ii < il; ii += _perVertexSize) {
- vbuf[ii] += _m12;
- vbuf[ii + 1] += _m13;
- }
- } else if (needBatch) {
- for (let ii = frameVFOffset, il = frameVFOffset + segVFCount; ii < il; ii += _perVertexSize) {
- _x = vbuf[ii];
- _y = vbuf[ii + 1];
- vbuf[ii] = _x * _m00 + _y * _m04 + _m12;
- vbuf[ii + 1] = _x * _m01 + _y * _m05 + _m13;
- }
- }
-
// Update color
if (_needColor) {
// handle color
diff --git a/cocos/spine/attach-util.ts b/cocos/spine/attach-util.ts
index ef5a4445d4..22c215085e 100644
--- a/cocos/spine/attach-util.ts
+++ b/cocos/spine/attach-util.ts
@@ -1,9 +1,29 @@
-/**
- * @packageDocumentation
- * @module spine
+/*
+ Copyright (c) 2020-2022 Xiamen Yaji Software Co., Ltd.
+
+ https://www.cocos.com/
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated engine source code (the "Software"), a limited,
+ worldwide, royalty-free, non-assignable, revocable and non-exclusive license
+ to use Cocos Creator solely to develop games on your target platforms. You shall
+ not use Cocos Creator software for developing other software or tools that's
+ used for developing games. You are not granted to publish, distribute,
+ sublicense, and/or sell copies of Cocos Creator.
+
+ The software or tools in this License Agreement are licensed, not sold.
+ Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
*/
-import { Mat4, Vec3, Node } from '../core';
+import { Mat4, Node } from '../core';
import { Skeleton } from './skeleton';
import spine from './lib/spine-core.js';
import { FrameBoneInfo } from './skeleton-cache';
diff --git a/cocos/spine/deprecated.ts b/cocos/spine/deprecated.ts
new file mode 100644
index 0000000000..ab8bf92610
--- /dev/null
+++ b/cocos/spine/deprecated.ts
@@ -0,0 +1,34 @@
+/*
+ Copyright (c) 2020 Xiamen Yaji Software Co., Ltd.
+
+ https://www.cocos.com/
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated engine source code (the "Software"), a limited,
+ worldwide, royalty-free, non-assignable, revocable and non-exclusive license
+ to use Cocos Creator solely to develop games on your target platforms. You shall
+ not use Cocos Creator software for developing other software or tools that's
+ used for developing games. You are not granted to publish, distribute,
+ sublicense, and/or sell copies of Cocos Creator.
+
+ The software or tools in this License Agreement are licensed, not sold.
+ Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ */
+
+import { removeProperty } from '../core/utils/x-deprecated';
+import { Skeleton } from './skeleton';
+
+removeProperty(Skeleton.prototype, 'Skeleton', [
+ {
+ name: 'enableBatch',
+ suggest: 'Not support batch render mode',
+ },
+]);
diff --git a/cocos/spine/index.jsb.ts b/cocos/spine/index.jsb.ts
index 72cf3e9ce3..bf974f52ad 100644
--- a/cocos/spine/index.jsb.ts
+++ b/cocos/spine/index.jsb.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module spine
- */
-
import { ccenum } from '../core';
import { legacyCC } from '../core/global-exports';
diff --git a/cocos/spine/index.ts b/cocos/spine/index.ts
index 048f1455c8..bd25ed13d3 100644
--- a/cocos/spine/index.ts
+++ b/cocos/spine/index.ts
@@ -1,6 +1,26 @@
-/**
- * @packageDocumentation
- * @module spine
+/*
+ Copyright (c) 2020-2022 Xiamen Yaji Software Co., Ltd.
+
+ https://www.cocos.com/
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated engine source code (the "Software"), a limited,
+ worldwide, royalty-free, non-assignable, revocable and non-exclusive license
+ to use Cocos Creator solely to develop games on your target platforms. You shall
+ not use Cocos Creator software for developing other software or tools that's
+ used for developing games. You are not granted to publish, distribute,
+ sublicense, and/or sell copies of Cocos Creator.
+
+ The software or tools in this License Agreement are licensed, not sold.
+ Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
*/
import { ccenum } from '../core';
@@ -29,19 +49,16 @@ export * from './skeleton-data';
export * from './skeleton-texture';
export * from './vertex-effect-delegate';
export * from './assembler';
+export * from './deprecated';
export { spine };
/**
* @en
- * The global time scale of Spine.
+ * The attachment type of spine. It contains three type: REGION(0), BOUNDING_BOX(1), MESH(2) and SKINNED_MESH
* @zh
- * Spine 全局时间缩放率。
- * @example
- * sp.timeScale = 0.8;
+ * Attachment 类型枚举。类型包括 REGION,BOUNDING_BOX,MESH,SKINNED_MESH
*/
-
-// The attachment type of spine. It contains three type: REGION(0), BOUNDING_BOX(1), MESH(2) and SKINNED_MESH.
export enum ATTACHMENT_TYPE {
REGION = 0,
BOUNDING_BOX = 1,
diff --git a/cocos/spine/skeleton-cache.ts b/cocos/spine/skeleton-cache.ts
index e0089b3be0..525c332dc5 100644
--- a/cocos/spine/skeleton-cache.ts
+++ b/cocos/spine/skeleton-cache.ts
@@ -1,6 +1,26 @@
-/**
- * @packageDocumentation
- * @module spine
+/*
+ Copyright (c) 2020-2022 Xiamen Yaji Software Co., Ltd.
+
+ https://www.cocos.com/
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated engine source code (the "Software"), a limited,
+ worldwide, royalty-free, non-assignable, revocable and non-exclusive license
+ to use Cocos Creator solely to develop games on your target platforms. You shall
+ not use Cocos Creator software for developing other software or tools that's
+ used for developing games. You are not granted to publish, distribute,
+ sublicense, and/or sell copies of Cocos Creator.
+
+ The software or tools in this License Agreement are licensed, not sold.
+ Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
*/
import { TrackEntryListeners } from './track-entry-listeners';
diff --git a/cocos/spine/skeleton-data.ts b/cocos/spine/skeleton-data.ts
index 8b9862aa0d..664f77f6dc 100644
--- a/cocos/spine/skeleton-data.ts
+++ b/cocos/spine/skeleton-data.ts
@@ -1,6 +1,26 @@
-/**
- * @packageDocumentation
- * @module spine
+/*
+ Copyright (c) 2020-2022 Xiamen Yaji Software Co., Ltd.
+
+ https://www.cocos.com/
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated engine source code (the "Software"), a limited,
+ worldwide, royalty-free, non-assignable, revocable and non-exclusive license
+ to use Cocos Creator solely to develop games on your target platforms. You shall
+ not use Cocos Creator software for developing other software or tools that's
+ used for developing games. You are not granted to publish, distribute,
+ sublicense, and/or sell copies of Cocos Creator.
+
+ The software or tools in this License Agreement are licensed, not sold.
+ Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
*/
import { EDITOR } from 'internal:constants';
@@ -21,6 +41,8 @@ import { legacyCC } from '../core/global-exports';
@ccclass('sp.SkeletonData')
export class SkeletonData extends Asset {
/**
+ * @en See http://en.esotericsoftware.com/spine-json-format
+ * @zh 可查看 Spine 官方文档 http://zh.esotericsoftware.com/spine-json-format
* @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
*/
@serializable
@@ -67,6 +89,8 @@ export class SkeletonData extends Asset {
}
/**
+ * @en Texture array
+ * @zh 纹理数组
* @property {Texture2D[]} textures
*/
diff --git a/cocos/spine/skeleton-system.ts b/cocos/spine/skeleton-system.ts
index 9ca4ec82e4..68ba3c042b 100644
--- a/cocos/spine/skeleton-system.ts
+++ b/cocos/spine/skeleton-system.ts
@@ -1,7 +1,31 @@
+/*
+ Copyright (c) 2020-2022 Xiamen Yaji Software Co., Ltd.
+
+ https://www.cocos.com/
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated engine source code (the "Software"), a limited,
+ worldwide, royalty-free, non-assignable, revocable and non-exclusive license
+ to use Cocos Creator solely to develop games on your target platforms. You shall
+ not use Cocos Creator software for developing other software or tools that's
+ used for developing games. You are not granted to publish, distribute,
+ sublicense, and/or sell copies of Cocos Creator.
+
+ The software or tools in this License Agreement are licensed, not sold.
+ Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ */
+
import { director } from '../core/director';
import { System } from '../core/components';
import { Skeleton } from './skeleton';
-import { errorID } from '../core';
export class SkeletonSystem extends System {
/**
diff --git a/cocos/spine/skeleton-texture.ts b/cocos/spine/skeleton-texture.ts
index fdd7bdcc99..e2e6e47361 100644
--- a/cocos/spine/skeleton-texture.ts
+++ b/cocos/spine/skeleton-texture.ts
@@ -1,6 +1,26 @@
-/**
- * @packageDocumentation
- * @module spine
+/*
+ Copyright (c) 2020-2022 Xiamen Yaji Software Co., Ltd.
+
+ https://www.cocos.com/
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated engine source code (the "Software"), a limited,
+ worldwide, royalty-free, non-assignable, revocable and non-exclusive license
+ to use Cocos Creator solely to develop games on your target platforms. You shall
+ not use Cocos Creator software for developing other software or tools that's
+ used for developing games. You are not granted to publish, distribute,
+ sublicense, and/or sell copies of Cocos Creator.
+
+ The software or tools in this License Agreement are licensed, not sold.
+ Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
*/
import { Material, Texture2D } from '../core';
diff --git a/cocos/spine/skeleton.ts b/cocos/spine/skeleton.ts
index cea6967d91..aa11c2a933 100644
--- a/cocos/spine/skeleton.ts
+++ b/cocos/spine/skeleton.ts
@@ -1,6 +1,26 @@
-/**
- * @packageDocumentation
- * @module spine
+/*
+ Copyright (c) 2020-2022 Xiamen Yaji Software Co., Ltd.
+
+ https://www.cocos.com/
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated engine source code (the "Software"), a limited,
+ worldwide, royalty-free, non-assignable, revocable and non-exclusive license
+ to use Cocos Creator solely to develop games on your target platforms. You shall
+ not use Cocos Creator software for developing other software or tools that's
+ used for developing games. You are not granted to publish, distribute,
+ sublicense, and/or sell copies of Cocos Creator.
+
+ The software or tools in this License Agreement are licensed, not sold.
+ Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
*/
import { EDITOR } from 'internal:constants';
@@ -441,24 +461,6 @@ export class Skeleton extends UIRenderer {
}
get socketNodes () { return this._socketNodes; }
-
- /*
- * @en Enabled batch model, if skeleton is complex, do not enable batch, or will lower performance.
- * @zh 开启合批,如果渲染大量相同纹理,且结构简单的骨骼动画,开启合批可以降低drawcall,否则请不要开启,cpu消耗会上升。
- */
- // @tooltip('i18n:COMPONENT.skeleton.enabled_batch')
- // get enableBatch () { return this._enableBatch; }
- // set enableBatch (value) {
- // if (value != this._enableBatch) {
- // this._enableBatch = value;
- // this._updateBatch();
- // }
- // }
-
- // @serializable
- // private _enableBatch: boolean = true;
-
- public enableBatch = false;
// Frame cache
/**
* @internal
@@ -574,8 +576,10 @@ export class Skeleton extends UIRenderer {
// 由于 spine 的 skin 是无法二次替换的,所以只能设置默认的 skin
/**
- * @en The name of default skin.
- * @zh 默认的皮肤名称。
+ * @en
+ * The name of default skin.
+ * @zh
+ * 默认的皮肤名称。
* @property {String} defaultSkin
*/
@serializable
@@ -583,8 +587,10 @@ export class Skeleton extends UIRenderer {
protected defaultSkin = '';
/**
- * @en The name of default animation.
- * @zh 默认的动画名称。
+ * @en
+ * The name of default animation.
+ * @zh
+ * 默认的动画名称。
* @property {String} defaultAnimation
*/
@visible(false)
diff --git a/cocos/spine/track-entry-listeners.ts b/cocos/spine/track-entry-listeners.ts
index c9bc4fdfec..c2af46bd42 100644
--- a/cocos/spine/track-entry-listeners.ts
+++ b/cocos/spine/track-entry-listeners.ts
@@ -1,6 +1,26 @@
-/**
- * @packageDocumentation
- * @module spine
+/*
+ Copyright (c) 2020-2022 Xiamen Yaji Software Co., Ltd.
+
+ https://www.cocos.com/
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated engine source code (the "Software"), a limited,
+ worldwide, royalty-free, non-assignable, revocable and non-exclusive license
+ to use Cocos Creator solely to develop games on your target platforms. You shall
+ not use Cocos Creator software for developing other software or tools that's
+ used for developing games. You are not granted to publish, distribute,
+ sublicense, and/or sell copies of Cocos Creator.
+
+ The software or tools in this License Agreement are licensed, not sold.
+ Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
*/
import spine from './lib/spine-core.js';
diff --git a/cocos/spine/vertex-effect-delegate.ts b/cocos/spine/vertex-effect-delegate.ts
index c1f38ee4c0..d642564fa7 100644
--- a/cocos/spine/vertex-effect-delegate.ts
+++ b/cocos/spine/vertex-effect-delegate.ts
@@ -1,6 +1,26 @@
-/**
- * @packageDocumentation
- * @module spine
+/*
+ Copyright (c) 2020-2022 Xiamen Yaji Software Co., Ltd.
+
+ https://www.cocos.com/
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated engine source code (the "Software"), a limited,
+ worldwide, royalty-free, non-assignable, revocable and non-exclusive license
+ to use Cocos Creator solely to develop games on your target platforms. You shall
+ not use Cocos Creator software for developing other software or tools that's
+ used for developing games. You are not granted to publish, distribute,
+ sublicense, and/or sell copies of Cocos Creator.
+
+ The software or tools in this License Agreement are licensed, not sold.
+ Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
*/
import spine from './lib/spine-core.js';
diff --git a/cocos/terrain/height-field.ts b/cocos/terrain/height-field.ts
index f232694a59..2f2176afb6 100644
--- a/cocos/terrain/height-field.ts
+++ b/cocos/terrain/height-field.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module terrain
- */
-
import { clamp } from '../core/math';
export class HeightField {
diff --git a/cocos/terrain/terrain-asset.ts b/cocos/terrain/terrain-asset.ts
index 2407fb1846..d37cc1191a 100644
--- a/cocos/terrain/terrain-asset.ts
+++ b/cocos/terrain/terrain-asset.ts
@@ -23,13 +23,8 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module terrain
- */
import { ccclass, serializable } from 'cc.decorator';
import { Asset, Texture2D } from '../core/assets';
-import { legacyCC } from '../core/global-exports';
export const TERRAIN_MAX_LEVELS = 4;
export const TERRAIN_MAX_BLEND_LAYERS = 4;
diff --git a/cocos/terrain/terrain.ts b/cocos/terrain/terrain.ts
index e4bfb973df..cc217c894b 100644
--- a/cocos/terrain/terrain.ts
+++ b/cocos/terrain/terrain.ts
@@ -23,10 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module terrain
- */
import { ccclass, disallowMultiple, executeInEditMode, help, visible, type, serializable, editable, disallowAnimation } from 'cc.decorator';
import { JSB } from 'internal:constants';
import { builtinResMgr } from '../core/builtin';
@@ -792,7 +788,7 @@ export class TerrainBlock {
public _getMaterialDefines (nlayers: number): MacroRecord {
return {
LAYERS: nlayers + 1,
- USE_LIGHTMAP: this.lightmap !== null ? 1 : 0,
+ CC_USE_LIGHTMAP: this.lightmap !== null ? 1 : 0,
USE_NORMALMAP: this._terrain.useNormalMap ? 1 : 0,
USE_PBR: this._terrain.usePBR ? 1 : 0,
// CC_RECEIVE_SHADOW: this._terrain.receiveShadow ? 1 : 0,
@@ -2209,7 +2205,7 @@ export class Terrain extends Component {
}
const terrainAsset = this.__asset;
- if (this._buitinAsset != terrainAsset) {
+ if (this._buitinAsset !== terrainAsset) {
this._buitinAsset = terrainAsset;
}
diff --git a/cocos/tiledmap/assembler/simple.ts b/cocos/tiledmap/assembler/simple.ts
index 2334097516..571ace2dbc 100644
--- a/cocos/tiledmap/assembler/simple.ts
+++ b/cocos/tiledmap/assembler/simple.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui-assembler
- */
-
import { Mat4, Size, Vec3 } from '../../core/math';
import { IAssembler } from '../../2d/renderer/base';
import { MeshRenderData } from '../../2d/renderer/render-data';
diff --git a/cocos/tiledmap/index.ts b/cocos/tiledmap/index.ts
index 238caccfc5..9c4b8315d3 100644
--- a/cocos/tiledmap/index.ts
+++ b/cocos/tiledmap/index.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module tiledmap
- */
-
export * from './tiled-map';
export * from './tiled-map-asset';
export * from './tiled-layer';
diff --git a/cocos/tiledmap/tiled-layer.ts b/cocos/tiledmap/tiled-layer.ts
index cd5070401c..e41546ea7c 100644
--- a/cocos/tiledmap/tiled-layer.ts
+++ b/cocos/tiledmap/tiled-layer.ts
@@ -25,11 +25,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module tiledmap
- */
-
import { ccclass } from 'cc.decorator';
import { EDITOR } from 'internal:constants';
@@ -1441,6 +1436,10 @@ export class TiledLayer extends UIRenderer {
}
/**
+ * @en
+ * Index of mesh render data array
+ * @zh
+ * 网格渲染数据数组的索引
* @deprecated since v3.5.0, this is an engine private interface that will be removed in the future.
*/
public _meshRenderDataArrayIdx = 0;
diff --git a/cocos/tiledmap/tiled-map-asset.ts b/cocos/tiledmap/tiled-map-asset.ts
index 8cc4cb3aab..84f673a0db 100644
--- a/cocos/tiledmap/tiled-map-asset.ts
+++ b/cocos/tiledmap/tiled-map-asset.ts
@@ -24,17 +24,16 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module tiledmap
- */
-
import { ccclass, type, serializable } from 'cc.decorator';
import { Asset } from '../core/assets/asset';
import { CCString, Size, TextAsset } from '../core';
import { SpriteFrame } from '../2d/assets';
+
/**
+ * @en
* Class for tiled map asset handling.
+ * @zh
+ * 用于获取 tiled map 资源类
* @class TiledMapAsset
* @extends Asset
*
@@ -53,13 +52,20 @@ export class TiledMapAsset extends Asset {
tsxFileNames: string[] = [];
/**
- * @zh s
+ * @en
+ * SpriteFrame array
+ * @zh
+ * SpriteFrame 数组
*/
@serializable
@type([SpriteFrame])
spriteFrames: SpriteFrame[] = [];
/**
+ * @en
+ * ImageLayerSpriteFrame array
+ * @zh
+ * ImageLayerSpriteFrame 数组
* @property {SpriteFrame[]} imageLayerSpriteFrame
*/
@serializable
@@ -67,6 +73,10 @@ export class TiledMapAsset extends Asset {
imageLayerSpriteFrame: SpriteFrame[] = []
/**
+ * @en
+ * Name of each object in imageLayerSpriteFrame
+ * @zh
+ * 每个 imageLayerSpriteFrame 名称
* @property {String[]} imageLayerTextureNames
*/
@serializable
@@ -74,6 +84,10 @@ export class TiledMapAsset extends Asset {
imageLayerSpriteFrameNames: string[] = [];
/**
+ * @en
+ * Name of each object in spriteFrames
+ * @zh
+ * 每个 SpriteFrame 名称
* @property {String[]} spriteFrameNames
*/
@serializable
@@ -81,6 +95,10 @@ export class TiledMapAsset extends Asset {
spriteFrameNames: string[] = [];
/**
+ * @en
+ * Size of each object in spriteFrames
+ * @zh
+ * 每个 SpriteFrame 的大小
* @property {Size[]} spriteFrameSizes
*/
@serializable
diff --git a/cocos/tiledmap/tiled-map.ts b/cocos/tiledmap/tiled-map.ts
index a49742c5dc..308c632d38 100644
--- a/cocos/tiledmap/tiled-map.ts
+++ b/cocos/tiledmap/tiled-map.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module tiledmap
- */
-
import { ccclass, displayOrder, executeInEditMode, help, menu, requireComponent, type, serializable, editable } from 'cc.decorator';
import { EDITOR, JSB } from 'internal:constants';
import { Component } from '../core/components';
diff --git a/cocos/tiledmap/tiled-object-group.ts b/cocos/tiledmap/tiled-object-group.ts
index a517b9583c..c4400cf52f 100644
--- a/cocos/tiledmap/tiled-object-group.ts
+++ b/cocos/tiledmap/tiled-object-group.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module tiledmap
- */
-
import { ccclass, help, type, requireComponent } from 'cc.decorator';
import { Component } from '../core/components';
import { Sprite } from '../2d/components/sprite';
diff --git a/cocos/tiledmap/tiled-tile.ts b/cocos/tiledmap/tiled-tile.ts
index 97ee500181..b15b399b02 100644
--- a/cocos/tiledmap/tiled-tile.ts
+++ b/cocos/tiledmap/tiled-tile.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module tiledmap
- */
-
/**
* @en TiledTile can control the specified map tile.
* It will apply the node rotation, scale, translate to the map tile.
diff --git a/cocos/tiledmap/tiled-types.ts b/cocos/tiledmap/tiled-types.ts
index ec42f45690..4fee9256f3 100644
--- a/cocos/tiledmap/tiled-types.ts
+++ b/cocos/tiledmap/tiled-types.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module tiledmap
- */
-
import { Color, Rect, Size, Texture2D, Vec2 } from '../core';
import { SpriteFrame } from '../2d/assets';
import { ccenum } from '../core/value-types/enum';
diff --git a/cocos/tiledmap/tiled-utils.ts b/cocos/tiledmap/tiled-utils.ts
index 38b0378731..0522b1dd32 100644
--- a/cocos/tiledmap/tiled-utils.ts
+++ b/cocos/tiledmap/tiled-utils.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module tiledmap
- */
-
import { SpriteFrame } from '../2d/assets';
import { Rect, Texture2D } from '../core';
import { GID, TiledGrid, TiledTextureGrids, TMXTilesetInfo } from './tiled-types';
diff --git a/cocos/tiledmap/tmx-xml-parser.ts b/cocos/tiledmap/tmx-xml-parser.ts
index d125701f74..c4de98b48a 100644
--- a/cocos/tiledmap/tmx-xml-parser.ts
+++ b/cocos/tiledmap/tmx-xml-parser.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module tiledmap
- */
-
import { Label, HorizontalTextAlignment, VerticalTextAlignment } from '../2d/components/label';
import codec from '../../external/compression/ZipUtils.js';
import zlib from '../../external/compression/zlib.min.js';
diff --git a/cocos/tween/actions/action-interval.ts b/cocos/tween/actions/action-interval.ts
index bda182cf95..7ff1598cd1 100644
--- a/cocos/tween/actions/action-interval.ts
+++ b/cocos/tween/actions/action-interval.ts
@@ -222,7 +222,10 @@ export class ActionInterval extends FiniteTimeAction {
}
/**
+ * @en
* Get this action speed.
+ * @zh
+ * 返回此动作速度
* @return {Number}
*/
getSpeed (): number {
@@ -230,7 +233,10 @@ export class ActionInterval extends FiniteTimeAction {
}
/**
+ * @en
* Set this action speed.
+ * @zh
+ * 设置此动作速度
* @param {Number} speed
* @returns {ActionInterval}
*/
diff --git a/cocos/tween/export-api.ts b/cocos/tween/export-api.ts
index e08dbd1e4a..cefff2361c 100644
--- a/cocos/tween/export-api.ts
+++ b/cocos/tween/export-api.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module tween
- */
-
/**
* @en
* Built-in string value definition for the cache function.
diff --git a/cocos/tween/tween-system.ts b/cocos/tween/tween-system.ts
index 2acb285156..04155b1aa7 100644
--- a/cocos/tween/tween-system.ts
+++ b/cocos/tween/tween-system.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module tween
- */
-
import { EDITOR } from 'internal:constants';
import { System, Director, director } from '../core';
import { ActionManager } from './actions/action-manager';
diff --git a/cocos/tween/tween.ts b/cocos/tween/tween.ts
index 3068b2980b..03353a2f4d 100644
--- a/cocos/tween/tween.ts
+++ b/cocos/tween/tween.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module tween
- */
-
import { TweenSystem } from './tween-system';
import { warn } from '../core';
import { ActionInterval, sequence, repeat, repeatForever, reverseTime, delayTime, spawn } from './actions/action-interval';
diff --git a/cocos/ui/block-input-events.ts b/cocos/ui/block-input-events.ts
index f9b4fd751b..1450772f11 100644
--- a/cocos/ui/block-input-events.ts
+++ b/cocos/ui/block-input-events.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module event
- */
-
import { ccclass, help, menu } from 'cc.decorator';
import { Component } from '../core/components/component';
import { Event } from '../input/types';
diff --git a/cocos/ui/button.ts b/cocos/ui/button.ts
index 2a926cf31d..e03c808ed3 100644
--- a/cocos/ui/button.ts
+++ b/cocos/ui/button.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui
- */
-
import { ccclass, help, executionOrder, menu, requireComponent, tooltip, displayOrder, type, rangeMin, rangeMax, serializable, executeInEditMode } from 'cc.decorator';
import { EDITOR } from 'internal:constants';
import { SpriteFrame } from '../2d/assets';
diff --git a/cocos/ui/deprecated.ts b/cocos/ui/deprecated.ts
index f0b87d59cd..aa764a7a93 100644
--- a/cocos/ui/deprecated.ts
+++ b/cocos/ui/deprecated.ts
@@ -23,10 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui
- */
import { UICoordinateTracker } from './ui-coordinate-tracker';
import { BlockInputEvents } from './block-input-events';
import { Button } from './button';
diff --git a/cocos/ui/editbox/edit-box.ts b/cocos/ui/editbox/edit-box.ts
index 8ee3b82a2f..884340feaa 100644
--- a/cocos/ui/editbox/edit-box.ts
+++ b/cocos/ui/editbox/edit-box.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui
- */
-
import { ccclass, help, executeInEditMode, executionOrder, menu, requireComponent, tooltip, displayOrder, type, serializable } from 'cc.decorator';
import { EDITOR, JSB, MINIGAME, RUNTIME_BASED } from 'internal:constants';
import { UITransform } from '../../2d/framework';
diff --git a/cocos/ui/layout.ts b/cocos/ui/layout.ts
index 77c882539e..e7464c24f3 100644
--- a/cocos/ui/layout.ts
+++ b/cocos/ui/layout.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui
- */
-
import { ccclass, help, executeInEditMode, executionOrder, menu, requireComponent, tooltip, type, displayOrder, serializable, visible, displayName } from 'cc.decorator';
import { Component } from '../core/components/component';
import { Rect, Size, Vec2, Vec3 } from '../core/math';
diff --git a/cocos/ui/page-view-indicator.ts b/cocos/ui/page-view-indicator.ts
index dad6ca8894..e74563be3f 100644
--- a/cocos/ui/page-view-indicator.ts
+++ b/cocos/ui/page-view-indicator.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui
- */
-
import { ccclass, help, executionOrder, menu, tooltip, type, serializable } from 'cc.decorator';
import { SpriteFrame } from '../2d/assets';
import { Component } from '../core/components';
diff --git a/cocos/ui/page-view.ts b/cocos/ui/page-view.ts
index a99a74ada8..982db58a20 100644
--- a/cocos/ui/page-view.ts
+++ b/cocos/ui/page-view.ts
@@ -23,10 +23,6 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui
- */
import { ccclass, help, executionOrder, menu, tooltip, type, slide, range, visible, override, serializable, editable } from 'cc.decorator';
import { EDITOR } from 'internal:constants';
diff --git a/cocos/ui/progress-bar.ts b/cocos/ui/progress-bar.ts
index ef330d5b6d..fb2735a993 100644
--- a/cocos/ui/progress-bar.ts
+++ b/cocos/ui/progress-bar.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui
- */
-
import { ccclass, help, executionOrder, menu, requireComponent, tooltip, type, range, slide, serializable } from 'cc.decorator';
import { Component } from '../core/components/component';
import { UITransform } from '../2d/framework';
diff --git a/cocos/ui/safe-area.ts b/cocos/ui/safe-area.ts
index 200ecb4f5a..5a1d6e51e2 100644
--- a/cocos/ui/safe-area.ts
+++ b/cocos/ui/safe-area.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui
- */
-
import { ccclass, help, executionOrder, menu, executeInEditMode, requireComponent } from 'cc.decorator';
import { EDITOR } from 'internal:constants';
import { screenAdapter } from 'pal/screen-adapter';
diff --git a/cocos/ui/scroll-bar.ts b/cocos/ui/scroll-bar.ts
index c9cf59ad17..9aa8c84485 100644
--- a/cocos/ui/scroll-bar.ts
+++ b/cocos/ui/scroll-bar.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui
- */
-
import { ccclass, help, executionOrder, menu, requireComponent, tooltip, displayOrder, type, serializable } from 'cc.decorator';
import { Component } from '../core/components/component';
import { UITransform } from '../2d/framework';
diff --git a/cocos/ui/scroll-view.ts b/cocos/ui/scroll-view.ts
index d2f5e88733..9b0d0a6bd4 100644
--- a/cocos/ui/scroll-view.ts
+++ b/cocos/ui/scroll-view.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui
- */
-
import { ccclass, help, executionOrder, menu, requireComponent, tooltip, displayOrder, range, type, serializable } from 'cc.decorator';
import { EDITOR } from 'internal:constants';
import { EventHandler as ComponentEventHandler } from '../core/components/component-event-handler';
diff --git a/cocos/ui/slider.ts b/cocos/ui/slider.ts
index f6ee21d7f4..81c9c801a7 100644
--- a/cocos/ui/slider.ts
+++ b/cocos/ui/slider.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui
- */
-
import { ccclass, help, executionOrder, menu, requireComponent, tooltip, type, slide, range, serializable } from 'cc.decorator';
import { EDITOR } from 'internal:constants';
import { Component, EventHandler } from '../core/components';
diff --git a/cocos/ui/sub-context-view.ts b/cocos/ui/sub-context-view.ts
index 295066eac0..eb1083ec21 100644
--- a/cocos/ui/sub-context-view.ts
+++ b/cocos/ui/sub-context-view.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module component
- */
-
import { ccclass, help, menu, executionOrder, requireComponent, tooltip, serializable } from 'cc.decorator';
import { EDITOR, WECHAT } from 'internal:constants';
import { minigame } from 'pal/minigame';
@@ -171,7 +166,7 @@ export class SubContextView extends Component {
}
}
sharedCanvas.width = designWidth;
- sharedCanvas.height = designWidth;
+ sharedCanvas.height = designHeight;
}
}
diff --git a/cocos/ui/toggle-container.ts b/cocos/ui/toggle-container.ts
index fb80222f8f..00e35f73e7 100644
--- a/cocos/ui/toggle-container.ts
+++ b/cocos/ui/toggle-container.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui
- */
-
import { ccclass, help, executeInEditMode, executionOrder, menu, tooltip, type, serializable } from 'cc.decorator';
import { Component, EventHandler as ComponentEventHandler } from '../core/components';
import { Toggle } from './toggle';
diff --git a/cocos/ui/toggle.ts b/cocos/ui/toggle.ts
index 4a0507690d..f19bbb615e 100644
--- a/cocos/ui/toggle.ts
+++ b/cocos/ui/toggle.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui
- */
-
import { ccclass, help, requireComponent, executionOrder, menu, tooltip, displayOrder, type, serializable } from 'cc.decorator';
import { EDITOR } from 'internal:constants';
import { EventHandler as ComponentEventHandler } from '../core/components/component-event-handler';
diff --git a/cocos/ui/ui-coordinate-tracker.ts b/cocos/ui/ui-coordinate-tracker.ts
index d2fded3bb8..c52aabf8c7 100644
--- a/cocos/ui/ui-coordinate-tracker.ts
+++ b/cocos/ui/ui-coordinate-tracker.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module component
- */
-
import { ccclass, help, menu, executionOrder, tooltip, type, serializable } from 'cc.decorator';
import { Component } from '../core/components/component';
import { EventHandler } from '../core/components/component-event-handler';
diff --git a/cocos/ui/view-group.ts b/cocos/ui/view-group.ts
index 4d29937e82..6e0c86e8c6 100644
--- a/cocos/ui/view-group.ts
+++ b/cocos/ui/view-group.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui
- */
-
/**
* @en
* Handling touch events in a ViewGroup takes special care,
diff --git a/cocos/ui/widget.ts b/cocos/ui/widget.ts
index 57555e0fe4..8731a549f4 100644
--- a/cocos/ui/widget.ts
+++ b/cocos/ui/widget.ts
@@ -24,11 +24,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module ui
- */
-
import { ccclass, help, executeInEditMode, executionOrder, menu, requireComponent, tooltip, type, editorOnly, editable, serializable, visible } from 'cc.decorator';
import { EDITOR, DEV } from 'internal:constants';
import { Component } from '../core/components';
diff --git a/cocos/video/assets/video-clip.ts b/cocos/video/assets/video-clip.ts
index e45b4d0dbb..2fb407cab0 100644
--- a/cocos/video/assets/video-clip.ts
+++ b/cocos/video/assets/video-clip.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module component/video
- */
-
import { ccclass, serializable } from 'cc.decorator';
import { Asset } from '../../core/assets';
diff --git a/cocos/video/video-downloader.ts b/cocos/video/video-downloader.ts
index 3b71887f67..8a838cdd70 100644
--- a/cocos/video/video-downloader.ts
+++ b/cocos/video/video-downloader.ts
@@ -23,10 +23,6 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module asset-manager
- */
import downloader from '../core/asset-manager/downloader';
import factory from '../core/asset-manager/factory';
diff --git a/cocos/video/video-player-enums.ts b/cocos/video/video-player-enums.ts
index c78636c3c8..c4e1065327 100644
--- a/cocos/video/video-player-enums.ts
+++ b/cocos/video/video-player-enums.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module component/video
- */
-
/**
* @en Enum for video resource type.
* @zh 视频来源
diff --git a/cocos/video/video-player-impl-manager.ts b/cocos/video/video-player-impl-manager.ts
index 3379916b91..4a1e653d86 100644
--- a/cocos/video/video-player-impl-manager.ts
+++ b/cocos/video/video-player-impl-manager.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module component/video
- */
-
import { legacyCC } from '../core/global-exports';
import { VideoPlayer } from './video-player';
import { VideoPlayerImplWeb } from './video-player-impl-web';
diff --git a/cocos/video/video-player-impl-web.ts b/cocos/video/video-player-impl-web.ts
index e65f3411f2..f2de1f58ff 100644
--- a/cocos/video/video-player-impl-web.ts
+++ b/cocos/video/video-player-impl-web.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module component/video
- */
-
import { screenAdapter } from 'pal/screen-adapter';
import { mat4 } from '../core/math';
import { sys, screen, warn } from '../core/platform';
diff --git a/cocos/video/video-player-impl.ts b/cocos/video/video-player-impl.ts
index 909e798dbe..dc9f11bfc0 100644
--- a/cocos/video/video-player-impl.ts
+++ b/cocos/video/video-player-impl.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module component/video
- */
-
import { legacyCC } from '../core/global-exports';
import { UITransform } from '../2d/framework';
import { VideoPlayer } from './video-player';
diff --git a/cocos/video/video-player.ts b/cocos/video/video-player.ts
index 1df5bf06c5..e043989146 100644
--- a/cocos/video/video-player.ts
+++ b/cocos/video/video-player.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module component/video
- */
-
import { ccclass, displayOrder, executeInEditMode, help, menu, slide, range, requireComponent, tooltip, type, serializable } from 'cc.decorator';
import { EDITOR } from 'internal:constants';
import { warn } from '../core/platform';
diff --git a/cocos/web-view/web-view-enums.ts b/cocos/web-view/web-view-enums.ts
index 27e554c61d..7996f3e80e 100644
--- a/cocos/web-view/web-view-enums.ts
+++ b/cocos/web-view/web-view-enums.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module component/web-view
- */
-
export enum EventType {
/**
* @en None
diff --git a/cocos/web-view/web-view-impl-manager.ts b/cocos/web-view/web-view-impl-manager.ts
index a781745d23..0b9ddf3b02 100644
--- a/cocos/web-view/web-view-impl-manager.ts
+++ b/cocos/web-view/web-view-impl-manager.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module component/web-view
- */
-
import { legacyCC } from '../core/global-exports';
import { WebViewImplWeb } from './web-view-impl-web';
diff --git a/cocos/web-view/web-view-impl-web.ts b/cocos/web-view/web-view-impl-web.ts
index da15d356e0..06e48edf95 100644
--- a/cocos/web-view/web-view-impl-web.ts
+++ b/cocos/web-view/web-view-impl-web.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module component/web-view
- */
-
import { screenAdapter } from 'pal/screen-adapter';
import { EventType } from './web-view-enums';
import { error, warn } from '../core/platform';
diff --git a/cocos/web-view/web-view-impl.ts b/cocos/web-view/web-view-impl.ts
index 6135c173f2..64ee646003 100644
--- a/cocos/web-view/web-view-impl.ts
+++ b/cocos/web-view/web-view-impl.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module component/web-view
- */
-
import { legacyCC } from '../core/global-exports';
import { WebView } from './web-view';
import { EventType } from './web-view-enums';
diff --git a/cocos/web-view/web-view.ts b/cocos/web-view/web-view.ts
index 48b9616dbb..317ae25d49 100644
--- a/cocos/web-view/web-view.ts
+++ b/cocos/web-view/web-view.ts
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
-/**
- * @packageDocumentation
- * @module component/web-view
- */
-
import { ccclass, help, executeInEditMode, menu, tooltip, type, displayOrder, serializable, requireComponent } from 'cc.decorator';
import { EDITOR } from 'internal:constants';
import { UITransform } from '../2d/framework';
diff --git a/editor/assets/chunks/aces.chunk.meta b/editor/assets/chunks/aces.chunk.meta
index eab88b41f8..0fee3c2f52 100644
--- a/editor/assets/chunks/aces.chunk.meta
+++ b/editor/assets/chunks/aces.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "7efbe295-0202-4979-8cda-6cfe35e086cf",
diff --git a/editor/assets/chunks/alpha-test.chunk.meta b/editor/assets/chunks/alpha-test.chunk.meta
index 407ebeb0ca..c0aa3f5e17 100644
--- a/editor/assets/chunks/alpha-test.chunk.meta
+++ b/editor/assets/chunks/alpha-test.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "2c3da5b6-0202-470a-a915-59f1e2968853",
diff --git a/editor/assets/chunks/anti-aliasing.chunk.meta b/editor/assets/chunks/anti-aliasing.chunk.meta
index 0451e74d58..a350a012a5 100644
--- a/editor/assets/chunks/anti-aliasing.chunk.meta
+++ b/editor/assets/chunks/anti-aliasing.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "60bb7684-4cd7-4d19-96c4-262e12e0b025",
diff --git a/editor/assets/chunks/builtin.meta b/editor/assets/chunks/builtin.meta
new file mode 100644
index 0000000000..e011724c9b
--- /dev/null
+++ b/editor/assets/chunks/builtin.meta
@@ -0,0 +1,12 @@
+{
+ "ver": "1.1.0",
+ "importer": "directory",
+ "imported": true,
+ "uuid": "85f366b2-d149-4b14-aa1d-4634e3c28f69",
+ "files": [],
+ "subMetas": {},
+ "userData": {
+ "compressionType": {},
+ "isRemoteBundle": {}
+ }
+}
diff --git a/editor/assets/chunks/builtin/internal-functions.meta b/editor/assets/chunks/builtin/internal-functions.meta
new file mode 100644
index 0000000000..fa8ad05d78
--- /dev/null
+++ b/editor/assets/chunks/builtin/internal-functions.meta
@@ -0,0 +1,12 @@
+{
+ "ver": "1.1.0",
+ "importer": "directory",
+ "imported": true,
+ "uuid": "784eb20c-c955-4a9b-a320-571a5c392f79",
+ "files": [],
+ "subMetas": {},
+ "userData": {
+ "compressionType": {},
+ "isRemoteBundle": {}
+ }
+}
diff --git a/editor/assets/chunks/builtin/internal-functions/morph-animation.chunk b/editor/assets/chunks/builtin/internal-functions/morph-animation.chunk
new file mode 100644
index 0000000000..a746bc41c0
--- /dev/null
+++ b/editor/assets/chunks/builtin/internal-functions/morph-animation.chunk
@@ -0,0 +1,113 @@
+
+/**
+ * Fetch n-th pixel from texture, row by row.
+ */
+vec2 getPixelLocation(vec2 textureResolution, int pixelIndex) {
+ float pixelIndexF = float(pixelIndex);
+ float x = mod(pixelIndexF, textureResolution.x);
+ float y = floor(pixelIndexF / textureResolution.x);
+ return vec2(x, y);
+}
+
+vec2 getPixelCoordFromLocation(vec2 location, vec2 textureResolution) {
+ return (vec2(location.x, location.y) + .5) / textureResolution;
+}
+
+#if CC_DEVICE_SUPPORT_FLOAT_TEXTURE
+ #if __VERSION__ >= 300
+ vec4 fetchVec3ArrayFromTexture(sampler2D tex, int pixelIndex) {
+ ivec2 texSize = textureSize(tex, 0);
+ return texelFetch(tex, ivec2(pixelIndex % texSize.x, pixelIndex / texSize.x), 0);
+ }
+ #else
+ vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {
+ int pixelIndex = elementIndex;
+ vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);
+ vec2 uv = getPixelCoordFromLocation(location, cc_displacementTextureInfo.xy);
+ return texture(tex, uv);
+ }
+ #endif
+#else
+ vec4 fetchVec3ArrayFromTexture(sampler2D tex, int elementIndex) {
+ int pixelIndex = elementIndex * 4;
+ vec2 location = getPixelLocation(cc_displacementTextureInfo.xy, pixelIndex);
+ // Here implies that the texture's width must be multiple of 4.
+ vec2 x = getPixelCoordFromLocation(location + vec2(0.0, 0.0), cc_displacementTextureInfo.xy);
+ vec2 y = getPixelCoordFromLocation(location + vec2(1.0, 0.0), cc_displacementTextureInfo.xy);
+ vec2 z = getPixelCoordFromLocation(location + vec2(2.0, 0.0), cc_displacementTextureInfo.xy);
+ return vec4(
+ decode32(texture(tex, x)),
+ decode32(texture(tex, y)),
+ decode32(texture(tex, z)),
+ 1.0
+ );
+ }
+#endif
+
+float getDisplacementWeight(int index) {
+ int quot = index / 4;
+ int remainder = index - quot * 4;
+ if (remainder == 0) {
+ return cc_displacementWeights[quot].x;
+ } else if (remainder == 1) {
+ return cc_displacementWeights[quot].y;
+ } else if (remainder == 2) {
+ return cc_displacementWeights[quot].z;
+ } else {
+ return cc_displacementWeights[quot].w;
+ }
+}
+
+vec3 getVec3DisplacementFromTexture(sampler2D tex, int vertexIndex) {
+#if CC_MORPH_PRECOMPUTED
+ return fetchVec3ArrayFromTexture(tex, vertexIndex).rgb;
+#else
+ vec3 result = vec3(0, 0, 0);
+ int nVertices = int(cc_displacementTextureInfo.z);
+ for (int iTarget = 0; iTarget < CC_MORPH_TARGET_COUNT; ++iTarget) {
+ result += (fetchVec3ArrayFromTexture(tex, nVertices * iTarget + vertexIndex).rgb * getDisplacementWeight(iTarget));
+ }
+ return result;
+#endif
+}
+
+
+#if CC_MORPH_TARGET_HAS_POSITION
+vec3 getPositionDisplacement(int vertexId) {
+ return getVec3DisplacementFromTexture(cc_PositionDisplacements, vertexId);
+}
+#endif
+
+#if CC_MORPH_TARGET_HAS_NORMAL
+vec3 getNormalDisplacement(int vertexId) {
+ return getVec3DisplacementFromTexture(cc_NormalDisplacements, vertexId);
+}
+#endif
+
+#if CC_MORPH_TARGET_HAS_TANGENT
+vec3 getTangentDisplacement(int vertexId) {
+ return getVec3DisplacementFromTexture(cc_TangentDisplacements, vertexId);
+}
+#endif
+
+void applyMorph (inout vec4 position, inout vec3 normal, inout vec4 tangent) {
+ int vertexId = getVertexId();
+
+#if CC_MORPH_TARGET_HAS_POSITION
+ position.xyz = position.xyz + getPositionDisplacement(vertexId);
+#endif
+
+#if CC_MORPH_TARGET_HAS_NORMAL
+ normal.xyz = normal.xyz + getNormalDisplacement(vertexId);
+#endif
+
+#if CC_MORPH_TARGET_HAS_TANGENT
+ tangent.xyz = tangent.xyz + getTangentDisplacement(vertexId);
+#endif
+}
+
+void applyMorph (inout vec4 position) {
+#if CC_MORPH_TARGET_HAS_POSITION
+ position.xyz = position.xyz + getPositionDisplacement(getVertexId());
+#endif
+}
diff --git a/editor/assets/chunks/builtin/internal-functions/morph-animation.chunk.meta b/editor/assets/chunks/builtin/internal-functions/morph-animation.chunk.meta
new file mode 100644
index 0000000000..ac34f9abec
--- /dev/null
+++ b/editor/assets/chunks/builtin/internal-functions/morph-animation.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "3adaa06a-e674-487c-9d49-42bc398c255b",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/builtin/internal-functions/skinning-animation-dqs.chunk b/editor/assets/chunks/builtin/internal-functions/skinning-animation-dqs.chunk
new file mode 100644
index 0000000000..97c9cee2f3
--- /dev/null
+++ b/editor/assets/chunks/builtin/internal-functions/skinning-animation-dqs.chunk
@@ -0,0 +1,75 @@
+// Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd.
+
+#if CC_USE_BAKED_ANIMATION
+ #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE
+ void getJointDQ (float i, out vec4 Qr, out vec4 Qt, out vec3 S) {
+ highp float x, y, invSize;
+ CCGetJointTextureCoords(3.0, i, x, y, invSize);
+ Qr = texture(cc_jointTexture, vec2((x + 0.5) * invSize, y));
+ Qt = texture(cc_jointTexture, vec2((x + 1.5) * invSize, y));
+ S = texture(cc_jointTexture, vec2((x + 2.5) * invSize, y)).xyz;
+ }
+ #else
+ void getJointDQ (float i, out vec4 Qr, out vec4 Qt, out vec3 S) {
+ highp float x, y, invSize;
+ CCGetJointTextureCoords(12.0, i, x, y, invSize);
+ Qr = vec4(
+ decode32(texture(cc_jointTexture, vec2((x + 0.5) * invSize, y))),
+ decode32(texture(cc_jointTexture, vec2((x + 1.5) * invSize, y))),
+ decode32(texture(cc_jointTexture, vec2((x + 2.5) * invSize, y))),
+ decode32(texture(cc_jointTexture, vec2((x + 3.5) * invSize, y)))
+ );
+ Qt = vec4(
+ decode32(texture(cc_jointTexture, vec2((x + 4.5) * invSize, y))),
+ decode32(texture(cc_jointTexture, vec2((x + 5.5) * invSize, y))),
+ decode32(texture(cc_jointTexture, vec2((x + 6.5) * invSize, y))),
+ decode32(texture(cc_jointTexture, vec2((x + 7.5) * invSize, y)))
+ );
+ S = vec3(
+ decode32(texture(cc_jointTexture, vec2((x + 8.5) * invSize, y))),
+ decode32(texture(cc_jointTexture, vec2((x + 9.5) * invSize, y))),
+ decode32(texture(cc_jointTexture, vec2((x + 10.5) * invSize, y)))
+ );
+ }
+ #endif
+#else
+ void getJointDQ (float i, out vec4 Qr, out vec4 Qt, out vec3 S) {
+ int idx = int(i);
+ Qr = cc_joints[idx * 3];
+ Qt = cc_joints[idx * 3 + 1];
+ S = cc_joints[idx * 3 + 2].xyz;
+ }
+#endif
+
+// [Kavan07] Skinning with Dual Quaternions
+void skinRTS (out vec4 R, out vec3 T, out vec3 S) {
+ vec4 r, t, Qt = vec4(0.0); vec3 s;
+ R = vec4(0.0); S = vec3(0.0);
+
+ for (int i = 0; i < 4; i++) {
+ float w = a_weights[i];
+ getJointDQ(a_joints[i], r, t, s);
+ S += s * w; R += r * w; Qt += t * w;
+ }
+
+ float invNorm = 1.0 / length(R); R *= invNorm; Qt *= invNorm;
+ T = 2.0 * (R.w * Qt.xyz - Qt.w * R.xyz + cross(R.xyz, Qt.xyz)); // 2 * Qt * conjugate(R)
+}
+
+vec3 VectorTransformQuat (vec3 v, vec4 Q) {
+ return v + 2.0 * cross(Q.xyz, cross(Q.xyz, v) + Q.w * v);
+}
+
+void CCSkin (inout vec4 position) {
+ vec4 R; vec3 T, S;
+ skinRTS(R, T, S);
+ position.xyz = VectorTransformQuat(position.xyz * S, R) + T;
+}
+
+void CCSkin (inout vec4 position, inout vec3 normal, inout vec4 tangent) {
+ vec4 R; vec3 T, S;
+ skinRTS(R, T, S);
+ position.xyz = VectorTransformQuat(position.xyz * S, R) + T;
+ normal = VectorTransformQuat(normal, R);
+ tangent.xyz = VectorTransformQuat(tangent.xyz, R);
+}
diff --git a/editor/assets/chunks/builtin/internal-functions/skinning-animation-dqs.chunk.meta b/editor/assets/chunks/builtin/internal-functions/skinning-animation-dqs.chunk.meta
new file mode 100644
index 0000000000..16475f8977
--- /dev/null
+++ b/editor/assets/chunks/builtin/internal-functions/skinning-animation-dqs.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "80908463-4566-4fdf-9744-775605cd7ab7",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/builtin/internal-functions/skinning-animation-lbs.chunk b/editor/assets/chunks/builtin/internal-functions/skinning-animation-lbs.chunk
new file mode 100644
index 0000000000..f0bcdeff4e
--- /dev/null
+++ b/editor/assets/chunks/builtin/internal-functions/skinning-animation-lbs.chunk
@@ -0,0 +1,66 @@
+// Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd.
+
+#if CC_USE_BAKED_ANIMATION
+ #if CC_DEVICE_SUPPORT_FLOAT_TEXTURE
+ mat4 getJointMatrix (float i) {
+ highp float x, y, invSize;
+ CCGetJointTextureCoords(3.0, i, x, y, invSize);
+ vec4 v1 = texture(cc_jointTexture, vec2((x + 0.5) * invSize, y));
+ vec4 v2 = texture(cc_jointTexture, vec2((x + 1.5) * invSize, y));
+ vec4 v3 = texture(cc_jointTexture, vec2((x + 2.5) * invSize, y));
+ return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));
+ }
+ #else
+ mat4 getJointMatrix (float i) {
+ highp float x, y, invSize;
+ CCGetJointTextureCoords(12.0, i, x, y, invSize);
+ vec4 v1 = vec4(
+ decode32(texture(cc_jointTexture, vec2((x + 0.5) * invSize, y))),
+ decode32(texture(cc_jointTexture, vec2((x + 1.5) * invSize, y))),
+ decode32(texture(cc_jointTexture, vec2((x + 2.5) * invSize, y))),
+ decode32(texture(cc_jointTexture, vec2((x + 3.5) * invSize, y)))
+ );
+ vec4 v2 = vec4(
+ decode32(texture(cc_jointTexture, vec2((x + 4.5) * invSize, y))),
+ decode32(texture(cc_jointTexture, vec2((x + 5.5) * invSize, y))),
+ decode32(texture(cc_jointTexture, vec2((x + 6.5) * invSize, y))),
+ decode32(texture(cc_jointTexture, vec2((x + 7.5) * invSize, y)))
+ );
+ vec4 v3 = vec4(
+ decode32(texture(cc_jointTexture, vec2((x + 8.5) * invSize, y))),
+ decode32(texture(cc_jointTexture, vec2((x + 9.5) * invSize, y))),
+ decode32(texture(cc_jointTexture, vec2((x + 10.5) * invSize, y))),
+ decode32(texture(cc_jointTexture, vec2((x + 11.5) * invSize, y)))
+ );
+ return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));
+ }
+ #endif
+#else
+ mat4 getJointMatrix (float i) {
+ int idx = int(i);
+ vec4 v1 = cc_joints[idx * 3];
+ vec4 v2 = cc_joints[idx * 3 + 1];
+ vec4 v3 = cc_joints[idx * 3 + 2];
+ return mat4(vec4(v1.xyz, 0.0), vec4(v2.xyz, 0.0), vec4(v3.xyz, 0.0), vec4(v1.w, v2.w, v3.w, 1.0));
+ }
+#endif
+
+mat4 skinMatrix () {
+ vec4 joints = vec4(a_joints); //simple conversion of a_joints from unsigned integer to float to match function parameter type
+ return getJointMatrix(joints.x) * a_weights.x
+ + getJointMatrix(joints.y) * a_weights.y
+ + getJointMatrix(joints.z) * a_weights.z
+ + getJointMatrix(joints.w) * a_weights.w;
+}
+
+void CCSkin (inout vec4 position) {
+ mat4 m = skinMatrix();
+ position = m * position;
+}
+
+void CCSkin (inout vec4 position, inout vec3 normal, inout vec4 tangent) {
+ mat4 m = skinMatrix();
+ position = m * position;
+ normal = (m * vec4(normal, 0.0)).xyz;
+ tangent.xyz = (m * vec4(tangent.xyz, 0.0)).xyz;
+}
diff --git a/editor/assets/chunks/builtin/internal-functions/skinning-animation-lbs.chunk.meta b/editor/assets/chunks/builtin/internal-functions/skinning-animation-lbs.chunk.meta
new file mode 100644
index 0000000000..81bf7555b7
--- /dev/null
+++ b/editor/assets/chunks/builtin/internal-functions/skinning-animation-lbs.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "258a17ce-6c50-4e8a-92aa-8ecec1a6af24",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/builtin/internal-functions/world-transform.chunk b/editor/assets/chunks/builtin/internal-functions/world-transform.chunk
new file mode 100644
index 0000000000..d40db41925
--- /dev/null
+++ b/editor/assets/chunks/builtin/internal-functions/world-transform.chunk
@@ -0,0 +1,36 @@
+// Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd.
+
+void CCGetWorldMatrix(out mat4 matWorld)
+{
+ #if USE_INSTANCING
+ matWorld = mat4(
+ vec4(a_matWorld0.xyz, 0.0),
+ vec4(a_matWorld1.xyz, 0.0),
+ vec4(a_matWorld2.xyz, 0.0),
+ vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)
+ );
+ #elif USE_BATCHING
+ matWorld = cc_matWorlds[int(a_dyn_batch_id)];
+ #else
+ matWorld = cc_matWorld;
+ #endif
+}
+
+void CCGetWorldMatrixFull(out mat4 matWorld, out mat4 matWorldIT)
+{
+ #if USE_INSTANCING
+ matWorld = mat4(
+ vec4(a_matWorld0.xyz, 0.0),
+ vec4(a_matWorld1.xyz, 0.0),
+ vec4(a_matWorld2.xyz, 0.0),
+ vec4(a_matWorld0.w, a_matWorld1.w, a_matWorld2.w, 1.0)
+ );
+ matWorldIT = matWorld;
+ #elif USE_BATCHING
+ matWorld = cc_matWorlds[int(a_dyn_batch_id)];
+ matWorldIT = matWorld;
+ #else
+ matWorld = cc_matWorld;
+ matWorldIT = cc_matWorldIT;
+ #endif
+}
diff --git a/editor/assets/chunks/builtin/internal-functions/world-transform.chunk.meta b/editor/assets/chunks/builtin/internal-functions/world-transform.chunk.meta
new file mode 100644
index 0000000000..3afa4fb202
--- /dev/null
+++ b/editor/assets/chunks/builtin/internal-functions/world-transform.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "c2885f54-4ff2-4284-8bbc-b77bc71965b4",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/builtin/uniforms.meta b/editor/assets/chunks/builtin/uniforms.meta
new file mode 100644
index 0000000000..3966a7bbd4
--- /dev/null
+++ b/editor/assets/chunks/builtin/uniforms.meta
@@ -0,0 +1,12 @@
+{
+ "ver": "1.1.0",
+ "importer": "directory",
+ "imported": true,
+ "uuid": "d81f2dfc-d5a9-49b9-a4ce-84a3cec1707a",
+ "files": [],
+ "subMetas": {},
+ "userData": {
+ "compressionType": {},
+ "isRemoteBundle": {}
+ }
+}
diff --git a/editor/assets/chunks/builtin/uniforms/cc-local-batched.chunk b/editor/assets/chunks/builtin/uniforms/cc-local-batched.chunk
new file mode 100644
index 0000000000..853996d554
--- /dev/null
+++ b/editor/assets/chunks/builtin/uniforms/cc-local-batched.chunk
@@ -0,0 +1,13 @@
+// Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd.
+
+#if !USE_INSTANCING
+ #if USE_BATCHING
+ #pragma define BATCHING_COUNT 10
+ #pragma builtin(local)
+ layout(set = 2, binding = 0) uniform CCLocalBatched {
+ highp mat4 cc_matWorlds[BATCHING_COUNT];
+ };
+ #else
+ #include
+ #endif
+#endif
diff --git a/editor/assets/chunks/builtin/uniforms/cc-local-batched.chunk.meta b/editor/assets/chunks/builtin/uniforms/cc-local-batched.chunk.meta
new file mode 100644
index 0000000000..746ef79799
--- /dev/null
+++ b/editor/assets/chunks/builtin/uniforms/cc-local-batched.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "21b24bc9-a158-488e-b27c-b98a461fb438",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/builtin/uniforms/cc-morph.chunk b/editor/assets/chunks/builtin/uniforms/cc-morph.chunk
new file mode 100644
index 0000000000..6f0e769158
--- /dev/null
+++ b/editor/assets/chunks/builtin/uniforms/cc-morph.chunk
@@ -0,0 +1,24 @@
+// Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd.
+
+#pragma define-meta CC_MORPH_TARGET_COUNT range([2, 8])
+
+#pragma builtin(local)
+layout(set = 2, binding = 4) uniform CCMorph {
+ vec4 cc_displacementWeights[15];
+ vec4 cc_displacementTextureInfo;
+};
+
+#if CC_MORPH_TARGET_HAS_POSITION
+ #pragma builtin(local)
+ layout(set = 2, binding = 7) uniform sampler2D cc_PositionDisplacements;
+#endif
+
+#if CC_MORPH_TARGET_HAS_NORMAL
+ #pragma builtin(local)
+ layout(set = 2, binding = 8) uniform sampler2D cc_NormalDisplacements;
+#endif
+
+#if CC_MORPH_TARGET_HAS_TANGENT
+ #pragma builtin(local)
+ layout(set = 2, binding = 9) uniform sampler2D cc_TangentDisplacements;
+#endif
diff --git a/editor/assets/chunks/builtin/uniforms/cc-morph.chunk.meta b/editor/assets/chunks/builtin/uniforms/cc-morph.chunk.meta
new file mode 100644
index 0000000000..750cb199d5
--- /dev/null
+++ b/editor/assets/chunks/builtin/uniforms/cc-morph.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "94d19070-32c6-4900-a288-2258fda37f29",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/builtin/uniforms/cc-skinning-uniforms.chunk b/editor/assets/chunks/builtin/uniforms/cc-skinning-uniforms.chunk
new file mode 100644
index 0000000000..1849e1ca6b
--- /dev/null
+++ b/editor/assets/chunks/builtin/uniforms/cc-skinning-uniforms.chunk
@@ -0,0 +1,39 @@
+// Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd.
+
+#pragma extension([GL_EXT_shader_explicit_arithmetic_types_int32, __VERSION__ > 310, require])
+
+#if CC_USE_BAKED_ANIMATION
+ #pragma builtin(local)
+ layout(set = 2, binding = 3) uniform CCSkinningTexture {
+ highp vec4 cc_jointTextureInfo; // length, totalJoints, offset, invLength
+ };
+ #pragma builtin(local)
+ layout(set = 2, binding = 2) uniform CCSkinningAnimation {
+ highp vec4 cc_jointAnimInfo; // frameID
+ };
+ #pragma builtin(local)
+ layout(set = 2, binding = 6) uniform highp sampler2D cc_jointTexture;
+ /**
+ * Although tempting, don't opt the offset arithmetics out to CPU (could
+ * be reduced to a single MAD). The enlarged numerical range could require
+ * more precision than what's actually provided on some devices.
+ */
+ void CCGetJointTextureCoords(float pixelsPerJoint, float jointIdx, out highp float x, out highp float y, out highp float invSize)
+ {
+ #if USE_INSTANCING
+ highp float temp = pixelsPerJoint * (a_jointAnimInfo.x * a_jointAnimInfo.y + jointIdx) + a_jointAnimInfo.z;
+ #else
+ highp float temp = pixelsPerJoint * (cc_jointAnimInfo.x * cc_jointTextureInfo.y + jointIdx) + cc_jointTextureInfo.z;
+ #endif
+ invSize = cc_jointTextureInfo.w;
+ highp float tempY = floor(temp * invSize);
+ x = floor(temp - tempY * cc_jointTextureInfo.x);
+ y = (tempY + 0.5) * invSize;
+ }
+#else
+ #pragma define JOINT_UNIFORM_CAPACITY 30
+ #pragma builtin(local)
+ layout(set = 2, binding = 3) uniform CCSkinning {
+ highp vec4 cc_joints[JOINT_UNIFORM_CAPACITY * 3];
+ };
+#endif
diff --git a/editor/assets/chunks/builtin/uniforms/cc-skinning-uniforms.chunk.meta b/editor/assets/chunks/builtin/uniforms/cc-skinning-uniforms.chunk.meta
new file mode 100644
index 0000000000..41438c9433
--- /dev/null
+++ b/editor/assets/chunks/builtin/uniforms/cc-skinning-uniforms.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "99488fd6-220b-4d13-9a41-8b9439cd3944",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/cc-diffusemap.chunk.meta b/editor/assets/chunks/cc-diffusemap.chunk.meta
index d2647ee43d..cd37967666 100644
--- a/editor/assets/chunks/cc-diffusemap.chunk.meta
+++ b/editor/assets/chunks/cc-diffusemap.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "17e8e047-4c5e-412c-85c8-a76a98742f2a",
diff --git a/editor/assets/chunks/cc-environment.chunk.meta b/editor/assets/chunks/cc-environment.chunk.meta
index 418145bc0e..16fb615ec8 100644
--- a/editor/assets/chunks/cc-environment.chunk.meta
+++ b/editor/assets/chunks/cc-environment.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "cd94308c-6959-4671-9dcb-6c58342273e2",
diff --git a/editor/assets/chunks/cc-fog-base.chunk.meta b/editor/assets/chunks/cc-fog-base.chunk.meta
index 88284d366a..674bf54934 100644
--- a/editor/assets/chunks/cc-fog-base.chunk.meta
+++ b/editor/assets/chunks/cc-fog-base.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "879b9f55-e5da-4d8f-bc84-3a12a20533ad",
diff --git a/editor/assets/chunks/cc-fog-fs.chunk.meta b/editor/assets/chunks/cc-fog-fs.chunk.meta
index 7850128658..03f75a9074 100644
--- a/editor/assets/chunks/cc-fog-fs.chunk.meta
+++ b/editor/assets/chunks/cc-fog-fs.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "5915ee07-9b06-4383-9b98-5b292bd116e9",
diff --git a/editor/assets/chunks/cc-fog-vs.chunk.meta b/editor/assets/chunks/cc-fog-vs.chunk.meta
index b7d58f30ef..f2fb871498 100644
--- a/editor/assets/chunks/cc-fog-vs.chunk.meta
+++ b/editor/assets/chunks/cc-fog-vs.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "0bc1a9f5-9282-4192-a0d4-4818568f2b16",
diff --git a/editor/assets/chunks/cc-forward-light.chunk.meta b/editor/assets/chunks/cc-forward-light.chunk.meta
index fd9a56f06b..c60d4496e1 100644
--- a/editor/assets/chunks/cc-forward-light.chunk.meta
+++ b/editor/assets/chunks/cc-forward-light.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "5e0f5e6e-5008-497f-b223-4e5f1801d8fd",
diff --git a/editor/assets/chunks/cc-global.chunk.meta b/editor/assets/chunks/cc-global.chunk.meta
index 00fc115831..0191017c7c 100644
--- a/editor/assets/chunks/cc-global.chunk.meta
+++ b/editor/assets/chunks/cc-global.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "1ea907a3-a36e-432a-ae38-af712c77aaad",
diff --git a/editor/assets/chunks/cc-local-batch.chunk.meta b/editor/assets/chunks/cc-local-batch.chunk.meta
index 540a58a09c..ac84ea9ad1 100644
--- a/editor/assets/chunks/cc-local-batch.chunk.meta
+++ b/editor/assets/chunks/cc-local-batch.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "21fbcb1c-648e-4700-b854-2a267fe50933",
diff --git a/editor/assets/chunks/cc-local.chunk.meta b/editor/assets/chunks/cc-local.chunk.meta
index 327706e160..929dad2669 100644
--- a/editor/assets/chunks/cc-local.chunk.meta
+++ b/editor/assets/chunks/cc-local.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "e835c2d5-a377-4197-bdb8-382037573494",
diff --git a/editor/assets/chunks/cc-shadow-map-base.chunk.meta b/editor/assets/chunks/cc-shadow-map-base.chunk.meta
index ebcd528fb3..59cc2975b3 100644
--- a/editor/assets/chunks/cc-shadow-map-base.chunk.meta
+++ b/editor/assets/chunks/cc-shadow-map-base.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "9b0e2f60-4c29-47e6-9b4c-ced160a61be6",
diff --git a/editor/assets/chunks/cc-shadow-map-fs.chunk.meta b/editor/assets/chunks/cc-shadow-map-fs.chunk.meta
index 73af35bdd5..cf73ffc551 100644
--- a/editor/assets/chunks/cc-shadow-map-fs.chunk.meta
+++ b/editor/assets/chunks/cc-shadow-map-fs.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "5716d893-2ecc-4110-9291-88b7e939d37d",
diff --git a/editor/assets/chunks/cc-shadow-map-vs.chunk.meta b/editor/assets/chunks/cc-shadow-map-vs.chunk.meta
index 3c7b935b72..1a2f4ad7c2 100644
--- a/editor/assets/chunks/cc-shadow-map-vs.chunk.meta
+++ b/editor/assets/chunks/cc-shadow-map-vs.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "b2e7c003-9c9f-40ee-82c6-32d920a759e8",
diff --git a/editor/assets/chunks/cc-shadow.chunk.meta b/editor/assets/chunks/cc-shadow.chunk.meta
index 96a083c2b0..848583ce68 100644
--- a/editor/assets/chunks/cc-shadow.chunk.meta
+++ b/editor/assets/chunks/cc-shadow.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "69f8ecd8-cdc9-4655-a6ec-d39dacdffc2f",
diff --git a/editor/assets/chunks/cc-skinning.chunk.meta b/editor/assets/chunks/cc-skinning.chunk.meta
index 66e1f29d6b..e59a9d16b5 100644
--- a/editor/assets/chunks/cc-skinning.chunk.meta
+++ b/editor/assets/chunks/cc-skinning.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "21191d65-d2ba-47a3-b9d2-c4afaaa713cd",
diff --git a/editor/assets/chunks/cc-sprite-common.chunk.meta b/editor/assets/chunks/cc-sprite-common.chunk.meta
index 980fe0321d..d39c415e5a 100644
--- a/editor/assets/chunks/cc-sprite-common.chunk.meta
+++ b/editor/assets/chunks/cc-sprite-common.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "35822e78-bb35-405f-87bd-d42af6ac9ede",
diff --git a/editor/assets/chunks/cc-sprite-texture.chunk.meta b/editor/assets/chunks/cc-sprite-texture.chunk.meta
index a844493118..399988de38 100644
--- a/editor/assets/chunks/cc-sprite-texture.chunk.meta
+++ b/editor/assets/chunks/cc-sprite-texture.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "4b48672e-e044-4035-9029-13afb50c1aee",
diff --git a/editor/assets/chunks/cc-world-bound.chunk.meta b/editor/assets/chunks/cc-world-bound.chunk.meta
index 32a114f8ff..72f5dda51a 100644
--- a/editor/assets/chunks/cc-world-bound.chunk.meta
+++ b/editor/assets/chunks/cc-world-bound.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "669458fe-c428-40cd-8575-51607aa8edbc",
diff --git a/editor/assets/chunks/common.chunk.meta b/editor/assets/chunks/common.chunk.meta
index e106796444..927dfe490f 100644
--- a/editor/assets/chunks/common.chunk.meta
+++ b/editor/assets/chunks/common.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "9d86a3e4-ec06-4e51-ba68-45f2b7739fbb",
diff --git a/editor/assets/chunks/common.meta b/editor/assets/chunks/common.meta
new file mode 100644
index 0000000000..02948fb6ba
--- /dev/null
+++ b/editor/assets/chunks/common.meta
@@ -0,0 +1,12 @@
+{
+ "ver": "1.1.0",
+ "importer": "directory",
+ "imported": true,
+ "uuid": "5dce7e3d-7c28-4f47-974c-e6904aeada37",
+ "files": [],
+ "subMetas": {},
+ "userData": {
+ "compressionType": {},
+ "isRemoteBundle": {}
+ }
+}
diff --git a/editor/assets/chunks/common/debug.meta b/editor/assets/chunks/common/debug.meta
new file mode 100644
index 0000000000..3bbe82131b
--- /dev/null
+++ b/editor/assets/chunks/common/debug.meta
@@ -0,0 +1,12 @@
+{
+ "ver": "1.1.0",
+ "importer": "directory",
+ "imported": true,
+ "uuid": "a1b68389-649a-4208-9453-85db77a65771",
+ "files": [],
+ "subMetas": {},
+ "userData": {
+ "compressionType": {},
+ "isRemoteBundle": {}
+ }
+}
diff --git a/editor/assets/chunks/common/debug/debug-view-define.chunk b/editor/assets/chunks/common/debug/debug-view-define.chunk
new file mode 100644
index 0000000000..719617e9f0
--- /dev/null
+++ b/editor/assets/chunks/common/debug/debug-view-define.chunk
@@ -0,0 +1,147 @@
+// vertex & face data
+#define CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR 1
+#define CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR + 1
+#define CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL + 1
+#define CC_SURFACES_DEBUG_VIEW_WORLD_POS CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT + 1
+#define CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR CC_SURFACES_DEBUG_VIEW_WORLD_POS + 1
+#define CC_SURFACES_DEBUG_VIEW_FACE_SIDE CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR + 1
+#define CC_SURFACES_DEBUG_VIEW_UV0 CC_SURFACES_DEBUG_VIEW_FACE_SIDE + 1
+#define CC_SURFACES_DEBUG_VIEW_UV1 CC_SURFACES_DEBUG_VIEW_UV0 + 1
+#define CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP CC_SURFACES_DEBUG_VIEW_UV1 + 1
+#define CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP + 1
+#define CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH + 1
+
+// surface material data
+#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH + 1
+#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL + 1
+#define CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT + 1
+#define CC_SURFACES_DEBUG_VIEW_BASE_COLOR CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL + 1
+#define CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR CC_SURFACES_DEBUG_VIEW_BASE_COLOR + 1
+#define CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR + 1
+#define CC_SURFACES_DEBUG_VIEW_TRANSPARENCY CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR + 1
+#define CC_SURFACES_DEBUG_VIEW_METALLIC CC_SURFACES_DEBUG_VIEW_TRANSPARENCY + 1
+#define CC_SURFACES_DEBUG_VIEW_ROUGHNESS CC_SURFACES_DEBUG_VIEW_METALLIC + 1
+#define CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY CC_SURFACES_DEBUG_VIEW_ROUGHNESS + 1
+
+// lighting data
+#define CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY + 1
+#define CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE + 1
+#define CC_SURFACES_DEBUG_VIEW_DIRECT_ALL CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR + 1
+#define CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_DIRECT_ALL + 1
+#define CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE + 1
+#define CC_SURFACES_DEBUG_VIEW_ENV_ALL CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR + 1
+#define CC_SURFACES_DEBUG_VIEW_EMISSIVE CC_SURFACES_DEBUG_VIEW_ENV_ALL + 1
+#define CC_SURFACES_DEBUG_VIEW_LIGHT_MAP CC_SURFACES_DEBUG_VIEW_EMISSIVE + 1
+#define CC_SURFACES_DEBUG_VIEW_SHADOW CC_SURFACES_DEBUG_VIEW_LIGHT_MAP + 1
+#define CC_SURFACES_DEBUG_VIEW_AO CC_SURFACES_DEBUG_VIEW_SHADOW + 1
+
+#define CC_SURFACES_DEBUG_VIEW_FOG CC_SURFACES_DEBUG_VIEW_AO + 1
+
+// composite sign: base lighting functionality, all switches on == non debug mode
+#define CC_SURFACES_DEBUG_VIEW_COMPOSITE_DIRECT_DIFFUSE 1
+#define CC_SURFACES_DEBUG_VIEW_COMPOSITE_DIRECT_SPECULAR CC_SURFACES_DEBUG_VIEW_COMPOSITE_DIRECT_DIFFUSE * 2
+#define CC_SURFACES_DEBUG_VIEW_COMPOSITE_ENV_DIFFUSE CC_SURFACES_DEBUG_VIEW_COMPOSITE_DIRECT_SPECULAR * 2
+#define CC_SURFACES_DEBUG_VIEW_COMPOSITE_ENV_SPECULAR CC_SURFACES_DEBUG_VIEW_COMPOSITE_ENV_DIFFUSE * 2
+#define CC_SURFACES_DEBUG_VIEW_COMPOSITE_EMISSIVE CC_SURFACES_DEBUG_VIEW_COMPOSITE_ENV_SPECULAR * 2
+#define CC_SURFACES_DEBUG_VIEW_COMPOSITE_LIGHT_MAP CC_SURFACES_DEBUG_VIEW_COMPOSITE_EMISSIVE * 2
+#define CC_SURFACES_DEBUG_VIEW_COMPOSITE_SHADOW CC_SURFACES_DEBUG_VIEW_COMPOSITE_LIGHT_MAP * 2
+#define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AO CC_SURFACES_DEBUG_VIEW_COMPOSITE_SHADOW * 2
+
+#define CC_SURFACES_DEBUG_VIEW_COMPOSITE_NORMAL_MAP CC_SURFACES_DEBUG_VIEW_COMPOSITE_AO * 2
+#define CC_SURFACES_DEBUG_VIEW_COMPOSITE_FOG CC_SURFACES_DEBUG_VIEW_COMPOSITE_NORMAL_MAP * 2
+
+#define CC_SURFACES_DEBUG_VIEW_COMPOSITE_TONE_MAPPING CC_SURFACES_DEBUG_VIEW_COMPOSITE_FOG * 2
+#define CC_SURFACES_DEBUG_VIEW_COMPOSITE_GAMMA_CORRECTION CC_SURFACES_DEBUG_VIEW_COMPOSITE_TONE_MAPPING * 2
+
+// Debug view UI and macros
+// #pragma define-meta CC_SURFACES_DEBUG_VIEW_MODE range([0, 19])
+// #pragma define-meta CC_SURFACES_DEBUG_VIEW_COMPOSITE_MODE range([0, 16])
+// #pragma define-meta CC_SURFACES_DEBUG_VIEW_LIGHTING_WITH_ALBEDO range([0, 1])
+// #pragma define-meta CC_SURFACES_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION range([0, 1])
+
+// test
+#pragma define CC_SURFACES_DEBUG_VIEW_LIGHTING_WITH_ALBEDO 0
+#pragma define CC_SURFACES_DEBUG_VIEW_MODE 0//CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH
+#pragma define CC_SURFACES_DEBUG_VIEW_COMPOSITE_MODE 0
+#pragma define CC_SURFACES_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION 0
+#pragma define CC_SURFACES_USE_DEBUG_VIEW 0
+
+// use uniforms for fast toggling
+// 逻辑: 只要单项调试开启,此宏即为1(ubo中设置view_single_mode)
+// 当单项调试关闭时:当复合开关全开且misc也全关时此宏为0, 否则此宏为2(ubo中设置composite和misc相关项)
+#define CC_SURFACES_DEBUG_VIEW_SINGLE 1
+#define CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC 2
+
+/*
+#if CC_SURFACES_USE_DEBUG_VIEW
+ #pragma builtin(global)
+ layout(set = 0, binding = 3) uniform CCDebugView {
+ int cc_debug_view_single_mode; // single debug
+ float cc_debug_view_lighting_enable_with_albedo;
+ float cc_debug_view_misc_enable_csm_layer_coloration; // misc debug
+ float cc_debug_view_composite_enable_direct_diffuse;
+ float cc_debug_view_composite_enable_direct_specular;
+ float cc_debug_view_composite_enable_env_diffuse;
+ float cc_debug_view_composite_enable_env_specular;
+ float cc_debug_view_composite_enable_emissive;
+ float cc_debug_view_composite_enable_light_map;
+ float cc_debug_view_composite_enable_shadow;
+ float cc_debug_view_composite_enable_ao;
+ float cc_debug_view_composite_enable_normal_map;
+ float cc_debug_view_composite_enable_fog;
+ float cc_debug_view_composite_enable_tone_mapping;
+ float cc_debug_view_composite_enable_gamma_correction;
+ };
+#endif
+*/
+ // move to common.chunk
+#pragma define equalf(data1, data2) (abs(float(data1) - float(data2)) < EPSILON)
+
+ // define.ts: 增加PipelineGlobalBindings.UBO_DEBUGVIEW, cc_shadowMap / cc_spotLightingMap / cc_environment / cc_diffuseMap的binding加1
+ /**
+ * @en The uniform buffer object for debug view
+ * @zh 渲染调试 UBO。
+ */
+/*
+ export class UBODebugView {
+ public static readonly SINGLE_MODE = 0;
+ public static readonly LIGHTING_ENABLE_WITH_ALBEDO = UBODebugView.SINGLE_MODE + 1;
+ public static readonly MISC_ENABLE_CSM_LAYER_COLORATION = UBODebugView.LIGHTING_ENABLE_WITH_ALBEDO + 1;
+ public static readonly COMPOSITE_ENABLE_DIRECT_DIFFUSE = UBODebugView.MISC_ENABLE_CSM_LAYER_COLORATION + 1;
+ public static readonly COMPOSITE_ENABLE_DIRECT_SPECULAR = UBODebugView.COMPOSITE_ENABLE_DIRECT_DIFFUSE + 1;
+ public static readonly COMPOSITE_ENABLE_ENV_DIFFUSE = UBODebugView.COMPOSITE_ENABLE_DIRECT_SPECULAR + 1;
+ public static readonly COMPOSITE_ENABLE_ENV_SPECULAR = UBODebugView.COMPOSITE_ENABLE_ENV_DIFFUSE + 1;
+ public static readonly COMPOSITE_ENABLE_EMISSIVE = UBODebugView.COMPOSITE_ENABLE_ENV_SPECULAR + 1;
+ public static readonly COMPOSITE_ENABLE_LIGHT_MAP = UBODebugView.COMPOSITE_ENABLE_EMISSIVE + 1;
+ public static readonly COMPOSITE_ENABLE_SHADOW = UBODebugView.COMPOSITE_ENABLE_LIGHT_MAP + 1;
+ public static readonly COMPOSITE_ENABLE_AO = UBODebugView.COMPOSITE_ENABLE_SHADOW + 1;
+ public static readonly COMPOSITE_ENABLE_NORMAL_MAP = UBODebugView.COMPOSITE_ENABLE_AO + 1;
+ public static readonly COMPOSITE_ENABLE_FOG = UBODebugView.COMPOSITE_ENABLE_NORMAL_MAP + 1;
+ public static readonly COMPOSITE_ENABLE_TONE_MAPPING = UBODebugView.COMPOSITE_ENABLE_FOG + 1;
+ public static readonly COMPOSITE_ENABLE_GAMMA_CORRECTION = UBODebugView.COMPOSITE_ENABLE_TONE_MAPPING + 1;
+ public static readonly COUNT : number = UBODebugView.COMPOSITE_ENABLE_GAMMA_CORRECTION + 1;
+ public static readonly SIZE = UBODebugView.COUNT * 4;
+ public static readonly NAME = 'CCDebugView';
+ public static readonly BINDING = PipelineGlobalBindings.UBO_DEBUGVIEW;
+ public static readonly DESCRIPTOR = new DescriptorSetLayoutBinding(UBODebugView.BINDING, DescriptorType.UNIFORM_BUFFER, 1, ShaderStageFlagBit.ALL);
+ public static readonly LAYOUT = new UniformBlock(SetIndex.GLOBAL, UBODebugView.BINDING, UBODebugView.NAME, [
+ new Uniform('cc_debug_view_single_mode', Type.INT, 1),
+ new Uniform('cc_debug_view_lighting_enable_with_albedo', Type.FLOAT, 1),
+ new Uniform('cc_debug_view_misc_enable_csm_layer_coloration', Type.FLOAT, 1),
+ new Uniform('cc_debug_view_composite_enable_direct_diffuse', Type.FLOAT, 1),
+ new Uniform('cc_debug_view_composite_enable_direct_specular', Type.FLOAT, 1),
+ new Uniform('cc_debug_view_composite_enable_env_diffuse', Type.FLOAT, 1),
+ new Uniform('cc_debug_view_composite_enable_env_specular', Type.FLOAT, 1),
+ new Uniform('cc_debug_view_composite_enable_emissive', Type.FLOAT, 1),
+ new Uniform('cc_debug_view_composite_enable_light_map', Type.FLOAT, 1),
+ new Uniform('cc_debug_view_composite_enable_shadow', Type.FLOAT, 1),
+ new Uniform('cc_debug_view_composite_enable_ao', Type.FLOAT, 1),
+ new Uniform('cc_debug_view_composite_enable_normal_map', Type.FLOAT, 1),
+ new Uniform('cc_debug_view_composite_enable_fog', Type.FLOAT, 1),
+ new Uniform('cc_debug_view_composite_enable_tone_mapping', Type.FLOAT, 1),
+ new Uniform('cc_debug_view_composite_enable_gamma_correction', Type.FLOAT, 1),
+ ], 1);
+ }
+ globalDescriptorSetLayout.layouts[UBODebugView.NAME] = UBODebugView.LAYOUT;
+ globalDescriptorSetLayout.bindings[UBODebugView.BINDING] = UBODebugView.DESCRIPTOR;
+ */
diff --git a/editor/assets/chunks/common/debug/debug-view-define.chunk.meta b/editor/assets/chunks/common/debug/debug-view-define.chunk.meta
new file mode 100644
index 0000000000..cc61ede78c
--- /dev/null
+++ b/editor/assets/chunks/common/debug/debug-view-define.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "9c973ee8-952a-4ee3-a617-ba6397db6bac",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/common/effect.meta b/editor/assets/chunks/common/effect.meta
new file mode 100644
index 0000000000..8d4205ead6
--- /dev/null
+++ b/editor/assets/chunks/common/effect.meta
@@ -0,0 +1,12 @@
+{
+ "ver": "1.1.0",
+ "importer": "directory",
+ "imported": true,
+ "uuid": "98420980-4268-402a-a26d-f66e6ee50a03",
+ "files": [],
+ "subMetas": {},
+ "userData": {
+ "compressionType": {},
+ "isRemoteBundle": {}
+ }
+}
diff --git a/editor/assets/chunks/common/effect/fog.chunk b/editor/assets/chunks/common/effect/fog.chunk
new file mode 100644
index 0000000000..14d10ba454
--- /dev/null
+++ b/editor/assets/chunks/common/effect/fog.chunk
@@ -0,0 +1,65 @@
+// fog related calculations
+
+//pos, cc_cameraPos, cc_fogBase.x, cc_fogBase.y
+float LinearFog(vec4 pos, vec3 cameraPos, float fogStart, float fogEnd) {
+ vec4 wPos = pos;
+ float cam_dis = distance(cameraPos, wPos);
+ return clamp((fogEnd - cam_dis) / (fogEnd - fogStart), 0., 1.);
+}
+
+//pos, cc_cameraPos, cc_fogBase.x, cc_fogBase.z, cc_fogAdd.z
+float ExpFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {
+ vec4 wPos = pos;
+ float cam_dis = max(distance(cameraPos, wPos) - fogStart, 0.0) / fogAtten * 4.;
+ float f = exp(-cam_dis * fogDensity);
+ return f;
+}
+
+float ExpSquaredFog(vec4 pos, vec3 cameraPos, float fogStart, float fogDensity, float fogAtten) {
+ vec4 wPos = pos;
+ float cam_dis = max(distance(cameraPos, wPos) - fogStart, 0.0) / fogAtten * 4.;
+ float f = exp(-cam_dis * cam_dis * fogDensity * fogDensity);
+ return f;
+}
+
+//pos, cc_cameraPos, cc_fogAdd.x, cc_fogAdd.y, cc_fogAdd.z
+float LayeredFog(vec4 pos, vec3 cameraPos, float fogTop, float fogRange, float fogAtten) {
+ vec4 wPos = pos;
+ vec3 camWorldProj = cameraPos.xyz;
+ camWorldProj.y = 0.;
+ vec3 worldPosProj = wPos.xyz;
+ worldPosProj.y = 0.;
+ float fDeltaD = distance(worldPosProj, camWorldProj) / fogAtten * 2.0;
+ float fDeltaY, fDensityIntegral;
+ if (cameraPos.y > fogTop) {
+ if (wPos.y < fogTop) {
+ fDeltaY = (fogTop - wPos.y) / fogRange * 2.0;
+ fDensityIntegral = fDeltaY * fDeltaY * 0.5;
+ }
+ else {
+ fDeltaY = 0.;
+ fDensityIntegral = 0.;
+ }
+ }
+ else {
+ if (wPos.y < fogTop) {
+ float fDeltaA = (fogTop - cameraPos.y) / fogRange * 2.;
+ float fDeltaB = (fogTop - wPos.y) / fogRange * 2.;
+ fDeltaY = abs(fDeltaA - fDeltaB);
+ fDensityIntegral = abs((fDeltaA * fDeltaA * 0.5) - (fDeltaB * fDeltaB * 0.5));
+ }
+ else {
+ fDeltaY = abs(fogTop - cameraPos.y) / fogRange * 2.;
+ fDensityIntegral = abs(fDeltaY * fDeltaY * 0.5);
+ }
+ }
+ float fDensity;
+ if (fDeltaY != 0.) {
+ fDensity = (sqrt(1.0 + ((fDeltaD / fDeltaY) * (fDeltaD / fDeltaY)))) * fDensityIntegral;
+ }
+ else {
+ fDensity = 0.;
+ }
+ float f = exp(-fDensity);
+ return f;
+}
diff --git a/editor/assets/chunks/common/effect/fog.chunk.meta b/editor/assets/chunks/common/effect/fog.chunk.meta
new file mode 100644
index 0000000000..4f8d522765
--- /dev/null
+++ b/editor/assets/chunks/common/effect/fog.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "399f5890-dde1-40de-9751-a7aa91a56b93",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/common/internal-functions.meta b/editor/assets/chunks/common/internal-functions.meta
new file mode 100644
index 0000000000..d2e456107a
--- /dev/null
+++ b/editor/assets/chunks/common/internal-functions.meta
@@ -0,0 +1,12 @@
+{
+ "ver": "1.1.0",
+ "importer": "directory",
+ "imported": true,
+ "uuid": "b67dfb5d-1a4d-469e-a35f-52e665ae1ea2",
+ "files": [],
+ "subMetas": {},
+ "userData": {
+ "compressionType": {},
+ "isRemoteBundle": {}
+ }
+}
diff --git a/editor/assets/chunks/common/lighting.meta b/editor/assets/chunks/common/lighting.meta
new file mode 100644
index 0000000000..8c7abb84c1
--- /dev/null
+++ b/editor/assets/chunks/common/lighting.meta
@@ -0,0 +1,12 @@
+{
+ "ver": "1.1.0",
+ "importer": "directory",
+ "imported": true,
+ "uuid": "a2ba2f72-737d-4b4b-84be-3e014d996327",
+ "files": [],
+ "subMetas": {},
+ "userData": {
+ "compressionType": {},
+ "isRemoteBundle": {}
+ }
+}
diff --git a/editor/assets/chunks/common/lighting/attenuation.chunk b/editor/assets/chunks/common/lighting/attenuation.chunk
new file mode 100644
index 0000000000..f6ef44e5cd
--- /dev/null
+++ b/editor/assets/chunks/common/lighting/attenuation.chunk
@@ -0,0 +1,26 @@
+
+float SmoothDistAtt2 (float distSqr, float invSqrAttRadius) {
+ float factor = distSqr * invSqrAttRadius; // ^2
+ float factor2 = factor * factor; // ^4
+ float factor3 = factor2 * factor2; // ^8
+ float smoothFactor = clamp(1.0 - factor3 * factor3, 0.0, 1.0);
+ return smoothFactor * smoothFactor;
+}
+
+float SmoothDistAtt (float distSqr, float invSqrAttRadius) {
+ float factor = distSqr * invSqrAttRadius;
+ float smoothFactor = clamp(1.0 - factor * factor, 0.0, 1.0);
+ return smoothFactor * smoothFactor;
+}
+
+float GetDistAtt (float distSqr, float invSqrAttRadius) {
+ float attenuation = 1.0 / max(distSqr, 0.01*0.01);
+ attenuation *= SmoothDistAtt(distSqr , invSqrAttRadius);
+ return attenuation;
+}
+
+float GetAngleAtt (vec3 L, vec3 litDir, float litAngleScale, float litAngleOffset) {
+ float cd = dot(litDir, L);
+ float attenuation = clamp(cd * litAngleScale + litAngleOffset, 0.0, 1.0);
+ return (attenuation * attenuation);
+}
diff --git a/editor/assets/chunks/common/lighting/attenuation.chunk.meta b/editor/assets/chunks/common/lighting/attenuation.chunk.meta
new file mode 100644
index 0000000000..2628f2bdad
--- /dev/null
+++ b/editor/assets/chunks/common/lighting/attenuation.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "077cca29-6f66-4aad-a3a7-4f0a7ecd523f",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/common/lighting/brdf.chunk b/editor/assets/chunks/common/lighting/brdf.chunk
new file mode 100644
index 0000000000..63a70735c1
--- /dev/null
+++ b/editor/assets/chunks/common/lighting/brdf.chunk
@@ -0,0 +1,69 @@
+float D_GGX(float roughness, float NoH)
+{
+ float m = roughness * roughness;
+ float m2 = m * m;
+ float d = (NoH * m2 - NoH) * NoH + 1.0;
+ return m2 / max(EPSILON, d * d);
+}
+
+float D_GGXMobile(float roughness, float NoH) {
+ float OneMinusNoHSqr = 1.0 - NoH * NoH;
+ float a = roughness * roughness;
+ float n = NoH * a;
+ float p = a / (OneMinusNoHSqr + n * n);
+ return p * p;
+}
+
+void GetAnisotropicRoughness(float roughness, float anisotropyShape, out float roughnessX, out float roughnessY)
+{
+ float shapeSign = sign(anisotropyShape);
+ anisotropyShape *= anisotropyShape;
+
+ float r1 = roughness, r2 = roughness;
+ float lerpedRoughness = mix(1.0, 10.0, anisotropyShape);
+ r2 *= shapeSign < 0.0 ? lerpedRoughness : 1.0;
+ r1 *= shapeSign > 0.0 ? lerpedRoughness : 1.0;
+ roughnessX = saturate(r1);
+ roughnessY = saturate(r2);
+}
+
+float D_GGXAniso(float RoughnessX, float RoughnessY, float NoH, vec3 H, vec3 X, vec3 Y)
+{
+ float mx = max(EPSILON_LOWP, RoughnessX * RoughnessX);
+ float my = max(EPSILON_LOWP, RoughnessY * RoughnessY);
+ float XoH = dot(X, H);
+ float YoH = dot(Y, H);
+ float d = XoH * XoH / (mx * mx) + YoH * YoH / (my * my) + NoH * NoH;
+ return 1.0 / max(EPSILON_LOWP, mx * my * d * d);
+}
+
+vec3 GetAnisotropicReflect(float roughness, float anisotropyShape, vec3 V, vec3 N, vec3 X, vec3 Y)
+{
+ float shapeSign = sign(anisotropyShape);
+ anisotropyShape *= anisotropyShape;
+
+ //clamp to shape=0.6x for invert reflection artifact
+ anisotropyShape = min(anisotropyShape, 0.4);
+
+ // roughness->0 means optical smooth surface (back to isotropic)
+ anisotropyShape *= smoothstep(0.0, 0.03, roughness);
+
+ // use view co-planar vector instead of XoH->0 plane convolution, but not accuracy
+ vec3 reflectTarget = shapeSign < 0.0 ? mix(N, -Y, anisotropyShape) :
+ shapeSign > 0.0 ? mix(N, -X, anisotropyShape) : N;
+ return reflect(-V, reflectTarget);
+}
+
+// EnvBRDFApprox
+vec3 IntegratedGFApprox (vec3 specular, float roughness, float NoV) {
+ const vec4 c0 = vec4(-1.0, -0.0275, -0.572, 0.022);
+ const vec4 c1 = vec4(1.0, 0.0425, 1.04, -0.04);
+ vec4 r = roughness * c0 + c1;
+ float a004 = min(r.x * r.x, exp2(-9.28 * NoV)) * r.x + r.y;
+ vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;
+ AB.y *= clamp(50.0 * specular.g, 0.0, 1.0);
+ return specular * AB.x + AB.y;
+}
+
+//Diffuse_Lambert
+#define DiffuseCoefficient_EnergyConservation INV_PI
diff --git a/editor/assets/chunks/common/lighting/brdf.chunk.meta b/editor/assets/chunks/common/lighting/brdf.chunk.meta
new file mode 100644
index 0000000000..40732d77b4
--- /dev/null
+++ b/editor/assets/chunks/common/lighting/brdf.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "3a85eafd-0fd0-468f-8a2e-0c81493230c7",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/common/lighting/functions.chunk b/editor/assets/chunks/common/lighting/functions.chunk
new file mode 100644
index 0000000000..7f48e073f9
--- /dev/null
+++ b/editor/assets/chunks/common/lighting/functions.chunk
@@ -0,0 +1,22 @@
+#include
+
+// helper functions for lighting model-functions
+
+float CalculateDistanceAttenuation(float distToLightSqr, float lightRadius, float lightRange)
+{
+ float litRadiusSqr = lightRadius * lightRadius;
+ float attRadiusSqrInv = 1.0 / max(lightRange, 0.01);
+ attRadiusSqrInv *= attRadiusSqrInv;
+
+ // soft edge fading
+ float edgeAttenuation = litRadiusSqr / max(litRadiusSqr, distToLightSqr);
+ return GetDistAtt(distToLightSqr, attRadiusSqrInv) * edgeAttenuation;
+}
+
+float CalculateAngleAttenuation(vec3 spotLightDir, vec3 L, float cosAngleOuter)
+{
+ float cosInner = max(dot(spotLightDir, L), 0.01);
+ float litAngleScale = 1.0 / max(0.001, cosInner - cosAngleOuter);
+ float litAngleOffset = -cosAngleOuter * litAngleScale;
+ return GetAngleAtt(L, spotLightDir, litAngleScale, litAngleOffset);
+}
diff --git a/editor/assets/chunks/common/lighting/functions.chunk.meta b/editor/assets/chunks/common/lighting/functions.chunk.meta
new file mode 100644
index 0000000000..a5bf067e79
--- /dev/null
+++ b/editor/assets/chunks/common/lighting/functions.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "d360c347-a546-4967-bdd3-30cae323f123",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/common/lighting/lightmap.chunk b/editor/assets/chunks/common/lighting/lightmap.chunk
new file mode 100644
index 0000000000..6b1a54b18c
--- /dev/null
+++ b/editor/assets/chunks/common/lighting/lightmap.chunk
@@ -0,0 +1,16 @@
+#pragma builtin(local)
+layout(set = 2, binding = 10) uniform sampler2D cc_lightingMap;
+
+vec4 GetLightMapColor(vec2 luv, float lum)
+{
+ vec4 lightmap = texture(cc_lightingMap, luv);
+ lightmap.rgb *= lum;
+
+#if CC_USE_HDR
+ // convert from standard camera exposure parameters to current exposure value
+ // baked in LDR scene still regarded as exposured with standard camera parameters
+ lightmap.rgb *= cc_exposure.w * cc_exposure.x;
+#endif
+
+ return lightmap;
+}
\ No newline at end of file
diff --git a/editor/assets/chunks/common/lighting/lightmap.chunk.meta b/editor/assets/chunks/common/lighting/lightmap.chunk.meta
new file mode 100644
index 0000000000..1c61044fa6
--- /dev/null
+++ b/editor/assets/chunks/common/lighting/lightmap.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "345abc7e-5211-479e-854e-03600d86f2cd",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/common/math.meta b/editor/assets/chunks/common/math.meta
new file mode 100644
index 0000000000..c4e77402e7
--- /dev/null
+++ b/editor/assets/chunks/common/math.meta
@@ -0,0 +1,12 @@
+{
+ "ver": "1.1.0",
+ "importer": "directory",
+ "imported": true,
+ "uuid": "328da6ff-910d-4cb5-904d-5c1a4ba35edd",
+ "files": [],
+ "subMetas": {},
+ "userData": {
+ "compressionType": {},
+ "isRemoteBundle": {}
+ }
+}
diff --git a/editor/assets/chunks/common/math/coordinates.chunk b/editor/assets/chunks/common/math/coordinates.chunk
new file mode 100644
index 0000000000..6b9f3c011f
--- /dev/null
+++ b/editor/assets/chunks/common/math/coordinates.chunk
@@ -0,0 +1,32 @@
+// params must be normalized
+vec3 CalculateBinormal(vec3 normal, vec3 tangent, float mirrorNormal)
+{
+ return cross(normal.xyz, tangent) * mirrorNormal;
+}
+
+
+// param1 is normal from normalmap
+// return value is un-normalized
+vec3 CalculateNormalFromTangentSpace(vec3 normalFromTangentSpace, float normalStrength, vec3 normal, vec3 tangent, float mirrorNormal)
+{
+ vec3 binormal = CalculateBinormal(normal, tangent, mirrorNormal);
+ return (normalFromTangentSpace.x * normalStrength) * normalize(tangent) +
+ (normalFromTangentSpace.y * normalStrength) * normalize(binormal) +
+ normalFromTangentSpace.z * normalize(normal);
+}
+
+
+// rotationAngle: 0-1 stand for 0-180 rotation
+void RotateTangentAndBinormal(inout vec3 tangent, inout vec3 binormal, vec3 normal, float rotationAngle)
+{
+ rotationAngle = clamp(rotationAngle, 0.0, 1.0 - EPSILON_LOWP); // 1.0 is invalid value that equals to 90 rotation (coef=0, angle>0.5)
+ float coef = fract(rotationAngle * 2.0);
+ bool isNegative = rotationAngle <= 0.5;
+
+ // spherical interpolating is more accuracy and linear transitions but expensive, use simple pow fix instead
+ coef = pow(coef, isNegative ? 0.75 : 1.25);
+ vec3 binormalNew = isNegative ? mix(binormal, -tangent, coef) : mix(-tangent, -binormal, coef);
+ vec3 tangentNew = isNegative ? mix(tangent, binormal, coef) : mix(binormal, -tangent, coef);
+ tangent = normalize(tangentNew);
+ binormal = normalize(binormalNew);
+}
diff --git a/editor/assets/chunks/common/math/coordinates.chunk.meta b/editor/assets/chunks/common/math/coordinates.chunk.meta
new file mode 100644
index 0000000000..54f7005b88
--- /dev/null
+++ b/editor/assets/chunks/common/math/coordinates.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "e9d8b3bb-03e4-46b2-be29-ea58fac18c18",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/common/math/number.chunk b/editor/assets/chunks/common/math/number.chunk
new file mode 100644
index 0000000000..9c9ae50f1c
--- /dev/null
+++ b/editor/assets/chunks/common/math/number.chunk
@@ -0,0 +1,24 @@
+#if __VERSION__ <= 100
+bool isnan(float val) {
+ return (val < 0.0 || 0.0 < val || val == 0.0) ? false : true;
+}
+bool isinf(float x) {
+ return x == x * 2.0;
+}
+#endif
+
+bool isnans(vec3 val) {
+ return isnan(val.x) && isnan(val.y) && isnan(val.z);
+}
+bool isnans(vec4 val) {
+ return isnan(val.x) && isnan(val.y) && isnan(val.z) && isnan(val.w);
+}
+bool isinfs(vec4 val) {
+ return isinf(val.x) && isinf(val.y) && isinf(val.z) && isinf(val.w);
+}
+bool isinfs(vec3 val) {
+ return isinf(val.x) && isinf(val.y) && isinf(val.z);
+}
+
+
+// random number
\ No newline at end of file
diff --git a/editor/assets/chunks/common/math/number.chunk.meta b/editor/assets/chunks/common/math/number.chunk.meta
new file mode 100644
index 0000000000..27780e4c40
--- /dev/null
+++ b/editor/assets/chunks/common/math/number.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "9f84c121-c61b-499f-b400-81a5448d6078",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/common/mesh.meta b/editor/assets/chunks/common/mesh.meta
new file mode 100644
index 0000000000..ab0c88b766
--- /dev/null
+++ b/editor/assets/chunks/common/mesh.meta
@@ -0,0 +1,12 @@
+{
+ "ver": "1.1.0",
+ "importer": "directory",
+ "imported": true,
+ "uuid": "44c741c8-2cdd-41c1-b359-feb18b2f3c69",
+ "files": [],
+ "subMetas": {},
+ "userData": {
+ "compressionType": {},
+ "isRemoteBundle": {}
+ }
+}
diff --git a/editor/assets/chunks/common/mesh/material.chunk b/editor/assets/chunks/common/mesh/material.chunk
new file mode 100644
index 0000000000..0f70837976
--- /dev/null
+++ b/editor/assets/chunks/common/mesh/material.chunk
@@ -0,0 +1,47 @@
+bool GetMetallicAlbedoFromDiffuseSpecularMathematic(out float metallic, out vec3 albedo, vec3 diffuse, vec3 specular, float channelFaultTolerant /*= 0.2*/, float f0 /*= 0.04*/)
+{
+ // inaccuracy match first
+ //GetMetallicAlbedoFromDiffuseSpecular(metallic, albedo, diffuse, specular);
+
+ // avoid illegal solver
+ diffuse += vec3(f0 + 0.01);
+ specular += vec3(f0 + 0.01);
+
+ vec3 delta = (diffuse + specular) * (diffuse + specular) - 4.0 * f0 * diffuse;
+ vec3 deltaSqrt = sqrt(max(vec3(0.0), delta));
+ // solver
+ vec3 m = (-diffuse - specular + 2.0 * f0 + deltaSqrt) / (2.0 * f0);
+ vec3 weight = diffuse + specular;
+ weight /= dot(weight, vec3(1.0));
+ float solverMetallic = dot(m, weight);
+ vec3 solverAlbedo = diffuse + specular - f0 * (1.0 - solverMetallic);
+
+ bool isValidSolver = delta.x >= 0.0 && delta.y >= 0.0 && delta.z >= 0.0
+ && abs(m.x - m.y) < channelFaultTolerant && abs(m.x - m.z) < channelFaultTolerant
+ && m.x >= 0.0 && m.y >= 0.0 && m.z >= 0.0
+ && m.x <= 1.0 && m.y <= 1.0 && m.z <= 1.0;
+
+ metallic = isValidSolver ? solverMetallic : metallic;
+ albedo = isValidSolver ? solverAlbedo : albedo;
+ return isValidSolver;
+}
+
+bool GetMetallicAlbedoFromDiffuseSpecularWithoutColor(out float metallic, out vec3 albedo, vec3 diffuse, vec3 specular, float f0 /*= 0.04*/)
+{
+ float d = max(max(diffuse.x, diffuse.y), diffuse.z);
+ vec3 normalizedColor = diffuse / (d + (d < EPSILON_LOWP ? EPSILON_LOWP : 0.0));
+ normalizedColor = d < EPSILON_LOWP ? specular : normalizedColor; //change specular to gray with intensity of max channel of specular
+
+ float s = max(max(specular.x, specular.y), specular.z);
+
+ float delta = (d + s) * (d + s) - 4.0 * f0 * d;
+ float deltaSqrt = sqrt(max(0.0, delta));
+ // solver
+ float solverMetallic = (-d - s + 2.0 * f0 + deltaSqrt) / (2.0 * f0);
+ vec3 solverAlbedo = (d + s) * normalizedColor - vec3(f0 * (1.0 - solverMetallic));
+
+ bool isValidSolver = delta >= 0.0;
+ metallic = isValidSolver ? clamp(solverMetallic, 0.0, 1.0) : 0.0;
+ albedo = isValidSolver ? vec3(max(0.0, solverAlbedo.x), max(0.0, solverAlbedo.y), max(0.0, solverAlbedo.z)) : diffuse;
+ return isValidSolver;
+}
diff --git a/editor/assets/chunks/common/mesh/material.chunk.meta b/editor/assets/chunks/common/mesh/material.chunk.meta
new file mode 100644
index 0000000000..821710ecf1
--- /dev/null
+++ b/editor/assets/chunks/common/mesh/material.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "f992af76-5145-4f8e-beae-6d88be403e8e",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/common/sss.meta b/editor/assets/chunks/common/sss.meta
new file mode 100644
index 0000000000..9f17ffb862
--- /dev/null
+++ b/editor/assets/chunks/common/sss.meta
@@ -0,0 +1,12 @@
+{
+ "ver": "1.1.0",
+ "importer": "directory",
+ "imported": true,
+ "uuid": "22d0392f-1cc0-4bb1-8b84-577e3f4551e0",
+ "files": [],
+ "subMetas": {},
+ "userData": {
+ "compressionType": {},
+ "isRemoteBundle": {}
+ }
+}
diff --git a/editor/assets/chunks/common/texture.meta b/editor/assets/chunks/common/texture.meta
new file mode 100644
index 0000000000..78b11e379d
--- /dev/null
+++ b/editor/assets/chunks/common/texture.meta
@@ -0,0 +1,12 @@
+{
+ "ver": "1.1.0",
+ "importer": "directory",
+ "imported": true,
+ "uuid": "fcd5dc66-1649-4a01-b94c-b528bb881cfb",
+ "files": [],
+ "subMetas": {},
+ "userData": {
+ "compressionType": {},
+ "isRemoteBundle": {}
+ }
+}
diff --git a/editor/assets/chunks/common/texture/cubemap.chunk b/editor/assets/chunks/common/texture/cubemap.chunk
new file mode 100644
index 0000000000..32f426e17c
--- /dev/null
+++ b/editor/assets/chunks/common/texture/cubemap.chunk
@@ -0,0 +1,48 @@
+#pragma extension([GL_OES_standard_derivatives, __VERSION__ < 110])
+ vec3 EnvReflectionWithMipFiltering(vec3 R, float roughness, float mipCount, float denoiseIntensity) {
+ #if CC_USE_IBL
+ // simulate GGX convolution
+ #if !CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING //#todo: && !CC_IBL_CONVOLUTED
+ roughness = pow(roughness, 0.5);
+ #endif
+
+ //#todo: add GL400 calcmip
+ float mip = roughness * mipCount;
+ float delta = (dot(dFdx(R), dFdy(R))) * 1000.0;
+ float mipBias = mix(0.0, 5.0, clamp(delta, 0.0, 1.0));
+
+ vec4 biased = fragTextureLod(cc_environment, R, mip + mipBias);
+ vec4 filtered = texture(cc_environment, R);
+
+ #if CC_USE_IBL == IBL_RGBE
+ biased.rgb = unpackRGBE(biased);
+ filtered.rgb = unpackRGBE(filtered);
+ #else
+ biased.rgb = SRGBToLinear(biased.rgb);
+ filtered.rgb = SRGBToLinear(filtered.rgb);
+ #endif
+
+ return mix(biased.rgb, filtered.rgb, denoiseIntensity);
+ #else
+ return vec3(0.0, 0.0, 0.0);
+ #endif
+ }
+
+ vec3 EnvReflection(vec3 R, float roughness, float mipCount) {
+ #if CC_USE_IBL
+ // simulate GGX convolution
+ #if !CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING //#todo: && !CC_IBL_CONVOLUTED
+ roughness = pow(roughness, 0.5);
+ #endif
+
+ vec4 envmap = fragTextureLod(cc_environment, R, roughness * mipCount);
+
+ #if CC_USE_IBL == IBL_RGBE
+ return unpackRGBE(envmap);
+ #else
+ return SRGBToLinear(envmap.rgb);
+ #endif
+ #else
+ return vec3(0.0, 0.0, 0.0);
+ #endif
+ }
diff --git a/editor/assets/chunks/common/texture/cubemap.chunk.meta b/editor/assets/chunks/common/texture/cubemap.chunk.meta
new file mode 100644
index 0000000000..c795d62178
--- /dev/null
+++ b/editor/assets/chunks/common/texture/cubemap.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "3931bd87-0a7b-4d2d-a5f1-9544227343a8",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/common/ubo.meta b/editor/assets/chunks/common/ubo.meta
new file mode 100644
index 0000000000..a8c355114b
--- /dev/null
+++ b/editor/assets/chunks/common/ubo.meta
@@ -0,0 +1,12 @@
+{
+ "ver": "1.1.0",
+ "importer": "directory",
+ "imported": true,
+ "uuid": "2476d369-6d06-4dab-ade6-0d8b22ae0948",
+ "files": [],
+ "subMetas": {},
+ "userData": {
+ "compressionType": {},
+ "isRemoteBundle": {}
+ }
+}
diff --git a/editor/assets/chunks/decode-base.chunk b/editor/assets/chunks/decode-base.chunk
index 1d3a532fc3..c7ca08bbbf 100644
--- a/editor/assets/chunks/decode-base.chunk
+++ b/editor/assets/chunks/decode-base.chunk
@@ -37,7 +37,7 @@ layout(location = 3) in vec4 a_tangent;
in vec4 a_matWorld0;
in vec4 a_matWorld1;
in vec4 a_matWorld2;
- #if USE_LIGHTMAP
+ #if CC_USE_LIGHTMAP
in vec4 a_lightingMapUVParam;
#endif
#if CC_RECEIVE_SHADOW
diff --git a/editor/assets/chunks/decode-base.chunk.meta b/editor/assets/chunks/decode-base.chunk.meta
index f693d19c74..eb5b24ea16 100644
--- a/editor/assets/chunks/decode-base.chunk.meta
+++ b/editor/assets/chunks/decode-base.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "e05f440c-0ba5-4c83-a039-5644d248bb87",
diff --git a/editor/assets/chunks/decode-standard.chunk.meta b/editor/assets/chunks/decode-standard.chunk.meta
index 7fb1eb3973..813d8eee16 100644
--- a/editor/assets/chunks/decode-standard.chunk.meta
+++ b/editor/assets/chunks/decode-standard.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "8daa33da-9438-4294-aace-2a58d1b183ab",
diff --git a/editor/assets/chunks/decode.chunk.meta b/editor/assets/chunks/decode.chunk.meta
index 5a0fd7f9ab..da1645564a 100644
--- a/editor/assets/chunks/decode.chunk.meta
+++ b/editor/assets/chunks/decode.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "385a7ca1-9421-475c-aa02-38d52ef3ba7f",
diff --git a/editor/assets/chunks/deprecated.chunk.meta b/editor/assets/chunks/deprecated.chunk.meta
index 43bfc3a5c6..5b4ab6e17c 100644
--- a/editor/assets/chunks/deprecated.chunk.meta
+++ b/editor/assets/chunks/deprecated.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "355259fc-3a13-4fed-b553-a5e2caeb2e75",
diff --git a/editor/assets/chunks/embedded-alpha.chunk.meta b/editor/assets/chunks/embedded-alpha.chunk.meta
index 807614d9ae..126ca1ad37 100644
--- a/editor/assets/chunks/embedded-alpha.chunk.meta
+++ b/editor/assets/chunks/embedded-alpha.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "ef4fb7de-9b39-4eeb-9ae8-d292ff94a452",
diff --git a/editor/assets/chunks/fxaa.chunk.meta b/editor/assets/chunks/fxaa.chunk.meta
index 8c6675f4bc..25e07541de 100644
--- a/editor/assets/chunks/fxaa.chunk.meta
+++ b/editor/assets/chunks/fxaa.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "0afb4a28-945f-48ac-91e5-6f483345f8ab",
diff --git a/editor/assets/chunks/gamma.chunk.meta b/editor/assets/chunks/gamma.chunk.meta
index f3a006da12..1db7425c78 100644
--- a/editor/assets/chunks/gamma.chunk.meta
+++ b/editor/assets/chunks/gamma.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "bb213412-2e68-43b3-9de5-73ca332acace",
diff --git a/editor/assets/chunks/general-vs.chunk.meta b/editor/assets/chunks/general-vs.chunk.meta
index 6ed03008b7..01808ffa98 100644
--- a/editor/assets/chunks/general-vs.chunk.meta
+++ b/editor/assets/chunks/general-vs.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "2cdcf2a6-42f3-4142-a340-eabfe530ccbf",
diff --git a/editor/assets/chunks/input-standard.chunk.meta b/editor/assets/chunks/input-standard.chunk.meta
index 6d57cac8a5..39dc9cf94e 100644
--- a/editor/assets/chunks/input-standard.chunk.meta
+++ b/editor/assets/chunks/input-standard.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "f957d7e0-a3eb-480c-b3c6-43a1a5273b71",
diff --git a/editor/assets/chunks/input.chunk.meta b/editor/assets/chunks/input.chunk.meta
index feab5b5856..71b62357e5 100644
--- a/editor/assets/chunks/input.chunk.meta
+++ b/editor/assets/chunks/input.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "3b9a2995-9fa1-4862-9bcf-9b6fa2c64bd4",
diff --git a/editor/assets/chunks/lighting-models.meta b/editor/assets/chunks/lighting-models.meta
new file mode 100644
index 0000000000..2af6387735
--- /dev/null
+++ b/editor/assets/chunks/lighting-models.meta
@@ -0,0 +1,12 @@
+{
+ "ver": "1.1.0",
+ "importer": "directory",
+ "imported": true,
+ "uuid": "fbccacc9-0f83-4d66-8bc5-afa9a6e54b36",
+ "files": [],
+ "subMetas": {},
+ "userData": {
+ "compressionType": {},
+ "isRemoteBundle": {}
+ }
+}
diff --git a/editor/assets/chunks/lighting-models/data-structures.meta b/editor/assets/chunks/lighting-models/data-structures.meta
new file mode 100644
index 0000000000..6948d608f4
--- /dev/null
+++ b/editor/assets/chunks/lighting-models/data-structures.meta
@@ -0,0 +1,12 @@
+{
+ "ver": "1.1.0",
+ "importer": "directory",
+ "imported": true,
+ "uuid": "91df99f8-d0d2-451e-9c9e-f2d776851f91",
+ "files": [],
+ "subMetas": {},
+ "userData": {
+ "compressionType": {},
+ "isRemoteBundle": {}
+ }
+}
diff --git a/editor/assets/chunks/lighting-models/data-structures/lighting-intermediate-data.chunk b/editor/assets/chunks/lighting-models/data-structures/lighting-intermediate-data.chunk
new file mode 100644
index 0000000000..1da0b3f96d
--- /dev/null
+++ b/editor/assets/chunks/lighting-models/data-structures/lighting-intermediate-data.chunk
@@ -0,0 +1,76 @@
+struct LightingIntermediateData
+{
+ vec3 N, H, L, V; // normalized
+ float distToLight, distToLightSqr; // (pos->light)^2
+ float distToCamera, distToCameraSqr; // pos->camera
+
+ float NoL, NoV, NoH;//, VoH;
+ float NoLSat, NoVSat, NoHSat;//, VoHSat; // clamped to 0-1
+ float NoVAbsSat; // abs and clamped to 1
+
+ // for advanced material
+ vec3 T, B;
+
+ // material data
+ float specularParam; // roughness or specular power
+#if CC_SURFACES_LIGHTING_ANISOTROPIC
+ float anisotropyShape;
+#endif
+
+ // #if CC_SURFACES_LIGHTING_SPECULAR_2ND
+ // float specularParam2nd, specularIntensity2nd, specularRotation2nd; // for hair
+ // vec3 specularColor2nd;
+ // #endif
+ // #if CC_SURFACES_LIGHTING_CLEAR_COAT
+ // float ior;
+ // float roughnessClearCoat; // for clear coat or multi-layer pbr
+ // #endif
+};
+
+// add overrided functions for difference shading-models in
+void CCSurfacesLightingGetIntermediateData_PerPixel(inout LightingIntermediateData data, vec3 worldNormal, vec3 worldPos, vec3 worldTangent, vec3 worldBinormal
+#if CC_SURFACES_LIGHTING_ANISOTROPIC
+ , float anisotropyShape
+#endif
+)
+{
+ // N V
+ data.N = worldNormal;
+
+ data.V = cc_cameraPos.xyz - worldPos;
+ data.distToCameraSqr = dot(data.V, data.V);
+ data.distToCamera = sqrt(data.distToCameraSqr);
+ data.V /= data.distToCamera;
+
+ data.NoV = dot(data.N, data.V);
+ data.NoVSat = max(data.NoV, 0.0);
+ data.NoVAbsSat = max(abs(data.NoV), 0.0);
+
+ data.T = worldTangent;
+ data.B = worldBinormal;
+
+#if CC_SURFACES_LIGHTING_ANISOTROPIC
+ data.anisotropyShape = anisotropyShape;
+#endif
+}
+
+void CCSurfacesLightingGetIntermediateData_PerLight(inout LightingIntermediateData data, vec3 lightDirWithDist)
+{
+ // L H
+ data.L = lightDirWithDist;
+ data.distToLightSqr = dot(data.L, data.L);
+ data.distToLight = sqrt(data.distToLightSqr);
+
+ data.L /= data.distToLight;
+
+ data.H = normalize(data.L + data.V);
+
+ // dot
+ data.NoL = dot(data.N, data.L);
+ data.NoH = dot(data.N, data.H);
+ // data.VoH = dot(data.V, data.H);
+
+ data.NoLSat = max(data.NoL, 0.0);
+ data.NoHSat = max(data.NoH, 0.0);
+ // data.VoHSat = max(data.VoH, 0.0);
+}
diff --git a/editor/assets/chunks/lighting-models/data-structures/lighting-intermediate-data.chunk.meta b/editor/assets/chunks/lighting-models/data-structures/lighting-intermediate-data.chunk.meta
new file mode 100644
index 0000000000..b51f333b25
--- /dev/null
+++ b/editor/assets/chunks/lighting-models/data-structures/lighting-intermediate-data.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "be2dc7d9-db45-4d0b-957b-aee1cb81bde0",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/lighting-models/data-structures/lighting-result.chunk b/editor/assets/chunks/lighting-models/data-structures/lighting-result.chunk
new file mode 100644
index 0000000000..97fdda2eb7
--- /dev/null
+++ b/editor/assets/chunks/lighting-models/data-structures/lighting-result.chunk
@@ -0,0 +1,13 @@
+struct LightingResult
+{
+ // material-dependent lighting data
+ vec3 diffuseColorWithLighting, specularColorWithLighting;
+
+ // pure lighting
+ vec3 directDiffuse, directSpecular;
+ vec3 environmentDiffuse, environmentSpecular;
+ float shadow, ao;
+ vec3 lightmapColor;
+ vec3 emissive;
+ //vec3 transmittance, scattered;
+};
diff --git a/editor/assets/chunks/lighting-models/data-structures/lighting-result.chunk.meta b/editor/assets/chunks/lighting-models/data-structures/lighting-result.chunk.meta
new file mode 100644
index 0000000000..b4006dc971
--- /dev/null
+++ b/editor/assets/chunks/lighting-models/data-structures/lighting-result.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "7646cc74-5fcc-47c4-970b-5958505c17e5",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/lighting-models/default-functions.meta b/editor/assets/chunks/lighting-models/default-functions.meta
new file mode 100644
index 0000000000..5648ba8f91
--- /dev/null
+++ b/editor/assets/chunks/lighting-models/default-functions.meta
@@ -0,0 +1,12 @@
+{
+ "ver": "1.1.0",
+ "importer": "directory",
+ "imported": true,
+ "uuid": "77dddf0f-b81c-4797-9222-905cbea8dcd5",
+ "files": [],
+ "subMetas": {},
+ "userData": {
+ "compressionType": {},
+ "isRemoteBundle": {}
+ }
+}
diff --git a/editor/assets/chunks/lighting-models/default-functions/simple-skin.chunk b/editor/assets/chunks/lighting-models/default-functions/simple-skin.chunk
new file mode 100644
index 0000000000..6691d26cdb
--- /dev/null
+++ b/editor/assets/chunks/lighting-models/default-functions/simple-skin.chunk
@@ -0,0 +1,7 @@
+#ifndef CC_SURFACES_LIGHTING_MODIFY_SKIN_DIFFUSE_LIGHTING
+ vec3 SurfacesLightingModifySkinDiffuseLighting(in LightingIntermediateData lightingData, in float ssssCurvature)
+ {
+ // if user do not sample PreIntegratedSSS tex, fallback to default light model
+ return vec3(lightingData.NoL);
+ }
+#endif
diff --git a/editor/assets/chunks/lighting-models/default-functions/simple-skin.chunk.meta b/editor/assets/chunks/lighting-models/default-functions/simple-skin.chunk.meta
new file mode 100644
index 0000000000..bc772acc79
--- /dev/null
+++ b/editor/assets/chunks/lighting-models/default-functions/simple-skin.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "9ada82f2-4c4e-433f-8090-e8bfad31fcf2",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/lighting-models/includes.meta b/editor/assets/chunks/lighting-models/includes.meta
new file mode 100644
index 0000000000..859cc26b67
--- /dev/null
+++ b/editor/assets/chunks/lighting-models/includes.meta
@@ -0,0 +1,12 @@
+{
+ "ver": "1.1.0",
+ "importer": "directory",
+ "imported": true,
+ "uuid": "30b9fedf-84ec-49a1-be3b-9555317e980e",
+ "files": [],
+ "subMetas": {},
+ "userData": {
+ "compressionType": {},
+ "isRemoteBundle": {}
+ }
+}
diff --git a/editor/assets/chunks/lighting-models/includes/standard.chunk b/editor/assets/chunks/lighting-models/includes/standard.chunk
new file mode 100644
index 0000000000..1da559d132
--- /dev/null
+++ b/editor/assets/chunks/lighting-models/includes/standard.chunk
@@ -0,0 +1,4 @@
+// Lighting-model includes
+#include
+#include
+#include
diff --git a/editor/assets/chunks/lighting-models/includes/standard.chunk.meta b/editor/assets/chunks/lighting-models/includes/standard.chunk.meta
new file mode 100644
index 0000000000..19baf32ea9
--- /dev/null
+++ b/editor/assets/chunks/lighting-models/includes/standard.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "cc12f5ac-3dcf-4455-aea9-b9be2dd9071e",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/lighting-models/includes/toon.chunk b/editor/assets/chunks/lighting-models/includes/toon.chunk
new file mode 100644
index 0000000000..90a13e1dc8
--- /dev/null
+++ b/editor/assets/chunks/lighting-models/includes/toon.chunk
@@ -0,0 +1,4 @@
+// Lighting-model includes
+#include
+#include
+#include
diff --git a/editor/assets/chunks/lighting-models/includes/toon.chunk.meta b/editor/assets/chunks/lighting-models/includes/toon.chunk.meta
new file mode 100644
index 0000000000..5419ba6bce
--- /dev/null
+++ b/editor/assets/chunks/lighting-models/includes/toon.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "2710ad01-b6c3-4048-b5d9-b3b69cec3e94",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/lighting-models/lighting-flow.meta b/editor/assets/chunks/lighting-models/lighting-flow.meta
new file mode 100644
index 0000000000..b824a90ede
--- /dev/null
+++ b/editor/assets/chunks/lighting-models/lighting-flow.meta
@@ -0,0 +1,12 @@
+{
+ "ver": "1.1.0",
+ "importer": "directory",
+ "imported": true,
+ "uuid": "6fee360e-820e-45a0-81a2-3c4896c0838e",
+ "files": [],
+ "subMetas": {},
+ "userData": {
+ "compressionType": {},
+ "isRemoteBundle": {}
+ }
+}
diff --git a/editor/assets/chunks/lighting-models/lighting-flow/common-flow.chunk b/editor/assets/chunks/lighting-models/lighting-flow/common-flow.chunk
new file mode 100644
index 0000000000..4a7264cfb1
--- /dev/null
+++ b/editor/assets/chunks/lighting-models/lighting-flow/common-flow.chunk
@@ -0,0 +1,95 @@
+#if (CC_PIPELINE_TYPE == CC_PIPELINE_TYPE_FORWARD || CC_FORCE_FORWARD_SHADING)
+ #if CC_FORWARD_ADD && !CC_ENABLE_CLUSTERED_LIGHT_CULLING
+ void CCSurfacesLighting(inout LightingResult lightingResult, in SurfacesMaterialData surfaceData, in vec4 shadowPos, in vec2 shadowBias)
+ {
+ vec3 worldPos;
+ HIGHP_VALUE_FROM_STRUCT_DEFINED(worldPos, surfaceData.worldPos);
+
+ LightingIntermediateData lightingData;
+ CCSurfacesInitializeLightingIntermediateData(lightingData, surfaceData);
+
+ CCSurfacesLightingInitializeColorWithLighting(lightingResult.diffuseColorWithLighting, lightingResult.specularColorWithLighting, surfaceData, lightingData);
+
+ lightingResult.directDiffuse = lightingResult.directSpecular = vec3(0.0);
+
+ int numLights = CC_PIPELINE_TYPE == CC_PIPELINE_TYPE_FORWARD ? LIGHTS_PER_PASS : int(cc_lightDir[0].w);
+ for (int i = 0; i < LIGHTS_PER_PASS; i++) {
+ if (i >= numLights) break;
+
+ CCSurfacesLightingCalculateIntermediateData_PerLight(lightingData, surfaceData, cc_lightPos[i].xyz - worldPos);
+ CCSurfacesLightingCalculateColorWithLighting(lightingResult.diffuseColorWithLighting, lightingResult.specularColorWithLighting, surfaceData, lightingData);
+
+ vec3 diffuseLighting, specularLighting;
+ CCSurfacesLightingCalculateDirect(diffuseLighting, specularLighting, lightingData, cc_lightColor[i]);
+
+ float shadow = 1.0;
+ #if CC_RECEIVE_SHADOW
+ if (cc_lightPos[i].w > 0.0 && cc_lightSizeRangeAngle[i].w > 0.0) {
+ if (CCSurfacesLightingEnableShadow(lightingData.NoL)) {
+ shadow = CCSpotShadowFactorBase(shadowPos, worldPos, shadowBias);
+ }
+ }
+ #endif
+
+ float distAtt = CCSurfacesLightingCalculateDistanceAttenuation(lightingData, cc_lightSizeRangeAngle[i]);
+
+ float angleAtt = 1.0;
+ if (cc_lightPos[i].w > 0.0) {
+ angleAtt = CCSurfacesLightingCalculateAngleAttenuation(lightingData, cc_lightSizeRangeAngle[i], -cc_lightDir[i].xyz);
+ }
+
+ float multiplier = distAtt * angleAtt * shadow;
+
+ lightingResult.directDiffuse += diffuseLighting * multiplier;
+ lightingResult.directSpecular += specularLighting * multiplier;
+ }
+ }
+ #else
+ void CCSurfacesLighting(inout LightingResult lightingResult, in SurfacesMaterialData surfaceData, in vec4 shadowPos, in vec2 shadowBias)
+ {
+ LightingIntermediateData lightingData;
+ CCSurfacesInitializeLightingIntermediateData(lightingData, surfaceData);
+ CCSurfacesInitializeLightingResult(lightingResult, surfaceData);
+
+ CCSurfacesLightingInitializeColorWithLighting(lightingResult.diffuseColorWithLighting, lightingResult.specularColorWithLighting, surfaceData, lightingData);
+
+ CCSurfacesLightingCalculateIntermediateData_PerLight(lightingData, surfaceData, -cc_mainLitDir.xyz);
+ CCSurfacesLightingCalculateColorWithLighting(lightingResult.diffuseColorWithLighting, lightingResult.specularColorWithLighting, surfaceData, lightingData);
+
+ CCSurfacesLightingCalculateDirect(lightingResult.directDiffuse, lightingResult.directSpecular, lightingData, cc_mainLitColor);
+
+ // CCSurfacesLightingCalculateShadow:
+ lightingResult.shadow = 1.0;
+ #if CC_RECEIVE_SHADOW
+ if (cc_mainLitDir.w > 0.0) {
+ if (CCSurfacesLightingEnableShadow(lightingData.NoL)) {
+ lightingResult.shadow = CCShadowFactorBase(shadowPos, lightingData.N, shadowBias);
+ }
+ }
+ #endif
+
+ // apply SSR, local probe & global probe
+ CCSurfacesLightingCalculateEnvironment(lightingResult, lightingData);
+
+ // CCSurfacesLightingCalculateTransmittence(lightingResult, lightingData, shadowPos);
+
+ // CCSurfacesLightingCalculateBaked:
+ lightingResult.lightmapColor = vec3(0.0);
+ #if CC_SURFACES_USE_LIGHT_MAP && !CC_SURFACES_USE_BATCHING && !CC_FORWARD_ADD
+ vec4 lightmap = GetLightMapColor(FSInput_lightMapUV.xy, FSInput_lightMapUV.z);
+ lightingResult.lightmapColor = lightmap.rgb;
+ // lightingResult.shadow/ao *= lightmap.a;
+ #endif
+
+ // apply screen-space shadow and ao
+ // lightingResult.shadow/ao *= XXX;
+
+
+
+ //#todo: cluster related lighting flow
+ #if CC_ENABLE_CLUSTERED_LIGHT_CULLING
+ //#include
+ #endif
+ }
+ #endif
+#endif
diff --git a/editor/assets/chunks/lighting-models/lighting-flow/common-flow.chunk.meta b/editor/assets/chunks/lighting-models/lighting-flow/common-flow.chunk.meta
new file mode 100644
index 0000000000..cab49c8ec6
--- /dev/null
+++ b/editor/assets/chunks/lighting-models/lighting-flow/common-flow.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "41c84281-f2e7-43e2-88bd-6ffcaf1daf5a",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/lighting-models/model-functions.meta b/editor/assets/chunks/lighting-models/model-functions.meta
new file mode 100644
index 0000000000..d4064e1afa
--- /dev/null
+++ b/editor/assets/chunks/lighting-models/model-functions.meta
@@ -0,0 +1,12 @@
+{
+ "ver": "1.1.0",
+ "importer": "directory",
+ "imported": true,
+ "uuid": "78ea1b40-6c4b-4eb4-b91e-b5bbee21f992",
+ "files": [],
+ "subMetas": {},
+ "userData": {
+ "compressionType": {},
+ "isRemoteBundle": {}
+ }
+}
diff --git a/editor/assets/chunks/lighting-models/model-functions/standard.chunk b/editor/assets/chunks/lighting-models/model-functions/standard.chunk
new file mode 100644
index 0000000000..c7161d938b
--- /dev/null
+++ b/editor/assets/chunks/lighting-models/model-functions/standard.chunk
@@ -0,0 +1,117 @@
+#include
+#include
+
+bool CCSurfacesLightingEnableShadow(in float NoL)
+{
+ return NoL > 0.0;
+}
+
+float CCSurfacesLightingCalculateDistanceAttenuation(in LightingIntermediateData lightingData, in vec4 lightSizeRangeAngle)
+{
+ return CalculateDistanceAttenuation(lightingData.distToLightSqr, lightSizeRangeAngle.x, lightSizeRangeAngle.y);
+}
+
+float CCSurfacesLightingCalculateAngleAttenuation(in LightingIntermediateData lightingData, in vec4 lightSizeRangeAngle, in vec3 spotLightDir)
+{
+ return CalculateAngleAttenuation(spotLightDir, lightingData.L, lightSizeRangeAngle.z);
+}
+
+void CCSurfacesLightingCalculateDirect(out vec3 lightingDiffuse, out vec3 lightingSpecular, in LightingIntermediateData lightingData, in vec4 lightSourceColorAndIntensity)
+{
+ vec3 irradiance = vec3(lightingData.NoLSat) * lightSourceColorAndIntensity.rgb * lightSourceColorAndIntensity.w;
+
+ lightingDiffuse = irradiance * DiffuseCoefficient_EnergyConservation;
+
+ float roughness = lightingData.specularParam;
+#if CC_SURFACES_LIGHTING_ANISOTROPIC
+ float rT, rB;
+ GetAnisotropicRoughness(roughness, lightingData.anisotropyShape, rT, rB);
+ float calcSpec = D_GGXAniso(rT, rB, lightingData.NoHSat, lightingData.H, lightingData.T, lightingData.B);
+#else
+ #if CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING
+ float calcSpec = (roughness * 0.25 + 0.25) * D_GGXMobile(roughness, lightingData.NoHSat);
+ #else
+ float calcSpec = D_GGX(roughness, lightingData.NoHSat);
+ #endif
+#endif
+ lightingSpecular = irradiance * calcSpec;
+}
+
+
+#if CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT
+ vec3 EnvAnisotropicReflection(vec3 R, float roughness, float mipCount, float anisotropyShape, vec3 V, vec3 N, vec3 T, vec3 B) {
+ R = normalize(R);
+ float integratedBRDF = 0.0;
+ vec3 envSpec = vec3(0.0);
+ // One direction sample count
+ const int SAMPLE_STEP_COUNT = CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT;
+ float sampleAngleRange = PI * abs(anisotropyShape);
+ vec3 anisoDirection = anisotropyShape < 0.0 ? T : B;
+ vec3 ROnNormalPlane = normalize(R - anisoDirection * dot(R, anisoDirection));
+ //ROnTangentPlane = R; //for example: cross-style
+ vec3 stepOffset = normalize(ROnNormalPlane - N) * (sampleAngleRange / float(SAMPLE_STEP_COUNT * 2));
+
+ for (int i = -SAMPLE_STEP_COUNT; i <= SAMPLE_STEP_COUNT; ++i)
+ {
+ float rT, rB;
+ GetAnisotropicRoughness(roughness, anisotropyShape, rT, rB);
+ float coef = pow(abs(float(i)) / float(SAMPLE_STEP_COUNT), 1.3) * float(SAMPLE_STEP_COUNT);
+ vec3 H = normalize(N + stepOffset * sign(float(i)) * coef);
+ vec3 L = reflect(-V, H);
+ float NoHSat = saturate(dot(N, H));
+ float calcSpec = D_GGXAniso(rT, rB, NoHSat, H, T, B);
+
+ envSpec += calcSpec * EnvReflection(L, roughness, mipCount);
+ integratedBRDF += calcSpec;
+ }
+ envSpec /= integratedBRDF;
+ return envSpec;
+ }
+#endif
+
+
+void CCSurfacesLightingCalculateEnvironment(inout LightingResult lightingResult, in LightingIntermediateData lightingData)
+{
+ float roughness = lightingData.specularParam;
+ float fAmb = 0.5 - lightingData.N.y * 0.5;
+ vec3 ambDiff = mix(cc_ambientSky.rgb, cc_ambientGround.rgb, fAmb);
+ vec3 envSpec = vec3(0.0);
+
+ #if CC_USE_IBL
+ #if CC_USE_DIFFUSEMAP
+ // Diffuse irradiance
+ vec4 diffuseMap = texture(cc_diffuseMap, lightingData.N);
+ #if CC_USE_DIFFUSEMAP == IBL_RGBE
+ ambDiff = unpackRGBE(diffuseMap);
+ #else
+ ambDiff = SRGBToLinear(diffuseMap.rgb);
+ #endif
+ #endif
+
+ #if CC_SURFACES_LIGHTING_ANISOTROPIC && !CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT
+ vec3 R = GetAnisotropicReflect(roughness, lightingData.anisotropyShape, lightingData.V, lightingData.N, lightingData.T, lightingData.B);
+ #else
+ vec3 R = reflect(-lightingData.V, lightingData.N);
+ #endif
+
+ #if CC_SURFACES_LIGHTING_ANISOTROPIC && CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT
+ envSpec = EnvAnisotropicReflection(R, roughness, cc_ambientGround.w, lightingData.anisotropyShape, lightingData.V, lightingData.N, lightingData.T, lightingData.B);
+ #else
+ #if CC_SURFACES_USE_REFLECTION_DENOISE
+ envSpec = EnvReflectionWithMipFiltering(normalize(R), roughness, cc_ambientGround.w, 0.6);
+ #else
+ envSpec = EnvReflection(R, roughness, cc_ambientGround.w);
+ #endif
+ #endif
+ #endif
+
+ lightingResult.environmentDiffuse = ambDiff.rgb * cc_ambientSky.w;
+ lightingResult.environmentSpecular = envSpec * cc_ambientSky.w;
+}
+
+void CCSurfacesLightingCalculateTransmittence(inout LightingResult lightingResult, in LightingIntermediateData lightingData, vec3 shadowPos)
+{
+ vec3 irradiance = vec3(lightingData.NoLSat);// * lightSourceColorAndIntensity.rgb * lightSourceColorAndIntensity.w;
+
+ vec3 transmittence = irradiance * DiffuseCoefficient_EnergyConservation;
+}
diff --git a/editor/assets/chunks/lighting-models/model-functions/standard.chunk.meta b/editor/assets/chunks/lighting-models/model-functions/standard.chunk.meta
new file mode 100644
index 0000000000..0849c228a1
--- /dev/null
+++ b/editor/assets/chunks/lighting-models/model-functions/standard.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "4c24618b-1e1d-40e4-883a-cd3fd2304233",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/lighting-models/model-functions/toon.chunk b/editor/assets/chunks/lighting-models/model-functions/toon.chunk
new file mode 100644
index 0000000000..4e6be6f9c4
--- /dev/null
+++ b/editor/assets/chunks/lighting-models/model-functions/toon.chunk
@@ -0,0 +1,42 @@
+#include
+#include
+
+bool CCSurfacesLightingEnableShadow(in float NoL)
+{
+ return NoL > 0.0;
+}
+
+float CCSurfacesLightingCalculateDistanceAttenuation(in LightingIntermediateData lightingData, in vec4 lightSizeRangeAngle)
+{
+ return CalculateDistanceAttenuation(lightingData.distToLightSqr, lightSizeRangeAngle.x, lightSizeRangeAngle.y);
+}
+
+float CCSurfacesLightingCalculateAngleAttenuation(in LightingIntermediateData lightingData, in vec4 lightSizeRangeAngle, in vec3 spotLightDir)
+{
+ return CalculateAngleAttenuation(spotLightDir, lightingData.L, lightSizeRangeAngle.z);
+}
+
+void CCSurfacesLightingCalculateDirect(out vec3 lightingDiffuse, out vec3 lightingSpecular, in LightingIntermediateData lightingData, in vec4 lightSourceColorAndIntensity)
+{
+ vec3 irradiance = lightSourceColorAndIntensity.rgb * lightSourceColorAndIntensity.w;
+
+ lightingDiffuse = irradiance; // no energy conservation
+
+ // punctual lighting is different from dir lighting
+#if CC_FORWARD_ADD || CC_ENABLE_CLUSTERED_LIGHT_CULLING
+ float NL = 0.5 * lightingData.NoL + 0.5;
+ lightingDiffuse *= NL;
+#endif
+
+ float NH = 0.5 * lightingData.NoH + 0.5;
+ float specularWeight = 1.0 - pow(lightingData.specularParam, 5.0);
+ float specularMask = step(specularWeight, NH);
+ lightingSpecular = irradiance * specularMask;
+}
+
+void CCSurfacesLightingCalculateEnvironment(inout LightingResult lightingResult, in LightingIntermediateData lightingData)
+{
+ lightingResult.environmentDiffuse = vec3(0.0);
+ lightingResult.environmentSpecular = vec3(0.0);
+}
+
diff --git a/editor/assets/chunks/lighting-models/model-functions/toon.chunk.meta b/editor/assets/chunks/lighting-models/model-functions/toon.chunk.meta
new file mode 100644
index 0000000000..f075e8bb14
--- /dev/null
+++ b/editor/assets/chunks/lighting-models/model-functions/toon.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "9276cd2c-6001-4f89-b024-f53f63628527",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/lighting.chunk.meta b/editor/assets/chunks/lighting.chunk.meta
index ccf012ca87..3948321428 100644
--- a/editor/assets/chunks/lighting.chunk.meta
+++ b/editor/assets/chunks/lighting.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "357618ca-4d71-41b6-af86-9534799c705e",
diff --git a/editor/assets/chunks/lightingmap-fs.chunk.meta b/editor/assets/chunks/lightingmap-fs.chunk.meta
index e5392020ba..96cde16ec4 100644
--- a/editor/assets/chunks/lightingmap-fs.chunk.meta
+++ b/editor/assets/chunks/lightingmap-fs.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "bf771826-ab41-49bd-8058-1cd0fa7a7273",
diff --git a/editor/assets/chunks/lightingmap-vs.chunk.meta b/editor/assets/chunks/lightingmap-vs.chunk.meta
index 251df876ed..c1c00b70f6 100644
--- a/editor/assets/chunks/lightingmap-vs.chunk.meta
+++ b/editor/assets/chunks/lightingmap-vs.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "d22a3ca1-78fe-442c-a604-0349f5c873f7",
diff --git a/editor/assets/chunks/morph.chunk.meta b/editor/assets/chunks/morph.chunk.meta
index 780801a95d..1c64e4e8f0 100644
--- a/editor/assets/chunks/morph.chunk.meta
+++ b/editor/assets/chunks/morph.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "5e669fb5-203c-4e59-90b1-10e6ef5d7e29",
diff --git a/editor/assets/chunks/octahedron-transform.chunk b/editor/assets/chunks/octahedron-transform.chunk
index 6c4869de2d..ab7c8cb26f 100644
--- a/editor/assets/chunks/octahedron-transform.chunk
+++ b/editor/assets/chunks/octahedron-transform.chunk
@@ -17,6 +17,11 @@ vec3 oct_to_float32x3(vec2 e) {
return normalize(v);
}
+float getCameraDepthRH(float ndcDepth, mat4 matProj)
+{
+ return -matProj[3][2] / (ndcDepth + matProj[2][2]);
+}
+
vec4 screen2WS(vec3 coord) {
vec3 ndc = vec3(
2.0 * (coord.x - cc_viewPort.x) / cc_viewPort.z - 1.0,
@@ -26,7 +31,8 @@ vec4 screen2WS(vec3 coord) {
#else
2.0 * coord.z - 1.0);
#endif
- vec4 world = ((cc_matViewProjInv) * (vec4(ndc, 1.0)));
- world = world / world.w;
+
+ float w = -getCameraDepthRH(ndc.z, cc_matProj);
+ vec4 world = (cc_matViewProjInv * vec4(ndc * w, w));
return world;
}
\ No newline at end of file
diff --git a/editor/assets/chunks/octahedron-transform.chunk.meta b/editor/assets/chunks/octahedron-transform.chunk.meta
index 3bda3bf8cb..eaba58d8f5 100644
--- a/editor/assets/chunks/octahedron-transform.chunk.meta
+++ b/editor/assets/chunks/octahedron-transform.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "41f91fc1-5aec-45dd-91ca-39ab964f8054",
diff --git a/editor/assets/chunks/outline-fs.chunk.meta b/editor/assets/chunks/outline-fs.chunk.meta
index 2d8169ce5a..1db43dc3d5 100644
--- a/editor/assets/chunks/outline-fs.chunk.meta
+++ b/editor/assets/chunks/outline-fs.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "4864e2f6-3eb5-4f08-a87a-5c98141cdef4",
diff --git a/editor/assets/chunks/outline-vs.chunk.meta b/editor/assets/chunks/outline-vs.chunk.meta
index 689b89766e..cf05e164f6 100644
--- a/editor/assets/chunks/outline-vs.chunk.meta
+++ b/editor/assets/chunks/outline-vs.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "f71444cb-cecf-4692-a310-2a5fdb96b469",
diff --git a/editor/assets/chunks/output-standard.chunk.meta b/editor/assets/chunks/output-standard.chunk.meta
index c3fbe0d46a..53509470a7 100644
--- a/editor/assets/chunks/output-standard.chunk.meta
+++ b/editor/assets/chunks/output-standard.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "a3c0cc1c-64de-4e52-9698-5f73f8db488e",
diff --git a/editor/assets/chunks/output.chunk.meta b/editor/assets/chunks/output.chunk.meta
index a2203d5e61..757b8947db 100644
--- a/editor/assets/chunks/output.chunk.meta
+++ b/editor/assets/chunks/output.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "713f0582-5c82-484f-81f7-5006e5a4f48f",
diff --git a/editor/assets/chunks/packing.chunk.meta b/editor/assets/chunks/packing.chunk.meta
index b1ab533fe1..342fe84231 100644
--- a/editor/assets/chunks/packing.chunk.meta
+++ b/editor/assets/chunks/packing.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "73866dd2-eaf5-40af-a061-1b9d38782204",
diff --git a/editor/assets/chunks/particle-common.chunk.meta b/editor/assets/chunks/particle-common.chunk.meta
index 4c2252d3d0..dd3cf33f0d 100644
--- a/editor/assets/chunks/particle-common.chunk.meta
+++ b/editor/assets/chunks/particle-common.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "7a49db3a-930e-4ffc-8659-a82141dabebb",
diff --git a/editor/assets/chunks/particle-trail.chunk.meta b/editor/assets/chunks/particle-trail.chunk.meta
index 910011983b..9f1815a4cc 100644
--- a/editor/assets/chunks/particle-trail.chunk.meta
+++ b/editor/assets/chunks/particle-trail.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "df7d02d8-559a-4c02-9aac-3732cfc83d7a",
diff --git a/editor/assets/chunks/particle-vs-gpu.chunk.meta b/editor/assets/chunks/particle-vs-gpu.chunk.meta
index c51d1602f3..7e57e88da4 100644
--- a/editor/assets/chunks/particle-vs-gpu.chunk.meta
+++ b/editor/assets/chunks/particle-vs-gpu.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "b4b00c01-eca8-4ae4-a04d-e00bbeb6d0e0",
diff --git a/editor/assets/chunks/particle-vs-legacy.chunk.meta b/editor/assets/chunks/particle-vs-legacy.chunk.meta
index 0f14dcbc47..0b053e1f26 100644
--- a/editor/assets/chunks/particle-vs-legacy.chunk.meta
+++ b/editor/assets/chunks/particle-vs-legacy.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "6e1b48cb-69c8-448c-8055-69ab9793fbab",
diff --git a/editor/assets/chunks/rect-area-light.chunk.meta b/editor/assets/chunks/rect-area-light.chunk.meta
index 1ab1daa523..a4d0acafa3 100644
--- a/editor/assets/chunks/rect-area-light.chunk.meta
+++ b/editor/assets/chunks/rect-area-light.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "a24fb7a1-f7a5-430c-a8b2-e4c516131086",
diff --git a/editor/assets/chunks/shading-cluster-additive.chunk.meta b/editor/assets/chunks/shading-cluster-additive.chunk.meta
index 7112e9b999..2e7fa12ab2 100644
--- a/editor/assets/chunks/shading-cluster-additive.chunk.meta
+++ b/editor/assets/chunks/shading-cluster-additive.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "b2d386c6-615b-4375-accd-574405611e35",
diff --git a/editor/assets/chunks/shading-entries.meta b/editor/assets/chunks/shading-entries.meta
new file mode 100644
index 0000000000..b7e1f7fbbb
--- /dev/null
+++ b/editor/assets/chunks/shading-entries.meta
@@ -0,0 +1,12 @@
+{
+ "ver": "1.1.0",
+ "importer": "directory",
+ "imported": true,
+ "uuid": "63ef0c7d-b48e-45d1-91ba-570e61a44c11",
+ "files": [],
+ "subMetas": {},
+ "userData": {
+ "compressionType": {},
+ "isRemoteBundle": {}
+ }
+}
diff --git a/editor/assets/chunks/shading-entries/data-structures.meta b/editor/assets/chunks/shading-entries/data-structures.meta
new file mode 100644
index 0000000000..ebc567d20a
--- /dev/null
+++ b/editor/assets/chunks/shading-entries/data-structures.meta
@@ -0,0 +1,12 @@
+{
+ "ver": "1.1.0",
+ "importer": "directory",
+ "imported": true,
+ "uuid": "f4c3a799-80ef-49a2-b0d8-b8f35ec3ddfb",
+ "files": [],
+ "subMetas": {},
+ "userData": {
+ "compressionType": {},
+ "isRemoteBundle": {}
+ }
+}
diff --git a/editor/assets/chunks/shading-entries/data-structures/fs-input.chunk b/editor/assets/chunks/shading-entries/data-structures/fs-input.chunk
new file mode 100644
index 0000000000..d676b0dbaa
--- /dev/null
+++ b/editor/assets/chunks/shading-entries/data-structures/fs-input.chunk
@@ -0,0 +1,90 @@
+#if __VERSION__ < 300
+ #define CC_SURFACES_VARING_MODIFIER varying
+#else
+ #define CC_SURFACES_VARING_MODIFIER in
+#endif
+
+#include
+
+// FS Input
+/*struct SurfacesStandardFragmentInput
+{
+ HIGHP_VALUE_STRUCT_DEFINE(vec3, worldPos);
+ vec3 worldNormal;
+ vec2 texcoord;
+
+#if CC_SURFACES_USE_VERTEX_COLOR
+ vec4 vertexColor;
+#endif
+
+#if CC_SURFACES_USE_TANGENT_SPACE
+ vec3 worldTangent, worldBitangent;
+ float mirrorNormal;
+#endif
+
+#if CC_SURFACES_USE_SECOND_UV
+ vec2 texcoord1;
+#endif
+
+#if CC_SURFACES_USE_LIGHT_MAP && !CC_SURFACES_USE_BATCHING && !CC_FORWARD_ADD
+ vec3 lightMapUV;
+#endif
+
+#if CC_RECEIVE_SHADOW
+ highp vec4 shadowPos;
+ vec2 shadowBias;
+#endif
+
+#if !CC_USE_ACCURATE_FOG
+ float fogFactor;
+#endif
+}
+void CCSurfacesGetFragmentInput(out SurfacesStandardFragmentInput fsInput)
+{
+}
+*/
+
+// Use macros instead of structure to avoid structure precision issues
+#define FSInput_worldPos v_worldPos
+#define FSInput_worldNormal v_normal.xyz
+#define FSInput_faceSideSign v_normal.w
+#define FSInput_texcoord v_uv
+
+#if CC_SURFACES_USE_VERTEX_COLOR
+ #define FSInput_vertexColor v_color
+#else
+ #define FSInput_vertexColor vec4(1.0) // for compatible user-surface functions in other render usage
+#endif
+
+#if CC_SURFACES_USE_TANGENT_SPACE
+ #define FSInput_worldTangent v_tangent.xyz
+ #define FSInput_mirrorNormal v_tangent.w
+#else
+ #define FSInput_worldTangent vec3(0.0, 0.0, 0.0)
+ #define FSInput_mirrorNormal 1.0
+#endif
+
+#if CC_SURFACES_USE_SECOND_UV && !CC_SURFACES_USE_LIGHT_MAP
+ #define FSInput_texcoord1 v_uv1
+#else
+ #define FSInput_texcoord1 vec2(0.0, 0.0)
+#endif
+
+#if CC_SURFACES_USE_LIGHT_MAP && !CC_SURFACES_USE_BATCHING && !CC_FORWARD_ADD
+ #define FSInput_lightMapUV v_luv
+#endif
+
+#if CC_RECEIVE_SHADOW
+ #define FSInput_shadowPos v_shadowPos
+ #if CC_SURFACES_USE_INSTANCING
+ #define FSInput_shadowBias v_shadowBias
+ #endif
+#endif
+
+#if !CC_USE_ACCURATE_FOG
+ #define FSInput_fogFactor v_fogFactor
+#endif
+
+#if CC_SURFACES_TRANSFER_LOCAL_POS
+ #define FSInput_localPos v_localPos
+#endif
diff --git a/editor/assets/chunks/shading-entries/data-structures/fs-input.chunk.meta b/editor/assets/chunks/shading-entries/data-structures/fs-input.chunk.meta
new file mode 100644
index 0000000000..ad5c2762a3
--- /dev/null
+++ b/editor/assets/chunks/shading-entries/data-structures/fs-input.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "ec870cfb-9c88-4f70-929a-ae540a33075b",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/shading-entries/data-structures/vs-fs.chunk b/editor/assets/chunks/shading-entries/data-structures/vs-fs.chunk
new file mode 100644
index 0000000000..2e5023f115
--- /dev/null
+++ b/editor/assets/chunks/shading-entries/data-structures/vs-fs.chunk
@@ -0,0 +1,35 @@
+//VS->PS
+CC_SURFACES_VARING_MODIFIER highp vec3 v_worldPos;
+CC_SURFACES_VARING_MODIFIER mediump vec4 v_normal;
+CC_SURFACES_VARING_MODIFIER vec2 v_uv;
+
+#if CC_SURFACES_USE_VERTEX_COLOR
+ CC_SURFACES_VARING_MODIFIER lowp vec4 v_color;
+#endif
+
+#if CC_SURFACES_USE_TANGENT_SPACE
+ CC_SURFACES_VARING_MODIFIER mediump vec4 v_tangent;
+#endif
+
+#if CC_SURFACES_USE_SECOND_UV && !CC_SURFACES_USE_LIGHT_MAP
+ CC_SURFACES_VARING_MODIFIER mediump vec2 v_uv1;
+#endif
+
+#if CC_SURFACES_USE_LIGHT_MAP && !CC_SURFACES_USE_BATCHING && !CC_FORWARD_ADD
+ CC_SURFACES_VARING_MODIFIER mediump vec3 v_luv;
+#endif
+
+#if CC_RECEIVE_SHADOW
+ CC_SURFACES_VARING_MODIFIER highp vec4 v_shadowPos;
+ #if CC_SURFACES_USE_INSTANCING
+ CC_SURFACES_VARING_MODIFIER mediump vec2 v_shadowBias;
+ #endif
+#endif
+
+#if !CC_USE_ACCURATE_FOG
+ CC_SURFACES_VARING_MODIFIER float v_fogFactor;
+#endif
+
+#if CC_SURFACES_TRANSFER_LOCAL_POS
+ CC_SURFACES_VARING_MODIFIER highp vec4 v_localPos;
+#endif
diff --git a/editor/assets/chunks/shading-entries/data-structures/vs-fs.chunk.meta b/editor/assets/chunks/shading-entries/data-structures/vs-fs.chunk.meta
new file mode 100644
index 0000000000..8d5234676c
--- /dev/null
+++ b/editor/assets/chunks/shading-entries/data-structures/vs-fs.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "f3454fd7-28d9-48dd-a761-ebc8e26834ed",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/shading-entries/data-structures/vs-input.chunk b/editor/assets/chunks/shading-entries/data-structures/vs-input.chunk
new file mode 100644
index 0000000000..c76eac5c7f
--- /dev/null
+++ b/editor/assets/chunks/shading-entries/data-structures/vs-input.chunk
@@ -0,0 +1,52 @@
+//IA Input
+layout(location = 0) in vec3 a_position;
+layout(location = 1) in vec3 a_normal;
+layout(location = 2) in vec2 a_texCoord;
+#if CC_SURFACES_USE_TANGENT_SPACE
+ layout(location = 3) in vec4 a_tangent;
+#endif
+
+#if CC_SURFACES_USE_VERTEX_COLOR
+ in vec4 a_color;
+#endif
+
+#if CC_SURFACES_USE_SECOND_UV || CC_SURFACES_USE_LIGHT_MAP
+ in vec2 a_texCoord1;
+#endif
+
+#if CC_USE_SKINNING
+ #if __VERSION__ > 310
+ // strictly speaking this should be u16vec4, but due to poor driver support
+ // somehow it seems we can get better results on many platforms using u32vec4
+ layout(location = 4) in u32vec4 a_joints;
+ #else
+ #pragma format(RGBA16UI)
+ layout(location = 4) in vec4 a_joints;
+ #endif
+
+ layout(location = 5) in vec4 a_weights;
+#endif
+
+#if CC_SURFACES_USE_INSTANCING
+ #if CC_USE_BAKED_ANIMATION
+ in highp vec4 a_jointAnimInfo; // frameID, totalJoints, offset
+ #endif
+ in vec4 a_matWorld0;
+ in vec4 a_matWorld1;
+ in vec4 a_matWorld2;
+ #if CC_SURFACES_USE_LIGHT_MAP
+ in vec4 a_lightingMapUVParam;
+ #endif
+ #if CC_RECEIVE_SHADOW
+ in vec2 a_localShadowBias; // x:shadow bias, y:shadow normal bias.
+ #endif
+#elif CC_SURFACES_USE_BATCHING
+ in float a_dyn_batch_id;
+#endif
+
+
+#if CC_USE_MORPH
+ #if __VERSION__ < 450
+ in float a_vertexId;
+ #endif
+#endif
diff --git a/editor/assets/chunks/shading-entries/data-structures/vs-input.chunk.meta b/editor/assets/chunks/shading-entries/data-structures/vs-input.chunk.meta
new file mode 100644
index 0000000000..f677aad75e
--- /dev/null
+++ b/editor/assets/chunks/shading-entries/data-structures/vs-input.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "65084d4a-ae7c-4ca9-8448-f4cd405144b7",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/shading-entries/data-structures/vs-intermediate.chunk b/editor/assets/chunks/shading-entries/data-structures/vs-intermediate.chunk
new file mode 100644
index 0000000000..447f2bfd3a
--- /dev/null
+++ b/editor/assets/chunks/shading-entries/data-structures/vs-intermediate.chunk
@@ -0,0 +1,54 @@
+struct SurfacesStandardVertexIntermediate
+{
+ //local space
+ highp vec4 position;
+ vec3 normal;
+#if CC_SURFACES_USE_TANGENT_SPACE
+ vec4 tangent;
+#endif
+
+ //other data
+#if CC_SURFACES_USE_VERTEX_COLOR
+ vec4 color;
+#endif
+
+ vec2 texCoord;
+#if CC_SURFACES_USE_SECOND_UV && !CC_SURFACES_USE_LIGHT_MAP
+ vec2 texCoord1;
+#endif
+
+ //transformed
+ highp vec4 clipPos;
+ highp vec3 worldPos;
+ vec4 worldNormal; // a: two side sign
+ #if CC_SURFACES_USE_TANGENT_SPACE
+ vec3 worldTangent, worldBinormal;
+ #endif
+
+ //transfered
+#if CC_RECEIVE_SHADOW
+ highp vec4 shadowPos;
+ vec2 shadowBias;
+#endif
+
+#if !CC_USE_ACCURATE_FOG
+ float fogFactor;
+#endif
+
+#if CC_SURFACES_USE_LIGHT_MAP && !CC_SURFACES_USE_BATCHING && !CC_FORWARD_ADD
+ vec3 lightmapUV;
+#endif
+};
+
+
+#if CC_USE_MORPH
+ #if __VERSION__ < 450
+ int getVertexId() {
+ return int(a_vertexId);
+ }
+ #else
+ int getVertexId() {
+ return gl_VertexIndex; // vulkan convension
+ }
+ #endif
+#endif
diff --git a/editor/assets/chunks/shading-entries/data-structures/vs-intermediate.chunk.meta b/editor/assets/chunks/shading-entries/data-structures/vs-intermediate.chunk.meta
new file mode 100644
index 0000000000..2b6fd329e8
--- /dev/null
+++ b/editor/assets/chunks/shading-entries/data-structures/vs-intermediate.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "45e6b403-a354-48de-a1e1-e59238bd30b1",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/shading-entries/data-structures/vs-output.chunk b/editor/assets/chunks/shading-entries/data-structures/vs-output.chunk
new file mode 100644
index 0000000000..6a3d167838
--- /dev/null
+++ b/editor/assets/chunks/shading-entries/data-structures/vs-output.chunk
@@ -0,0 +1,46 @@
+#if __VERSION__ < 300
+ #define CC_SURFACES_VARING_MODIFIER varying
+#else
+ #define CC_SURFACES_VARING_MODIFIER out
+#endif
+
+#include
+
+
+// Output item macros
+#define VSOutput_worldPos v_worldPos
+#define VSOutput_worldNormal v_normal.xyz
+#define VSOutput_faceSideSign v_normal.w
+#define VSOutput_texcoord v_uv
+
+#if CC_SURFACES_USE_VERTEX_COLOR
+ #define VSOutput_vertexColor v_color
+#endif
+
+#if CC_SURFACES_USE_TANGENT_SPACE
+ #define VSOutput_worldTangent v_tangent.xyz
+ #define VSOutput_mirrorNormal v_tangent.w
+#endif
+
+#if CC_SURFACES_USE_SECOND_UV && !CC_SURFACES_USE_LIGHT_MAP
+ #define VSOutput_texcoord1 v_uv1
+#endif
+
+#if CC_SURFACES_USE_LIGHT_MAP && !CC_SURFACES_USE_BATCHING && !CC_FORWARD_ADD
+ #define VSOutput_lightMapUV v_luv
+#endif
+
+#if CC_RECEIVE_SHADOW
+ #define VSOutput_shadowPos v_shadowPos
+ #if CC_SURFACES_USE_INSTANCING
+ #define VSOutput_shadowBias v_shadowBias
+ #endif
+#endif
+
+#if !CC_USE_ACCURATE_FOG
+ #define VSOutput_fogFactor v_fogFactor
+#endif
+
+#if CC_SURFACES_TRANSFER_LOCAL_POS
+ #define VSOutput_localPos v_localPos
+#endif
diff --git a/editor/assets/chunks/shading-entries/data-structures/vs-output.chunk.meta b/editor/assets/chunks/shading-entries/data-structures/vs-output.chunk.meta
new file mode 100644
index 0000000000..c96afad8fa
--- /dev/null
+++ b/editor/assets/chunks/shading-entries/data-structures/vs-output.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "513eb9a6-0193-4ab1-a7da-2ab087936caa",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/shading-entries/main-functions.meta b/editor/assets/chunks/shading-entries/main-functions.meta
new file mode 100644
index 0000000000..8beeb23d3a
--- /dev/null
+++ b/editor/assets/chunks/shading-entries/main-functions.meta
@@ -0,0 +1,12 @@
+{
+ "ver": "1.1.0",
+ "importer": "directory",
+ "imported": true,
+ "uuid": "06ae07af-f0bd-4133-acd2-f1f8580f797b",
+ "files": [],
+ "subMetas": {},
+ "userData": {
+ "compressionType": {},
+ "isRemoteBundle": {}
+ }
+}
diff --git a/editor/assets/chunks/shading-entries/main-functions/deferred.meta b/editor/assets/chunks/shading-entries/main-functions/deferred.meta
new file mode 100644
index 0000000000..817d1ceccf
--- /dev/null
+++ b/editor/assets/chunks/shading-entries/main-functions/deferred.meta
@@ -0,0 +1,12 @@
+{
+ "ver": "1.1.0",
+ "importer": "directory",
+ "imported": true,
+ "uuid": "bf711db6-efd9-4505-b6cb-ab1583165328",
+ "files": [],
+ "subMetas": {},
+ "userData": {
+ "compressionType": {},
+ "isRemoteBundle": {}
+ }
+}
diff --git a/editor/assets/chunks/shading-entries/main-functions/forward.meta b/editor/assets/chunks/shading-entries/main-functions/forward.meta
new file mode 100644
index 0000000000..9e44948a56
--- /dev/null
+++ b/editor/assets/chunks/shading-entries/main-functions/forward.meta
@@ -0,0 +1,12 @@
+{
+ "ver": "1.1.0",
+ "importer": "directory",
+ "imported": true,
+ "uuid": "7698a66d-0cc2-4602-92b4-ced4196f5554",
+ "files": [],
+ "subMetas": {},
+ "userData": {
+ "compressionType": {},
+ "isRemoteBundle": {}
+ }
+}
diff --git a/editor/assets/chunks/shading-entries/main-functions/misc.meta b/editor/assets/chunks/shading-entries/main-functions/misc.meta
new file mode 100644
index 0000000000..004c94499c
--- /dev/null
+++ b/editor/assets/chunks/shading-entries/main-functions/misc.meta
@@ -0,0 +1,12 @@
+{
+ "ver": "1.1.0",
+ "importer": "directory",
+ "imported": true,
+ "uuid": "2cf1e156-25bd-4e1c-8cda-d9f14512debf",
+ "files": [],
+ "subMetas": {},
+ "userData": {
+ "compressionType": {},
+ "isRemoteBundle": {}
+ }
+}
diff --git a/editor/assets/chunks/shading-entries/main-functions/misc/silhouette-edge-fs.chunk b/editor/assets/chunks/shading-entries/main-functions/misc/silhouette-edge-fs.chunk
new file mode 100644
index 0000000000..b04440b2e4
--- /dev/null
+++ b/editor/assets/chunks/shading-entries/main-functions/misc/silhouette-edge-fs.chunk
@@ -0,0 +1,20 @@
+layout(location = 0) out vec4 fragColorX;
+
+void main () {
+ // for alpha clip
+ vec4 color = SurfacesFragmentModifyBaseColorAndTransparency();
+
+ //#uniformStyle need sync here
+
+ // Color output
+#if CC_USE_HDR
+ #if !CC_SURFACES_DEBUG_VIEW_COMPOSITE_MODE || (CC_SURFACES_DEBUG_VIEW_COMPOSITE_MODE & CC_SURFACES_DEBUG_VIEW_COMPOSITE_TONE_MAPPING)
+ color.rgb = ACESToneMap(color.rgb);
+ #endif
+#endif
+#if !CC_SURFACES_DEBUG_VIEW_COMPOSITE_MODE || (CC_SURFACES_DEBUG_VIEW_COMPOSITE_MODE & CC_SURFACES_DEBUG_VIEW_COMPOSITE_GAMMA_CORRECTION)
+ color.rgb = LinearToSRGB(color.rgb);
+#endif
+
+ fragColorX = color;
+}
diff --git a/editor/assets/chunks/shading-entries/main-functions/misc/silhouette-edge-fs.chunk.meta b/editor/assets/chunks/shading-entries/main-functions/misc/silhouette-edge-fs.chunk.meta
new file mode 100644
index 0000000000..c074a8c6a7
--- /dev/null
+++ b/editor/assets/chunks/shading-entries/main-functions/misc/silhouette-edge-fs.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "1d7d5670-83c4-4dab-acf3-edb7ae758881",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/shading-entries/main-functions/misc/silhouette-edge-vs.chunk b/editor/assets/chunks/shading-entries/main-functions/misc/silhouette-edge-vs.chunk
new file mode 100644
index 0000000000..c8705aaad0
--- /dev/null
+++ b/editor/assets/chunks/shading-entries/main-functions/misc/silhouette-edge-vs.chunk
@@ -0,0 +1 @@
+ #include
diff --git a/editor/assets/chunks/shading-entries/main-functions/misc/silhouette-edge-vs.chunk.meta b/editor/assets/chunks/shading-entries/main-functions/misc/silhouette-edge-vs.chunk.meta
new file mode 100644
index 0000000000..f7d04edfca
--- /dev/null
+++ b/editor/assets/chunks/shading-entries/main-functions/misc/silhouette-edge-vs.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "e25e8368-0f16-4322-981e-8b7eebc97afb",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/shading-entries/main-functions/render-to-scene.meta b/editor/assets/chunks/shading-entries/main-functions/render-to-scene.meta
new file mode 100644
index 0000000000..2fdbbcc211
--- /dev/null
+++ b/editor/assets/chunks/shading-entries/main-functions/render-to-scene.meta
@@ -0,0 +1,12 @@
+{
+ "ver": "1.1.0",
+ "importer": "directory",
+ "imported": true,
+ "uuid": "3178c6da-bf26-4546-b3f2-a4d0dddd82aa",
+ "files": [],
+ "subMetas": {},
+ "userData": {
+ "compressionType": {},
+ "isRemoteBundle": {}
+ }
+}
diff --git a/editor/assets/chunks/shading-entries/main-functions/render-to-scene/fs.chunk b/editor/assets/chunks/shading-entries/main-functions/render-to-scene/fs.chunk
new file mode 100644
index 0000000000..74abf06c26
--- /dev/null
+++ b/editor/assets/chunks/shading-entries/main-functions/render-to-scene/fs.chunk
@@ -0,0 +1,5 @@
+#if (CC_PIPELINE_TYPE == CC_PIPELINE_TYPE_FORWARD || CC_FORCE_FORWARD_SHADING)
+ #include
+#elif CC_PIPELINE_TYPE == CC_PIPELINE_TYPE_DEFERRED
+ #include
+#endif
diff --git a/editor/assets/chunks/shading-entries/main-functions/render-to-scene/fs.chunk.meta b/editor/assets/chunks/shading-entries/main-functions/render-to-scene/fs.chunk.meta
new file mode 100644
index 0000000000..f03f9d5b00
--- /dev/null
+++ b/editor/assets/chunks/shading-entries/main-functions/render-to-scene/fs.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "52b875e1-87c0-4dc5-a3f7-ce32cb4d93c6",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/shading-entries/main-functions/render-to-scene/pipeline.meta b/editor/assets/chunks/shading-entries/main-functions/render-to-scene/pipeline.meta
new file mode 100644
index 0000000000..a4b519d6a2
--- /dev/null
+++ b/editor/assets/chunks/shading-entries/main-functions/render-to-scene/pipeline.meta
@@ -0,0 +1,12 @@
+{
+ "ver": "1.1.0",
+ "importer": "directory",
+ "imported": true,
+ "uuid": "adef72f1-d7cf-4519-b83c-6fd861d8c703",
+ "files": [],
+ "subMetas": {},
+ "userData": {
+ "compressionType": {},
+ "isRemoteBundle": {}
+ }
+}
diff --git a/editor/assets/chunks/shading-entries/main-functions/render-to-scene/pipeline/deferred-fs.chunk b/editor/assets/chunks/shading-entries/main-functions/render-to-scene/pipeline/deferred-fs.chunk
new file mode 100644
index 0000000000..75e7e1c512
--- /dev/null
+++ b/editor/assets/chunks/shading-entries/main-functions/render-to-scene/pipeline/deferred-fs.chunk
@@ -0,0 +1,13 @@
+ layout(location = 0) out vec4 fragColor0;
+ layout(location = 1) out vec4 fragColor1;
+ layout(location = 2) out vec4 fragColor2;
+
+ void main () {
+ // Surface
+ SurfacesMaterialData surfaceData;
+ CCSurfacesFragmentGetMaterialData(surfaceData);
+
+ fragColor0 = CCSurfacesDeferredOutput0(surfaceData);
+ fragColor1 = CCSurfacesDeferredOutput1(surfaceData);
+ fragColor2 = CCSurfacesDeferredOutput2(surfaceData);
+ }
diff --git a/editor/assets/chunks/shading-entries/main-functions/render-to-scene/pipeline/deferred-fs.chunk.meta b/editor/assets/chunks/shading-entries/main-functions/render-to-scene/pipeline/deferred-fs.chunk.meta
new file mode 100644
index 0000000000..0650e1b8f5
--- /dev/null
+++ b/editor/assets/chunks/shading-entries/main-functions/render-to-scene/pipeline/deferred-fs.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "1101cf65-cc90-486b-b6a5-29ae060e01c7",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/shading-entries/main-functions/render-to-scene/pipeline/forward-fs.chunk b/editor/assets/chunks/shading-entries/main-functions/render-to-scene/pipeline/forward-fs.chunk
new file mode 100644
index 0000000000..884652ef8b
--- /dev/null
+++ b/editor/assets/chunks/shading-entries/main-functions/render-to-scene/pipeline/forward-fs.chunk
@@ -0,0 +1,178 @@
+layout(location = 0) out vec4 fragColorX;
+
+void main() {
+#if CC_DISABLE_STRUCTURE_IN_FRAGMENT_SHADER
+ float NoL = dot(-cc_mainLitDir.xyz, FSInput_worldNormal.xyz); //trigger ubo binding
+ vec4 color = SurfacesFragmentModifyBaseColorAndTransparency();
+#else
+ // Surface
+ SurfacesMaterialData surfaceData;
+ CCSurfacesFragmentGetMaterialData(surfaceData);
+
+ // Shadow factor
+ highp vec4 shadowPos = vec4(0.0);
+ vec2 shadowBias = vec2(0.0);
+ vec3 colDebugCSMLayer = vec3(1.0);
+ #if CC_RECEIVE_SHADOW
+ shadowPos = FSInput_shadowPos;
+ shadowBias = vec2(cc_shadowWHPBInfo.w, cc_shadowLPNNInfo.z);
+ #if CC_SURFACES_USE_INSTANCING
+ shadowBias = FSInput_shadowBias;
+ #elif !CC_SURFACES_USE_BATCHING
+ shadowBias += cc_localShadowBias.xy;
+ #endif
+ #if !CC_FORWARD_ADD
+ //#uniformStyle
+ #if CC_SURFACES_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION
+ //#if CC_SURFACES_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC
+ //if (cc_debug_view_misc_enable_csm_layer_coloration > 0.0)
+ {
+ int CSMLayer = 0;
+ bool OutOfRange = false;
+ if (OutOfRange)
+ colDebugCSMLayer = vec3(1.0);
+ else if (CSMLayer == 0)
+ colDebugCSMLayer = vec3(1.0, 0.0, 0.0);
+ else if (CSMLayer == 1)
+ colDebugCSMLayer = vec3(0.0, 1.0, 0.0);
+ else if (CSMLayer == 2)
+ colDebugCSMLayer = vec3(0.0, 0.0, 1.0);
+ else if (CSMLayer == 3)
+ colDebugCSMLayer = vec3(0.0, 1.0, 1.0);
+ }
+ #endif
+ #endif
+ #endif
+
+
+ // Fog factor
+ #if !CC_FORWARD_ADD
+ float fogFactor = 0.0;
+ #if !CC_USE_ACCURATE_FOG
+ fogFactor = FSInput_fogFactor;
+ #else
+ CC_TRANSFER_FOG_BASE(vec4(FSInput_worldPos, 1.0), fogFactor);
+ #endif
+
+ #if CC_SURFACES_DEBUG_VIEW_COMPOSITE_MODE && !(CC_SURFACES_DEBUG_VIEW_COMPOSITE_MODE & CC_SURFACES_DEBUG_VIEW_COMPOSITE_FOG)
+ fogFactor = 0.0;
+ #endif
+ //#uniformStyle
+ #if CC_SURFACES_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC
+ if (cc_debug_view_composite_enable_fog <= 0.0) {
+ fogFactor = 0.0;
+ }
+ #endif
+ //-----------------------------------------------
+ #endif
+
+
+ // Lighting
+ LightingResult lightingResult;
+ CCSurfacesLighting(lightingResult, surfaceData, shadowPos, shadowBias);
+
+
+ // Debug view
+ #if CC_SURFACES_DEBUG_VIEW_MODE
+ vec4 debugColor = vec4(0.0, 0.0, 0.0, 1.0);
+ #if !CC_FORWARD_ADD
+ CCSurfacesDebugViewMeshData(debugColor);
+ CCSurfacesDebugViewSurfaceData(debugColor, surfaceData);
+ CCSurfacesDebugViewLightingResult(debugColor, lightingResult);
+ #if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_FOG
+ fogFactor = 1.0 - fogFactor;
+ debugColor = vec4(fogFactor, fogFactor, fogFactor, 1.0);
+ #endif
+ #endif
+
+ // only base pass or direct lighting is enabled in add pass
+ #if !CC_FORWARD_ADD || CC_FORWARD_ADD && (CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE || CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR || CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_DIRECT_ALL)
+ CCSurfacesDebugViewLightingResult(debugColor, lightingResult);
+ #endif
+
+ fragColorX = debugColor;
+ return;
+ #elif CC_SURFACES_DEBUG_VIEW_COMPOSITE_MODE
+ #if !CC_FORWARD_ADD || CC_FORWARD_ADD && ((CC_SURFACES_DEBUG_VIEW_COMPOSITE_MODE & CC_SURFACES_DEBUG_VIEW_COMPOSITE_DIRECT_DIFFUSE) || (CC_SURFACES_DEBUG_VIEW_COMPOSITE_MODE & CC_SURFACES_DEBUG_VIEW_COMPOSITE_DIRECT_SPECULAR))
+ CCSurfacesDebugViewCompositeLightingResult(lightingResult);
+ #endif
+ #endif
+
+ //#uniformStyle
+ #if CC_SURFACES_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_SINGLE
+ vec4 debugColor = vec4(0.0, 0.0, 0.0, 1.0);
+ #if !CC_FORWARD_ADD
+ CCSurfacesDebugViewMeshData(debugColor);
+ CCSurfacesDebugViewSurfaceData(debugColor, surfaceData);
+ CCSurfacesDebugViewLightingResult(debugColor, lightingResult);
+ if (equalf(cc_debug_view_single_mode, CC_SURFACES_DEBUG_VIEW_FOG))
+ {
+ fogFactor = 1.0 - fogFactor;
+ debugColor = vec4(fogFactor, fogFactor, fogFactor, 1.0);
+ }
+ #endif
+
+ // only base pass or direct lighting is enabled in add pass
+ #if CC_FORWARD_ADD
+ if (equalf(cc_debug_view_single_mode, CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE) || equalf(cc_debug_view_single_mode, CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR) || equalf(cc_debug_view_single_mode, CC_SURFACES_DEBUG_VIEW_DIRECT_ALL))
+ #endif
+ CCSurfacesDebugViewLightingResult(debugColor, lightingResult);
+
+ fragColorX = debugColor;
+ return;
+ #elif CC_SURFACES_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC
+ #if CC_FORWARD_ADD
+ if(cc_debug_view_composite_enable_direct_diffuse > 0.0 || cc_debug_view_composite_enable_direct_specular > 0.0)
+ #endif
+ CCSurfacesDebugViewCompositeLightingResult(lightingResult);
+ #endif
+ //-----------------------------------------------
+
+ // Shading and output
+ vec4 color = CCSurfacesShading(surfaceData, lightingResult);
+
+ #if !CC_FORWARD_ADD
+ CC_APPLY_FOG_BASE(color, fogFactor);
+ #endif
+
+ /*
+ // CSM Debug
+ #if CC_SURFACES_DEBUG_VIEW_MISC_ENABLE_CSM_LAYER_COLORATION
+ color.rgb *= colDebugCSMLayer.rgb;
+ #endif
+
+ // Color output
+ #if CC_USE_HDR
+ #if !CC_SURFACES_DEBUG_VIEW_COMPOSITE_MODE || (CC_SURFACES_DEBUG_VIEW_COMPOSITE_MODE & CC_SURFACES_DEBUG_VIEW_COMPOSITE_TONE_MAPPING)
+ color.rgb = ACESToneMap(color.rgb);
+ #endif
+ #endif
+ #if !CC_SURFACES_DEBUG_VIEW_COMPOSITE_MODE || (CC_SURFACES_DEBUG_VIEW_COMPOSITE_MODE & CC_SURFACES_DEBUG_VIEW_COMPOSITE_GAMMA_CORRECTION)
+ color.rgb = LinearToSRGB(color.rgb);
+ #endif
+ */
+ //#uniformStyle
+ // CSM Debug
+ #if CC_SURFACES_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC
+ if (cc_debug_view_misc_enable_csm_layer_coloration > 0.0) {
+ color.rgb *= colDebugCSMLayer.rgb;
+ }
+ #endif
+
+ #if CC_USE_HDR
+ #if CC_SURFACES_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC
+ if (cc_debug_view_composite_enable_tone_mapping > 0.0)
+ #endif
+ color.rgb = ACESToneMap(color.rgb);
+ #endif
+ #if CC_SURFACES_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC
+ if (cc_debug_view_composite_enable_gamma_correction > 0.0)
+ #endif
+ color.rgb = LinearToSRGB(color.rgb);
+ //-----------------------------------------------
+
+ CCSurfacesDebugDisplayInvalidNumber(color);
+#endif
+
+ fragColorX = color;
+}
diff --git a/editor/assets/chunks/shading-entries/main-functions/render-to-scene/pipeline/forward-fs.chunk.meta b/editor/assets/chunks/shading-entries/main-functions/render-to-scene/pipeline/forward-fs.chunk.meta
new file mode 100644
index 0000000000..aa263fd2cf
--- /dev/null
+++ b/editor/assets/chunks/shading-entries/main-functions/render-to-scene/pipeline/forward-fs.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "349a2be0-c8d3-420c-9dd1-bf86e01a7055",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/shading-entries/main-functions/render-to-scene/vs.chunk b/editor/assets/chunks/shading-entries/main-functions/render-to-scene/vs.chunk
new file mode 100644
index 0000000000..6d9239e75d
--- /dev/null
+++ b/editor/assets/chunks/shading-entries/main-functions/render-to-scene/vs.chunk
@@ -0,0 +1,32 @@
+void main()
+{
+ SurfacesStandardVertexIntermediate In;
+
+ // Local Space
+ CCSurfacesVertexInput(In);
+ CCSurfacesVertexAnimation(In);
+ In.position.xyz = SurfacesVertexModifyLocalPos(In);
+
+ // World Space
+ CCSurfacesVertexWorldTransform(In);
+ In.worldPos = SurfacesVertexModifyWorldPos(In);
+
+ // Clip Space
+ In.clipPos = cc_matProj * cc_matView * vec4(In.worldPos, 1.0);
+ In.clipPos = SurfacesVertexModifyClipPos(In);
+
+ // Other Surfaces Function
+ SurfacesVertexModifyUV(In);
+
+ vec3 viewDirect = normalize(cc_cameraPos.xyz - In.worldPos);
+ In.worldNormal.w = dot(In.worldNormal.xyz, viewDirect) < 0.0 ? -1.0 : 1.0;
+ In.worldNormal.xyz = SurfacesVertexModifyWorldNormal(In);
+
+ // Other Data
+ CCSurfacesVertexTransformUV(In);
+ CCSurfacesVertexTransferFog(In);
+ CCSurfacesVertexTransferShadow(In);
+ CCSurfacesVertexTransferLightMapUV(In);
+
+ CCSurfacesVertexOutput(In);
+}
diff --git a/editor/assets/chunks/shading-entries/main-functions/render-to-scene/vs.chunk.meta b/editor/assets/chunks/shading-entries/main-functions/render-to-scene/vs.chunk.meta
new file mode 100644
index 0000000000..c64dcbc2aa
--- /dev/null
+++ b/editor/assets/chunks/shading-entries/main-functions/render-to-scene/vs.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "4306c0df-b6d6-4733-8a45-c85907f94d29",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/shading-entries/main-functions/render-to-shadowmap.meta b/editor/assets/chunks/shading-entries/main-functions/render-to-shadowmap.meta
new file mode 100644
index 0000000000..91f6878c7c
--- /dev/null
+++ b/editor/assets/chunks/shading-entries/main-functions/render-to-shadowmap.meta
@@ -0,0 +1,12 @@
+{
+ "ver": "1.1.0",
+ "importer": "directory",
+ "imported": true,
+ "uuid": "f9762a24-4414-4234-82fd-5c6b37f1cb51",
+ "files": [],
+ "subMetas": {},
+ "userData": {
+ "compressionType": {},
+ "isRemoteBundle": {}
+ }
+}
diff --git a/editor/assets/chunks/shading-entries/main-functions/render-to-shadowmap/fs.chunk b/editor/assets/chunks/shading-entries/main-functions/render-to-shadowmap/fs.chunk
new file mode 100644
index 0000000000..f9df74b7f6
--- /dev/null
+++ b/editor/assets/chunks/shading-entries/main-functions/render-to-shadowmap/fs.chunk
@@ -0,0 +1,23 @@
+ in float v_clip_depth;
+
+ layout(location = 0) out vec4 fragColorX;
+
+ void main () {
+ // for alpha clip
+ SurfacesFragmentModifyBaseColorAndTransparency();
+
+ // spot use linear
+ if(cc_shadowLPNNInfo.x > EPSILON && cc_shadowLPNNInfo.x < 1.999999) {
+ // enabled linear depth
+ if (cc_shadowNFLSInfo.z > EPSILON) {
+ fragColorX = vec4(CCGetLinearDepth(FSInput_worldPos.xyz), 1.0, 1.0, 1.0);
+ return;
+ }
+ }
+
+ if (cc_shadowLPNNInfo.y > EPSILON) {
+ fragColorX = packDepthToRGBA(v_clip_depth);
+ } else {
+ fragColorX = vec4(v_clip_depth, 1.0, 1.0, 1.0);
+ }
+ }
\ No newline at end of file
diff --git a/editor/assets/chunks/shading-entries/main-functions/render-to-shadowmap/fs.chunk.meta b/editor/assets/chunks/shading-entries/main-functions/render-to-shadowmap/fs.chunk.meta
new file mode 100644
index 0000000000..b1162e9aa6
--- /dev/null
+++ b/editor/assets/chunks/shading-entries/main-functions/render-to-shadowmap/fs.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "a734c67a-3ce2-4978-bf57-080d1dfbbb43",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/shading-entries/main-functions/render-to-shadowmap/vs.chunk b/editor/assets/chunks/shading-entries/main-functions/render-to-shadowmap/vs.chunk
new file mode 100644
index 0000000000..9122256bb6
--- /dev/null
+++ b/editor/assets/chunks/shading-entries/main-functions/render-to-shadowmap/vs.chunk
@@ -0,0 +1,33 @@
+#include
+#include
+
+out float v_clip_depth;
+
+void main()
+{
+ SurfacesStandardVertexIntermediate In;
+
+ // Local Space
+ CCSurfacesVertexInput(In);
+ CCSurfacesVertexAnimation(In);
+ In.position.xyz = SurfacesVertexModifyLocalPos(In);
+
+ // World Space
+ CCSurfacesVertexWorldTransform(In);
+ In.worldPos = SurfacesVertexModifyWorldPos(In);
+
+ // Clip Space
+ In.clipPos = cc_matLightViewProj * vec4(In.worldPos, 1.0);
+ In.clipPos = SurfacesVertexModifyClipPos(In);
+
+ // Other Surfaces Function
+ SurfacesVertexModifyUV(In);
+
+ // Other Data
+ CCSurfacesVertexTransformUV(In);
+
+ CCSurfacesVertexOutput(In);
+
+ // Depth
+ v_clip_depth = In.clipPos.z / In.clipPos.w * 0.5 + 0.5;
+}
diff --git a/editor/assets/chunks/shading-entries/main-functions/render-to-shadowmap/vs.chunk.meta b/editor/assets/chunks/shading-entries/main-functions/render-to-shadowmap/vs.chunk.meta
new file mode 100644
index 0000000000..1352797f1f
--- /dev/null
+++ b/editor/assets/chunks/shading-entries/main-functions/render-to-shadowmap/vs.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "7a668e36-d75e-488d-b47a-52591e07151d",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/shading-standard-additive.chunk.meta b/editor/assets/chunks/shading-standard-additive.chunk.meta
index 91bdac4b31..6fd305c7af 100644
--- a/editor/assets/chunks/shading-standard-additive.chunk.meta
+++ b/editor/assets/chunks/shading-standard-additive.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "a70c48b7-cf69-4c97-a857-21149cd71200",
diff --git a/editor/assets/chunks/shading-standard-base.chunk b/editor/assets/chunks/shading-standard-base.chunk
index f438889c48..e82175428a 100644
--- a/editor/assets/chunks/shading-standard-base.chunk
+++ b/editor/assets/chunks/shading-standard-base.chunk
@@ -124,7 +124,7 @@ vec4 CCStandardShadingBase (StandardSurface s, vec4 shadowPos) {
dirlightContrib *= shadow;
finalColor *= dirlightContrib;
- #if USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD
+ #if CC_USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD
if (s.lightmap_test > EPSILON_LOWP) {
finalColor = diffuse * s.lightmap.rgb * shadow;
}
diff --git a/editor/assets/chunks/shading-standard-base.chunk.meta b/editor/assets/chunks/shading-standard-base.chunk.meta
index 3585f00cd2..4bc9d740c5 100644
--- a/editor/assets/chunks/shading-standard-base.chunk.meta
+++ b/editor/assets/chunks/shading-standard-base.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "9ae7cfaf-c5cc-4899-95a5-d6e1215c8964",
diff --git a/editor/assets/chunks/shading-standard.chunk.meta b/editor/assets/chunks/shading-standard.chunk.meta
index c068df4ee3..90d6765d17 100644
--- a/editor/assets/chunks/shading-standard.chunk.meta
+++ b/editor/assets/chunks/shading-standard.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "f9ba1729-bacf-4e62-8c97-0103d940c464",
diff --git a/editor/assets/chunks/shading-toon.chunk.meta b/editor/assets/chunks/shading-toon.chunk.meta
index 49dc7e3349..1d5796ffff 100644
--- a/editor/assets/chunks/shading-toon.chunk.meta
+++ b/editor/assets/chunks/shading-toon.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "bbfd1dfb-8f99-4b68-9aa6-817d5b67096d",
diff --git a/editor/assets/chunks/skinning-dqs.chunk.meta b/editor/assets/chunks/skinning-dqs.chunk.meta
index 344e7a5a86..4495eb796d 100644
--- a/editor/assets/chunks/skinning-dqs.chunk.meta
+++ b/editor/assets/chunks/skinning-dqs.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "207a9764-f20a-4e41-997d-cadd0cdb65fd",
diff --git a/editor/assets/chunks/skinning-lbs.chunk.meta b/editor/assets/chunks/skinning-lbs.chunk.meta
index 35dc6382e9..a66ddab4bc 100644
--- a/editor/assets/chunks/skinning-lbs.chunk.meta
+++ b/editor/assets/chunks/skinning-lbs.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "d875d091-0140-4a00-9517-6810755d394d",
diff --git a/editor/assets/chunks/standard-surface-entry.chunk.meta b/editor/assets/chunks/standard-surface-entry.chunk.meta
index 0725978f59..e025cf4dc4 100644
--- a/editor/assets/chunks/standard-surface-entry.chunk.meta
+++ b/editor/assets/chunks/standard-surface-entry.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "31d0a199-05e2-422c-a019-8139a855841c",
diff --git a/editor/assets/chunks/surfaces.meta b/editor/assets/chunks/surfaces.meta
new file mode 100644
index 0000000000..c40fdf128b
--- /dev/null
+++ b/editor/assets/chunks/surfaces.meta
@@ -0,0 +1,12 @@
+{
+ "ver": "1.1.0",
+ "importer": "directory",
+ "imported": true,
+ "uuid": "a72601dc-aa97-42b1-b08b-89baead303e5",
+ "files": [],
+ "subMetas": {},
+ "userData": {
+ "compressionType": {},
+ "isRemoteBundle": {}
+ }
+}
diff --git a/editor/assets/chunks/surfaces/data-structures.meta b/editor/assets/chunks/surfaces/data-structures.meta
new file mode 100644
index 0000000000..afad70e182
--- /dev/null
+++ b/editor/assets/chunks/surfaces/data-structures.meta
@@ -0,0 +1,12 @@
+{
+ "ver": "1.1.0",
+ "importer": "directory",
+ "imported": true,
+ "uuid": "d1b7b36d-4023-435d-9223-6ed39e86dbfb",
+ "files": [],
+ "subMetas": {},
+ "userData": {
+ "compressionType": {},
+ "isRemoteBundle": {}
+ }
+}
diff --git a/editor/assets/chunks/surfaces/data-structures/standard.chunk b/editor/assets/chunks/surfaces/data-structures/standard.chunk
new file mode 100644
index 0000000000..62711411f6
--- /dev/null
+++ b/editor/assets/chunks/surfaces/data-structures/standard.chunk
@@ -0,0 +1,21 @@
+struct SurfacesMaterialData
+{
+ HIGHP_VALUE_STRUCT_DEFINE(vec3, worldPos);
+
+ vec4 baseColor;
+ vec3 worldNormal;
+ vec3 emissive;
+
+ float specularIntensity;
+ float roughness;
+ float metallic;
+ float ao;
+
+ // for advanced PBR
+ vec3 worldTangent, worldBinormal;
+#if CC_SURFACES_LIGHTING_ANISOTROPIC
+ float anisotropyShape;
+#endif
+ // float transmittanceFactor;
+ // float sssCurvature;
+};
diff --git a/editor/assets/chunks/surfaces/data-structures/standard.chunk.meta b/editor/assets/chunks/surfaces/data-structures/standard.chunk.meta
new file mode 100644
index 0000000000..6f0d6deb76
--- /dev/null
+++ b/editor/assets/chunks/surfaces/data-structures/standard.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "29b8aed8-f4da-471e-a036-4fffc28868f3",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/surfaces/data-structures/toon.chunk b/editor/assets/chunks/surfaces/data-structures/toon.chunk
new file mode 100644
index 0000000000..0fe329c835
--- /dev/null
+++ b/editor/assets/chunks/surfaces/data-structures/toon.chunk
@@ -0,0 +1,17 @@
+struct SurfacesMaterialData
+{
+ HIGHP_VALUE_STRUCT_DEFINE(vec3, worldPos);
+
+ vec4 baseColor;
+ vec4 specular;
+ vec3 worldNormal;
+ vec3 emissive;
+
+ vec3 shade1;
+ vec3 shade2;
+ float baseStep;
+ float baseFeather;
+ float shadeStep;
+ float shadeFeather;
+ float shadowCover;
+};
diff --git a/editor/assets/chunks/surfaces/data-structures/toon.chunk.meta b/editor/assets/chunks/surfaces/data-structures/toon.chunk.meta
new file mode 100644
index 0000000000..0d55495a36
--- /dev/null
+++ b/editor/assets/chunks/surfaces/data-structures/toon.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "7ac0dc35-81bc-4b7c-9701-a401747deccf",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/surfaces/default-functions.meta b/editor/assets/chunks/surfaces/default-functions.meta
new file mode 100644
index 0000000000..91a74700e7
--- /dev/null
+++ b/editor/assets/chunks/surfaces/default-functions.meta
@@ -0,0 +1,12 @@
+{
+ "ver": "1.1.0",
+ "importer": "directory",
+ "imported": true,
+ "uuid": "eaa476cb-d357-463b-ae54-9807cb10e791",
+ "files": [],
+ "subMetas": {},
+ "userData": {
+ "compressionType": {},
+ "isRemoteBundle": {}
+ }
+}
diff --git a/editor/assets/chunks/surfaces/default-functions/common-vs.chunk b/editor/assets/chunks/surfaces/default-functions/common-vs.chunk
new file mode 100644
index 0000000000..f864ee97e4
--- /dev/null
+++ b/editor/assets/chunks/surfaces/default-functions/common-vs.chunk
@@ -0,0 +1,41 @@
+#ifndef CC_SURFACES_VERTEX_MODIFY_LOCAL_POS
+vec3 SurfacesVertexModifyLocalPos(in SurfacesStandardVertexIntermediate In)
+{
+ return In.position.xyz;
+}
+#endif
+
+#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_POS
+vec3 SurfacesVertexModifyWorldPos(in SurfacesStandardVertexIntermediate In)
+{
+ return In.worldPos;
+}
+#endif
+
+#ifndef CC_SURFACES_VERTEX_MODIFY_CLIP_POS
+vec4 SurfacesVertexModifyClipPos(in SurfacesStandardVertexIntermediate In)
+{
+ return In.clipPos;
+}
+#endif
+
+#ifndef CC_SURFACES_VERTEX_MODIFY_UV
+void SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)
+{
+ In.texCoord = In.texCoord;
+#if CC_SURFACES_USE_SECOND_UV && !CC_SURFACES_USE_LIGHT_MAP
+ In.texCoord1 = In.texCoord1;
+#endif
+}
+#endif
+
+#ifndef CC_SURFACES_VERTEX_MODIFY_WORLD_NORMAL
+vec3 SurfacesVertexModifyWorldNormal(in SurfacesStandardVertexIntermediate In)
+{
+ vec3 worldNormal = In.worldNormal.xyz;
+ #if CC_SURFACES_USE_TWO_SIDED
+ worldNormal.xyz *= In.worldNormal.w;
+ #endif
+ return worldNormal;
+}
+#endif
diff --git a/editor/assets/chunks/surfaces/default-functions/common-vs.chunk.meta b/editor/assets/chunks/surfaces/default-functions/common-vs.chunk.meta
new file mode 100644
index 0000000000..e985640ba4
--- /dev/null
+++ b/editor/assets/chunks/surfaces/default-functions/common-vs.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "b3d7cc71-db0a-4f76-a2e1-c145c679180f",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/surfaces/default-functions/standard-fs.chunk b/editor/assets/chunks/surfaces/default-functions/standard-fs.chunk
new file mode 100644
index 0000000000..bfcd935630
--- /dev/null
+++ b/editor/assets/chunks/surfaces/default-functions/standard-fs.chunk
@@ -0,0 +1,62 @@
+#ifndef CC_SURFACES_FRAGMENT_MODIFY_BASECOLOR_AND_TRANSPARENCY
+vec4 SurfacesFragmentModifyBaseColorAndTransparency()
+{
+ return FSInput_vertexColor;
+}
+#endif
+
+
+#ifndef CC_SURFACES_FRAGMENT_MODIFY_WORLD_NORMAL
+vec3 SurfacesFragmentModifyWorldNormal()
+{
+ return normalize(FSInput_worldNormal);
+}
+#endif
+
+#ifndef CC_SURFACES_FRAGMENT_MODIFY_WORLD_TANGENT_AND_BINORMAL
+void SurfacesFragmentModifyWorldTangentAndBinormal(inout vec3 worldTangent, inout vec3 worldBinormal, vec3 worldNormal)
+{
+ vec3 tangent = FSInput_worldTangent;
+
+#if CC_SURFACES_USE_TANGENT_SPACE
+ vec3 binormal = normalize(CalculateBinormal(worldNormal.xyz, tangent, FSInput_mirrorNormal));
+ tangent = normalize(cross(binormal, worldNormal));
+#else
+ vec3 binormal = vec3(0.0, 0.0, 0.0);
+#endif
+
+ worldTangent = tangent;
+ worldBinormal = binormal;
+}
+#endif
+
+#ifndef CC_SURFACES_FRAGMENT_MODIFY_ANISOTROPY_PARAMS
+// rotation, shape, xx, xx
+vec4 SurfacesFragmentModifyAnisotropyParams()
+{
+ return vec4(0.0, 1.0, 0.0, 0.0);
+}
+#endif
+
+#ifndef CC_SURFACES_FRAGMENT_MODIFY_EMISSIVE
+vec3 SurfacesFragmentModifyEmissive()
+{
+ return vec3(0.0, 0.0, 0.0);
+}
+#endif
+
+#ifndef CC_SURFACES_FRAGMENT_MODIFY_PBRPARAMS
+vec4 SurfacesFragmentModifyPBRParams()
+{
+ // ao, roughness, metallic, ao, specularIntensity
+ return vec4(1.0, 0.5, 0.0, 0.5);
+}
+#endif
+
+// some material datas use shared raw data, avoid sample / calculate same raw data multiply times, use this function for better performance
+// this function invokes at last
+#ifndef CC_SURFACES_FRAGMENT_MODIFY_SHARED_DATA
+void SurfacesFragmentModifySharedData(inout SurfacesMaterialData surfaceData)
+{
+}
+#endif
diff --git a/editor/assets/chunks/surfaces/default-functions/standard-fs.chunk.meta b/editor/assets/chunks/surfaces/default-functions/standard-fs.chunk.meta
new file mode 100644
index 0000000000..1be7ce3ca4
--- /dev/null
+++ b/editor/assets/chunks/surfaces/default-functions/standard-fs.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "57b9c877-9855-47c0-bb6f-da3a2c19414e",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/surfaces/default-functions/toon-fs.chunk b/editor/assets/chunks/surfaces/default-functions/toon-fs.chunk
new file mode 100644
index 0000000000..d37ff7a50d
--- /dev/null
+++ b/editor/assets/chunks/surfaces/default-functions/toon-fs.chunk
@@ -0,0 +1,30 @@
+#include
+
+#ifndef CC_SURFACES_FRAGMENT_MODIFY_BASECOLOR_AND_TOONSHADE
+void SurfacesFragmentModifyBaseColorAndToonShade(out vec4 baseColorAndTransparency, out vec3 shade1, out vec3 shade2, in vec3 baseColor)
+{
+ baseColorAndTransparency = FSInput_vertexColor;
+ shade1 = shade2 = vec3(0.0);
+}
+#endif
+
+#ifndef CC_SURFACES_FRAGMENT_MODIFY_TOON_STEP_AND_FEATHER
+vec4 SurfacesFragmentModifyToonStepAndFeather()
+{
+ return vec3(0.8, 0.001, 0.5, 0.001);
+}
+#endif
+
+#ifndef CC_SURFACES_FRAGMENT_MODIFY_TOON_SHADOW_COVER
+float SurfacesFragmentModifyToonShadowCover()
+{
+ return 0.5;
+}
+#endif
+
+#ifndef CC_SURFACES_FRAGMENT_MODIFY_TOON_SPECULAR
+vec4 SurfacesFragmentModifyToonSpecular()
+{
+ return vec4(1.0, 1.0, 1.0, 0.3);
+}
+#endif
diff --git a/editor/assets/chunks/surfaces/default-functions/toon-fs.chunk.meta b/editor/assets/chunks/surfaces/default-functions/toon-fs.chunk.meta
new file mode 100644
index 0000000000..512e297a48
--- /dev/null
+++ b/editor/assets/chunks/surfaces/default-functions/toon-fs.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "3804c73c-5c8d-42cf-8382-6b64ab2ea7bc",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/surfaces/effect-macros.meta b/editor/assets/chunks/surfaces/effect-macros.meta
new file mode 100644
index 0000000000..71beccfb44
--- /dev/null
+++ b/editor/assets/chunks/surfaces/effect-macros.meta
@@ -0,0 +1,12 @@
+{
+ "ver": "1.1.0",
+ "importer": "directory",
+ "imported": true,
+ "uuid": "af5687e7-3bb4-438a-b00e-037a68d72478",
+ "files": [],
+ "subMetas": {},
+ "userData": {
+ "compressionType": {},
+ "isRemoteBundle": {}
+ }
+}
diff --git a/editor/assets/chunks/surfaces/effect-macros/common-macros.chunk b/editor/assets/chunks/surfaces/effect-macros/common-macros.chunk
new file mode 100644
index 0000000000..7ba8bfaefc
--- /dev/null
+++ b/editor/assets/chunks/surfaces/effect-macros/common-macros.chunk
@@ -0,0 +1,47 @@
+#pragma define-meta USE_INSTANCING editor(elevated: true)
+#pragma define-meta USE_BATCHING editor(elevated: true)
+// these two macros must be non-const
+// use #pragma define to rename a macro with editor flag
+#pragma define CC_SURFACES_USE_INSTANCING USE_INSTANCING
+#pragma define CC_SURFACES_USE_BATCHING USE_BATCHING
+
+
+
+// all material->internal macros
+#ifndef CC_SURFACES_USE_SECOND_UV
+ #define CC_SURFACES_USE_SECOND_UV 0
+#endif
+#ifndef CC_SURFACES_USE_TWO_SIDED
+ #define CC_SURFACES_USE_TWO_SIDED 0
+#endif
+#ifndef CC_SURFACES_USE_REFLECTION_DENOISE
+ #define CC_SURFACES_USE_REFLECTION_DENOISE 0
+#endif
+#ifndef CC_SURFACES_USE_TANGENT_SPACE
+ #define CC_SURFACES_USE_TANGENT_SPACE 0
+#endif
+#ifndef CC_SURFACES_USE_VERTEX_COLOR
+ #define CC_SURFACES_USE_VERTEX_COLOR 0
+#endif
+#ifndef CC_SURFACES_TRANSFER_LOCAL_POS
+ #define CC_SURFACES_TRANSFER_LOCAL_POS 0
+#endif
+#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC
+ #define CC_SURFACES_LIGHTING_ANISOTROPIC 0
+#endif
+#ifndef CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT
+ #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 0
+#endif
+#ifndef CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING
+ #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING 0
+#endif
+
+#if CC_USE_LIGHTMAP
+ #ifndef CC_SURFACES_USE_LIGHT_MAP
+ #define CC_SURFACES_USE_LIGHT_MAP 1
+ #endif
+#else
+ #ifndef CC_SURFACES_USE_LIGHT_MAP
+ #define CC_SURFACES_USE_LIGHT_MAP 0
+ #endif
+#endif
diff --git a/editor/assets/chunks/surfaces/effect-macros/common-macros.chunk.meta b/editor/assets/chunks/surfaces/effect-macros/common-macros.chunk.meta
new file mode 100644
index 0000000000..0cb228dd0f
--- /dev/null
+++ b/editor/assets/chunks/surfaces/effect-macros/common-macros.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "5fb14bc4-12ef-4b8f-b2d2-e0a7df233e31",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/surfaces/effect-macros/render-to-shadowmap.chunk b/editor/assets/chunks/surfaces/effect-macros/render-to-shadowmap.chunk
new file mode 100644
index 0000000000..4c63ef3378
--- /dev/null
+++ b/editor/assets/chunks/surfaces/effect-macros/render-to-shadowmap.chunk
@@ -0,0 +1,12 @@
+// Copyright (c) 2017-2022 Xiamen Yaji Software Co., Ltd.
+
+// Rename some user macros to surface internal macros
+
+#define CC_SURFACES_USE_TANGENT_SPACE 0
+#define CC_SURFACES_USE_VERTEX_COLOR 0
+#define CC_SURFACES_USE_SECOND_UV 0
+#define CC_SURFACES_USE_TWO_SIDED 0
+#define CC_SURFACES_USE_REFLECTION_DENOISE 0
+#define CC_SURFACES_USE_LIGHT_MAP 0
+
+#include
diff --git a/editor/assets/chunks/surfaces/effect-macros/render-to-shadowmap.chunk.meta b/editor/assets/chunks/surfaces/effect-macros/render-to-shadowmap.chunk.meta
new file mode 100644
index 0000000000..bbf168369e
--- /dev/null
+++ b/editor/assets/chunks/surfaces/effect-macros/render-to-shadowmap.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "f66020b7-1a8a-424a-abf4-a8cbe80e410f",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/surfaces/effect-macros/silhouette-edge.chunk b/editor/assets/chunks/surfaces/effect-macros/silhouette-edge.chunk
new file mode 100644
index 0000000000..4c63ef3378
--- /dev/null
+++ b/editor/assets/chunks/surfaces/effect-macros/silhouette-edge.chunk
@@ -0,0 +1,12 @@
+// Copyright (c) 2017-2022 Xiamen Yaji Software Co., Ltd.
+
+// Rename some user macros to surface internal macros
+
+#define CC_SURFACES_USE_TANGENT_SPACE 0
+#define CC_SURFACES_USE_VERTEX_COLOR 0
+#define CC_SURFACES_USE_SECOND_UV 0
+#define CC_SURFACES_USE_TWO_SIDED 0
+#define CC_SURFACES_USE_REFLECTION_DENOISE 0
+#define CC_SURFACES_USE_LIGHT_MAP 0
+
+#include
diff --git a/editor/assets/chunks/surfaces/effect-macros/silhouette-edge.chunk.meta b/editor/assets/chunks/surfaces/effect-macros/silhouette-edge.chunk.meta
new file mode 100644
index 0000000000..bccfa19912
--- /dev/null
+++ b/editor/assets/chunks/surfaces/effect-macros/silhouette-edge.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "2f746ff4-a6d3-41ec-bcd7-52c8283f3a57",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/surfaces/effect-macros/terrain.chunk b/editor/assets/chunks/surfaces/effect-macros/terrain.chunk
new file mode 100644
index 0000000000..f2f988a30c
--- /dev/null
+++ b/editor/assets/chunks/surfaces/effect-macros/terrain.chunk
@@ -0,0 +1,23 @@
+// Copyright (c) 2017-2022 Xiamen Yaji Software Co., Ltd.
+
+// Rename some user macros to surface internal macros
+
+#pragma define-meta USE_NORMAL_MAP
+#define CC_SURFACES_USE_TANGENT_SPACE USE_NORMAL_MAP
+
+#define CC_SURFACES_USE_VERTEX_COLOR 0
+#define CC_SURFACES_USE_SECOND_UV 0
+#define CC_SURFACES_USE_TWO_SIDED 0
+
+#define CC_SURFACES_USE_LIGHT_MAP CC_USE_LIGHTMAP
+
+// vs-fs varing addon data
+#define CC_SURFACES_TRANSFER_LOCAL_POS 1
+
+#if USE_REFLECTION_DENOISE
+ #define CC_SURFACES_USE_REFLECTION_DENOISE USE_REFLECTION_DENOISE
+#else
+ #define CC_SURFACES_USE_REFLECTION_DENOISE 0
+#endif
+
+#include
diff --git a/editor/assets/chunks/surfaces/effect-macros/terrain.chunk.meta b/editor/assets/chunks/surfaces/effect-macros/terrain.chunk.meta
new file mode 100644
index 0000000000..0cb64b9490
--- /dev/null
+++ b/editor/assets/chunks/surfaces/effect-macros/terrain.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "1de87047-07ab-491a-b418-588ff145eaec",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/surfaces/includes.meta b/editor/assets/chunks/surfaces/includes.meta
new file mode 100644
index 0000000000..a5ec2fdb8c
--- /dev/null
+++ b/editor/assets/chunks/surfaces/includes.meta
@@ -0,0 +1,12 @@
+{
+ "ver": "1.1.0",
+ "importer": "directory",
+ "imported": true,
+ "uuid": "7e22c0d7-a9df-4194-bdac-acddb43f365b",
+ "files": [],
+ "subMetas": {},
+ "userData": {
+ "compressionType": {},
+ "isRemoteBundle": {}
+ }
+}
diff --git a/editor/assets/chunks/surfaces/includes/common-fs.chunk b/editor/assets/chunks/surfaces/includes/common-fs.chunk
new file mode 100644
index 0000000000..cd657cca27
--- /dev/null
+++ b/editor/assets/chunks/surfaces/includes/common-fs.chunk
@@ -0,0 +1,54 @@
+// defines
+//#todo: #10131 Redmi5A = 1
+#pragma define-meta CC_DISABLE_STRUCTURE_IN_FRAGMENT_SHADER range([0, 1])
+
+#pragma define CC_PIPELINE_TYPE_FORWARD 0
+#pragma define CC_PIPELINE_TYPE_DEFERRED 1
+#pragma define-meta CC_PIPELINE_TYPE range([0, 1])
+#pragma define-meta CC_FORCE_FORWARD_SHADING
+
+
+// Surface
+#include
+
+// Uniforms--UBO
+#include
+#if (CC_PIPELINE_TYPE == CC_PIPELINE_TYPE_FORWARD || CC_FORCE_FORWARD_SHADING)
+ #if CC_FORWARD_ADD
+ #include
+ #endif
+#endif
+
+// Uniforms--Tex
+#include
+#if CC_USE_IBL
+ #include
+ #if CC_USE_DIFFUSEMAP
+ #include
+ #endif
+#endif
+
+// Base
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+// Functional
+#include
+#include
+
+#if CC_SURFACES_USE_LIGHT_MAP && !CC_SURFACES_USE_BATCHING && !CC_FORWARD_ADD
+ #include
+#endif
+
+
+// Debug view
+#include
diff --git a/editor/assets/chunks/surfaces/includes/common-fs.chunk.meta b/editor/assets/chunks/surfaces/includes/common-fs.chunk.meta
new file mode 100644
index 0000000000..781864c659
--- /dev/null
+++ b/editor/assets/chunks/surfaces/includes/common-fs.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "a6451dbc-fc4c-4a10-84f5-072c6e982fa5",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/surfaces/includes/common-vs.chunk b/editor/assets/chunks/surfaces/includes/common-vs.chunk
new file mode 100644
index 0000000000..4561216297
--- /dev/null
+++ b/editor/assets/chunks/surfaces/includes/common-vs.chunk
@@ -0,0 +1,35 @@
+// Surface
+#include
+#include
+#include
+
+// UBO
+#include
+#include
+
+#if CC_USE_MORPH
+ #include
+#endif
+#if CC_USE_SKINNING
+ #include
+#endif
+
+// Functional
+#include
+#include
+
+#if CC_USE_MORPH
+ #include
+ //#include
+#endif
+
+#if CC_USE_SKINNING
+ #include
+ //#include
+#endif
+
+#if !CC_USE_ACCURATE_FOG
+ #include
+#endif
+
+#include
diff --git a/editor/assets/chunks/surfaces/includes/common-vs.chunk.meta b/editor/assets/chunks/surfaces/includes/common-vs.chunk.meta
new file mode 100644
index 0000000000..f989bb4d65
--- /dev/null
+++ b/editor/assets/chunks/surfaces/includes/common-vs.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "c66380b2-694f-40bd-afd8-91a2e58d904d",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/surfaces/includes/silhouette-edge-vs.chunk b/editor/assets/chunks/surfaces/includes/silhouette-edge-vs.chunk
new file mode 100644
index 0000000000..56e839422a
--- /dev/null
+++ b/editor/assets/chunks/surfaces/includes/silhouette-edge-vs.chunk
@@ -0,0 +1,2 @@
+#include
+#include
diff --git a/editor/assets/chunks/surfaces/includes/silhouette-edge-vs.chunk.meta b/editor/assets/chunks/surfaces/includes/silhouette-edge-vs.chunk.meta
new file mode 100644
index 0000000000..a78f30b757
--- /dev/null
+++ b/editor/assets/chunks/surfaces/includes/silhouette-edge-vs.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "6b061492-5e48-4193-b4f0-97f5aacae05d",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/surfaces/includes/standard-fs.chunk b/editor/assets/chunks/surfaces/includes/standard-fs.chunk
new file mode 100644
index 0000000000..625767bbb1
--- /dev/null
+++ b/editor/assets/chunks/surfaces/includes/standard-fs.chunk
@@ -0,0 +1,5 @@
+// Surface includes
+#include
+#include
+#include
+#include
diff --git a/editor/assets/chunks/surfaces/includes/standard-fs.chunk.meta b/editor/assets/chunks/surfaces/includes/standard-fs.chunk.meta
new file mode 100644
index 0000000000..5a2d3620be
--- /dev/null
+++ b/editor/assets/chunks/surfaces/includes/standard-fs.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "0d0afa06-80d6-45b8-9fa6-6f6ad947c00b",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/surfaces/includes/standard-vs.chunk b/editor/assets/chunks/surfaces/includes/standard-vs.chunk
new file mode 100644
index 0000000000..56e839422a
--- /dev/null
+++ b/editor/assets/chunks/surfaces/includes/standard-vs.chunk
@@ -0,0 +1,2 @@
+#include
+#include
diff --git a/editor/assets/chunks/surfaces/includes/standard-vs.chunk.meta b/editor/assets/chunks/surfaces/includes/standard-vs.chunk.meta
new file mode 100644
index 0000000000..2386a48176
--- /dev/null
+++ b/editor/assets/chunks/surfaces/includes/standard-vs.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "698b9da6-3f0e-4113-8b1c-5ebc82e3ab3d",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/surfaces/includes/toon-fs.chunk b/editor/assets/chunks/surfaces/includes/toon-fs.chunk
new file mode 100644
index 0000000000..221f1ce377
--- /dev/null
+++ b/editor/assets/chunks/surfaces/includes/toon-fs.chunk
@@ -0,0 +1,5 @@
+// Surface includes
+#include
+#include
+#include
+#include
diff --git a/editor/assets/chunks/surfaces/includes/toon-fs.chunk.meta b/editor/assets/chunks/surfaces/includes/toon-fs.chunk.meta
new file mode 100644
index 0000000000..5c8f4fb252
--- /dev/null
+++ b/editor/assets/chunks/surfaces/includes/toon-fs.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "5a2c165c-7d8d-4ed5-9142-52f895dee13c",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/surfaces/includes/toon-vs.chunk b/editor/assets/chunks/surfaces/includes/toon-vs.chunk
new file mode 100644
index 0000000000..56e839422a
--- /dev/null
+++ b/editor/assets/chunks/surfaces/includes/toon-vs.chunk
@@ -0,0 +1,2 @@
+#include
+#include
diff --git a/editor/assets/chunks/surfaces/includes/toon-vs.chunk.meta b/editor/assets/chunks/surfaces/includes/toon-vs.chunk.meta
new file mode 100644
index 0000000000..a0ee5cd548
--- /dev/null
+++ b/editor/assets/chunks/surfaces/includes/toon-vs.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "ef0e1f2a-454f-4613-959c-3d9da0cae4f8",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/surfaces/module-functions.meta b/editor/assets/chunks/surfaces/module-functions.meta
new file mode 100644
index 0000000000..666b1c9b85
--- /dev/null
+++ b/editor/assets/chunks/surfaces/module-functions.meta
@@ -0,0 +1,12 @@
+{
+ "ver": "1.1.0",
+ "importer": "directory",
+ "imported": true,
+ "uuid": "e0dda21b-408d-4e5c-a519-71fad239c854",
+ "files": [],
+ "subMetas": {},
+ "userData": {
+ "compressionType": {},
+ "isRemoteBundle": {}
+ }
+}
diff --git a/editor/assets/chunks/surfaces/module-functions/common-vs.chunk b/editor/assets/chunks/surfaces/module-functions/common-vs.chunk
new file mode 100644
index 0000000000..db09fb02ad
--- /dev/null
+++ b/editor/assets/chunks/surfaces/module-functions/common-vs.chunk
@@ -0,0 +1,142 @@
+// IA Input->Intermediate
+void CCSurfacesVertexInput(out SurfacesStandardVertexIntermediate In)
+{
+ In.position = vec4(a_position, 1.0);
+ In.normal = a_normal;
+
+#if CC_SURFACES_USE_TANGENT_SPACE
+ In.tangent = a_tangent;
+#endif
+
+#if CC_SURFACES_USE_VERTEX_COLOR
+ In.color = a_color;
+#endif
+
+ In.texCoord = a_texCoord;
+#if CC_SURFACES_USE_SECOND_UV && !CC_SURFACES_USE_LIGHT_MAP
+ In.texCoord1 = a_texCoord1;
+#endif
+}
+
+void CCSurfacesVertexOutput(in SurfacesStandardVertexIntermediate In)
+{
+ gl_Position = In.clipPos;
+ VSOutput_worldNormal = In.worldNormal.xyz;
+ VSOutput_faceSideSign = In.worldNormal.w;
+ VSOutput_worldPos = In.worldPos;
+
+#if CC_SURFACES_USE_TANGENT_SPACE
+ VSOutput_worldTangent = In.worldTangent.xyz;
+ // VSOutput_worldBitangent = In.worldBinormal;
+ VSOutput_mirrorNormal = In.tangent.w;
+#endif
+
+#if CC_SURFACES_USE_VERTEX_COLOR
+ VSOutput_vertexColor = In.color;
+#endif
+
+ VSOutput_texcoord = In.texCoord;
+#if CC_SURFACES_USE_SECOND_UV && !CC_SURFACES_USE_LIGHT_MAP
+ VSOutput_texcoord1 = In.texCoord1;
+#endif
+
+#if !CC_USE_ACCURATE_FOG
+ VSOutput_fogFactor = In.fogFactor;
+#endif
+
+#if CC_RECEIVE_SHADOW
+ VSOutput_shadowPos = In.shadowPos;
+ #if CC_SURFACES_USE_INSTANCING
+ VSOutput_shadowBias = In.shadowBias;
+ #endif
+#endif
+
+#if CC_SURFACES_USE_LIGHT_MAP && !CC_SURFACES_USE_BATCHING && !CC_FORWARD_ADD
+ VSOutput_lightMapUV = In.lightmapUV;
+#endif
+
+#if CC_SURFACES_TRANSFER_LOCAL_POS
+ VSOutput_localPos = In.position;
+#endif
+}
+
+// Morph & Skinning
+void CCSurfacesVertexAnimation(inout SurfacesStandardVertexIntermediate In)
+{
+vec4 temp = vec4(0.0);
+#if CC_USE_MORPH
+ #if CC_SURFACES_USE_TANGENT_SPACE
+ applyMorph(In.position, In.normal, In.tangent);
+ #else
+ applyMorph(In.position, In.normal, temp);
+ #endif
+#endif
+
+#if CC_USE_SKINNING
+ #if CC_SURFACES_USE_TANGENT_SPACE
+ CCSkin(In.position, In.normal, In.tangent);
+ #else
+ CCSkin(In.position, In.normal, temp);
+ #endif
+#endif
+}
+
+// Space Transform
+void CCSurfacesVertexWorldTransform(inout SurfacesStandardVertexIntermediate In)
+{
+ mat4 matWorld, matWorldIT;
+ CCGetWorldMatrixFull(matWorld, matWorldIT);
+
+ In.worldPos = (matWorld * In.position).xyz;
+ In.worldNormal.xyz = normalize((matWorldIT * vec4(In.normal.xyz, 0.0)).xyz);
+
+ #if CC_SURFACES_USE_TANGENT_SPACE
+ In.worldTangent = normalize((matWorld * vec4(In.tangent.xyz, 0.0)).xyz);
+ In.worldBinormal = cross(In.worldNormal.xyz, In.worldTangent) * In.tangent.w; // note the cross order
+ #endif
+}
+
+void CCSurfacesVertexTransformUV(inout SurfacesStandardVertexIntermediate In)
+{
+ #if SAMPLE_FROM_RT
+ CC_HANDLE_RT_SAMPLE_FLIP(In.texCoord);
+ #if CC_SURFACES_USE_SECOND_UV && !CC_SURFACES_USE_LIGHT_MAP
+ CC_HANDLE_RT_SAMPLE_FLIP(In.texCoord1);
+ #endif
+ #endif
+}
+
+// Shading
+void CCSurfacesVertexTransferFog(inout SurfacesStandardVertexIntermediate In)
+{
+#if !CC_USE_ACCURATE_FOG
+ CC_TRANSFER_FOG_BASE(vec4(In.worldPos, 1.0), In.fogFactor);
+#endif
+}
+
+void CCSurfacesVertexTransferShadow(inout SurfacesStandardVertexIntermediate In)
+{
+ #if CC_RECEIVE_SHADOW
+ In.shadowPos = cc_matLightViewProj * vec4(In.worldPos, 1.0);
+
+ In.shadowBias = vec2(cc_shadowWHPBInfo.w, cc_shadowLPNNInfo.z);
+ #if CC_SURFACES_USE_INSTANCING
+ In.shadowBias = vec2(a_localShadowBias.x + cc_shadowWHPBInfo.w, a_localShadowBias.y + cc_shadowLPNNInfo.z);
+ #elif !CC_SURFACES_USE_BATCHING
+ In.shadowBias += cc_localShadowBias.xy;
+ #endif
+ #endif
+}
+
+void CCSurfacesVertexTransferLightMapUV(inout SurfacesStandardVertexIntermediate In)
+{
+#if CC_SURFACES_USE_LIGHT_MAP && !CC_SURFACES_USE_BATCHING && !CC_FORWARD_ADD
+ #if CC_SURFACES_USE_INSTANCING
+ In.lightmapUV.xy = a_lightingMapUVParam.xy + a_texCoord1 * a_lightingMapUVParam.z;
+ In.lightmapUV.z = a_lightingMapUVParam.w;
+ #else
+ In.lightmapUV.xy = cc_lightingMapUVParam.xy + a_texCoord1 * cc_lightingMapUVParam.z;
+ In.lightmapUV.z = cc_lightingMapUVParam.w;
+ #endif
+#endif
+}
diff --git a/editor/assets/chunks/surfaces/module-functions/common-vs.chunk.meta b/editor/assets/chunks/surfaces/module-functions/common-vs.chunk.meta
new file mode 100644
index 0000000000..610b46a392
--- /dev/null
+++ b/editor/assets/chunks/surfaces/module-functions/common-vs.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "e1feba3c-c7a2-4208-9c1f-732b7e46abd4",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/surfaces/module-functions/debug-view.chunk b/editor/assets/chunks/surfaces/module-functions/debug-view.chunk
new file mode 100644
index 0000000000..efed83483a
--- /dev/null
+++ b/editor/assets/chunks/surfaces/module-functions/debug-view.chunk
@@ -0,0 +1,154 @@
+// make divid-by-zero, non-rational pixel more obvious
+void CCSurfacesDebugDisplayInvalidNumber(inout vec4 color)
+{
+ vec4 error = vec4(1.0, 0.0, 0.2, 1.0);
+
+ color = (isnans(color.rgb) || isinfs(color.rgb)) ? error : color;
+}
+
+#if (CC_SURFACES_DEBUG_VIEW_MODE || CC_SURFACES_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_SINGLE) && !CC_FORWARD_ADD
+ void CCSurfacesDebugViewMeshData(out vec4 color)
+ {
+ vec4 white = vec4(1.0, 1.0, 1.0, 1.0);
+ vec4 black = vec4(0.0, 0.0, 0.0, 1.0);
+
+ // vertex input
+ #if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_VERTEX_COLOR
+ #if CC_SURFACES_USE_VERTEX_COLOR
+ color = FSInput_vertexColor;
+ #else
+ color = white;
+ #endif
+ #endif
+
+ #if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_VERTEX_NORMAL
+ color = vec4(FSInput_worldNormal * 0.5 + vec3(0.5), 1.0);
+ #endif
+
+ #if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_VERTEX_TANGENT
+ #if CC_SURFACES_USE_TANGENT_SPACE
+ color = vec4(FSInput_worldTangent * 0.5 + vec3(0.5), 1.0);
+ #else
+ color = black;
+ #endif
+ #endif
+
+ #if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_VERTEX_MIRROR
+ #if CC_SURFACES_USE_TANGENT_SPACE
+ float sign = FSInput_mirrorNormal * 0.5 + 0.5;
+ color = vec4(sign, sign, sign, 1.0);
+ #else
+ color = black;
+ #endif
+ #endif
+
+ #if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_FACE_SIDE
+ float scalar = clamp(FSInput_faceSideSign, 0.0, 1.0);
+ color = vec4(scalar, scalar, scalar, 1.0);
+ #endif
+
+ #if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_UV0
+ color = vec4(FSInput_texcoord.xy, 0.0, 1.0);
+ #endif
+
+ #if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_UV1
+ color = vec4(FSInput_texcoord1.xy, 0.0, 1.0);
+ #endif
+
+ #if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_UVLIGHTMAP
+ #if CC_SURFACES_USE_LIGHT_MAP && !CC_SURFACES_USE_BATCHING && !CC_FORWARD_ADD
+ color = vec4(FSInput_lightMapUV.xy, 0.0, 1.0);
+ #else
+ color = vec4(0.0, 0.0, 0.0, 1.0);
+ #endif
+ #endif
+
+ #if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_PROJ_DEPTH
+ vec4 clipPos = cc_matProj * cc_matView * vec4(FSInput_worldPos.xyz, 1.0);
+ float depth = clipPos.z / clipPos.w;
+ color = vec4(depth, depth, depth, 1.0);
+ #endif
+
+ #if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_LINEAR_DEPTH
+ vec4 viewPos = cc_matView * vec4(FSInput_worldPos.xyz, 1.0);
+ float depth = (-viewPos.z - cc_nearFar.x) / cc_nearFar.y;
+ color = vec4(depth, depth, depth, 1.0);
+ #endif
+
+ #if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_WORLD_POS
+ color = vec4(FSInput_worldPos.xyz, 1.0);
+ #endif
+ }
+#endif
+
+
+
+#if CC_SURFACES_DEBUG_VIEW_MODE || CC_SURFACES_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_SINGLE
+ // Lighting related
+ void CCSurfacesDebugViewLightingResult(out vec4 color, in LightingResult lightingResult)
+ {
+ #if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_DIRECT_DIFFUSE
+ color.rgb = lightingResult.directDiffuse * lightingResult.diffuseColorWithLighting;
+ #endif
+ #if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_DIRECT_SPECULAR
+ color.rgb = lightingResult.directSpecular * lightingResult.specularColorWithLighting;
+ #endif
+ #if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_DIRECT_ALL
+ color.rgb = lightingResult.directDiffuse * lightingResult.diffuseColorWithLighting + lightingResult.directSpecular * lightingResult.specularColorWithLighting;
+ #endif
+ #if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_ENV_DIFFUSE
+ color.rgb = lightingResult.environmentDiffuse * lightingResult.diffuseColorWithLighting;
+ #endif
+ #if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_ENV_SPECULAR
+ color.rgb = lightingResult.environmentSpecular * lightingResult.specularColorWithLighting;
+ #endif
+ #if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_ENV_ALL
+ color.rgb = lightingResult.environmentDiffuse * lightingResult.diffuseColorWithLighting + lightingResult.environmentSpecular * lightingResult.specularColorWithLighting;
+ #endif
+ #if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_LIGHT_MAP
+ color.rgb = lightingResult.lightmapColor;
+ #endif
+ #if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_EMISSIVE
+ color.rgb = lightingResult.emissive;
+ #endif
+ #if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_AO
+ color.rgb = vec3(lightingResult.ao);
+ #endif
+ #if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_SHADOW
+ color.rgb = vec3(lightingResult.shadow);
+ #endif
+ }
+#endif
+
+
+
+#if CC_SURFACES_DEBUG_VIEW_COMPOSITE_MODE || CC_SURFACES_USE_DEBUG_VIEW == CC_SURFACES_DEBUG_VIEW_COMPOSITE_AND_MISC
+ void CCSurfacesDebugViewCompositeLightingResult(inout LightingResult lightingResult)
+ {
+ #if !(CC_SURFACES_DEBUG_VIEW_COMPOSITE_MODE & CC_SURFACES_DEBUG_VIEW_COMPOSITE_DIRECT_DIFFUSE)
+ lightingResult.directDiffuse = vec3(0.0);
+ #endif
+ #if !(CC_SURFACES_DEBUG_VIEW_COMPOSITE_MODE & CC_SURFACES_DEBUG_VIEW_COMPOSITE_DIRECT_SPECULAR)
+ lightingResult.directSpecular = vec3(0.0);
+ #endif
+ #if !(CC_SURFACES_DEBUG_VIEW_COMPOSITE_MODE & CC_SURFACES_DEBUG_VIEW_COMPOSITE_ENV_DIFFUSE)
+ lightingResult.environmentDiffuse = vec3(0.0);
+ #endif
+ #if !(CC_SURFACES_DEBUG_VIEW_COMPOSITE_MODE & CC_SURFACES_DEBUG_VIEW_COMPOSITE_ENV_SPECULAR)
+ lightingResult.environmentSpecular = vec3(0.0);
+ #endif
+ #if !(CC_SURFACES_DEBUG_VIEW_COMPOSITE_MODE & CC_SURFACES_DEBUG_VIEW_COMPOSITE_EMISSIVE)
+ lightingResult.emissive = vec3(0.0);
+ #endif
+ #if !(CC_SURFACES_DEBUG_VIEW_COMPOSITE_MODE & CC_SURFACES_DEBUG_VIEW_COMPOSITE_LIGHT_MAP)
+ lightingResult.lightmapColor = vec3(0.0);
+ #endif
+ #if !(CC_SURFACES_DEBUG_VIEW_COMPOSITE_MODE & CC_SURFACES_DEBUG_VIEW_COMPOSITE_SHADOW)
+ lightingResult.shadow = 1.0;
+ #endif
+ #if !(CC_SURFACES_DEBUG_VIEW_COMPOSITE_MODE & CC_SURFACES_DEBUG_VIEW_COMPOSITE_AO)
+ lightingResult.ao = 1.0;
+ #endif
+ }
+#endif
+
diff --git a/editor/assets/chunks/surfaces/module-functions/debug-view.chunk.meta b/editor/assets/chunks/surfaces/module-functions/debug-view.chunk.meta
new file mode 100644
index 0000000000..9feec4dcf8
--- /dev/null
+++ b/editor/assets/chunks/surfaces/module-functions/debug-view.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "30961f82-b8ef-4d3b-a9e5-944bb5e103f1",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/surfaces/module-functions/standard-fs.chunk b/editor/assets/chunks/surfaces/module-functions/standard-fs.chunk
new file mode 100644
index 0000000000..83b65bddf3
--- /dev/null
+++ b/editor/assets/chunks/surfaces/module-functions/standard-fs.chunk
@@ -0,0 +1,179 @@
+#include
+
+// Surface
+void CCSurfacesFragmentGetMaterialData(inout SurfacesMaterialData surfaceData)
+{
+ HIGHP_VALUE_TO_STRUCT_DEFINED(FSInput_worldPos, surfaceData.worldPos);
+
+ surfaceData.baseColor = SurfacesFragmentModifyBaseColorAndTransparency();
+
+ surfaceData.worldNormal = SurfacesFragmentModifyWorldNormal();
+ SurfacesFragmentModifyWorldTangentAndBinormal(surfaceData.worldTangent, surfaceData.worldBinormal, surfaceData.worldNormal);
+#if CC_SURFACES_LIGHTING_ANISOTROPIC
+ vec4 anisotropyParams = SurfacesFragmentModifyAnisotropyParams();
+ surfaceData.anisotropyShape = anisotropyParams.y;
+ RotateTangentAndBinormal(surfaceData.worldTangent, surfaceData.worldBinormal, surfaceData.worldNormal, anisotropyParams.x);
+#endif
+
+ surfaceData.emissive = SurfacesFragmentModifyEmissive();
+
+ vec4 pbr = SurfacesFragmentModifyPBRParams();
+ surfaceData.ao = pbr.x;
+ surfaceData.roughness = pbr.y;
+ surfaceData.metallic = pbr.z;
+ surfaceData.specularIntensity = pbr.w;
+
+ SurfacesFragmentModifySharedData(surfaceData);
+
+#if CC_SURFACES_DEBUG_VIEW_COMPOSITE_MODE && !(CC_SURFACES_DEBUG_VIEW_COMPOSITE_MODE & CC_SURFACES_DEBUG_VIEW_COMPOSITE_NORMAL_MAP)
+ surfaceData.worldNormal = FSInput_worldNormal;
+ surfaceData.worldTangent = FSInput_worldTangent;
+#endif
+
+#if (CC_SURFACES_DEBUG_VIEW_MODE || CC_SURFACES_DEBUG_VIEW_COMPOSITE_MODE) && !CC_SURFACES_DEBUG_VIEW_LIGHTING_WITH_ALBEDO
+ surfaceData.baseColor.rgb = vec3(1.0);
+#endif
+}
+
+// Intrinsic function, make connection of material data and lighting data
+vec3 CCSurfacesGetDiffuseColor(in SurfacesMaterialData surfaceData)
+{
+ return surfaceData.baseColor.rgb * (1.0 - surfaceData.metallic);
+}
+vec3 CCSurfacesGetSpecularColor(in SurfacesMaterialData surfaceData)
+{
+ float F0 = surfaceData.specularIntensity * 0.08;
+ return mix(vec3(F0), surfaceData.baseColor.rgb, surfaceData.metallic);
+}
+
+// Diffuse/Specular Color with BRDF lighting preparation
+void CCSurfacesLightingInitializeColorWithLighting(inout vec3 diffuseColorWithLighting, inout vec3 specularColorWithLighting, in SurfacesMaterialData surfaceData, in LightingIntermediateData lightingData)
+{
+ diffuseColorWithLighting = CCSurfacesGetDiffuseColor(surfaceData);
+ // (Intergrated) GF/4Pi use approximate value for both direct lighting and environment lighting
+ // accuracy value can be calculated in LightingCalculateDirect/Environment instead of IntegratedGFApprox
+ specularColorWithLighting = IntegratedGFApprox(CCSurfacesGetSpecularColor(surfaceData).xyz, surfaceData.roughness, lightingData.NoVAbsSat);
+}
+// Update two colors with BRDF which depend on lights (optional)
+void CCSurfacesLightingCalculateColorWithLighting(inout vec3 diffuseColorWithLighting, inout vec3 specularColorWithLighting, in SurfacesMaterialData surfaceData, in LightingIntermediateData lightingData)
+{
+}
+
+// Copy material data to lighting data
+// such as tangent data for anisotropic materials
+void CCSurfacesInitializeLightingIntermediateData(inout LightingIntermediateData lightingData, in SurfacesMaterialData surfaceData)
+{
+ vec3 worldPos;
+ HIGHP_VALUE_FROM_STRUCT_DEFINED(worldPos, surfaceData.worldPos);
+ CCSurfacesLightingGetIntermediateData_PerPixel(lightingData, surfaceData.worldNormal, worldPos, surfaceData.worldTangent, surfaceData.worldBinormal
+#if CC_SURFACES_LIGHTING_ANISOTROPIC
+ , surfaceData.anisotropyShape
+#endif
+ );
+ lightingData.specularParam = surfaceData.roughness;
+}
+void CCSurfacesLightingCalculateIntermediateData_PerLight(inout LightingIntermediateData lightingData, in SurfacesMaterialData surfaceData, vec3 lightDirWithDist)
+{
+ CCSurfacesLightingGetIntermediateData_PerLight(lightingData, lightDirWithDist);
+}
+
+// Copy material data to lighting results
+void CCSurfacesInitializeLightingResult(inout LightingResult lightingResult, in SurfacesMaterialData surfaceData)
+{
+ lightingResult.ao = surfaceData.ao;
+ lightingResult.emissive = surfaceData.emissive;
+}
+
+
+
+#if CC_PIPELINE_TYPE == CC_PIPELINE_TYPE_DEFERRED
+ vec4 CCSurfacesDeferredOutput0(in SurfacesMaterialData surfaceData)
+ {
+ return surfaceData.baseColor;
+ }
+ vec4 CCSurfacesDeferredOutput1(in SurfacesMaterialData surfaceData)
+ {
+ return vec4(float32x3_to_oct(surfaceData.worldNormal), surfaceData.roughness, surfaceData.metallic);
+ }
+ vec4 CCSurfacesDeferredOutput2(in SurfacesMaterialData surfaceData)
+ {
+ return vec4(surfaceData.emissive, surfaceData.ao);
+ }
+#endif
+
+
+// Shading
+vec4 CCSurfacesShading(in SurfacesMaterialData surfaceData, in LightingResult lightingResult)
+{
+ vec4 color = vec4(0.0, 0.0, 0.0, surfaceData.baseColor.a);
+#if CC_FORWARD_ADD
+ color.xyz += lightingResult.directDiffuse * lightingResult.diffuseColorWithLighting;
+ color.xyz += lightingResult.directSpecular * lightingResult.specularColorWithLighting;
+#else
+ #if CC_SURFACES_USE_LIGHT_MAP && !CC_SURFACES_USE_BATCHING && !CC_FORWARD_ADD
+ float lum = FSInput_lightMapUV.z;
+ float lightmapCoef = step(lum, EPSILON_LOWP);
+ #else
+ float lightmapCoef = 0.0;
+ #endif
+
+ color.xyz += (
+ mix(lightingResult.directDiffuse, lightingResult.lightmapColor, lightmapCoef) * lightingResult.diffuseColorWithLighting
+ + lightingResult.directSpecular * lightingResult.specularColorWithLighting)
+ * lightingResult.shadow;
+
+ color.xyz += (
+ lightingResult.environmentDiffuse * lightingResult.diffuseColorWithLighting
+ + lightingResult.environmentSpecular * lightingResult.specularColorWithLighting)
+ * lightingResult.ao;
+
+ color.xyz += lightingResult.emissive;
+#endif
+
+ return color;
+}
+
+
+// Debug view
+void CCSurfacesDebugViewSurfaceData(out vec4 color, in SurfacesMaterialData surfaceData)
+{
+ float scalar;
+#if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL
+ color = vec4(surfaceData.worldNormal * 0.5 + vec3(0.5), 1.0);
+#endif
+#if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT
+ color = vec4(surfaceData.worldTangent * 0.5 + vec3(0.5), 1.0);
+#endif
+#if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL
+ color = vec4(surfaceData.worldBinormal * 0.5 + vec3(0.5), 1.0);
+#endif
+#if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_TRANSPARENCY
+ scalar = surfaceData.baseColor.a;
+ color = vec4(scalar, scalar, scalar, 1.0);
+#endif
+#if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_BASE_COLOR
+ color = vec4(SRGBToLinear(surfaceData.baseColor.rgb), 1.0);
+#endif
+#if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR
+ color = vec4(SRGBToLinear(CCSurfacesGetDiffuseColor(surfaceData)), 1.0);
+#endif
+#if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR
+ color = vec4(SRGBToLinear(CCSurfacesGetSpecularColor(surfaceData)), 1.0);
+#endif
+#if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_ROUGHNESS
+ scalar = surfaceData.roughness;
+ color = vec4(scalar, scalar, scalar, 1.0);
+#endif
+#if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_METALLIC
+ scalar = surfaceData.metallic;
+ color = vec4(scalar, scalar, scalar, 1.0);
+#endif
+#if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY
+ scalar = surfaceData.specularIntensity;
+ color = vec4(scalar, scalar, scalar, 1.0);
+#endif
+}
+
+
+// lighting flow module-function used by this material
+#include
diff --git a/editor/assets/chunks/surfaces/module-functions/standard-fs.chunk.meta b/editor/assets/chunks/surfaces/module-functions/standard-fs.chunk.meta
new file mode 100644
index 0000000000..6faa52c0d9
--- /dev/null
+++ b/editor/assets/chunks/surfaces/module-functions/standard-fs.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "6853f548-fd1c-4a96-94f3-ba6981fbefd4",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/surfaces/module-functions/toon-fs.chunk b/editor/assets/chunks/surfaces/module-functions/toon-fs.chunk
new file mode 100644
index 0000000000..7f0df576c2
--- /dev/null
+++ b/editor/assets/chunks/surfaces/module-functions/toon-fs.chunk
@@ -0,0 +1,155 @@
+// Surface
+void CCSurfacesFragmentGetMaterialData(inout SurfacesMaterialData surfaceData)
+{
+ HIGHP_VALUE_TO_STRUCT_DEFINED(FSInput_worldPos, surfaceData.worldPos);
+
+ // common
+ surfaceData.worldNormal = SurfacesFragmentModifyWorldNormal();
+
+ surfaceData.emissive = SurfacesFragmentModifyEmissive();
+
+ // toon
+ SurfacesFragmentModifyBaseColorAndToonShade(surfaceData.baseColor, surfaceData.shade1, surfaceData.shade2);
+
+ surfaceData.specular = SurfacesFragmentModifyToonSpecular();
+ surfaceData.shadowCover = SurfacesFragmentModifyToonShadowCover();
+
+ vec4 shaderParams = SurfacesFragmentModifyToonStepAndFeather();
+ surfaceData.baseStep = shadeParams.x;
+ surfaceData.baseFeather = shadeParams.y;
+ surfaceData.shadeStep = shadeParams.z;
+ surfaceData.shadeFeather = shadeParams.w;
+
+ SurfacesFragmentModifySharedData(surfaceData);
+
+
+#if CC_SURFACES_DEBUG_VIEW_COMPOSITE_MODE && !(CC_SURFACES_DEBUG_VIEW_COMPOSITE_MODE & CC_SURFACES_DEBUG_VIEW_COMPOSITE_NORMAL_MAP)
+ surfaceData.worldNormal = FSInput_worldNormal;
+#endif
+
+#if (CC_SURFACES_DEBUG_VIEW_MODE || CC_SURFACES_DEBUG_VIEW_COMPOSITE_MODE) && !CC_SURFACES_DEBUG_VIEW_LIGHTING_WITH_ALBEDO
+ surfaceData.baseColor.rgb = vec3(1.0);
+ surfaceData.specular.rgb = vec3(1.0);
+#endif
+}
+
+// Intrinsic function
+vec3 CCSurfacesGetDiffuseColor(in SurfacesMaterialData surfaceData)
+{
+ return surfaceData.shade1;
+}
+vec3 CCSurfacesGetSpecularColor(in SurfacesMaterialData surfaceData)
+{
+ return surfaceData.specular.xyz;
+}
+void CCSurfacesLightingInitializeColorWithLighting(inout vec3 diffuseColorWithLighting, inout vec3 specularColorWithLighting, in SurfacesMaterialData surfaceData, in LightingIntermediateData lightingData)
+{
+ specularColorWithLighting = surfaceData.specular.xyz * surfaceData.baseStep;
+}
+void CCSurfacesLightingCalculateColorWithLighting(inout vec3 diffuseColorWithLighting, inout vec3 specularColorWithLighting, in SurfacesMaterialData surfaceData, in LightingIntermediateData lightingData)
+{
+ float NL = 0.5 * lightingData.NoL + 0.5;
+
+ vec3 diffuse = mix(surfaceData.shade1, surfaceData.shade2,
+ clamp(1.0 + (surfaceData.shadeStep - surfaceData.shadeFeather - NL) / surfaceData.shadeFeather, 0.0, 1.0));
+
+ diffuse = mix(surfaceData.baseColor.rgb, diffuse,
+ clamp(1.0 + (surfaceData.baseStep - surfaceData.baseFeather - NL) / surfaceData.baseFeather, 0.0, 1.0));
+
+ diffuseColorWithLighting = diffuse * surfaceData.baseStep;
+}
+
+
+// Copy material data to lighting data
+// such as tangent data for anisotropic materials
+void CCSurfacesInitializeLightingIntermediateData(inout LightingIntermediateData lightingData, in SurfacesMaterialData surfaceData)
+{
+ vec3 worldPos;
+ HIGHP_VALUE_FROM_STRUCT_DEFINED(worldPos, surfaceData.worldPos);
+ CCSurfacesLightingGetIntermediateData_PerPixel(lightingData, surfaceData.worldNormal, worldPos, vec3(0.0), vec3(0.0));
+ lightingData.specularParam = surfaceData.specular.a;
+}
+void CCSurfacesLightingCalculateIntermediateData_PerLight(inout LightingIntermediateData lightingData, in SurfacesMaterialData surfaceData, vec3 lightDirWithDist)
+{
+ CCSurfacesLightingGetIntermediateData_PerLight(lightingData, lightDirWithDist);
+}
+
+// Copy material data to lighting results
+void CCSurfacesInitializeLightingResult(inout LightingResult lightingResult, in SurfacesMaterialData surfaceData)
+{
+ lightingResult.emissive = surfaceData.emissive;
+}
+
+// Lighting
+#if CC_PIPELINE_TYPE == CC_PIPELINE_TYPE_DEFERRED
+ vec4 CCSurfacesDeferredOutput0(in SurfacesMaterialData surfaceData)
+ {
+ return surfaceData.baseColor;
+ }
+ vec4 CCSurfacesDeferredOutput1(in SurfacesMaterialData surfaceData)
+ {
+ return vec4(float32x3_to_oct(surfaceData.worldNormal), 0.5, 0.0);
+ }
+ vec4 CCSurfacesDeferredOutput2(in SurfacesMaterialData surfaceData)
+ {
+ return vec4(surfaceData.emissive, 1.0);
+ }
+#endif
+
+// Shading
+vec4 CCSurfacesShading(in SurfacesMaterialData surfaceData, in LightingResult lightingResult)
+{
+ vec4 color = vec4(0.0, 0.0, 0.0, surfaceData.baseColor.a);
+#if CC_FORWARD_ADD
+ color.xyz += lightingResult.directDiffuse * lightingResult.diffuseColorWithLighting;
+ color.xyz += lightingResult.directSpecular * lightingResult.specularColorWithLighting;
+#else
+ float lightmapCoef = 0.0;
+
+ color.xyz += (
+ mix(lightingResult.directDiffuse, lightingResult.lightmapColor, lightmapCoef) * lightingResult.diffuseColorWithLighting
+ + lightingResult.directSpecular * lightingResult.specularColorWithLighting)
+ * lightingResult.shadow;
+
+ color.xyz += lightingResult.emissive;
+#endif
+
+ return color;
+}
+
+
+// Debug view
+void CCSurfacesDebugViewSurfaceData(out vec4 color, in SurfacesMaterialData surfaceData)
+{
+ float scalar;
+#if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_FRAGMENT_NORMAL
+ color = vec4(surfaceData.worldNormal * 0.5 + vec3(0.5), 1.0);
+#endif
+#if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_FRAGMENT_TANGENT
+ color = vec4(surfaceData.worldTangent * 0.5 + vec3(0.5), 1.0);
+#endif
+#if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_FRAGMENT_BINORMAL
+ vec3 binormal = CalculateBinormal(surfaceData.worldNormal.xyz, surfaceData.worldTangent.xyz, FSInput_mirrorNormal);
+ color = vec4(binormal * 0.5 + vec3(0.5), 1.0);
+#endif
+#if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_TRANSPARENCY
+ scalar = surfaceData.baseColor.a;
+ color = vec4(scalar, scalar, scalar, 1.0);
+#endif
+#if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_BASE_COLOR
+ color = vec4(SRGBToLinear(surfaceData.baseColor.rgb), 1.0);
+#endif
+#if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_DIFFUSE_COLOR
+ color = vec4(SRGBToLinear(CCSurfacesGetDiffuseColor(surfaceData)), 1.0);
+#endif
+#if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_SPECULAR_COLOR
+ color = vec4(SRGBToLinear(CCSurfacesGetSpecularColor(surfaceData)), 1.0);
+#endif
+#if CC_SURFACES_DEBUG_VIEW_MODE == CC_SURFACES_DEBUG_VIEW_SPECULAR_INTENSITY
+ scalar = surfaceData.specular.a;
+ color = vec4(scalar, scalar, scalar, 1.0);
+#endif
+}
+
+// lighting flow module-function used by this material
+#include
diff --git a/editor/assets/chunks/surfaces/module-functions/toon-fs.chunk.meta b/editor/assets/chunks/surfaces/module-functions/toon-fs.chunk.meta
new file mode 100644
index 0000000000..a6f4380e5e
--- /dev/null
+++ b/editor/assets/chunks/surfaces/module-functions/toon-fs.chunk.meta
@@ -0,0 +1,9 @@
+{
+ "ver": "1.0.4",
+ "importer": "effect-header",
+ "imported": true,
+ "uuid": "218130cc-7167-4535-b6b8-99807138bb39",
+ "files": [],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/chunks/texture-lod.chunk.meta b/editor/assets/chunks/texture-lod.chunk.meta
index ff25873856..45853d0851 100644
--- a/editor/assets/chunks/texture-lod.chunk.meta
+++ b/editor/assets/chunks/texture-lod.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "d26f7be9-ac7f-4dfd-88ee-6657dfe3426e",
diff --git a/editor/assets/chunks/transform.chunk.meta b/editor/assets/chunks/transform.chunk.meta
index 3bd4f201fd..043f3e1892 100644
--- a/editor/assets/chunks/transform.chunk.meta
+++ b/editor/assets/chunks/transform.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "0de81d5f-2a3e-467e-bcf5-84f7828edab6",
diff --git a/editor/assets/chunks/unpack.chunk.meta b/editor/assets/chunks/unpack.chunk.meta
index 9b4864e042..2313982390 100644
--- a/editor/assets/chunks/unpack.chunk.meta
+++ b/editor/assets/chunks/unpack.chunk.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.0.2",
+ "ver": "1.0.4",
"importer": "effect-header",
"imported": true,
"uuid": "e3e5d086-acc9-4dd8-98e8-24ac02f547d5",
diff --git a/editor/assets/default_file_content/scene-2d b/editor/assets/default_file_content/scene-2d
index 6e3d691ad2..3b3ac017bb 100644
--- a/editor/assets/default_file_content/scene-2d
+++ b/editor/assets/default_file_content/scene-2d
@@ -148,7 +148,7 @@
},
"_depth": 1,
"_stencil": 0,
- "_clearFlags": 6,
+ "_clearFlags": 7,
"_rect": {
"__type__": "cc.Rect",
"x": 0,
diff --git a/editor/assets/default_file_content/ts-render-pipeline b/editor/assets/default_file_content/ts-render-pipeline
index f8dc5951ee..d2991b5f07 100644
--- a/editor/assets/default_file_content/ts-render-pipeline
+++ b/editor/assets/default_file_content/ts-render-pipeline
@@ -1,7 +1,7 @@
import { _decorator, Component, Node, RenderPipeline } from "cc";
const { ccclass, property } = _decorator;
-@ccclass("UnderscoreCaseClassName")
+@ccclass("<%UnderscoreCaseClassName%>")
export class <%UnderscoreCaseClassName%> extends RenderPipeline {
destroy() {
diff --git a/editor/assets/effects/builtin-billboard.effect.meta b/editor/assets/effects/builtin-billboard.effect.meta
index 5bda6356de..6b5ed2cb86 100644
--- a/editor/assets/effects/builtin-billboard.effect.meta
+++ b/editor/assets/effects/builtin-billboard.effect.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.5.4",
+ "ver": "1.5.6",
"importer": "effect",
"imported": true,
"uuid": "711ebe11-f673-4cd9-9a83-63c60ba54c5b",
diff --git a/editor/assets/effects/builtin-camera-texture.effect.meta b/editor/assets/effects/builtin-camera-texture.effect.meta
index 6c8bd1c76f..b4c5d74f2b 100644
--- a/editor/assets/effects/builtin-camera-texture.effect.meta
+++ b/editor/assets/effects/builtin-camera-texture.effect.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.5.4",
+ "ver": "1.5.6",
"importer": "effect",
"imported": true,
"uuid": "bf4078d6-d2d7-4073-83bb-cd6f1802e880",
diff --git a/editor/assets/effects/builtin-clear-stencil.effect.meta b/editor/assets/effects/builtin-clear-stencil.effect.meta
index 5341d26897..637a62644d 100644
--- a/editor/assets/effects/builtin-clear-stencil.effect.meta
+++ b/editor/assets/effects/builtin-clear-stencil.effect.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.5.4",
+ "ver": "1.5.6",
"importer": "effect",
"imported": true,
"uuid": "810e96e4-e456-4468-9b59-f4e8f39732c0",
diff --git a/editor/assets/effects/builtin-geometry-renderer.effect.meta b/editor/assets/effects/builtin-geometry-renderer.effect.meta
index 203f824cb6..ed85b54beb 100644
--- a/editor/assets/effects/builtin-geometry-renderer.effect.meta
+++ b/editor/assets/effects/builtin-geometry-renderer.effect.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.5.4",
+ "ver": "1.5.6",
"importer": "effect",
"imported": true,
"uuid": "4bb480dd-8384-4bc9-987f-de67cc53052a",
diff --git a/editor/assets/effects/builtin-graphics.effect.meta b/editor/assets/effects/builtin-graphics.effect.meta
index 3013df8780..b4e0ba5ecc 100644
--- a/editor/assets/effects/builtin-graphics.effect.meta
+++ b/editor/assets/effects/builtin-graphics.effect.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.5.4",
+ "ver": "1.5.6",
"importer": "effect",
"imported": true,
"uuid": "1c02ae6f-4492-4915-b8f8-7492a3b1e4cd",
diff --git a/editor/assets/effects/builtin-occlusion-query.effect.meta b/editor/assets/effects/builtin-occlusion-query.effect.meta
index 62359c7432..cfc859fc47 100644
--- a/editor/assets/effects/builtin-occlusion-query.effect.meta
+++ b/editor/assets/effects/builtin-occlusion-query.effect.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.5.4",
+ "ver": "1.5.6",
"importer": "effect",
"imported": true,
"uuid": "d9937e59-61fe-4ec6-92ab-7ac5a19c89b0",
diff --git a/editor/assets/effects/builtin-particle-gpu.effect.meta b/editor/assets/effects/builtin-particle-gpu.effect.meta
index c71ab1b245..6d5aca1330 100644
--- a/editor/assets/effects/builtin-particle-gpu.effect.meta
+++ b/editor/assets/effects/builtin-particle-gpu.effect.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.5.4",
+ "ver": "1.5.6",
"importer": "effect",
"imported": true,
"uuid": "971bdb23-3ff6-43eb-b422-1c30165a3663",
diff --git a/editor/assets/effects/builtin-particle-trail.effect.meta b/editor/assets/effects/builtin-particle-trail.effect.meta
index 70b455d6b4..82ee1cdad8 100644
--- a/editor/assets/effects/builtin-particle-trail.effect.meta
+++ b/editor/assets/effects/builtin-particle-trail.effect.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.5.4",
+ "ver": "1.5.6",
"importer": "effect",
"imported": true,
"uuid": "17debcc3-0a6b-4b8a-b00b-dc58b885581e",
diff --git a/editor/assets/effects/builtin-particle.effect.meta b/editor/assets/effects/builtin-particle.effect.meta
index 5fd24a8955..541b065de2 100644
--- a/editor/assets/effects/builtin-particle.effect.meta
+++ b/editor/assets/effects/builtin-particle.effect.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.5.4",
+ "ver": "1.5.6",
"importer": "effect",
"imported": true,
"uuid": "d1346436-ac96-4271-b863-1f4fdead95b0",
diff --git a/editor/assets/effects/builtin-reflection-deferred.effect b/editor/assets/effects/builtin-reflection-deferred.effect
index 7cd10b759e..6eb877ef8d 100644
--- a/editor/assets/effects/builtin-reflection-deferred.effect
+++ b/editor/assets/effects/builtin-reflection-deferred.effect
@@ -70,11 +70,11 @@ CCProgram standard-vs %{
out vec3 v_bitangent;
#endif
- #if HAS_SECOND_UV || USE_LIGHTMAP
+ #if HAS_SECOND_UV || CC_USE_LIGHTMAP
in vec2 a_texCoord1;
#endif
- #if USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD
+ #if CC_USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD
#include
#endif
@@ -106,7 +106,7 @@ CCProgram standard-vs %{
CC_TRANSFER_FOG(pos);
CC_TRANSFER_SHADOW(pos);
- #if USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD
+ #if CC_USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD
CCLightingMapCaclUV();
#endif
@@ -121,7 +121,7 @@ CCProgram standard-fs %{
#include
#include
#include
- #if USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD
+ #if CC_USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD
#include
#endif
@@ -184,7 +184,7 @@ CCProgram standard-fs %{
if (s.albedo.ALPHA_TEST_CHANNEL < albedoScaleAndCutoff.w) discard;
#endif
- #if USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD
+ #if CC_USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD
s.lightmap = texture(cc_lightingMap, v_luv);
#endif
diff --git a/editor/assets/effects/builtin-reflection-deferred.effect.meta b/editor/assets/effects/builtin-reflection-deferred.effect.meta
index e250c20e98..d402380361 100644
--- a/editor/assets/effects/builtin-reflection-deferred.effect.meta
+++ b/editor/assets/effects/builtin-reflection-deferred.effect.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.5.4",
+ "ver": "1.5.6",
"importer": "effect",
"imported": true,
"uuid": "99498f84-efe6-43a6-a9a7-e6e93eb845c1",
diff --git a/editor/assets/effects/builtin-spine.effect.meta b/editor/assets/effects/builtin-spine.effect.meta
index 40c8f366a9..2d039228f7 100644
--- a/editor/assets/effects/builtin-spine.effect.meta
+++ b/editor/assets/effects/builtin-spine.effect.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.5.4",
+ "ver": "1.5.6",
"importer": "effect",
"imported": true,
"uuid": "c27215d8-6835-4b68-bfbb-bdeac6100c04",
diff --git a/editor/assets/effects/builtin-sprite.effect.meta b/editor/assets/effects/builtin-sprite.effect.meta
index 4813af5d97..18902f2f6a 100644
--- a/editor/assets/effects/builtin-sprite.effect.meta
+++ b/editor/assets/effects/builtin-sprite.effect.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.5.4",
+ "ver": "1.5.6",
"importer": "effect",
"imported": true,
"uuid": "60f7195c-ec2a-45eb-ba94-8955f60e81d0",
diff --git a/editor/assets/effects/builtin-standard.effect b/editor/assets/effects/builtin-standard.effect
index e9a2496794..0b38d5320e 100644
--- a/editor/assets/effects/builtin-standard.effect
+++ b/editor/assets/effects/builtin-standard.effect
@@ -114,11 +114,11 @@ CCProgram standard-vs %{
out mediump vec4 v_tangent;
#endif
- #if HAS_SECOND_UV || USE_LIGHTMAP
+ #if HAS_SECOND_UV || CC_USE_LIGHTMAP
in vec2 a_texCoord1;
#endif
- #if USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD
+ #if CC_USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD
#include
#endif
@@ -166,7 +166,7 @@ CCProgram standard-vs %{
CC_TRANSFER_FOG(pos);
CC_TRANSFER_SHADOW(pos);
- #if USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD
+ #if CC_USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD
CCLightingMapCaclUV();
#endif
@@ -180,7 +180,7 @@ CCProgram standard-fs %{
#include
#include
#include
- #if USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD
+ #if CC_USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD
#include
#endif
@@ -250,7 +250,7 @@ CCProgram standard-fs %{
if (s.albedo.ALPHA_TEST_CHANNEL < albedoScaleAndCutoff.w) discard;
#endif
- #if USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD
+ #if CC_USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD
vec4 lightColor = texture(cc_lightingMap, v_luv.xy);
s.lightmap = lightColor.xyz * v_luv.z;
s.lightmap_test = v_luv.z; /*lum*/
@@ -311,7 +311,7 @@ CCProgram shadow-caster-vs %{
#include
#include
- #if HAS_SECOND_UV || USE_LIGHTMAP
+ #if HAS_SECOND_UV || CC_USE_LIGHTMAP
in vec2 a_texCoord1;
#endif
diff --git a/editor/assets/effects/builtin-standard.effect.meta b/editor/assets/effects/builtin-standard.effect.meta
index 00120e7a51..3f6521ba08 100644
--- a/editor/assets/effects/builtin-standard.effect.meta
+++ b/editor/assets/effects/builtin-standard.effect.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.5.4",
+ "ver": "1.5.6",
"importer": "effect",
"imported": true,
"uuid": "1baf0fc9-befa-459c-8bdd-af1a450a0319",
diff --git a/editor/assets/effects/builtin-terrain.effect b/editor/assets/effects/builtin-terrain.effect
index c8086cd409..6ff1eba8d8 100644
--- a/editor/assets/effects/builtin-terrain.effect
+++ b/editor/assets/effects/builtin-terrain.effect
@@ -89,7 +89,7 @@ CCProgram terrain-vs %{
uv1 = a_position.xz * UVScale.y;
uv2 = a_position.xz * UVScale.z;
uv3 = a_position.xz * UVScale.w;
- #if USE_LIGHTMAP
+ #if CC_USE_LIGHTMAP
luv.xy = lightMapUVParam.xy + a_texCoord * lightMapUVParam.z;
luv.z = lightMapUVParam.w;
#endif
@@ -113,7 +113,7 @@ CCProgram terrain-fs %{
#include
#include
#include
- #if USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD
+ #if CC_USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD
#include
#endif
#pragma define-meta LAYERS range([0, 4])
@@ -264,7 +264,7 @@ CCProgram terrain-fs %{
#endif
s.emissive = vec3(0.0, 0.0, 0.0);
- #if USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD
+ #if CC_USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD
vec4 lightColor = texture(lightMap, luv.xy);
s.lightmap = lightColor.xyz * luv.z;
s.lightmap_test = luv.z; /*lum*/
diff --git a/editor/assets/effects/builtin-terrain.effect.meta b/editor/assets/effects/builtin-terrain.effect.meta
index b3f10e8db8..5c01bc0082 100644
--- a/editor/assets/effects/builtin-terrain.effect.meta
+++ b/editor/assets/effects/builtin-terrain.effect.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.5.4",
+ "ver": "1.5.6",
"importer": "effect",
"imported": true,
"uuid": "1d08ef62-a503-4ce2-8b9a-46c90873f7d3",
diff --git a/editor/assets/effects/builtin-toon.effect.meta b/editor/assets/effects/builtin-toon.effect.meta
index ea4bd3e1af..6a77346000 100644
--- a/editor/assets/effects/builtin-toon.effect.meta
+++ b/editor/assets/effects/builtin-toon.effect.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.5.4",
+ "ver": "1.5.6",
"importer": "effect",
"imported": true,
"uuid": "a7612b54-35e3-4238-a1a9-4a7b54635839",
diff --git a/editor/assets/effects/builtin-unlit.effect.meta b/editor/assets/effects/builtin-unlit.effect.meta
index 73547a737a..241707a5bf 100644
--- a/editor/assets/effects/builtin-unlit.effect.meta
+++ b/editor/assets/effects/builtin-unlit.effect.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.5.4",
+ "ver": "1.5.6",
"importer": "effect",
"imported": true,
"uuid": "a3cd009f-0ab0-420d-9278-b9fdab939bbc",
diff --git a/editor/assets/effects/builtin-wireframe.effect.meta b/editor/assets/effects/builtin-wireframe.effect.meta
index c7cd0afd49..be47067091 100644
--- a/editor/assets/effects/builtin-wireframe.effect.meta
+++ b/editor/assets/effects/builtin-wireframe.effect.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.5.4",
+ "ver": "1.5.6",
"importer": "effect",
"imported": true,
"uuid": "81127eb0-7556-453c-b147-670782dd5e53",
diff --git a/editor/assets/effects/dcc.meta b/editor/assets/effects/dcc.meta
new file mode 100644
index 0000000000..c76976d314
--- /dev/null
+++ b/editor/assets/effects/dcc.meta
@@ -0,0 +1,12 @@
+{
+ "ver": "1.1.0",
+ "importer": "directory",
+ "imported": true,
+ "uuid": "7318038e-8127-4c1b-9b93-e809f973ce6c",
+ "files": [],
+ "subMetas": {},
+ "userData": {
+ "compressionType": {},
+ "isRemoteBundle": {}
+ }
+}
diff --git a/editor/assets/effects/dcc/imported-metallic-roughness.effect b/editor/assets/effects/dcc/imported-metallic-roughness.effect
new file mode 100644
index 0000000000..1122886ed3
--- /dev/null
+++ b/editor/assets/effects/dcc/imported-metallic-roughness.effect
@@ -0,0 +1,466 @@
+// Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd.
+
+CCEffect %{
+ techniques:
+ - name: opaque
+ passes:
+ - vert: standard-vs
+ frag: standard-fs
+ properties: &props
+ tilingOffset: { value: [1.0, 1.0, 0.0, 0.0] }
+ mainColor: { value: [1.0, 1.0, 1.0, 1.0], target: albedo, linear: true, editor: { displayName: BaseColor, type: color } }
+ mainTexture: { value: grey, target: albedoMap, editor: { displayName: BaseColorMap } }
+ baseWeightMap: { value: grey }
+ albedoScale: { value: 1.0, editor: { displayName: BaseWeight } }
+ roughness: { value: 1.0 }
+ roughnessMap: { value: grey }
+ metallic: { value: 1.0 }
+ metallicMap: { value: grey }
+ occlusion: { value: 1.0 }
+ occlusionMap: { value: white }
+ emissiveScale: { value: 1.0, editor: { displayName: Emissive } }
+ emissiveScaleMap: { value: grey, editor: { displayName: EmissiveMap } }
+ emissive: { value: [0.0, 0.0, 0.0, 1.0], linear: true, editor: { displayName: EmissiveColor, type: color} }
+ emissiveMap: { value: grey, editor: { displayName: EmissiveColorMap } }
+ alphaSource: { value: 0.0, editor: { slide: true, range: [0, 1.0], step: 0.001 } }
+ alphaSourceMap: { value: grey, editor: { parent: USE_OPACITY_MAP } }
+ alphaThreshold: { value: 0.5, target: albedoScaleAndCutoff.w, editor: { parent: USE_ALPHA_TEST, slide: true, range: [0, 1.0], step: 0.001 } }
+ normalStrength: { value: 1.0, editor: { parent: USE_NORMAL_MAP, slide: true, range: [0, 1.0], step: 0.001 } }
+ normalMap: { value: normal }
+ - &forward-add
+ vert: standard-vs
+ frag: standard-fs
+ phase: forward-add
+ propertyIndex: 0
+ embeddedMacros: { CC_FORWARD_ADD: true }
+ depthStencilState:
+ depthFunc: equal
+ depthTest: true
+ depthWrite: false
+ blendState:
+ targets:
+ - blend: true
+ blendSrc: one
+ blendDst: one
+ blendSrcAlpha: zero
+ blendDstAlpha: one
+ - &shadow-caster
+ vert: shadow-caster-vs:vert
+ frag: shadow-caster-fs:frag
+ phase: shadow-caster
+ propertyIndex: 0
+ rasterizerState:
+ cullMode: front
+ properties:
+ tilingOffset: { value: [1.0, 1.0, 0.0, 0.0] }
+ mainColor: { value: [1.0, 1.0, 1.0, 1.0], target: albedo, editor: { displayName: Albedo, type: color } }
+ albedoScale: { value: [1.0, 1.0, 1.0], target: albedoScaleAndCutoff.xyz }
+ alphaThreshold: { value: 0.5, target: albedoScaleAndCutoff.w, editor: { parent: USE_ALPHA_TEST } }
+ mainTexture: { value: grey, target: albedoMap, editor: { displayName: AlbedoMap } }
+ - name: transparent
+ passes:
+ - vert: standard-vs
+ frag: standard-fs
+ embeddedMacros: { CC_FORCE_FORWARD_SHADING: true }
+ depthStencilState:
+ depthTest: true
+ depthWrite: false
+ blendState:
+ targets:
+ - blend: true
+ blendSrc: src_alpha
+ blendDst: one_minus_src_alpha
+ blendDstAlpha: one_minus_src_alpha
+ properties: *props
+ - *forward-add
+ - *shadow-caster
+}%
+
+CCProgram shared-ubos %{
+ uniform Constants {
+ vec4 tilingOffset;
+ vec4 albedo;
+ vec4 albedoScaleAndCutoff;
+ vec4 emissive;
+ float emissiveScale;
+ float occlusion;
+ float roughness;
+ float metallic;
+ float normalStrength;
+ float alphaSource;
+ float albedoScale;
+ };
+}%
+
+CCProgram standard-vs %{
+ precision highp float;
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+
+ #if USE_VERTEX_COLOR
+ in vec4 a_color;
+ out vec4 v_color;
+ #endif
+
+ out vec3 v_position;
+ out vec3 v_normal;
+ out vec2 v_uv;
+ out vec2 v_uv1;
+
+ #if CC_RECEIVE_SHADOW
+ out vec2 v_shadowBias;
+ #endif
+
+ #if USE_NORMAL_MAP
+ out vec3 v_tangent;
+ out vec3 v_bitangent;
+ #endif
+
+ #if HAS_SECOND_UV || CC_USE_LIGHTMAP
+ in vec2 a_texCoord1;
+ #endif
+
+ #if CC_USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD
+ #include
+ #endif
+
+ void main () {
+ StandardVertInput In;
+ CCVertInput(In);
+
+ mat4 matWorld, matWorldIT;
+ CCGetWorldMatrixFull(matWorld, matWorldIT);
+
+ vec4 pos = matWorld * In.position;
+
+ v_position = pos.xyz;
+ v_normal = normalize((matWorldIT * vec4(In.normal, 0.0)).xyz);
+
+ #if CC_RECEIVE_SHADOW
+ v_shadowBias = CCGetShadowBias();
+ #endif
+
+ #if USE_TWOSIDE
+ vec3 viewDirect = normalize(cc_cameraPos.xyz - v_position);
+ v_normal *= dot(v_normal, viewDirect) < 0.0 ? -1.0 : 1.0;
+ #endif
+
+ #if USE_NORMAL_MAP
+ v_tangent = normalize((matWorld * vec4(In.tangent.xyz, 0.0)).xyz);
+ v_bitangent = cross(v_normal, v_tangent) * In.tangent.w; // note the cross order
+ #endif
+
+ v_uv = a_texCoord * tilingOffset.xy + tilingOffset.zw;
+ #if SAMPLE_FROM_RT
+ CC_HANDLE_RT_SAMPLE_FLIP(v_uv);
+ #endif
+ #if HAS_SECOND_UV
+ v_uv1 = a_texCoord1 * tilingOffset.xy + tilingOffset.zw;
+ #if SAMPLE_FROM_RT
+ CC_HANDLE_RT_SAMPLE_FLIP(v_uv1);
+ #endif
+ #endif
+
+ #if USE_VERTEX_COLOR
+ v_color = a_color;
+ #endif
+
+ CC_TRANSFER_FOG(pos);
+ CC_TRANSFER_SHADOW(pos);
+
+ #if CC_USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD
+ CCLightingMapCaclUV();
+ #endif
+
+ gl_Position = cc_matProj * (cc_matView * matWorld) * In.position;
+ }
+}%
+
+CCProgram standard-fs %{
+ precision highp float;
+ #include
+ #include
+ #include
+ #include
+ #if CC_USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD
+ #include
+ #endif
+
+ in vec3 v_position;
+ in vec2 v_uv;
+ in vec2 v_uv1;
+ in vec3 v_normal;
+
+ #if CC_RECEIVE_SHADOW
+ in vec2 v_shadowBias;
+ #endif
+
+ #if USE_VERTEX_COLOR
+ in vec4 v_color;
+ #endif
+
+ #pragma define-meta TEXTURE_UV options([v_uv, v_uv1])
+
+ #if USE_ALBEDO_MAP
+ uniform sampler2D albedoMap;
+ #endif
+
+ #if USE_WEIGHT_MAP
+ uniform sampler2D baseWeightMap;
+ #endif
+
+ #if USE_NORMAL_MAP
+ in vec3 v_tangent;
+ in vec3 v_bitangent;
+ uniform sampler2D normalMap;
+ #pragma define-meta NORMAL_UV options([v_uv, v_uv1])
+ #endif
+
+ #if USE_METALLIC_MAP
+ #pragma define-meta METALLIC_CHANNEL options([r, g, b, a])
+ uniform sampler2D metallicMap;
+ #endif
+
+ #if USE_ROUGHNESS_MAP
+ #pragma define-meta ROUGHNESS_CHANNEL options([r, g, b, a])
+ uniform sampler2D roughnessMap;
+ #endif
+
+ #if USE_OCCLUSION_MAP
+ #pragma define-meta OCCLUSION_CHANNEL options([r, g, b, a])
+ uniform sampler2D occlusionMap;
+ #endif
+
+ #if USE_TRANSPARENCY_MAP
+ uniform sampler2D transparencyMap;
+ #endif
+
+ #if USE_TRANSPARENCYCOLOR_MAP
+ uniform sampler2D transparencyColorMap;
+ #endif
+
+ #if USE_EMISSIVE_MAP
+ uniform sampler2D emissiveMap;
+ #endif
+ #if USE_EMISSIVESCALE_MAP
+ uniform sampler2D emissiveScaleMap;
+ #endif
+
+ #if USE_OPACITY_MAP
+ #pragma define-meta ALPHA_SOURCE_CHANNEL options([r, g, b, a])
+ uniform sampler2D alphaSourceMap;
+ #endif
+
+ float discolor(vec3 srcColor) {
+ return dot(GRAY_VECTOR, srcColor);
+ }
+
+ void surf (out StandardSurface s) {
+ vec4 baseColor = albedo;
+ #if USE_VERTEX_COLOR
+ baseColor.rgb *= SRGBToLinear(v_color.rgb); // use linear
+ baseColor.a *= v_color.a;
+ #endif
+
+ #if USE_ALBEDO_MAP
+ vec4 texColor = texture(albedoMap, TEXTURE_UV);
+ texColor.rgb = SRGBToLinear(texColor.rgb);
+ baseColor *= texColor;
+ #endif
+
+ #if USE_WEIGHT_MAP
+ vec4 weightColor = texture(baseWeightMap, TEXTURE_UV);
+ weightColor.rgb = SRGBToLinear(weightColor.rgb);
+ baseColor.rgb *= weightColor.rgb;
+ #else
+ baseColor.rgb *= albedoScale;
+ #endif
+ ////////////////////////
+ float metallicValue = metallic;
+ #if USE_METALLIC_MAP
+ vec4 metallicColor = texture(metallicMap, TEXTURE_UV);
+ metallicValue = discolor(metallicColor.rgb);
+ #if USE_METALLIC_CHANNEL
+ metallicColor.rgb = SRGBToLinear(metallicColor.rgb);
+ metallicValue = metallicColor.METALLIC_CHANNEL;
+ #endif
+ #endif
+ s.metallic = metallicValue;
+
+ float roughnessValue = roughness;
+ #if USE_ROUGHNESS_MAP
+ vec4 roughnessColor = texture(roughnessMap, TEXTURE_UV);
+ roughnessValue = discolor(roughnessColor.rgb);
+ #if USE_ROUGHNESS_CHANNEL
+ roughnessColor.rgb = SRGBToLinear(roughnessColor.rgb);
+ roughnessValue = roughnessColor.ROUGHNESS_CHANNEL;
+ #endif
+ #endif
+ s.roughness = roughnessValue;
+
+
+ float occlusionValue = occlusion;
+ #if USE_OCCLUSION_MAP
+ vec4 occlusionColor = texture(occlusionMap, TEXTURE_UV);
+ occlusionValue = discolor(occlusionColor.rgb);
+ #if USE_OCCLUSION_CHANNEL
+ occlusionColor.rgb = SRGBToLinear(occlusionColor.rgb);
+ occlusionValue = occlusionColor.OCCLUSION_CHANNEL;
+ #endif
+ #endif
+ s.occlusion = occlusionValue;
+
+ #if ALPHA_SOURCE_IS_OPACITY
+ #if USE_OPACITY_MAP
+ baseColor.a = 1.0 - texture(alphaSourceMap, TEXTURE_UV).ALPHA_SOURCE_CHANNEL;
+ #else
+ baseColor.a = 1.0 - alphaSource;
+ #endif
+ #else
+ #if USE_OPACITY_MAP
+ baseColor.a = texture(alphaSourceMap, TEXTURE_UV).ALPHA_SOURCE_CHANNEL;
+ #else
+ baseColor.a = alphaSource;
+ #endif
+ #endif
+ #if USE_ALPHA_TEST
+ if (baseColor.a < albedoScaleAndCutoff.w) discard;
+ #endif
+ /////////////////////////////
+ s.albedo = baseColor;
+
+ #if CC_USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD
+ vec4 lightColor = texture(cc_lightingMap, v_luv.xy);
+ s.lightmap = lightColor.xyz * v_luv.z;
+ s.lightmap_test = v_luv.z; /*lum*/
+ #endif
+
+ s.normal = v_normal;
+
+ #if CC_RECEIVE_SHADOW
+ s.shadowBias = v_shadowBias;
+ #endif
+
+ #if USE_NORMAL_MAP
+ vec3 nmmp = texture(normalMap, NORMAL_UV).xyz - vec3(0.5);
+ s.normal =
+ (nmmp.x * normalStrength) * normalize(v_tangent) +
+ (nmmp.y * normalStrength) * normalize(v_bitangent) +
+ nmmp.z * normalize(s.normal);
+ #endif
+
+ HIGHP_VALUE_TO_STRUCT_DEFINED(v_position, s.position);
+
+ s.specularIntensity = 0.5;
+
+ //emissive color
+ vec3 emissiveColor = emissive.rgb;
+ #if USE_EMISSIVE_MAP
+ emissiveColor.rgb = SRGBToLinear(texture(emissiveMap, TEXTURE_UV).rgb);
+ #endif
+ //emissive color scale
+ #if USE_EMISSIVESCALE_MAP
+ vec4 emissiveScaleColor = texture(emissiveScaleMap, TEXTURE_UV);
+ emissiveScaleColor.rgb = SRGBToLinear(emissiveScaleColor.rgb);
+ emissiveColor.rgb *= emissiveScaleColor.rgb;
+ #else
+ emissiveColor.rgb *= emissiveScale;
+ #endif
+
+ s.emissive = emissiveColor.rgb;
+ }
+
+ CC_STANDARD_SURFACE_ENTRY()
+}%
+
+CCProgram shadow-caster-vs %{
+ precision highp float;
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+
+ #if HAS_SECOND_UV || CC_USE_LIGHTMAP
+ in vec2 a_texCoord1;
+ #endif
+
+ out vec2 v_uv;
+ out vec2 v_uv1;
+ out vec4 v_worldPos;
+
+ out float v_clip_depth;
+
+ vec4 vert () {
+ StandardVertInput In;
+ CCVertInput(In);
+
+ mat4 matWorld, matWorldIT;
+ CCGetWorldMatrixFull(matWorld, matWorldIT);
+
+ v_worldPos = matWorld * In.position;
+ vec4 clipPos = cc_matLightViewProj * v_worldPos;
+
+ v_uv = a_texCoord * tilingOffset.xy + tilingOffset.zw;
+ #if HAS_SECOND_UV
+ v_uv1 = a_texCoord1 * tilingOffset.xy + tilingOffset.zw;
+ #endif
+
+ v_clip_depth = clipPos.z / clipPos.w * 0.5 + 0.5;
+
+ return clipPos;
+ }
+}%
+
+CCProgram shadow-caster-fs %{
+ precision highp float;
+ #include
+ #include
+ #include
+
+ in vec2 v_uv;
+ in vec2 v_uv1;
+ in vec4 v_worldPos;
+ in float v_clip_depth;
+
+ #if USE_ALBEDO_MAP
+ uniform sampler2D albedoMap;
+ #pragma define-meta ALBEDO_UV options([v_uv, v_uv1])
+ #endif
+
+ #if USE_ALPHA_TEST
+ #pragma define-meta ALPHA_TEST_CHANNEL options([a, r])
+ #endif
+
+ vec4 frag () {
+ vec4 baseColor = albedo;
+
+ #if USE_ALBEDO_MAP
+ baseColor *= texture(albedoMap, ALBEDO_UV);
+ #endif
+
+ #if USE_ALPHA_TEST
+ if (baseColor.ALPHA_TEST_CHANNEL < albedoScaleAndCutoff.w) discard;
+ #endif
+
+ // spot use linear
+ if(cc_shadowLPNNInfo.x > 0.000001 && cc_shadowLPNNInfo.x < 1.999999) {
+ // enabled linear depth
+ if (cc_shadowNFLSInfo.z > 0.000001) {
+ return vec4(CCGetLinearDepth(v_worldPos.xyz), 1.0, 1.0, 1.0);
+ }
+ }
+
+ if (cc_shadowLPNNInfo.y > 0.000001) {
+ return packDepthToRGBA(v_clip_depth);
+ }
+
+ return vec4(v_clip_depth, 1.0, 1.0, 1.0);
+ }
+}%
diff --git a/editor/assets/effects/dcc/imported-metallic-roughness.effect.meta b/editor/assets/effects/dcc/imported-metallic-roughness.effect.meta
new file mode 100644
index 0000000000..bf390b2c82
--- /dev/null
+++ b/editor/assets/effects/dcc/imported-metallic-roughness.effect.meta
@@ -0,0 +1,11 @@
+{
+ "ver": "1.5.6",
+ "importer": "effect",
+ "imported": true,
+ "uuid": "2ec11458-f855-4978-b14d-f3ed5cf697fa",
+ "files": [
+ ".json"
+ ],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/effects/dcc/imported-specular-glossiness.effect b/editor/assets/effects/dcc/imported-specular-glossiness.effect
new file mode 100644
index 0000000000..94accbc819
--- /dev/null
+++ b/editor/assets/effects/dcc/imported-specular-glossiness.effect
@@ -0,0 +1,459 @@
+// Copyright (c) 2017-2020 Xiamen Yaji Software Co., Ltd.
+
+CCEffect %{
+ techniques:
+ - name: opaque
+ passes:
+ - vert: standard-vs
+ frag: standard-fs
+ properties: &props
+ mainTexture: { value: grey, target: albedoMap, editor: { displayName: DiffuseMap }}
+ mainColor: { value: [1.0,1.0,1.0,1.0], target: diffuseColor, linear: true, editor: { displayName: DiffuseColor, type: color }}
+ albedoScale: { value: 1.0, target: diffuseFactor, editor: { displayName: diffuseFactor } }
+ alphaThreshold: { value: 0.5, target: albedoScaleAndCutoff.w, editor: { parent: USE_ALPHA_TEST } }
+ emissive: { value: [0.0, 0.0, 0.0, 1.0], linear: true, editor: { type: color } }
+ emissiveMap: { value: grey }
+ shininessExponentMap: { value: grey, editor: { parent: '!HAS_EXPORTED_GLOSSINESS' } }
+ shininessExponent: { value: 100.0, editor: { parent: '!HAS_EXPORTED_GLOSSINESS' } }
+ specularColor: { value: [0.0,0.0,0.0,0.0], linear: true, editor: { displayName: SpecularColor, type: color }}
+ specularMap: { value: grey, editor: { parent: '!HAS_EXPORTED_METALLIC' } }
+ specularFactor: { value: 1.0, editor: { parent: '!HAS_EXPORTED_METALLIC' } }
+ transparencyMap: { value: grey, editor: { displayName: TransparencyMap} }
+ transparencyFactor: { value: 0.0 }
+ tilingOffset: { value: [1.0, 1.0, 0.0, 0.0] }
+ normalStrength: { value: 1.0, target: normalScale, editor: { displayName: bumpFactor, parent: USE_NORMAL_MAP, slide: true, range: [0, 5.0], step: 0.001 } }
+ normalMap: { value: normal }
+ glossiness: { value: 0.0, editor: { parent: HAS_EXPORTED_GLOSSINESS, slide: true, range: [0, 1.0], step: 0.001 }}
+ metallic: { value: 0.0, editor: { parent: HAS_EXPORTED_METALLIC, slide: true, range: [0, 1.0], step: 0.001 }}
+ metallicMap: { value: grey, editor: {parent: HAS_EXPORTED_METALLIC } }
+ - &forward-add
+ vert: standard-vs
+ frag: standard-fs
+ phase: forward-add
+ propertyIndex: 0
+ embeddedMacros: { CC_FORWARD_ADD: true }
+ depthStencilState:
+ depthFunc: equal
+ depthTest: true
+ depthWrite: false
+ blendState:
+ targets:
+ - blend: true
+ blendSrc: one
+ blendDst: one
+ blendSrcAlpha: zero
+ blendDstAlpha: one
+ - &shadow-caster
+ vert: shadow-caster-vs:vert
+ frag: shadow-caster-fs:frag
+ phase: shadow-caster
+ propertyIndex: 0
+ rasterizerState:
+ cullMode: front
+ properties:
+ tilingOffset: { value: [1.0, 1.0, 0.0, 0.0] }
+ mainColor: { value: [1.0, 1.0, 1.0, 1.0], target: albedo, editor: { displayName: Albedo, type: color } }
+ albedoScale: { value: [1.0, 1.0, 1.0], target: albedoScaleAndCutoff.xyz }
+ alphaThreshold: { value: 0.5, target: albedoScaleAndCutoff.w, editor: { parent: USE_ALPHA_TEST } }
+ mainTexture: { value: grey, target: albedoMap, editor: { displayName: AlbedoMap } }
+ - name: transparent
+ passes:
+ - vert: standard-vs
+ frag: standard-fs
+ embeddedMacros: { CC_FORCE_FORWARD_SHADING: true }
+ depthStencilState:
+ depthTest: true
+ depthWrite: false
+ blendState:
+ targets:
+ - blend: true
+ blendSrc: src_alpha
+ blendDst: one_minus_src_alpha
+ blendDstAlpha: one_minus_src_alpha
+ properties: *props
+ - *forward-add
+ - *shadow-caster
+}%
+
+CCProgram shared-ubos %{
+ uniform Constants {
+ vec4 tilingOffset;
+ vec4 albedo;
+ vec4 albedoScaleAndCutoff;
+
+ vec4 diffuseColor;
+ vec4 specularColor;
+ vec4 emissive;
+ float alphaThreshold;
+ float shininessExponent;
+ float glossiness;
+ float metallic;
+ float normalScale;
+ float transparencyFactor;
+ float diffuseFactor;
+ float specularFactor;
+ };
+}%
+
+CCProgram standard-vs %{
+ precision highp float;
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+
+ #if USE_VERTEX_COLOR
+ in vec4 a_color;
+ out vec4 v_color;
+ #endif
+
+ out vec3 v_position;
+ out vec3 v_normal;
+ out vec2 v_uv;
+ out vec2 v_uv1;
+
+ #if USE_NORMAL_MAP
+ out vec3 v_tangent;
+ out vec3 v_bitangent;
+ #endif
+
+ #if HAS_SECOND_UV || CC_USE_LIGHTMAP
+ in vec2 a_texCoord1;
+ #endif
+
+ #if CC_USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD
+ #include
+ #endif
+
+ void main () {
+ StandardVertInput In;
+ CCVertInput(In);
+
+ mat4 matWorld, matWorldIT;
+ CCGetWorldMatrixFull(matWorld, matWorldIT);
+
+ vec4 pos = matWorld * In.position;
+
+ v_position = pos.xyz;
+ v_normal = normalize((matWorldIT * vec4(In.normal, 0.0)).xyz);
+
+ #if USE_TWOSIDE
+ vec3 viewDirect = normalize(cc_cameraPos.xyz - v_position);
+ v_normal *= dot(v_normal, viewDirect) < 0.0 ? -1.0 : 1.0;
+ #endif
+
+ #if USE_NORMAL_MAP
+ v_tangent = normalize((matWorld * vec4(In.tangent.xyz, 0.0)).xyz);
+ v_bitangent = cross(v_normal, v_tangent) * In.tangent.w; // note the cross order
+ #endif
+
+ v_uv = a_texCoord * tilingOffset.xy + tilingOffset.zw;
+
+ #if HAS_SECOND_UV
+ v_uv1 = a_texCoord1 * tilingOffset.xy + tilingOffset.zw;
+ #endif
+
+ #if USE_VERTEX_COLOR
+ v_color = a_color;
+ #endif
+
+ CC_TRANSFER_FOG(pos);
+ CC_TRANSFER_SHADOW(pos);
+
+ #if CC_USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD
+ CCLightingMapCaclUV();
+ #endif
+
+ gl_Position = cc_matProj * (cc_matView * matWorld) * In.position;
+ }
+}%
+
+CCProgram standard-fs %{
+ precision highp float;
+ #include
+ #include
+ #include
+ #include
+ #if CC_USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD
+ #include
+ #endif
+
+ in vec3 v_position;
+ in vec2 v_uv;
+ in vec2 v_uv1;
+ in vec3 v_normal;
+
+
+ #pragma define-meta TEXTURE_UV options([v_uv, v_uv1])
+ #pragma define-meta DCC_APP_NAME range([0, 2])
+ #define DCC_APP_AUTODESK 0
+ #define DCC_APP_BLENDER 1
+ #define DCC_APP_CINEMA4D 2
+
+ #if USE_SHININESS_MAP
+ uniform sampler2D shininessExponentMap;
+ #pragma define-meta GLOSSINESS_MAP_CHANNEL options([r,g,b,a])
+ #endif
+ #if USE_SPECULAR_MAP
+ uniform sampler2D specularMap;
+ #endif
+ #if USE_METALLIC_MAP
+ uniform sampler2D metallicMap;
+ #endif
+
+ #if USE_VERTEX_COLOR
+ in vec4 v_color;
+ #endif
+
+ #if USE_ALBEDO_MAP
+ uniform sampler2D albedoMap;
+ #endif
+ #if USE_TRANSPARENCY_MAP
+ uniform sampler2D transparencyMap;
+ #endif
+
+ #if USE_NORMAL_MAP
+ in vec3 v_tangent;
+ in vec3 v_bitangent;
+ uniform sampler2D normalMap;
+ #endif
+
+ #if USE_EMISSIVE_MAP
+ uniform sampler2D emissiveMap;
+ #endif
+
+bool GetMetallicAlbedoFromDiffuseSpecularWithoutColor(out float metallic, out vec3 albedo, vec3 diffuse, vec3 specular, float f0 /*= 0.04*/)
+{
+ float d = max(max(diffuse.x, diffuse.y), diffuse.z);
+ vec3 normalizedColor = diffuse / (d + (d < EPSILON_LOWP ? EPSILON_LOWP : 0.0));
+ normalizedColor = d < EPSILON_LOWP ? specular : normalizedColor;
+
+ float s = max(max(specular.x, specular.y), specular.z);
+
+ float delta = (d + s) * (d + s) - 4.0 * f0 * d;
+ float deltaSqrt = sqrt(max(0.0, delta));
+ // solver
+ float solverMetallic = (-d - s + 2.0 * f0 + deltaSqrt) / (2.0 * f0);
+ vec3 solverAlbedo = (d + s) * normalizedColor - vec3(f0 * (1.0 - solverMetallic));
+
+ bool isValidSolver = delta >= 0.0;
+ metallic = isValidSolver ? clamp(solverMetallic, 0.0, 1.0) : 0.0;
+ albedo = isValidSolver ? vec3(max(0.0, solverAlbedo.x), max(0.0, solverAlbedo.y), max(0.0, solverAlbedo.z)) : diffuse;
+ return isValidSolver;
+}
+
+ float discolor(vec3 srcColor) {
+ return dot(GRAY_VECTOR, srcColor);
+ }
+ float convertShininessExponent(float shininessExp)
+ {
+ #if DCC_APP_NAME == DCC_APP_BLENDER
+ // 2-100
+ float glossiness = clamp(sqrt(shininessExp) * 0.1/*/10.0*/, 0.0, 0.95); // glossiness=1 may leads to specular disappear
+ #elif DCC_APP_NAME == DCC_APP_CINEMA4D
+ // 2-1024
+ float glossiness = clamp(log(shininessExp + EPSILON) * 0.1442695 /*/log(2.0)/10.0*/, 0.0, 1.0);
+ #else // DCC_APP_NAME == DCC_APP_AUTODESK
+ // 2-1024
+ float l2 = clamp(log(shininessExp + EPSILON) * 0.1442695 /*/log(2.0)/10.0*/, 0.0, 1.0);
+ float glossiness = pow(l2, 0.5);
+ #endif
+ return glossiness;
+ }
+ float getSpecularIntensityFromRoughness(float roughness)
+ {
+ #if DCC_APP_NAME == DCC_APP_BLENDER
+ float specularIntensityMultiplier = mix(1.0, 5.0, roughness);
+ #elif DCC_APP_NAME == DCC_APP_CINEMA4D
+ float specularIntensityMultiplier = mix(1.0, 50.0, roughness);
+ #else // DCC_APP_NAME == DCC_APP_AUTODESK
+ float specularIntensityMultiplier = mix(1.0, 20.0, roughness);
+ #endif
+ return specularIntensityMultiplier;
+ }
+
+ vec4 getSpecularColorAndFactor()
+ {
+ vec3 inSpecular = specularColor.rgb;
+ #if USE_SPECULAR_MAP
+ vec4 specularTex = texture(specularMap, TEXTURE_UV);
+ specularTex.rgb = SRGBToLinear(specularTex.rgb);
+ inSpecular = specularTex.rgb;
+ #endif
+ return vec4(inSpecular, specularFactor);
+ }
+ void surf (out StandardSurface s) {
+ //diffuse
+ vec4 baseColor = diffuseColor;
+ #if USE_VERTEX_COLOR
+ baseColor.rgb *= SRGBToLinear(v_color.rgb);
+ baseColor.a *= v_color.a;
+ #endif
+ float diffuseScale = diffuseFactor;
+ #if USE_ALBEDO_MAP
+ vec4 texColor = texture(albedoMap, TEXTURE_UV);
+ texColor.rgb = SRGBToLinear(texColor.rgb);
+ baseColor *= texColor;
+ diffuseScale = 1.0;
+ #endif
+ baseColor.rgb *= diffuseScale;
+
+ #if USE_TRANSPARENCY_MAP
+ baseColor.a = texture(transparencyMap, TEXTURE_UV).a * transparencyFactor;
+ #endif
+
+ #if USE_ALPHA_TEST
+ if (baseColor.a < albedoScaleAndCutoff.w) discard;
+ #endif
+
+ vec4 specularColorAndFactor = getSpecularColorAndFactor();
+
+ //glossiness
+ float inGlossiness = 0.0, inSpecularIntensity = specularColorAndFactor.w;
+ #if HAS_EXPORTED_GLOSSINESS
+ inGlossiness = glossiness;
+ #else
+ #if USE_SHININESS_MAP
+ #if GLOSSINESS_MAP_USE_SINGLE_CHANNEL
+ inGlossiness = 1.0 - texture(shininessExponentMap, TEXTURE_UV).GLOSSINESS_MAP_CHANNEL;
+ #else
+ inGlossiness = 1.0 - discolor(texture(shininessExponentMap, TEXTURE_UV).rgb);
+ #endif
+ #else
+ inGlossiness = convertShininessExponent(shininessExponent);
+ #endif
+ inSpecularIntensity *= getSpecularIntensityFromRoughness(1.0 - inGlossiness);
+ #endif
+
+ //metallic
+ float inMetallic = 0.0;
+ vec4 albedo = baseColor;
+ #if HAS_EXPORTED_METALLIC
+ inMetallic = metallic;
+ #else
+ GetMetallicAlbedoFromDiffuseSpecularWithoutColor(inMetallic, albedo.rgb, baseColor.rgb, specularColorAndFactor.rgb, 0.04);
+ inSpecularIntensity *= inMetallic; //simulate specular color is black
+ #endif
+
+ s.normal = v_normal;
+ #if USE_NORMAL_MAP
+ vec3 nmmp = texture(normalMap, TEXTURE_UV).xyz - vec3(0.5);
+ s.normal =
+ (nmmp.x * normalScale) * normalize(v_tangent) +
+ (nmmp.y * normalScale) * normalize(v_bitangent) +
+ nmmp.z * normalize(s.normal);
+ #endif
+
+ HIGHP_VALUE_TO_STRUCT_DEFINED(v_position, s.position);
+
+ s.albedo = albedo;
+ s.occlusion = 1.0;
+ s.roughness = 1.0 - inGlossiness;
+ s.metallic = inMetallic;
+ s.specularIntensity = inSpecularIntensity * 0.5;
+ s.emissive = vec3(0.0);
+ #if USE_EMISSIVE_MAP
+ s.emissive = texture(emissiveMap, TEXTURE_UV).xyz;
+ #endif
+
+ #if CC_USE_LIGHTMAP && !USE_BATCHING && !CC_FORWARD_ADD
+ vec4 lightColor = texture(cc_lightingMap, v_luv.xy);
+ s.lightmap = lightColor.xyz * v_luv.z;
+ s.lightmap_test = v_luv.z; /*lum*/
+ #endif
+ }
+
+ CC_STANDARD_SURFACE_ENTRY()
+}%
+
+CCProgram shadow-caster-vs %{
+ precision highp float;
+ #include
+ #include
+ #include
+ #include
+
+ #if HAS_SECOND_UV || CC_USE_LIGHTMAP
+ in vec2 a_texCoord1;
+ #endif
+
+ out vec2 v_uv;
+ out vec2 v_uv1;
+ out vec4 v_worldPos;
+
+ out float v_clip_depth;
+
+ vec4 vert () {
+ StandardVertInput In;
+ CCVertInput(In);
+
+ mat4 matWorld, matWorldIT;
+ CCGetWorldMatrixFull(matWorld, matWorldIT);
+
+ v_worldPos = matWorld * In.position;
+ vec4 clipPos = cc_matLightViewProj * v_worldPos;
+
+ v_uv = a_texCoord * tilingOffset.xy + tilingOffset.zw;
+ #if HAS_SECOND_UV
+ v_uv1 = a_texCoord1 * tilingOffset.xy + tilingOffset.zw;
+ #endif
+
+ v_clip_depth = clipPos.z / clipPos.w * 0.5 + 0.5;
+
+ return clipPos;
+ }
+}%
+
+CCProgram shadow-caster-fs %{
+ precision highp float;
+ #include
+ #include
+ #include
+
+ in vec2 v_uv;
+ in vec2 v_uv1;
+ in vec4 v_worldPos;
+ in float v_clip_depth;
+
+ #pragma define-meta TEXTURE_UV options([v_uv, v_uv1])
+
+ #if USE_ALBEDO_MAP
+ uniform sampler2D albedoMap;
+ #endif
+
+ #if USE_TRANSPARENCY_MAP
+ uniform sampler2D transparencyMap;
+ #endif
+
+ vec4 frag () {
+ vec4 baseColor = diffuseColor;
+ #if USE_ALBEDO_MAP
+ vec4 texColor = texture(albedoMap, TEXTURE_UV);
+ baseColor *= texColor;
+ #endif
+
+ #if USE_TRANSPARENCY_MAP
+ baseColor.a = texture(transparencyMap, TEXTURE_UV).a * transparencyFactor;
+ #endif
+
+ #if USE_ALPHA_TEST
+ if (baseColor.a < albedoScaleAndCutoff.w) discard;
+ #endif
+
+ // spot use linear
+ if(cc_shadowLPNNInfo.x > 0.000001 && cc_shadowLPNNInfo.x < 1.999999) {
+ // enabled linear depth
+ if (cc_shadowNFLSInfo.z > 0.000001) {
+ return vec4(CCGetLinearDepth(v_worldPos.xyz), 1.0, 1.0, 1.0);
+ }
+ }
+
+ if (cc_shadowLPNNInfo.y > 0.000001) {
+ return packDepthToRGBA(v_clip_depth);
+ }
+
+ return vec4(v_clip_depth, 1.0, 1.0, 1.0);
+ }
+}%
diff --git a/editor/assets/effects/dcc/imported-specular-glossiness.effect.meta b/editor/assets/effects/dcc/imported-specular-glossiness.effect.meta
new file mode 100644
index 0000000000..626fcc68ff
--- /dev/null
+++ b/editor/assets/effects/dcc/imported-specular-glossiness.effect.meta
@@ -0,0 +1,11 @@
+{
+ "ver": "1.5.6",
+ "importer": "effect",
+ "imported": true,
+ "uuid": "f648964e-8d32-41fc-9ac9-7a1e714dd17b",
+ "files": [
+ ".json"
+ ],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/effects/editor/gizmo.effect.meta b/editor/assets/effects/editor/gizmo.effect.meta
index 720517c2cc..5905489260 100644
--- a/editor/assets/effects/editor/gizmo.effect.meta
+++ b/editor/assets/effects/editor/gizmo.effect.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.5.4",
+ "ver": "1.5.6",
"importer": "effect",
"imported": true,
"uuid": "9d6c6bde-2fe2-44ee-883b-909608948b04",
diff --git a/editor/assets/effects/editor/grid-2d.effect.meta b/editor/assets/effects/editor/grid-2d.effect.meta
index 0b61508b44..6f8ebab825 100644
--- a/editor/assets/effects/editor/grid-2d.effect.meta
+++ b/editor/assets/effects/editor/grid-2d.effect.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.5.4",
+ "ver": "1.5.6",
"importer": "effect",
"imported": true,
"uuid": "cb2c332a-fa5e-4235-a129-f011634bb7ad",
diff --git a/editor/assets/effects/editor/grid-stroke.effect.meta b/editor/assets/effects/editor/grid-stroke.effect.meta
index acc664be2f..7930eb612e 100644
--- a/editor/assets/effects/editor/grid-stroke.effect.meta
+++ b/editor/assets/effects/editor/grid-stroke.effect.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.5.4",
+ "ver": "1.5.6",
"importer": "effect",
"imported": true,
"uuid": "4736e978-c8fa-449f-9cf6-fe0158ded9d7",
diff --git a/editor/assets/effects/editor/grid.effect.meta b/editor/assets/effects/editor/grid.effect.meta
index 2b8f061431..c360c31ef2 100644
--- a/editor/assets/effects/editor/grid.effect.meta
+++ b/editor/assets/effects/editor/grid.effect.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.5.4",
+ "ver": "1.5.6",
"importer": "effect",
"imported": true,
"uuid": "ba35f02e-a81c-464c-bfc5-c788328da667",
diff --git a/editor/assets/effects/editor/light.effect.meta b/editor/assets/effects/editor/light.effect.meta
index 7ad4a5a359..6bfc0a1d63 100644
--- a/editor/assets/effects/editor/light.effect.meta
+++ b/editor/assets/effects/editor/light.effect.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.5.4",
+ "ver": "1.5.6",
"importer": "effect",
"imported": true,
"uuid": "e4e4cb19-8dd2-450d-ad20-1a818263b8d3",
diff --git a/editor/assets/effects/editor/terrain-circle-brush.effect.meta b/editor/assets/effects/editor/terrain-circle-brush.effect.meta
index 8c7c73f187..ae9df61cfb 100644
--- a/editor/assets/effects/editor/terrain-circle-brush.effect.meta
+++ b/editor/assets/effects/editor/terrain-circle-brush.effect.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.5.4",
+ "ver": "1.5.6",
"importer": "effect",
"imported": true,
"uuid": "a3e72674-c38f-4336-a285-1826b1799cd7",
diff --git a/editor/assets/effects/editor/terrain-image-brush.effect.meta b/editor/assets/effects/editor/terrain-image-brush.effect.meta
index 998366727f..3b63a9f667 100644
--- a/editor/assets/effects/editor/terrain-image-brush.effect.meta
+++ b/editor/assets/effects/editor/terrain-image-brush.effect.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.5.4",
+ "ver": "1.5.6",
"importer": "effect",
"imported": true,
"uuid": "7a115de7-2d94-4620-8b89-766d7f8cbff9",
diff --git a/editor/assets/effects/editor/terrain-select-brush.effect.meta b/editor/assets/effects/editor/terrain-select-brush.effect.meta
index 91341ddfc8..42cd7a1ad5 100644
--- a/editor/assets/effects/editor/terrain-select-brush.effect.meta
+++ b/editor/assets/effects/editor/terrain-select-brush.effect.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.5.4",
+ "ver": "1.5.6",
"importer": "effect",
"imported": true,
"uuid": "9b4d3fa5-89bf-4715-b69a-dbbd1efaf6a5",
diff --git a/editor/assets/effects/pipeline/bloom.effect.meta b/editor/assets/effects/pipeline/bloom.effect.meta
index ba8ce3c104..a990d89a9c 100644
--- a/editor/assets/effects/pipeline/bloom.effect.meta
+++ b/editor/assets/effects/pipeline/bloom.effect.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.5.4",
+ "ver": "1.5.6",
"importer": "effect",
"imported": true,
"uuid": "28d6d6b8-3f66-4a73-9795-17a0852ba2d4",
diff --git a/editor/assets/effects/pipeline/deferred-lighting.effect.meta b/editor/assets/effects/pipeline/deferred-lighting.effect.meta
index 9cbceb645b..5dc2360e80 100644
--- a/editor/assets/effects/pipeline/deferred-lighting.effect.meta
+++ b/editor/assets/effects/pipeline/deferred-lighting.effect.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.5.4",
+ "ver": "1.5.6",
"importer": "effect",
"imported": true,
"uuid": "5d45aa00-e064-4938-b314-4265f0c2258c",
diff --git a/editor/assets/effects/pipeline/planar-shadow.effect.meta b/editor/assets/effects/pipeline/planar-shadow.effect.meta
index e4abfa0bbe..d7f371cce6 100644
--- a/editor/assets/effects/pipeline/planar-shadow.effect.meta
+++ b/editor/assets/effects/pipeline/planar-shadow.effect.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.5.4",
+ "ver": "1.5.6",
"importer": "effect",
"imported": true,
"uuid": "9361fd90-ba52-4f84-aa93-6e878fd576ca",
diff --git a/editor/assets/effects/pipeline/post-process.effect.meta b/editor/assets/effects/pipeline/post-process.effect.meta
index 50809d9909..d378952062 100644
--- a/editor/assets/effects/pipeline/post-process.effect.meta
+++ b/editor/assets/effects/pipeline/post-process.effect.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.5.4",
+ "ver": "1.5.6",
"importer": "effect",
"imported": true,
"uuid": "ec8106fe-05bf-4e94-943c-e0d3b7bb5e45",
diff --git a/editor/assets/effects/pipeline/skybox.effect.meta b/editor/assets/effects/pipeline/skybox.effect.meta
index 2115dc760f..6e1d5345b2 100644
--- a/editor/assets/effects/pipeline/skybox.effect.meta
+++ b/editor/assets/effects/pipeline/skybox.effect.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.5.4",
+ "ver": "1.5.6",
"importer": "effect",
"imported": true,
"uuid": "511d2633-09a7-4bdd-ac42-f778032124b3",
diff --git a/editor/assets/effects/pipeline/smaa.effect.meta b/editor/assets/effects/pipeline/smaa.effect.meta
index bb1bc86069..8f2fcfff7b 100644
--- a/editor/assets/effects/pipeline/smaa.effect.meta
+++ b/editor/assets/effects/pipeline/smaa.effect.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.5.4",
+ "ver": "1.5.6",
"importer": "effect",
"imported": true,
"uuid": "6624c63c-0e3d-4d5f-bd15-a7805b71c521",
diff --git a/editor/assets/effects/pipeline/tonemap.effect.meta b/editor/assets/effects/pipeline/tonemap.effect.meta
index d4736287c9..41a82e631e 100644
--- a/editor/assets/effects/pipeline/tonemap.effect.meta
+++ b/editor/assets/effects/pipeline/tonemap.effect.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.5.4",
+ "ver": "1.5.6",
"importer": "effect",
"imported": true,
"uuid": "31b152ff-f689-4082-a292-3eb5a0b33014",
diff --git a/editor/assets/effects/surfaces.meta b/editor/assets/effects/surfaces.meta
new file mode 100644
index 0000000000..3c19b6aeec
--- /dev/null
+++ b/editor/assets/effects/surfaces.meta
@@ -0,0 +1,12 @@
+{
+ "ver": "1.1.0",
+ "importer": "directory",
+ "imported": true,
+ "uuid": "943258e0-bb7e-46a9-8995-31c983e3b692",
+ "files": [],
+ "subMetas": {},
+ "userData": {
+ "compressionType": {},
+ "isRemoteBundle": {}
+ }
+}
diff --git a/editor/assets/effects/surfaces/standard.effect b/editor/assets/effects/surfaces/standard.effect
new file mode 100644
index 0000000000..96ea17b9ff
--- /dev/null
+++ b/editor/assets/effects/surfaces/standard.effect
@@ -0,0 +1,335 @@
+// Copyright (c) 2017-2022 Xiamen Yaji Software Co., Ltd.
+
+CCEffect %{
+ techniques:
+ - name: opaque
+ passes:
+ - vert: standard-vs
+ frag: standard-fs
+ properties: &props
+ tilingOffset: { value: [1.0, 1.0, 0.0, 0.0] }
+ mainColor: { value: [1.0, 1.0, 1.0, 1.0], target: albedo, linear: true, editor: { displayName: Albedo, type: color } }
+ albedoScale: { value: [1.0, 1.0, 1.0], target: albedoScaleAndCutoff.xyz }
+ alphaThreshold: { value: 0.5, target: albedoScaleAndCutoff.w, editor: { parent: USE_ALPHA_TEST, slide: true, range: [0, 1.0], step: 0.001 } }
+ occlusion: { value: 1.0, target: pbrParams.x, editor: { slide: true, range: [0, 1.0], step: 0.001 } }
+ roughness: { value: 0.8, target: pbrParams.y, editor: { slide: true, range: [0, 1.0], step: 0.001 } }
+ metallic: { value: 0.6, target: pbrParams.z, editor: { slide: true, range: [0, 1.0], step: 0.001 } }
+ specularIntensity: { value: 0.5, target: pbrParams.w, editor: { slide: true, range: [0.0, 1.0], step: 0.001 } }
+ emissive: { value: [0.0, 0.0, 0.0, 1.0], linear: true, editor: { type: color } }
+ emissiveScale: { value: [1.0, 1.0, 1.0], target: emissiveScaleParam.xyz }
+ normalStrength: { value: 1.0, target: emissiveScaleParam.w, editor: { parent: USE_NORMAL_MAP, slide: true, range: [0, 5.0], step: 0.001 } }
+ anisotropyShape: { value: 1.0, target: anisotropyParam.x, editor: { parent: IS_ANISOTROPY, slide : true, range : [0.0, 1.0] , step : 0.0001 } }
+ anisotropyRotation: { value: 0.0, target: anisotropyParam.y, editor: { parent: IS_ANISOTROPY, slide : true, range : [0, 1.0] , step : 0.0001 } }
+ mainTexture: { value: grey, target: albedoMap, editor: { displayName: AlbedoMap } }
+ normalMap: { value: normal }
+ pbrMap: { value: grey }
+ metallicRoughnessMap: { value: grey }
+ occlusionMap: { value: white }
+ emissiveMap: { value: grey }
+ anisotropyRotationMap: { value: black, editor : { parent: IS_ANISOTROPY } }
+ - &forward-add
+ vert: standard-vs
+ frag: standard-fs
+ phase: forward-add
+ propertyIndex: 0
+ embeddedMacros: { CC_FORWARD_ADD: true }
+ depthStencilState:
+ depthFunc: equal
+ depthTest: true
+ depthWrite: false
+ blendState:
+ targets:
+ - blend: true
+ blendSrc: one
+ blendDst: one
+ blendSrcAlpha: zero
+ blendDstAlpha: one
+ - &shadow-caster
+ vert: shadow-caster-vs
+ frag: shadow-caster-fs
+ phase: shadow-caster
+ propertyIndex: 0
+ rasterizerState:
+ cullMode: front
+ properties:
+ tilingOffset: { value: [1.0, 1.0, 0.0, 0.0] }
+ mainColor: { value: [1.0, 1.0, 1.0, 1.0], target: albedo, editor: { displayName: Albedo, type: color } }
+ albedoScale: { value: [1.0, 1.0, 1.0], target: albedoScaleAndCutoff.xyz }
+ alphaThreshold: { value: 0.5, target: albedoScaleAndCutoff.w, editor: { parent: USE_ALPHA_TEST } }
+ mainTexture: { value: grey, target: albedoMap, editor: { displayName: AlbedoMap } }
+ - name: transparent
+ passes:
+ - vert: standard-vs
+ frag: standard-fs
+ embeddedMacros: { CC_FORCE_FORWARD_SHADING: true }
+ depthStencilState:
+ depthTest: true
+ depthWrite: false
+ blendState:
+ targets:
+ - blend: true
+ blendSrc: src_alpha
+ blendDst: one_minus_src_alpha
+ blendDstAlpha: one_minus_src_alpha
+ properties: *props
+ - *forward-add
+ - *shadow-caster
+}%
+
+CCProgram shared-ubos %{
+ uniform Constants {
+ vec4 tilingOffset;
+ vec4 albedo;
+ vec4 albedoScaleAndCutoff;
+ vec4 pbrParams;
+ vec4 emissive;
+ vec4 emissiveScaleParam;
+ vec2 anisotropyParam;
+ };
+}%
+
+CCProgram macro-remapping %{
+ // ui displayed macros not used in this effect file
+ #pragma define-meta HAS_SECOND_UV
+ #pragma define-meta USE_TWOSIDE
+ #pragma define-meta USE_REFLECTION_DENOISE
+ #pragma define-meta IS_ANISOTROPY
+
+ #define CC_SURFACES_USE_SECOND_UV HAS_SECOND_UV
+ #define CC_SURFACES_USE_TWO_SIDED USE_TWOSIDE
+ #define CC_SURFACES_USE_REFLECTION_DENOISE USE_REFLECTION_DENOISE
+ #define CC_SURFACES_LIGHTING_ANISOTROPIC IS_ANISOTROPY
+
+ // if disabled, simulate convoluted IBL without convolution
+ #pragma define-meta USE_COMPATIBLE_LIGHTING
+ #define CC_SURFACES_USE_LEGACY_COMPATIBLE_LIGHTING USE_COMPATIBLE_LIGHTING
+
+ // ui displayed macros used in this effect file
+ #define CC_SURFACES_USE_VERTEX_COLOR USE_VERTEX_COLOR
+#if IS_ANISOTROPY || USE_NORMAL_MAP
+ #define CC_SURFACES_USE_TANGENT_SPACE 1
+#endif
+
+ // functionality for each effect
+ #define CC_SURFACES_LIGHTING_ANISOTROPIC_ENVCONVOLUTION_COUNT 31
+}%
+
+CCProgram surface-vertex %{
+ /*#define CC_SURFACES_VERTEX_MODIFY_WORLD_POS
+ vec3 SurfacesVertexModifyWorldPos(in SurfacesStandardVertexIntermediate In)
+ {
+ vec3 worldPos = In.worldPos;
+ worldPos.x += sin(cc_time.x * worldPos.z);
+ worldPos.y += cos(cc_time.x * worldPos.z);
+ return worldPos;
+ }
+
+ #define CC_SURFACES_VERTEX_MODIFY_WORLD_NORMAL
+ vec3 SurfacesVertexModifyWorldNormal(in SurfacesStandardVertexIntermediate In)
+ {
+ vec3 worldNormal = In.worldNormal.xyz;
+ worldNormal.x += sin(cc_time.x * 3.0);
+ worldNormal.y += cos(cc_time.x * 3.0);
+ return normalize(worldNormal);
+ }*/
+
+ #define CC_SURFACES_VERTEX_MODIFY_UV
+ void SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)
+ {
+ In.texCoord = In.texCoord * tilingOffset.xy + tilingOffset.zw;
+ #if CC_SURFACES_USE_SECOND_UV && !CC_SURFACES_USE_LIGHT_MAP
+ In.texCoord1 = In.texCoord1 * tilingOffset.xy + tilingOffset.zw;
+ #endif
+ }
+}%
+
+CCProgram surface-fragment %{
+ #if USE_ALBEDO_MAP
+ uniform sampler2D albedoMap;
+ #pragma define-meta ALBEDO_UV options([v_uv, v_uv1])
+ #endif
+ #if USE_NORMAL_MAP
+ uniform sampler2D normalMap;
+ #pragma define-meta NORMAL_UV options([v_uv, v_uv1])
+ #endif
+ #pragma define-meta DEFAULT_UV options([v_uv, v_uv1])
+ #if USE_PBR_MAP
+ uniform sampler2D pbrMap;
+ #endif
+ #if USE_METALLIC_ROUGHNESS_MAP
+ uniform sampler2D metallicRoughnessMap;
+ #endif
+ #if USE_OCCLUSION_MAP
+ uniform sampler2D occlusionMap;
+ #endif
+ #if USE_EMISSIVE_MAP
+ uniform sampler2D emissiveMap;
+ #pragma define-meta EMISSIVE_UV options([v_uv, v_uv1])
+ #endif
+ #if IS_ANISOTROPY && USE_ANISOTROPY_ROTATION_MAP
+ uniform sampler2D anisotropyRotationMap;
+ #endif
+
+ #pragma define OCCLUSION_CHANNEL r
+ #pragma define ROUGHNESS_CHANNEL g
+ #pragma define METALLIC_CHANNEL b
+ #pragma define SPECULAR_INTENSITY_CHANNEL a
+
+ #if USE_ALPHA_TEST
+ #pragma define-meta ALPHA_TEST_CHANNEL options([a, r])
+ #endif
+
+
+ #define CC_SURFACES_FRAGMENT_MODIFY_BASECOLOR_AND_TRANSPARENCY
+ vec4 SurfacesFragmentModifyBaseColorAndTransparency()
+ {
+ vec4 baseColor = albedo;
+
+ #if USE_VERTEX_COLOR
+ baseColor.rgb *= SRGBToLinear(FSInput_vertexColor.rgb); // use linear
+ baseColor.a *= FSInput_vertexColor.a;
+ #endif
+
+ #if USE_ALBEDO_MAP
+ vec4 texColor = texture(albedoMap, ALBEDO_UV);
+ texColor.rgb = SRGBToLinear(texColor.rgb);
+ baseColor *= texColor;
+ #endif
+
+ #if USE_ALPHA_TEST
+ if (baseColor.ALPHA_TEST_CHANNEL < albedoScaleAndCutoff.w) discard;
+ #endif
+
+ baseColor.rgb *= albedoScaleAndCutoff.xyz;
+ return baseColor;
+ }
+
+
+ #define CC_SURFACES_FRAGMENT_MODIFY_WORLD_NORMAL
+ vec3 SurfacesFragmentModifyWorldNormal()
+ {
+ vec3 normal = FSInput_worldNormal;
+ #if USE_NORMAL_MAP
+ vec3 nmmp = texture(normalMap, NORMAL_UV).xyz - vec3(0.5);
+ normal = CalculateNormalFromTangentSpace(nmmp, emissiveScaleParam.w, normal.xyz, FSInput_worldTangent, FSInput_mirrorNormal);
+ #endif
+
+ return normalize(normal);
+ }
+
+ #define CC_SURFACES_FRAGMENT_MODIFY_ANISOTROPY_PARAMS
+ vec4 SurfacesFragmentModifyAnisotropyParams()
+ {
+ float anisotropyRotation = anisotropyParam.y;
+ float anisotropyShape = anisotropyParam.x;
+#if IS_ANISOTROPY && USE_ANISOTROPY_ROTATION_MAP
+ anisotropyRotation = fract(anisotropyRotation + texture(anisotropyRotationMap, DEFAULT_UV).x);
+#endif
+ return vec4(anisotropyRotation, anisotropyShape, 0.0, 0.0);
+ }
+
+ #define CC_SURFACES_FRAGMENT_MODIFY_EMISSIVE
+ vec3 SurfacesFragmentModifyEmissive()
+ {
+ vec3 emissive = emissive.rgb * emissiveScaleParam.xyz;
+ #if USE_EMISSIVE_MAP
+ emissive *= SRGBToLinear(texture(emissiveMap, EMISSIVE_UV).rgb);
+ #endif
+ return emissive;
+ }
+
+ #define CC_SURFACES_FRAGMENT_MODIFY_PBRPARAMS
+ vec4 SurfacesFragmentModifyPBRParams()
+ {
+ vec4 pbr = pbrParams;
+ #if USE_PBR_MAP
+ vec4 res = texture(pbrMap, DEFAULT_UV);
+ pbr.x *= res.OCCLUSION_CHANNEL;
+ pbr.y *= res.ROUGHNESS_CHANNEL;
+ pbr.z *= res.METALLIC_CHANNEL;
+ pbr.w *= res.SPECULAR_INTENSITY_CHANNEL;
+ #endif
+ #if USE_METALLIC_ROUGHNESS_MAP
+ vec4 metallicRoughness = texture(metallicRoughnessMap, DEFAULT_UV);
+ pbr.z *= metallicRoughness.METALLIC_CHANNEL;
+ pbr.y *= metallicRoughness.ROUGHNESS_CHANNEL;
+ #endif
+ #if USE_OCCLUSION_MAP
+ pbr.x *= texture(occlusionMap, DEFAULT_UV).OCCLUSION_CHANNEL;
+ #endif
+
+ return pbr;
+ }
+}%
+
+CCProgram standard-vs %{
+ precision highp float;
+
+ // 1. surface internal macros, for technique usage or remapping some user (material) macros to surface internal macros
+ #include
+ #include
+
+ // 2. common include with corresponding shader stage
+ #include
+
+ // 3. user surface functions that can use user (effect) parameters (ubo Constants)
+ // see surfaces/default-functions/xxx.chunk
+ #include
+ #include
+
+ // 4. surface include with corresponding shader stage and shading-model (optional)
+ #include
+
+ // 5. shader entry with corresponding shader stage and technique usage/type
+ #include
+}%
+
+
+CCProgram shadow-caster-vs %{
+ precision highp float;
+ #include
+ #include
+ #include
+ #include
+ #include
+}%
+
+
+
+CCProgram standard-fs %{
+ // shading-model : standard
+ // lighting-model : standard (isotropy / anisotropy pbr)
+ // shader stage : fs
+ // technique usage/type : render-to-scene
+
+ precision highp float;
+ // 1. surface internal macros, for technique usage or remapping some user (material) macros to surface internal macros
+ #include
+ #include
+
+ // 2. common include with corresponding shader stage
+ #include
+
+ // 3. user surface functions that can use user (effect) parameters (ubo Constants)
+ // see surfaces/default-functions/xxx.chunk
+ #include
+ #include
+
+ // 4. lighting-model (optional)
+ #include
+
+ // 5. surface include with corresponding shader stage and shading-model (optional)
+ #include
+
+ // 6. shader entry with corresponding shader stage and technique usage/type
+ #include
+}%
+
+CCProgram shadow-caster-fs %{
+ precision highp float;
+ #include
+ #include
+ #include
+ #include
+ #include
+}%
diff --git a/editor/assets/effects/surfaces/standard.effect.meta b/editor/assets/effects/surfaces/standard.effect.meta
new file mode 100644
index 0000000000..5657c8423c
--- /dev/null
+++ b/editor/assets/effects/surfaces/standard.effect.meta
@@ -0,0 +1,16 @@
+{
+ "ver": "1.5.6",
+ "importer": "effect",
+ "imported": true,
+ "uuid": "c8f66d17-351a-48da-a12c-0212d28575c4",
+ "files": [
+ ".json"
+ ],
+ "subMetas": {},
+ "userData": {
+ "combinations": [
+ {},
+ {}
+ ]
+ }
+}
diff --git a/editor/assets/effects/surfaces/toon.effect b/editor/assets/effects/surfaces/toon.effect
new file mode 100644
index 0000000000..7f067f46f5
--- /dev/null
+++ b/editor/assets/effects/surfaces/toon.effect
@@ -0,0 +1,391 @@
+// Copyright (c) 2017-2022 Xiamen Yaji Software Co., Ltd.
+
+CCEffect %{
+ techniques:
+ - passes:
+ - switch: USE_OUTLINE_PASS
+ vert: silhouette-edge-vs
+ frag: silhouette-edge-fs
+ rasterizerState:
+ cullMode: front
+ depthStencilState:
+ depthFunc: less_equal
+ depthTest: true
+ depthWrite: true
+ properties:
+ lineWidth: { value: 10, target: outlineParams.x }
+ depthBias: { value: 0, target: outlineParams.y }
+ baseColor: { editor: { type: color } }
+ baseColorMap: { value: grey }
+ - vert: toon-vs
+ frag: toon-fs
+ properties: &props
+ tilingOffset: { value: [1.0, 1.0, 0.0, 0.0] }
+ mainColor: { value: [0.6, 0.6, 0.6, 1.0], target: baseColor, linear: true, editor: { displayName: BaseColor, type: color } }
+ colorScale: { value: [1.0, 1.0, 1.0], target: colorScaleAndCutoff.xyz }
+ alphaThreshold: { value: 0.5, target: colorScaleAndCutoff.w, editor: { parent: USE_ALPHA_TEST } }
+ shadeColor1: { value: [0.4, 0.4, 0.4, 1.0], linear: true, editor: { type: color } }
+ shadeColor2: { value: [0.2, 0.2, 0.2, 1.0], linear: true, editor: { type: color } }
+ specular: { value: [1.0, 1.0, 1.0, 0.3], linear: true, editor: { type: color } }
+ baseStep: { value: 0.8, target: shadeParams.x }
+ baseFeather: { value: 0.001, target: shadeParams.y }
+ shadeStep: { value: 0.5, target: shadeParams.z }
+ shadeFeather: { value: 0.001, target: shadeParams.w }
+ shadowCover: { value: 0.5, target: miscParams.x, editor: { slide: true, range: [0, 1.0], step: 0.001 } }
+ emissive: { value: [0.0, 0.0, 0.0, 1.0], linear: true, editor: { type: color } }
+ emissiveScale: { value: [1.0, 1.0, 1.0], target: emissiveScaleAndStrenth.xyz }
+ normalStrength: { value: 1.0, target: emissiveScaleAndStrenth.w, editor: { parent: USE_NORMAL_MAP }, slide: true, range: [0, 5.0], step: 0.001 }
+ normalMap: { value: normal }
+ mainTexture: { value: white, target: baseColorMap, editor: { displayName: BaseColorMap } }
+ shadeMap1: { value: white }
+ shadeMap2: { value: white }
+ specularMap: { value: white }
+ emissiveMap: { value: grey }
+ - vert: toon-vs
+ frag: toon-fs
+ phase: forward-add
+ propertyIndex: 1
+ embeddedMacros: { CC_FORWARD_ADD: true }
+ depthStencilState:
+ depthFunc: equal
+ depthTest: true
+ depthWrite: false
+ blendState:
+ targets:
+ - blend: true
+ blendSrc: one
+ blendDst: one
+ blendSrcAlpha: zero
+ blendDstAlpha: one
+ properties: *props
+ - vert: shadow-caster-vs
+ frag: shadow-caster-fs
+ phase: shadow-caster
+ propertyIndex: 1
+ rasterizerState:
+ cullMode: front
+ properties:
+ tilingOffset: { value: [1.0, 1.0, 0.0, 0.0] }
+ mainColor: { value: [0.6, 0.6, 0.6, 1.0], target: baseColor, editor: { displayName: BaseColor, type: color } }
+ colorScale: { value: [1.0, 1.0, 1.0], target: colorScaleAndCutoff.xyz }
+ alphaThreshold: { value: 0.5, target: colorScaleAndCutoff.w, editor: { parent: USE_ALPHA_TEST } }
+ shadeColor1: { value: [0.4, 0.4, 0.4, 1.0], editor: { type: color } }
+ shadeColor2: { value: [0.2, 0.2, 0.2, 1.0], editor: { type: color } }
+ specular: { value: [1.0, 1.0, 1.0, 0.3], editor: { type: color } }
+ baseStep: { value: 0.8, target: shadeParams.x }
+ baseFeather: { value: 0.001, target: shadeParams.y }
+ shadeStep: { value: 0.5, target: shadeParams.z }
+ shadeFeather: { value: 0.001, target: shadeParams.w }
+ emissive: { value: [0.0, 0.0, 0.0, 1.0], editor: { type: color } }
+ emissiveScale: { value: [1.0, 1.0, 1.0], target: emissiveScaleAndStrenth.xyz }
+ normalStrenth: { value: 1.0, target: emissiveScaleAndStrenth.w, editor: { parent: USE_NORMAL_MAP } }
+ mainTexture: { value: white, target: baseColorMap, editor: { displayName: BaseColorMap } }
+}%
+
+CCProgram shared-ubos %{
+ uniform Constants {
+ vec4 tilingOffset;
+ vec4 baseColor;
+ vec4 colorScaleAndCutoff;
+ vec4 shadeColor1;
+ vec4 shadeColor2;
+ vec4 specular; // xyz: specular color, w: power
+ vec4 shadeParams;
+ vec4 miscParams;
+ vec4 emissive;
+ vec4 emissiveScaleAndStrenth;
+ };}%
+
+CCProgram macro-remapping %{
+ #define CC_SURFACES_USE_TANGENT_SPACE USE_NORMAL_MAP
+}%
+
+CCProgram surface-vertex %{
+ #define CC_SURFACES_VERTEX_MODIFY_UV
+ void SurfacesVertexModifyUV(inout SurfacesStandardVertexIntermediate In)
+ {
+ In.texCoord = In.texCoord * tilingOffset.xy + tilingOffset.zw;
+ #if CC_SURFACES_USE_SECOND_UV && !CC_SURFACES_USE_LIGHT_MAP
+ In.texCoord1 = In.texCoord1 * tilingOffset.xy + tilingOffset.zw;
+ #endif
+ }
+}%
+
+CCProgram surface-fragment %{
+ #if USE_BASE_COLOR_MAP
+ uniform sampler2D baseColorMap;
+ #endif
+
+ #if USE_NORMAL_MAP
+ uniform sampler2D normalMap;
+ #endif
+
+ #if USE_1ST_SHADE_MAP
+ uniform sampler2D shadeMap1;
+ #endif
+ #if USE_2ND_SHADE_MAP
+ uniform sampler2D shadeMap2;
+ #endif
+ #if USE_SPECULAR_MAP
+ uniform sampler2D specularMap;
+ #endif
+ #if USE_EMISSIVE_MAP
+ uniform sampler2D emissiveMap;
+ #endif
+
+ #if USE_ALPHA_TEST
+ #pragma define-meta ALPHA_TEST_CHANNEL options([a, r, g, b])
+ #endif
+
+
+ #define CC_SURFACES_FRAGMENT_MODIFY_BASECOLOR_AND_TOONSHADE
+ void SurfacesFragmentModifyBaseColorAndToonShade(out vec4 baseColorAndTransparency, out vec3 shade1, out vec3 shade2)
+ {
+ shade2 = shadeColor2.rgb * colorScaleAndCutoff.rgb;
+ #if USE_2ND_SHADE_MAP
+ shade2 *= SRGBToLinear(texture(shadeMap2, FSInput_texcoord).rgb);
+ #endif
+ shade1 = shadeColor1.rgb * colorScaleAndCutoff.rgb;
+ #if USE_1ST_SHADE_MAP
+ shade1 *= SRGBToLinear(texture(shadeMap1, FSInput_texcoord).rgb);
+ #if SHADE_MAP_1_AS_SHADE_MAP_2
+ shade2 *= shade1.rgb;
+ #endif
+ #endif
+
+ vec4 color = baseColor;
+ #if USE_BASE_COLOR_MAP
+ vec4 texColor = texture(baseColorMap, FSInput_texcoord);
+ texColor.rgb = SRGBToLinear(texColor.rgb);
+ color *= texColor;
+ #if BASE_COLOR_MAP_AS_SHADE_MAP_1
+ shade1 *= texColor.rgb;
+ #endif
+ #if BASE_COLOR_MAP_AS_SHADE_MAP_2
+ shade2 *= texColor.rgb;
+ #endif
+ #endif
+ baseColorAndTransparency = color;
+ baseColorAndTransparency.rgb *= colorScaleAndCutoff.xyz;
+
+ #if USE_ALPHA_TEST
+ if (baseColorAndTransparency.ALPHA_TEST_CHANNEL < colorScaleAndCutoff.w) discard;
+ #endif
+ }
+
+ // only for render-to-shadow-map or misc usage
+ #define CC_SURFACES_FRAGMENT_MODIFY_BASECOLOR_AND_TRANSPARENCY
+ vec4 SurfacesFragmentModifyBaseColorAndTransparency()
+ {
+ vec4 color = baseColor;
+ #if USE_BASE_COLOR_MAP
+ vec4 texColor = texture(baseColorMap, FSInput_texcoord);
+ texColor.rgb = SRGBToLinear(texColor.rgb);
+ color *= texColor;
+ #endif
+
+ #if USE_ALPHA_TEST
+ if (color.ALPHA_TEST_CHANNEL < colorScaleAndCutoff.w) discard;
+ #endif
+
+ return color;
+ }
+
+ #define CC_SURFACES_FRAGMENT_MODIFY_WORLD_NORMAL
+ vec3 SurfacesFragmentModifyWorldNormal()
+ {
+ vec3 normal = FSInput_worldNormal;
+ #if USE_NORMAL_MAP
+ vec3 nmmp = texture(normalMap, FSInput_texcoord).xyz - vec3(0.5);
+ normal = CalculateNormalFromTangentSpace(nmmp, emissiveScaleAndStrenth.w, normal.xyz, FSInput_worldTangent, FSInput_mirrorNormal);
+ #endif
+
+ return normalize(normal);
+ }
+
+ #define CC_SURFACES_FRAGMENT_MODIFY_EMISSIVE
+ vec3 SurfacesFragmentModifyEmissive()
+ {
+ vec3 emissive = emissive.rgb * emissiveScaleAndStrenth.xyz;
+ #if USE_EMISSIVE_MAP
+ emissive *= SRGBToLinear(texture(emissiveMap, FSInput_texcoord).rgb);
+ #endif
+ return emissive;
+ }
+
+ #define CC_SURFACES_FRAGMENT_MODIFY_TOON_STEP_AND_FEATHER
+ vec4 SurfacesFragmentModifyToonStepAndFeather()
+ {
+ return shadeParams;
+ }
+
+ #define CC_SURFACES_FRAGMENT_MODIFY_TOON_SHADOW_COVER
+ float SurfacesFragmentModifyToonShadowCover()
+ {
+ return miscParams.x;
+ }
+
+ #define CC_SURFACES_FRAGMENT_MODIFY_TOON_SPECULAR
+ vec4 SurfacesFragmentModifyToonSpecular()
+ {
+ return vec4(1.0, 1.0, 1.0, 0.3);
+ }
+}%
+
+CCProgram toon-vs %{
+ precision highp float;
+
+ // 1. surface internal macros, for technique usage or remapping some user (material) macros to surface internal macros
+ #include
+ #include
+
+ // 2. common include with corresponding shader stage
+ #include
+
+ // 3. user surface functions that can use user (effect) parameters (ubo Constants)
+ // see surfaces/default-functions/xxx.chunk
+ #include
+ #include
+
+ // 4. surface include with corresponding shader stage and shading-model (optional)
+ #include
+
+ // 5. shader entry with corresponding shader stage and technique usage/type
+ #include
+}%
+
+
+CCProgram shadow-caster-vs %{
+ precision highp float;
+ #include
+ #include
+ #include
+ #include
+ #include
+}%
+
+CCProgram toon-fs %{
+ // shading-model : toon
+ // lighting-model : toon
+ // shader stage : fs
+ // technique usage/type : render-to-scene
+
+ precision highp float;
+ // 1. surface internal macros, for technique usage or remapping some user (material) macros to surface internal macros
+ #include
+ #include
+
+ // 2. common include with corresponding shader stage
+ #include
+
+ // 3. user surface functions that can use user (effect) parameters (ubo Constants)
+ // see surfaces/default-functions/xxx.chunk
+ #include
+ #include
+
+ // 4. lighting-model (optional)
+ #include
+
+ // 5. surface include with corresponding shader stage and shading-model (optional)
+ #include
+
+ // 6. shader entry with corresponding shader stage and technique usage/type
+ #include
+}%
+
+CCProgram shadow-caster-fs %{
+ precision highp float;
+ #include
+ #include
+ #include
+ #include
+ #include
+}%
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+////////////////////////////////////////////////silhouette-edge sample
+// how to write a simple surface material
+// change technique outline-vs/fs:vert/frag to silhouette-edge-vs/fs
+CCProgram surface-vertex-silhouette-edge %{
+ uniform OutlineVert {
+ vec4 outlineParams; // x: line width, y: depth hack
+};
+
+ #define CC_SURFACES_VERTEX_MODIFY_LOCAL_POS
+ vec3 SurfacesVertexModifyLocalPos(in SurfacesStandardVertexIntermediate In)
+ {
+ float width = outlineParams.x * 0.001;
+ vec3 localPos = In.position.xyz;
+
+ #if USE_POSITION_SCALING
+ vec3 dir = normalize(localPos);
+ float flip = dot(dir, normalize(In.normal)) < 0.0 ? -1.0 : 1.0;
+ localPos += flip * dir * width * 2.0;
+ #else
+ localPos += normalize(In.normal) * width;
+ #endif
+ return localPos;
+ }
+
+ #define CC_SURFACES_VERTEX_MODIFY_CLIP_POS
+ vec4 SurfacesVertexModifyClipPos(in SurfacesStandardVertexIntermediate In)
+ {
+ vec4 clipPos = In.clipPos;
+ clipPos.z -= outlineParams.y * 0.002;
+ return clipPos;
+ }
+}%
+
+CCProgram surface-fragment-silhouette-edge %{
+ uniform OutlineFrag {
+ vec4 baseColor;
+ };
+ #if USE_BASE_COLOR_MAP
+ uniform sampler2D baseColorMap;
+ #endif
+
+ // only for render-to-shadow-map or misc usage
+ #define CC_SURFACES_FRAGMENT_MODIFY_BASECOLOR_AND_TRANSPARENCY
+ vec4 SurfacesFragmentModifyBaseColorAndTransparency()
+ {
+ vec4 color = vec4(cc_mainLitColor.rgb, 1.0);
+ color.rgb = SRGBToLinear(baseColor.rgb);
+ #if USE_BASE_COLOR_MAP
+ vec4 texColor = texture(baseColorMap, FSInput_texcoord);
+ texColor.rgb = SRGBToLinear(texColor.rgb);
+ color *= texColor;
+ #endif
+
+ return color;
+ }
+}%
+
+CCProgram silhouette-edge-vs %{
+ precision highp float;
+ #include
+ #include
+ #include
+ #include
+ #include
+}%
+
+CCProgram silhouette-edge-fs %{
+ precision highp float;
+ #include
+ #include
+ #include
+ #include
+}%
diff --git a/editor/assets/effects/surfaces/toon.effect.meta b/editor/assets/effects/surfaces/toon.effect.meta
new file mode 100644
index 0000000000..771b299d1c
--- /dev/null
+++ b/editor/assets/effects/surfaces/toon.effect.meta
@@ -0,0 +1,11 @@
+{
+ "ver": "1.5.6",
+ "importer": "effect",
+ "imported": true,
+ "uuid": "9b20a514-6cc3-49de-b216-b6b863046249",
+ "files": [
+ ".json"
+ ],
+ "subMetas": {},
+ "userData": {}
+}
diff --git a/editor/assets/effects/util/batched-unlit.effect.meta b/editor/assets/effects/util/batched-unlit.effect.meta
index 1f8e010dc0..3177456ad0 100644
--- a/editor/assets/effects/util/batched-unlit.effect.meta
+++ b/editor/assets/effects/util/batched-unlit.effect.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.5.4",
+ "ver": "1.5.6",
"importer": "effect",
"imported": true,
"uuid": "f1556893-88b6-4c65-8c16-a5256ef3ad25",
diff --git a/editor/assets/effects/util/profiler.effect.meta b/editor/assets/effects/util/profiler.effect.meta
index e91b38e1f7..03eb04da40 100644
--- a/editor/assets/effects/util/profiler.effect.meta
+++ b/editor/assets/effects/util/profiler.effect.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.5.4",
+ "ver": "1.5.6",
"importer": "effect",
"imported": true,
"uuid": "871c3b6c-7379-419d-bda3-794b239ab90d",
diff --git a/editor/assets/effects/util/sequence-anim.effect.meta b/editor/assets/effects/util/sequence-anim.effect.meta
index 6a32880b3b..fd2f187bd8 100644
--- a/editor/assets/effects/util/sequence-anim.effect.meta
+++ b/editor/assets/effects/util/sequence-anim.effect.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.5.4",
+ "ver": "1.5.6",
"importer": "effect",
"imported": true,
"uuid": "27cc5a0b-ec0b-4a67-98cf-b42d4fa971de",
diff --git a/editor/assets/effects/util/splash-screen.effect.meta b/editor/assets/effects/util/splash-screen.effect.meta
index e802147834..7035264a4b 100644
--- a/editor/assets/effects/util/splash-screen.effect.meta
+++ b/editor/assets/effects/util/splash-screen.effect.meta
@@ -1,5 +1,5 @@
{
- "ver": "1.5.4",
+ "ver": "1.5.6",
"importer": "effect",
"imported": true,
"uuid": "970b0598-bcb0-4714-91fb-2e81440dccd8",
diff --git a/editor/assets/primitives.fbx.meta b/editor/assets/primitives.fbx.meta
index 32cdace5e7..f979262dd8 100644
--- a/editor/assets/primitives.fbx.meta
+++ b/editor/assets/primitives.fbx.meta
@@ -1,5 +1,5 @@
{
- "ver": "2.1.14",
+ "ver": "2.2.0",
"importer": "fbx",
"imported": true,
"uuid": "1263d74c-8167-4928-91a6-4e2672411f47",
@@ -216,7 +216,8 @@
"imageMetas": [],
"legacyFbxImporter": false,
"fbx": {
- "preferLocalTimeSpan": false
+ "preferLocalTimeSpan": false,
+ "smartMaterialEnabled": false
}
}
}
diff --git a/editor/i18n/en/assets.js b/editor/i18n/en/assets.js
index 01795c8174..3a36c9fdc7 100644
--- a/editor/i18n/en/assets.js
+++ b/editor/i18n/en/assets.js
@@ -318,10 +318,15 @@ module.exports = {
preferLocalTimeSpan: {
name: 'Prefer Local Time Span',
title:
- 'When exporting FBX animations, whether prefer to use the time range recorded in FBX file. ' +
- 'If one is not preferred, or one is invalid for use, the time range is robustly calculated. ' +
+ 'When exporting FBX animations, whether prefer to use the time range recorded in FBX file.
' +
+ 'If one is not preferred, or one is invalid for use, the time range is robustly calculated.
' +
'Some FBX generators may not export this information.',
},
+ smartMaterialEnabled: {
+ name: 'Smart Material Conversion',
+ title: 'Convert DCC materials to engine builtin materials which match the internal lighting model.',
+ warn: 'The laboratory feature "Smart Material Conversion" in the preferences is turned off, please enable this feature to modify model level settings.',
+ },
},
textureCube: {
anisotropy: 'Anisotropy',
diff --git a/editor/i18n/en/localization.js b/editor/i18n/en/localization.js
index 18d408d2af..2987ce4db3 100755
--- a/editor/i18n/en/localization.js
+++ b/editor/i18n/en/localization.js
@@ -12,22 +12,22 @@ module.exports = {
MeshRenderer: `${url}/${version}/manual/en/engine/renderable/model-component.html`,
UITransform: `${url}/${version}/manual/en/ui-system/components/editor/ui-transform.html`,
Sprite: `${url}/${version}/manual/en/ui-system/components/editor/sprite.html`,
- SubContextView: `${url}/${version}/manual/zh/editor/publish/build-open-data-context.html`,
+ SubContextView: `${url}/${version}/manual/en/editor/publish/build-open-data-context.html`,
BlockInputEvents: `${url}/${version}/manual/en/ui-system/components/editor/block-input-events.html`,
Camera: `${url}/${version}/manual/en/editor/components/camera-component.html`,
Canvas: `${url}/${version}/manual/en/ui-system/components/editor/canvas.html`,
- SkinnedMeshRenderer: `${url}/${version}/manual/en/engine/animation/skeletal-animation.html`,
- SkinnedMeshBatchRenderer: `${url}/${version}/manual/en/engine/animation/skeletal-animation.html`,
- Ambient: `${url}/${version}/manual/zh/concepts/scene/light/lighttype/ambient.html`,
- Skybox: `${url}/${version}/manual/zh/concepts/scene/skybox.html`,
- Fog: `${url}/${version}/manual/zh/concepts/scene/fog.html`,
- Shadow: `${url}/${version}/manual/zh/concepts/scene/light/shadow.html`,
- DirectionalLight: `${url}/${version}/manual/en/concepts/scene/light/dir-light.html`,
- SphereLight: `${url}/${version}/manual/en/concepts/scene/light/sphere-light.html`,
- SpotLight: `${url}/${version}/manual/en/concepts/scene/light/spot-light.html`,
+ SkinnedMeshRenderer: `${url}/${version}/manual/en/animation/skeletal-animation.html`,
+ SkinnedMeshBatchRenderer: `${url}/${version}/manual/en/animation/skeletal-animation.html`,
+ Ambient: `${url}/${version}/manual/en/concepts/scene/light/lightType/ambient.html`,
+ Skybox: `${url}/${version}/manual/en/concepts/scene/skybox.html`,
+ Fog: `${url}/${version}/manual/en/concepts/scene/fog.html`,
+ Shadow: `${url}/${version}/manual/en/concepts/scene/light/shadow.html`,
+ DirectionalLight: `${url}/${version}/manual/en/concepts/scene/light/lightType/dir-light.html`,
+ SphereLight: `${url}/${version}/manual/en/concepts/scene/light/lightType/sphere-light.html`,
+ SpotLight: `${url}/${version}/manual/en/concepts/scene/light/lightType/spot-light.html`,
UICoordinateTracker: `${url}/${version}/manual/en/ui-system/components/editor/ui-coordinate-tracker.html`,
- Animation: `${url}/${version}/manual/en/engine/animation/animation-component.html`,
- SkeletalAnimation: `${url}/${version}/manual/en/engine/animation/skeletal-animation.html`,
+ Animation: `${url}/${version}/manual/en/animation/animation-component.html`,
+ SkeletalAnimation: `${url}/${version}/manual/en/animation/skeletal-animation.html`,
AudioSource: `${url}/${version}/manual/en/audio-system/overview.html`,
Billboard: `${url}/${version}/manual/en/particle-system/billboard-component.html`,
Line: `${url}/${version}/manual/en/particle-system/line-component.html`,
diff --git a/editor/i18n/zh/assets.js b/editor/i18n/zh/assets.js
index 128ab1d085..d5a5f704b2 100644
--- a/editor/i18n/zh/assets.js
+++ b/editor/i18n/zh/assets.js
@@ -312,7 +312,12 @@ module.exports = {
},
preferLocalTimeSpan: {
name: '优先使用文件时间范围',
- title: '在导出 FBX 动画时,是否优先使用 FBX 文件中记录的动画时间范围。若不使用该时间范围或此范围不可能用,则会粗略地计算动画时间范围。有些 FBX 生产工具中可能并未导出该信息。',
+ title: '在导出 FBX 动画时,是否优先使用 FBX 文件中记录的动画时间范围。
若不使用该时间范围或此范围不可能用,则会粗略地计算动画时间范围。有些 FBX 生产工具中可能并未导出该信息。',
+ },
+ smartMaterialEnabled: {
+ name: '材质智能转换',
+ title: '将 DCC 材质转化为引擎材质, 并匹对 DCC 材质的光照模型',
+ warn: '偏好设置里的实验室功能 "材质智能转换" 已关闭,请启用此项功能来修改模型级别设置。',
},
},
textureCube: {
diff --git a/editor/i18n/zh/localization.js b/editor/i18n/zh/localization.js
index b67fbfa9b6..b30961fbbd 100755
--- a/editor/i18n/zh/localization.js
+++ b/editor/i18n/zh/localization.js
@@ -16,18 +16,18 @@ module.exports = {
BlockInputEvents: `${url}/${version}/manual/zh/ui-system/components/editor/block-input-events.html`,
Camera: `${url}/${version}/manual/zh/editor/components/camera-component.html`,
Canvas: `${url}/${version}/manual/zh/ui-system/components/editor/canvas.html`,
- SkinnedMeshRenderer: `${url}/${version}/manual/zh/engine/animation/skeletal-animation.html`,
- SkinnedMeshBatchRenderer: `${url}/${version}/manual/zh/engine/animation/skeletal-animation.html`,
- Ambient: `${url}/${version}/manual/zh/concepts/scene/light/lighttype/ambient.html`,
+ SkinnedMeshRenderer: `${url}/${version}/manual/zh/animation/skeletal-animation.html`,
+ SkinnedMeshBatchRenderer: `${url}/${version}/manual/zh/animation/skeletal-animation.html`,
+ Ambient: `${url}/${version}/manual/zh/concepts/scene/light/lightType/ambient.html`,
Skybox: `${url}/${version}/manual/zh/concepts/scene/skybox.html`,
Fog: `${url}/${version}/manual/zh/concepts/scene/fog.html`,
Shadow: `${url}/${version}/manual/zh/concepts/scene/light/shadow.html`,
- DirectionalLight: `${url}/${version}/manual/zh/concepts/scene/light/dir-light.html`,
- SphereLight: `${url}/${version}/manual/zh/concepts/scene/light/sphere-light.html`,
- SpotLight: `${url}/${version}/manual/zh/concepts/scene/light/spot-light.html`,
+ DirectionalLight: `${url}/${version}/manual/zh/concepts/scene/light/lightType/dir-light.html`,
+ SphereLight: `${url}/${version}/manual/zh/concepts/scene/light/lightType/sphere-light.html`,
+ SpotLight: `${url}/${version}/manual/zh/concepts/scene/light/lightType/spot-light.html`,
UICoordinateTracker: `${url}/${version}/manual/zh/ui-system/components/editor/ui-coordinate-tracker.html`,
- Animation: `${url}/${version}/manual/zh/engine/animation/animation-component.html`,
- SkeletalAnimation: `${url}/${version}/manual/zh/engine/animation/skeletal-animation.html`,
+ Animation: `${url}/${version}/manual/zh/animation/animation-component.html`,
+ SkeletalAnimation: `${url}/${version}/manual/zh/animation/skeletal-animation.html`,
AudioSource: `${url}/${version}/manual/zh/audio-system/overview.html`,
Billboard: `${url}/${version}/manual/zh/particle-system/billboard-component.html`,
Line: `${url}/${version}/manual/zh/particle-system/line-component.html`,
@@ -154,7 +154,7 @@ module.exports = {
use_color_temperature: '是否启用光源色温',
color_temperature: '光源色温',
illuminance: '光源强度',
- luminous_power: '光通量',
+ luminous_flux: '光通量',
luminance: '光亮度',
term: '当前使用的光度学计量单位',
size: '光源大小',
diff --git a/editor/inspector/assets/animation-mask.js b/editor/inspector/assets/animation-mask.js
index 674d387ccc..319e0b542e 100644
--- a/editor/inspector/assets/animation-mask.js
+++ b/editor/inspector/assets/animation-mask.js
@@ -160,7 +160,7 @@ exports.methods = {
},
updateTree() {
- const convertData = this.convertData(this.queryData._jointMasks.value);
+ const convertData = this.convertData(this.queryData.joints.value);
this.flatData = convertData.flatData;
this.$.tree.tree = convertData.treeData;
},
@@ -215,7 +215,7 @@ exports.ready = function() {
timestamp: rawTimestamp,
type: 'asset',
assetFilter: {
- importer: 'fbx',
+ importer: ['fbx', 'gltf'],
},
events: {
async confirm(uuid) {
diff --git a/editor/inspector/assets/audio-clip.js b/editor/inspector/assets/audio-clip.js
index ee69af99c1..beca784a2f 100644
--- a/editor/inspector/assets/audio-clip.js
+++ b/editor/inspector/assets/audio-clip.js
@@ -27,7 +27,7 @@ exports.update = function(assetList, metaList) {
html += `${asset.name}
`;
}
- html += ``;
+ html += ``;
});
this.$.constainer.innerHTML = html;
diff --git a/editor/inspector/assets/fbx/fbx.js b/editor/inspector/assets/fbx/fbx.js
index aa1a89c014..ed3601c644 100644
--- a/editor/inspector/assets/fbx/fbx.js
+++ b/editor/inspector/assets/fbx/fbx.js
@@ -20,6 +20,13 @@ exports.template = `
+
+
+
+
+
+
+
@@ -47,6 +54,19 @@ ui-section {
display: none;
margin-top: 10px;
}
+.smart-material-prop .warn-words {
+ display: none;
+}
+
+.smart-material-prop[readonly] .warn-words {
+ display: block;
+ margin-top: 5px;
+ line-height: 20px;
+}
+.smart-material-prop[readonly] .smartMaterialEnabled-checkbox {
+ pointer-events: none;
+ opacity: 0.3;
+}
`;
exports.$ = {
@@ -57,6 +77,8 @@ exports.$ = {
animationBakeRateSelect: '.animationBakeRate-select',
promoteSingleRootNodeCheckbox: '.promoteSingleRootNode-checkbox',
preferLocalTimeSpanCheckbox: '.preferLocalTimeSpan-checkbox',
+ smartMaterialEnabledCheckbox: '.smartMaterialEnabled-checkbox',
+ smartMaterialEnabledProp: '.smart-material-prop',
};
/**
@@ -154,9 +176,36 @@ const Elements = {
panel.updateReadonly(panel.$.preferLocalTimeSpanCheckbox);
},
},
+ smartMaterialEnabled: {
+ ready() {
+ const panel = this;
+
+ panel.$.smartMaterialEnabledCheckbox.addEventListener('change', panel.setProp.bind(panel, 'fbx.smartMaterialEnabled', 'boolean'));
+ },
+ async update() {
+ const panel = this;
+
+ const laboratoryExpectedValue = await Editor.Profile.getConfig('engine', 'asset.fbx.material.smart');
+ if (!laboratoryExpectedValue) {
+ panel.$.smartMaterialEnabledProp.setAttribute('readonly', '');
+ } else {
+ panel.$.smartMaterialEnabledProp.removeAttribute('readonly');
+ }
+
+ let defaultValue = false;
+ if (panel.meta.userData.fbx) {
+ defaultValue = panel.getDefault(panel.meta.userData.fbx.smartMaterialEnabled, defaultValue);
+ }
+
+ panel.$.smartMaterialEnabledCheckbox.value = defaultValue;
+
+ panel.updateInvalid(panel.$.smartMaterialEnabledCheckbox, 'fbx.smartMaterialEnabled');
+ panel.updateReadonly(panel.$.smartMaterialEnabledCheckbox);
+ },
+ },
};
-exports.update = function(assetList, metaList) {
+exports.update = async function(assetList, metaList) {
this.assetList = assetList;
this.metaList = metaList;
this.asset = assetList[0];
@@ -165,7 +214,7 @@ exports.update = function(assetList, metaList) {
for (const prop in Elements) {
const element = Elements[prop];
if (element.update) {
- element.update.call(this);
+ await element.update.call(this);
}
}
};
diff --git a/editor/inspector/assets/material.js b/editor/inspector/assets/material.js
index 51a5bc813b..3f2d06dd36 100644
--- a/editor/inspector/assets/material.js
+++ b/editor/inspector/assets/material.js
@@ -192,7 +192,11 @@ exports.methods = {
return;
}
- this.useCache();
+ if (this.requestInitCache) {
+ this.initCache();
+ } else {
+ this.useCache();
+ }
if (technique.passes) {
// The interface is not a regular data loop, which needs to be completely cleared and placed, but the UI-prop element is still reusable
@@ -349,6 +353,57 @@ exports.methods = {
Editor.Message.broadcast('material-inspector:change-dump');
},
+ initCache() {
+ const excludeNames = [
+ 'children',
+ 'defines',
+ 'extends',
+ 'pipelineStates',
+ ];
+
+ const cacheData = this.cacheData;
+ this.technique.passes.forEach((pass, i) => {
+ if (pass.propertyIndex !== undefined && pass.propertyIndex.value !== i) {
+ return;
+ }
+
+ cacheProperty(pass.value);
+ });
+
+ function cacheProperty(prop) {
+ for (const name in prop) {
+ // 这些字段是基础类型或配置性的数据,不需要变动
+ if (excludeNames.includes(name)) {
+ continue;
+ }
+
+ if (prop[name] && typeof prop[name] === 'object') {
+ if (!(name in cacheData)) {
+ const { type, value } = prop[name];
+ if (type) {
+ if (value !== undefined) {
+ cacheData[name] = { type };
+ if (value && typeof value === 'object') {
+ cacheData[name].value = JSON.parse(JSON.stringify(value));
+ } else {
+ cacheData[name].value = value;
+ }
+ }
+ }
+ }
+
+ if (prop[name].childMap && typeof prop[name].childMap === 'object') {
+ cacheProperty(prop[name].childMap);
+ }
+ }
+ }
+ }
+
+ this.requestInitCache = false;
+ this.updateInstancing();
+ this.updatePreview();
+ },
+
storeCache(dump) {
const { name, type, value, default: defaultValue } = dump;
@@ -418,6 +473,7 @@ exports.update = async function(assetList, metaList) {
this.dirtyData.uuid = this.asset.uuid;
this.dirtyData.origin = '';
this.cacheData = {};
+ this.requestInitCache = true;
}
// set this.material.technique
this.material = await Editor.Message.request('scene', 'query-material', this.asset.uuid);
diff --git a/editor/inspector/assets/video-clip.js b/editor/inspector/assets/video-clip.js
index 075faae8c5..e4f4f5654e 100644
--- a/editor/inspector/assets/video-clip.js
+++ b/editor/inspector/assets/video-clip.js
@@ -30,7 +30,7 @@ exports.update = function(assetList, metaList) {
html += `
${asset.name}
`;
}
- html += `
`;
+ html += `
`;
});
this.$.constainer.innerHTML = html;
diff --git a/editor/inspector/components/class.js b/editor/inspector/components/class.js
index 66273ef1ff..129dc31ba2 100644
--- a/editor/inspector/components/class.js
+++ b/editor/inspector/components/class.js
@@ -68,12 +68,7 @@ exports.methods = {
},
appendChildByDisplayOrder(parent, newChild, displayOrder = 0) {
const children = Array.from(parent.children);
- const child = children.find((child) => {
- if (child.dump && child.displayOrder > displayOrder) {
- return child;
- }
- return null;
- });
+ const child = children.find(child => child.dump && child.displayOrder > displayOrder);
if (child) {
child.before(newChild);
} else {
@@ -119,30 +114,35 @@ async function update(dump) {
$prop.setAttribute('type', 'dump');
$panel.$propList[id] = $prop;
- $prop.displayOrder = info.displayOrder === undefined ? index : Number(info.displayOrder);
+ const _displayOrder = info.group?.displayOrder || info.displayOrder;
+ $prop.displayOrder = _displayOrder === undefined ? index : Number(_displayOrder);
if (info.group && dump.groups) {
- const key = info.group.id || 'default';
- const name = info.group.name;
- if (!$panel.$groups[key] && dump.groups[key]) {
- if (dump.groups[key].style === 'tab') {
- $panel.$groups[key] = $panel.createTabGroup(dump.groups[key]);
+ const { id = 'default', name } = info.group;
+ if (!$panel.$groups[id] && dump.groups[id]) {
+ if (dump.groups[id].style === 'tab') {
+ $panel.$groups[id] = $panel.createTabGroup(dump.groups[id]);
}
}
- if ($panel.$groups[key]) {
- if (!$panel.$groups[key].isConnected) {
- $panel.appendChildByDisplayOrder($section, $panel.$groups[key], dump.groups[key].displayOrder);
+ if ($panel.$groups[id]) {
+ if (!$panel.$groups[id].isConnected) {
+ $panel.appendChildByDisplayOrder($section, $panel.$groups[id], dump.groups[id].displayOrder);
}
- if (dump.groups[key].style === 'tab') {
- $panel.appendToTabGroup($panel.$groups[key], name);
+ if (dump.groups[id].style === 'tab') {
+ $panel.appendToTabGroup($panel.$groups[id], name);
}
}
- $panel.appendChildByDisplayOrder($panel.$groups[key].tabs[name], $prop, $prop.displayOrder);
+ $panel.appendChildByDisplayOrder($panel.$groups[id].tabs[name], $prop, $prop.displayOrder);
} else {
$panel.appendChildByDisplayOrder($section, $prop, $prop.displayOrder);
}
} else if (!$prop.isConnected || !$prop.parentElement) {
- $panel.appendChildByDisplayOrder($section, $prop, $prop.displayOrder);
+ if (info.group && dump.groups) {
+ const { id = 'default', name } = info.group;
+ $panel.appendChildByDisplayOrder($panel.$groups[id].tabs[name], $prop, $prop.displayOrder);
+ } else {
+ $panel.appendChildByDisplayOrder($section, $prop, $prop.displayOrder);
+ }
}
$prop.render(info);
});
diff --git a/editor/inspector/contributions/asset.js b/editor/inspector/contributions/asset.js
index 14eef8e648..516adc5b54 100644
--- a/editor/inspector/contributions/asset.js
+++ b/editor/inspector/contributions/asset.js
@@ -577,7 +577,7 @@ exports.update = async function update(uuidList, renderMap, dropConfig) {
}
}
- panel.history.snapshot(panel);
+ panel.history && panel.history.snapshot(panel);
};
exports.ready = function ready() {
diff --git a/editor/inspector/contributions/node.js b/editor/inspector/contributions/node.js
index a85b582257..22d241db6f 100644
--- a/editor/inspector/contributions/node.js
+++ b/editor/inspector/contributions/node.js
@@ -156,7 +156,7 @@ exports.listeners = {
},
};
-exports.template = `
+exports.template = /* html*/`
@@ -582,32 +582,30 @@ const Elements = {
panel.$.sceneRelease.render(panel.dump.autoReleaseAssets);
- panel.dump._globals.ambient.displayName = panel.dump._globals.ambient.displayName || 'Ambient';
- panel.dump._globals.ambient.help =
- panel.dump._globals.ambient.help || Editor.Utils.Url.getDocUrl('concepts/scene/ambient.html');
+ // 由于场景属性对象不是继承于 Component 所以没有修饰器,displayName, help 数据在这里配置
+ panel.dump._globals.ambient.displayName = 'Ambient';
+ panel.dump._globals.ambient.help = panel.getHelpUrl({ help: 'i18n:cc.Ambient' });
panel.$.sceneAmbient.render(panel.dump._globals.ambient);
- panel.dump._globals.fog.displayName = panel.dump._globals.fog.displayName || 'Fog';
- panel.dump._globals.fog.help = panel.dump._globals.fog.help || Editor.Utils.Url.getDocUrl('concepts/scene/skybox.html');
+ panel.dump._globals.fog.displayName = 'Fog';
+ panel.dump._globals.fog.help = panel.getHelpUrl({ help: 'i18n:cc.Fog' });
panel.$.sceneFog.render(panel.dump._globals.fog);
- panel.dump._globals.shadows.displayName = panel.dump._globals.shadows.displayName || 'Shadows';
- panel.dump._globals.shadows.help =
- panel.dump._globals.shadows.help || Editor.Utils.Url.getDocUrl('concepts/scene/light/shadow.html');
+ panel.dump._globals.shadows.displayName = 'Shadows';
+ panel.dump._globals.shadows.help = panel.getHelpUrl({ help: 'i18n:cc.Shadow' });
panel.$.sceneShadows.render(panel.dump._globals.shadows);
- panel.dump._globals.skybox.displayName = panel.dump._globals.skybox.displayName || 'Skybox';
- panel.dump._globals.skybox.help = panel.dump._globals.skybox.help || Editor.Utils.Url.getDocUrl('concepts/scene/skybox.html');
+ panel.dump._globals.skybox.displayName = 'Skybox';
+ panel.dump._globals.skybox.help = panel.getHelpUrl({ help: 'i18n:cc.Skybox' });
panel.$.sceneSkybox.render(panel.dump._globals.skybox);
- panel.dump._globals.octree.help =
- panel.dump._globals.octree.help || Editor.Utils.Url.getDocUrl('advanced-topics/native-scene-culling.html');
- panel.dump._globals.octree.displayName = panel.dump._globals.octree.displayName || 'Octree Scene Culling';
+ panel.dump._globals.octree.displayName = 'Octree Scene Culling';
+ panel.dump._globals.octree.help = panel.getHelpUrl({ help: 'i18n:cc.OctreeCulling' });
panel.$.sceneOctree.render(panel.dump._globals.octree);
// TODO:这个 if 暂时配合引擎调整使用,测试调通后可以去掉
if (panel.dump._globals.postProcess) {
- panel.dump._globals.postProcess.displayName = panel.dump._globals.postProcess.displayName || 'Post Process';
+ panel.dump._globals.postProcess.displayName = 'Post Process';
panel.$.postProcess.render(panel.dump._globals.postProcess);
}
diff --git a/editor/inspector/utils/prop.js b/editor/inspector/utils/prop.js
index 63862b2a1b..9790167bf6 100644
--- a/editor/inspector/utils/prop.js
+++ b/editor/inspector/utils/prop.js
@@ -221,7 +221,8 @@ exports.updatePropByDump = function(panel, dump) {
$prop.setAttribute('type', 'dump');
}
- $prop.displayOrder = info.displayOrder === undefined ? index : Number(info.displayOrder);
+ const _displayOrder = info.group?.displayOrder || info.displayOrder;
+ $prop.displayOrder = _displayOrder === undefined ? index : Number(_displayOrder);
if (element && element.displayOrder !== undefined) {
$prop.displayOrder = element.displayOrder;
@@ -229,8 +230,7 @@ exports.updatePropByDump = function(panel, dump) {
if (!element || !element.isAppendToParent || element.isAppendToParent.call(panel)) {
if (info.group && dump.groups) {
- const id = info.group.id || 'default';
- const name = info.group.name;
+ const { id = 'default', name } = info.group;
if (!panel.$groups[id] && dump.groups[id]) {
if (dump.groups[id].style === 'tab') {
@@ -255,7 +255,12 @@ exports.updatePropByDump = function(panel, dump) {
}
} else if (!$prop.isConnected || !$prop.parentElement) {
if (!element || !element.isAppendToParent || element.isAppendToParent.call(panel)) {
- exports.appendChildByDisplayOrder(panel.$.componentContainer, $prop, $prop.displayOrder);
+ if (info.group && dump.groups) {
+ const { id = 'default', name } = info.group;
+ exports.appendChildByDisplayOrder(panel.$groups[id].tabs[name], $prop, $prop.displayOrder);
+ } else {
+ exports.appendChildByDisplayOrder(panel.$.componentContainer, $prop, $prop.displayOrder);
+ }
}
}
$prop.render(info);
diff --git a/exports/physics-2d-box2d.ts b/exports/physics-2d-box2d.ts
index bcdee345cb..0417ad9a3e 100644
--- a/exports/physics-2d-box2d.ts
+++ b/exports/physics-2d-box2d.ts
@@ -23,5 +23,4 @@
THE SOFTWARE.
*/
-
import '../cocos/physics-2d/box2d/instantiate';
diff --git a/exports/physics-2d-builtin.ts b/exports/physics-2d-builtin.ts
index 5b8bb0eb28..f92aba022c 100644
--- a/exports/physics-2d-builtin.ts
+++ b/exports/physics-2d-builtin.ts
@@ -23,5 +23,4 @@
THE SOFTWARE.
*/
-
import '../cocos/physics-2d/builtin/instantiate';
diff --git a/exports/physics-2d-framework.ts b/exports/physics-2d-framework.ts
index c43afdc3dc..d70947f496 100644
--- a/exports/physics-2d-framework.ts
+++ b/exports/physics-2d-framework.ts
@@ -23,5 +23,4 @@
THE SOFTWARE.
*/
-
-export * from '../cocos/physics-2d/framework';
\ No newline at end of file
+export * from '../cocos/physics-2d/framework';
diff --git a/exports/tiled-map.ts b/exports/tiled-map.ts
index 624d77512c..1c2b5ea405 100644
--- a/exports/tiled-map.ts
+++ b/exports/tiled-map.ts
@@ -23,5 +23,4 @@
THE SOFTWARE.
*/
-
-export * from '../cocos/tiledmap';
\ No newline at end of file
+export * from '../cocos/tiledmap';
diff --git a/gulpfile.js b/gulpfile.js
index 75c21a01c9..b14c37237d 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -57,19 +57,28 @@ gulp.task('build-h5-source', gulp.series('build-debug-infos', async () => {
await fs.ensureDir(outDir);
await fs.emptyDir(outDir);
const cli = require.resolve('@cocos/build-engine/dist/cli');
- return cp.spawn('node', [
- cli,
- `--engine=${__dirname}`,
- '--module=system',
- '--build-mode=BUILD',
- '--platform=HTML5',
- '--physics=cannon',
- `--out=${outDir}`,
- ], {
- shell: true,
- stdio: 'inherit',
- cwd: __dirname,
+ const exitCode = await new Promise((resolve, reject) => {
+ cp.spawn('node', [
+ cli,
+ `--engine=${__dirname}`,
+ '--module=system',
+ '--build-mode=BUILD',
+ '--platform=HTML5',
+ '--physics=cannon',
+ `--out=${outDir}`,
+ ], {
+ shell: true,
+ stdio: 'inherit',
+ cwd: __dirname,
+ }).on('exit', (code) => {
+ resolve(code);
+ }).on('error', (err) => {
+ reject(err);
+ });
});
+ if (exitCode) {
+ throw new Error(`Build process exit with ${exitCode}`);
+ }
}));
gulp.task('build-h5-minified', gulp.series('build-debug-infos', async () => {
diff --git a/jest.config.js b/jest.config.js
index de4d772cd6..6d713e5a0f 100644
--- a/jest.config.js
+++ b/jest.config.js
@@ -17,6 +17,7 @@ module.exports = {
],
setupFilesAfterEnv: [
"./tests/setup-after-env.ts",
+ "./tests/utils/log-capture-setup-after-env.ts"
],
setupFiles: [
'./tests/init.ts',
diff --git a/native/CMakeLists.txt b/native/CMakeLists.txt
index 7f7bd950f7..d9729146f9 100644
--- a/native/CMakeLists.txt
+++ b/native/CMakeLists.txt
@@ -346,6 +346,7 @@ cocos_source_files(
cocos/application/ApplicationManager.h
cocos/application/ApplicationManager.cpp
cocos/application/BaseGame.h
+ cocos/application/BaseGame.cpp
)
############ engine
@@ -2922,14 +2923,11 @@ if(ANDROID)
)
find_library(LIB_EGL NAMES EGL)
- find_library(LIB_GLESv2 NAMES GLESv2)
target_link_libraries(${ENGINE_NAME} PUBLIC
android
paddleboat_static
OpenSLES
${LIB_EGL}
- ${LIB_GLESv2}
- GLESv2
jnigraphics
${CC_EXTERNAL_LIBS}
)
diff --git a/native/cocos/3d/assets/Mesh.h b/native/cocos/3d/assets/Mesh.h
index 6b25b1a7a9..a79570f6db 100644
--- a/native/cocos/3d/assets/Mesh.h
+++ b/native/cocos/3d/assets/Mesh.h
@@ -26,7 +26,7 @@
#pragma once
#include "3d/assets/MorphRendering.h"
-#include "3d/assets/Types.h"
+#include "3d/assets/Morph.h"
#include "cocos/base/Optional.h"
#include "core/assets/Asset.h"
#include "core/geometry/AABB.h"
diff --git a/native/cocos/3d/assets/Morph.cpp b/native/cocos/3d/assets/Morph.cpp
index 7d2e4d929d..6b664b479f 100644
--- a/native/cocos/3d/assets/Morph.cpp
+++ b/native/cocos/3d/assets/Morph.cpp
@@ -28,8 +28,6 @@
namespace cc {
-MorphRendering *createMorphRendering(Mesh *mesh, gfx::Device *gfxDevice) {
- return ccnew StdMorphRendering(mesh, gfxDevice);
-}
+
} // namespace cc
diff --git a/native/cocos/3d/assets/Morph.h b/native/cocos/3d/assets/Morph.h
index b690fa4f50..4336fca30a 100644
--- a/native/cocos/3d/assets/Morph.h
+++ b/native/cocos/3d/assets/Morph.h
@@ -28,56 +28,74 @@
#include "3d/assets/Types.h"
#include "base/RefCounted.h"
#include "base/TypeDef.h"
-#include "scene/Define.h"
namespace cc {
-class Mesh;
-class MorphRendering;
-class MorphRenderingInstance;
-
-namespace gfx {
-class Device;
-class DescriptorSet;
-} // namespace gfx
-
-MorphRendering *createMorphRendering(Mesh *mesh, gfx::Device *gfxDevice);
-
-/**
- * Class which control rendering of a morph resource.
- */
-class MorphRendering : public RefCounted {
-public:
- ~MorphRendering() override = default;
- virtual MorphRenderingInstance *createInstance() = 0;
+struct IMeshBufferView {
+ uint32_t offset{0};
+ uint32_t length{0};
+ uint32_t count{0};
+ uint32_t stride{0};
};
/**
- * This rendering instance of a morph resource.
+ * @en Morph target contains all displacements data of each vertex attribute like position and normal.
+ * @zh 形变目标数据包含网格顶点属性在形变下的变化值,可能包含位移、法线等属性
*/
-class MorphRenderingInstance : public RefCounted {
-public:
- ~MorphRenderingInstance() override = default;
+struct MorphTarget {
/**
- * Sets weights of targets of specified sub mesh.
- * @param subMeshIndex
- * @param weights
+ * Displacement of each target attribute.
*/
- virtual void setWeights(index_t subMeshIndex, const MeshWeightsType &weights) = 0;
+ ccstd::vector displacements;
+};
+/**
+ * @en Sub mesh morph data describes all morph targets for one sub mesh,
+ * including attributes in each morph target, morph targets data and weights corresponding each targets.
+ * @zh 子网格形变数据描述一个子网格下所有的形变目标数据,包含顶点形变属性,形变目标数据和对应每个形变目标的权重。
+ */
+struct SubMeshMorph {
/**
- * Adapts pipeline state to do the rendering.
- * @param subMeshIndex
- * @param pipelineState
+ * Attributes to morph.
*/
- virtual void adaptPipelineState(index_t subMeshIndex, gfx::DescriptorSet *descriptorSet) = 0;
-
- virtual ccstd::vector requiredPatches(index_t subMeshIndex) = 0;
-
+ ccstd::vector attributes;
+
/**
- * Destroy the rendering instance.
+ * Targets.
*/
- virtual void destroy() = 0;
+ ccstd::vector targets;
+
+ /**
+ * Initial weights of each target.
+ */
+ cc::optional weights;
+};
+
+/**
+ * @en Mesh morph data structure to describe the sub meshes data of all sub meshes,
+ * it also contains all sub mesh morphs, global weights configuration and target names.
+ * Normally the global weights configuration should be identical to the sub mesh morph weights,
+ * but if not, the global weights in morph is less prioritized.
+ * @zh 网格的形变数据结构,包含所有子网格形变数据,全局的权重配置和所有形变目标名称。
+ * 一般来说,全局权重配置和子网格形变数据中保持一致,但如果有差异,以子网格形变数据中的权重配置为准。
+ */
+
+struct Morph {
+ /**
+ * Morph data of each sub-mesh.
+ */
+ ccstd::vector> subMeshMorphs;
+
+ /**
+ * Common initial weights of each sub-mesh.
+ */
+ cc::optional weights;
+
+ /**
+ * Name of each target of each sub-mesh morph.
+ * This field is only meaningful if every sub-mesh has the same number of targets.
+ */
+ cc::optional> targetNames;
};
} // namespace cc
diff --git a/native/cocos/3d/assets/MorphRendering.cpp b/native/cocos/3d/assets/MorphRendering.cpp
index 88bc79263c..be9d192659 100644
--- a/native/cocos/3d/assets/MorphRendering.cpp
+++ b/native/cocos/3d/assets/MorphRendering.cpp
@@ -40,6 +40,10 @@
namespace cc {
+MorphRendering *createMorphRendering(Mesh *mesh, gfx::Device *gfxDevice) {
+ return ccnew StdMorphRendering(mesh, gfxDevice);
+}
+
/**
* The instance of once sub-mesh morph rendering.
*/
diff --git a/native/cocos/3d/assets/MorphRendering.h b/native/cocos/3d/assets/MorphRendering.h
index 23f71c6c58..d7452de3eb 100644
--- a/native/cocos/3d/assets/MorphRendering.h
+++ b/native/cocos/3d/assets/MorphRendering.h
@@ -25,17 +25,69 @@
#pragma once
-#include "3d/assets/Morph.h"
+#include "3d/assets/MorphRendering.h"
+#include "3d/assets/Types.h"
#include "base/Ptr.h"
+#include "scene/Define.h"
namespace cc {
class SubMeshMorphRendering;
+class Mesh;
+
+namespace gfx {
+class Device;
+class DescriptorSet;
+} // namespace gfx
/**
- * Standard morph rendering.
- * The standard morph rendering renders each of sub-mesh morph separately.
- * Sub-mesh morph rendering may select different technique according sub-mesh morph itself.
+ * @en The instance of [[MorphRendering]] for dedicated control in the mesh renderer.
+ * The root [[MorphRendering]] is owned by [[Mesh]] asset, each [[MeshRenderer]] can have its own morph rendering instance.
+ * @zh 用于网格渲染器中独立控制 [[MorphRendering]] 的实例。原始 [[MorphRendering]] 被 [[Mesh]] 资源持有,每个 [[MeshRenderer]] 都持有自己的形变网格渲染实例。
+ */
+class MorphRenderingInstance : public RefCounted {
+public:
+ ~MorphRenderingInstance() override = default;
+ /**
+ * Sets weights of targets of specified sub mesh.
+ * @param subMeshIndex
+ * @param weights
+ */
+ virtual void setWeights(index_t subMeshIndex, const MeshWeightsType &weights) = 0;
+
+ /**
+ * Adapts pipeline state to do the rendering.
+ * @param subMeshIndex
+ * @param pipelineState
+ */
+ virtual void adaptPipelineState(index_t subMeshIndex, gfx::DescriptorSet *descriptorSet) = 0;
+
+ virtual ccstd::vector requiredPatches(index_t subMeshIndex) = 0;
+
+ /**
+ * Destroy the rendering instance.
+ */
+ virtual void destroy() = 0;
+};
+
+/**
+ * @en Interface for classes which control the rendering of morph resources.
+ * @zh 支持形变网格渲染的基类。
+ */
+class MorphRendering : public RefCounted {
+public:
+ ~MorphRendering() override = default;
+ virtual MorphRenderingInstance *createInstance() = 0;
+};
+
+/**
+ * @en Standard morph rendering class, it supports both GPU and CPU based morph blending.
+ * If sub mesh morph targets count is less than [[pipeline.UBOMorph.MAX_MORPH_TARGET_COUNT]], then GPU based blending is enabled.
+ * Each of the sub-mesh morph has its own [[MorphRenderingInstance]],
+ * its morph target weights, render pipeline state and strategy of morph blending are controlled separately.
+ * @zh 标准形变网格渲染类,它同时支持 CPU 和 GPU 的形变混合计算。
+ * 如果子网格形变目标数量少于 [[pipeline.UBOMorph.MAX_MORPH_TARGET_COUNT]],那么就会使用基于 GPU 的形变混合计算。
+ * 每个子网格形变都使用自己独立的 [[MorphRenderingInstance]],它的形变目标权重、渲染管线状态和形变混合计算策略都是独立控制的。
*/
class StdMorphRendering final : public MorphRendering {
public:
@@ -52,4 +104,12 @@ private:
friend class StdMorphRenderingInstance;
};
+/**
+ * @en Create morph rendering from mesh which contains morph targets data.
+ * @zh 从包含形变对象的网格资源中创建形变网格渲染对象。
+ * @param mesh @en The mesh to create morph rendering from. @zh 用于创建形变网格渲染对象的原始网格资源。
+ * @param gfxDevice @en The device instance acquired from [[Root]]. @zh 设备对象实例,可以从 [[Root]] 获取。
+ */
+MorphRendering *createMorphRendering(Mesh *mesh, gfx::Device *gfxDevice);
+
} // namespace cc
diff --git a/native/cocos/3d/assets/Types.h b/native/cocos/3d/assets/Types.h
index ae38a27410..3d85a7ce50 100644
--- a/native/cocos/3d/assets/Types.h
+++ b/native/cocos/3d/assets/Types.h
@@ -31,13 +31,6 @@
#include "core/TypedArray.h"
namespace cc {
-struct IMeshBufferView {
- uint32_t offset{0};
- uint32_t length{0};
- uint32_t count{0};
- uint32_t stride{0};
-};
-
using MeshWeightsType = ccstd::vector;
/**
@@ -65,46 +58,4 @@ T getIBArrayValue(const IBArray &arr, uint32_t idx) {
return 0;
}
-struct MorphTarget {
- /**
- * Displacement of each target attribute.
- */
- ccstd::vector displacements;
-};
-
-struct SubMeshMorph {
- /**
- * Attributes to morph.
- */
- ccstd::vector attributes;
-
- /**
- * Targets.
- */
- ccstd::vector targets;
-
- /**
- * Initial weights of each target.
- */
- cc::optional weights;
-};
-
-struct Morph {
- /**
- * Morph data of each sub-mesh.
- */
- ccstd::vector> subMeshMorphs;
-
- /**
- * Common initial weights of each sub-mesh.
- */
- cc::optional weights;
-
- /**
- * Name of each target of each sub-mesh morph.
- * This field is only meaningful if every sub-mesh has the same number of targets.
- */
- cc::optional> targetNames;
-};
-
} // namespace cc
diff --git a/native/cocos/3d/models/MorphModel.h b/native/cocos/3d/models/MorphModel.h
index bcaf13dcfd..6fcd5fc4cd 100644
--- a/native/cocos/3d/models/MorphModel.h
+++ b/native/cocos/3d/models/MorphModel.h
@@ -25,7 +25,7 @@
#pragma once
#include
-#include "3d/assets/Morph.h"
+#include "3d/assets/MorphRendering.h"
#include "scene/Define.h"
#include "scene/Model.h"
diff --git a/native/cocos/application/BaseGame.cpp b/native/cocos/application/BaseGame.cpp
new file mode 100644
index 0000000000..4cad2516a2
--- /dev/null
+++ b/native/cocos/application/BaseGame.cpp
@@ -0,0 +1,68 @@
+/****************************************************************************
+ Copyright (c) 2017-2022 Xiamen Yaji Software Co., Ltd.
+
+ http://www.cocos.com
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated engine source code (the "Software"), a limited,
+ worldwide, royalty-free, non-assignable, revocable and non-exclusive license
+ to use Cocos Creator solely to develop games on your target platforms. You shall
+ not use Cocos Creator software for developing other software or tools that's
+ used for developing games. You are not granted to publish, distribute,
+ sublicense, and/or sell copies of Cocos Creator.
+
+ The software or tools in this License Agreement are licensed, not sold.
+ Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+****************************************************************************/
+
+#include "BaseGame.h"
+#include
+#include "renderer/pipeline/GlobalDescriptorSetManager.h"
+
+namespace cc {
+int BaseGame::init() {
+ cc::pipeline::GlobalDSManager::setDescriptorSetLayout();
+#if CC_PLATFORM == CC_PLATFORM_WINDOWS || CC_PLATFORM == CC_PLATFORM_LINUX || CC_PLATFORM == CC_PLATFORM_QNX || CC_PLATFORM == CC_PLATFORM_MAC_OSX
+ // override default value
+ //_windowInfo.x = _windowInfo.x == -1 ? 0 : _windowInfo.x;
+ //_windowInfo.y = _windowInfo.y == -1 ? 0 : _windowInfo.y;
+ _windowInfo.width = _windowInfo.width == -1 ? 800 : _windowInfo.width;
+ _windowInfo.height = _windowInfo.height == -1 ? 600 : _windowInfo.height;
+ _windowInfo.flags = _windowInfo.flags == -1 ? cc::ISystemWindow::CC_WINDOW_SHOWN |
+ cc::ISystemWindow::CC_WINDOW_RESIZABLE |
+ cc::ISystemWindow::CC_WINDOW_INPUT_FOCUS
+ : _windowInfo.flags;
+ std::call_once(_windowCreateFlag, [&]() {
+ if (_windowInfo.x == -1 || _windowInfo.y == -1) {
+ createWindow(_windowInfo.title.c_str(), _windowInfo.width, _windowInfo.height, _windowInfo.flags);
+ } else {
+ createWindow(_windowInfo.title.c_str(),
+ _windowInfo.x, _windowInfo.y, _windowInfo.width, _windowInfo.height, _windowInfo.flags);
+ }
+ });
+
+#endif
+
+ if (_debuggerInfo.enabled) {
+ setDebugIpAndPort(_debuggerInfo.address, _debuggerInfo.port, _debuggerInfo.pauseOnStart);
+ }
+
+ int ret = cc::CocosApplication::init();
+ if (ret != 0) {
+ return ret;
+ }
+
+ setXXTeaKey(_xxteaKey);
+ runScript("jsb-adapter/jsb-builtin.js");
+ runScript("main.js");
+ return 0;
+}
+} // namespace cc
diff --git a/native/cocos/application/BaseGame.h b/native/cocos/application/BaseGame.h
index 4e65ea740e..bb412446b2 100644
--- a/native/cocos/application/BaseGame.h
+++ b/native/cocos/application/BaseGame.h
@@ -24,7 +24,6 @@
****************************************************************************/
#include
#include "CocosApplication.h"
-#include "renderer/pipeline/GlobalDescriptorSetManager.h"
namespace cc {
class BaseGame : public CocosApplication {
@@ -45,45 +44,12 @@ public:
};
BaseGame() = default;
- int init() override {
- cc::pipeline::GlobalDSManager::setDescriptorSetLayout();
-#if CC_PLATFORM == CC_PLATFORM_WINDOWS || CC_PLATFORM == CC_PLATFORM_LINUX || CC_PLATFORM == CC_PLATFORM_QNX || CC_PLATFORM == CC_PLATFORM_MAC_OSX
- // override default value
- //_windowInfo.x = _windowInfo.x == -1 ? 0 : _windowInfo.x;
- //_windowInfo.y = _windowInfo.y == -1 ? 0 : _windowInfo.y;
- _windowInfo.width = _windowInfo.width == -1 ? 800 : _windowInfo.width;
- _windowInfo.height = _windowInfo.height == -1 ? 600 : _windowInfo.height;
- _windowInfo.flags = _windowInfo.flags == -1 ? cc::ISystemWindow::CC_WINDOW_SHOWN |
- cc::ISystemWindow::CC_WINDOW_RESIZABLE |
- cc::ISystemWindow::CC_WINDOW_INPUT_FOCUS
- : _windowInfo.flags;
- if (_windowInfo.x == -1 || _windowInfo.y == -1) {
- createWindow(_windowInfo.title.c_str(), _windowInfo.width, _windowInfo.height, _windowInfo.flags);
- } else {
- createWindow(_windowInfo.title.c_str(),
- _windowInfo.x, _windowInfo.y, _windowInfo.width, _windowInfo.height, _windowInfo.flags);
- }
-#endif
-
- if (_debuggerInfo.enabled) {
- setDebugIpAndPort(_debuggerInfo.address, _debuggerInfo.port, _debuggerInfo.pauseOnStart);
- }
-
- int ret = cc::CocosApplication::init();
- if (ret != 0) {
- return ret;
- }
-
- setXXTeaKey(_xxteaKey);
-
- runScript("jsb-adapter/jsb-builtin.js");
- runScript("main.js");
- return 0;
- }
+ int init() override;
protected:
std::string _xxteaKey;
DebuggerInfo _debuggerInfo;
WindowInfo _windowInfo;
+ std::once_flag _windowCreateFlag;
};
} // namespace cc
diff --git a/native/cocos/audio/AudioEngine.cpp b/native/cocos/audio/AudioEngine.cpp
index 1ecfddd06d..fa6896a3d2 100644
--- a/native/cocos/audio/AudioEngine.cpp
+++ b/native/cocos/audio/AudioEngine.cpp
@@ -246,6 +246,7 @@ int AudioEngine::play2d(const ccstd::string &filePath, bool loop, float volume,
audioRef.volume = volume;
audioRef.loop = loop;
audioRef.filePath = &it->first;
+ audioRef.state = AudioState::PLAYING;
if (profileHelper) {
profileHelper->lastPlayTime = std::chrono::high_resolution_clock::now();
diff --git a/native/cocos/audio/apple/AudioEngine-inl.mm b/native/cocos/audio/apple/AudioEngine-inl.mm
index c09f9cbbd0..92b85efd28 100644
--- a/native/cocos/audio/apple/AudioEngine-inl.mm
+++ b/native/cocos/audio/apple/AudioEngine-inl.mm
@@ -72,8 +72,6 @@ static ALenum alSourceAddNotificationExt(ALuint sid, ALuint notificationID, alSo
@implementation AudioEngineSessionHandler
- // only enable it on iOS. Disable it on tvOS
- #if !defined(CC_TARGET_OS_TVOS)
void AudioEngineInterruptionListenerCallback(void *user_data, UInt32 interruption_state) {
if (kAudioSessionBeginInterruption == interruption_state) {
alcMakeContextCurrent(nullptr);
@@ -84,7 +82,6 @@ void AudioEngineInterruptionListenerCallback(void *user_data, UInt32 interruptio
alcMakeContextCurrent(s_ALContext);
}
}
- #endif
- (id)init {
if (self = [super init]) {
@@ -93,16 +90,12 @@ void AudioEngineInterruptionListenerCallback(void *user_data, UInt32 interruptio
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleInterruption:) name:UIApplicationDidBecomeActiveNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleInterruption:) name:UIApplicationWillResignActiveNotification object:nil];
}
- // only enable it on iOS. Disable it on tvOS
- // AudioSessionInitialize removed from tvOS
- #if !defined(CC_TARGET_OS_TVOS)
else {
AudioSessionInitialize(NULL, NULL, AudioEngineInterruptionListenerCallback, self);
}
- #endif
BOOL success = [[AVAudioSession sharedInstance]
- setCategory:AVAudioSessionCategoryAmbient
+ setCategory:AVAudioSessionCategoryPlayback
error:nil];
if (!success)
ALOGE("Fail to set audio session.");
@@ -152,7 +145,7 @@ void AudioEngineInterruptionListenerCallback(void *user_data, UInt32 interruptio
resumeOnBecomingActive = false;
ALOGD("UIApplicationDidBecomeActiveNotification, alcMakeContextCurrent(s_ALContext)");
NSError *error = nil;
- BOOL success = [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error:&error];
+ BOOL success = [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:&error];
if (!success) {
ALOGE("Fail to set audio session.");
return;
@@ -402,14 +395,10 @@ void AudioEngineImpl::play2dImpl(AudioCache *cache, int audioID) {
if (!*cache->_isDestroyed && cache->_state == AudioCache::State::READY) {
_threadMutex.lock();
auto playerIt = _audioPlayers.find(audioID);
- if (playerIt != _audioPlayers.end() && playerIt->second->play2d()) {
- if (auto sche = _scheduler.lock()) {
- sche->performFunctionInCocosThread([audioID]() {
- if (AudioEngine::sAudioIDInfoMap.find(audioID) != AudioEngine::sAudioIDInfoMap.end()) {
- AudioEngine::sAudioIDInfoMap[audioID].state = AudioEngine::AudioState::PLAYING;
- }
- });
- }
+ if (playerIt != _audioPlayers.end()) {
+ // Trust it, or assert it out.
+ bool res = playerIt->second->play2d();
+ CC_ASSERT(res);
}
_threadMutex.unlock();
} else {
diff --git a/native/cocos/audio/apple/AudioPlayer.mm b/native/cocos/audio/apple/AudioPlayer.mm
index 57d9db845a..fd1d56c98a 100644
--- a/native/cocos/audio/apple/AudioPlayer.mm
+++ b/native/cocos/audio/apple/AudioPlayer.mm
@@ -205,10 +205,19 @@ bool AudioPlayer::play2d() {
ALOGE("%s:alSourcePlay error code:%x", __PRETTY_FUNCTION__, alError);
break;
}
-
- ALint state;
- alGetSourcei(_alSource, AL_SOURCE_STATE, &state);
- CC_ASSERT(state == AL_PLAYING);
+ /** Due to the bug of OpenAL, when the second time OpenAL trying to mix audio into bus, the mRampState become kRampingComplete, and for those oalSource whose mRampState == kRampingComplete, nothing happens.
+ * OALSource::Play{
+ * switch(mState){
+ * case kTransitionToStop:
+ * case kTransitionToStop:
+ * if(mRampState != kRampingComplete){..}
+ * break;
+ * }
+ * }
+ * So the assert here will trigger this bug as aolSource is reused.
+ * Replace OpenAL with AVAudioEngine on V3.6 mightbe helpful
+ */
+// CC_ASSERT(state == AL_PLAYING);
_ready = true;
ret = true;
} while (false);
diff --git a/native/cocos/bindings/event/EventDispatcher.cpp b/native/cocos/bindings/event/EventDispatcher.cpp
index 5bf3656795..fa9f3260ae 100644
--- a/native/cocos/bindings/event/EventDispatcher.cpp
+++ b/native/cocos/bindings/event/EventDispatcher.cpp
@@ -22,7 +22,7 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
-
+#include
#include "EventDispatcher.h"
#include "cocos/application/ApplicationManager.h"
#include "cocos/bindings/event/CustomEventTypes.h"
@@ -41,7 +41,6 @@ se::Object *jsResizeEventObj = nullptr;
se::Object *jsOrientationEventObj = nullptr;
bool inited = false;
} // namespace
-
namespace cc {
ccstd::unordered_map