From c42e5832bfdb39dcb7ab606e0858a08cd1f70f4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E5=85=B5?= <49358166+xubing0906@users.noreply.github.com> Date: Tue, 24 May 2022 19:16:43 +0800 Subject: [PATCH 1/5] roughness limit (#11209) --- editor/assets/effects/dcc/imported-metallic-roughness.effect | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/editor/assets/effects/dcc/imported-metallic-roughness.effect b/editor/assets/effects/dcc/imported-metallic-roughness.effect index a73d37dcc1..84e923ea9e 100644 --- a/editor/assets/effects/dcc/imported-metallic-roughness.effect +++ b/editor/assets/effects/dcc/imported-metallic-roughness.effect @@ -301,7 +301,8 @@ CCProgram standard-fs %{ roughnessValue = roughnessColor.ROUGHNESS_CHANNEL; #endif #endif - s.roughness = roughnessValue; + //fit specular ior=1.5 + s.roughness = max(0.02, roughnessValue); float occlusionValue = occlusion; From bd8d118d292be712838ad275df476a7ab4c5ad50 Mon Sep 17 00:00:00 2001 From: SijieWang Date: Tue, 24 May 2022 22:43:00 +0800 Subject: [PATCH 2/5] [Bug] Prefab generates incorrect data(Repeated node) (#11211) Co-authored-by: Sijie --- cocos/core/utils/prefab/utils.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cocos/core/utils/prefab/utils.ts b/cocos/core/utils/prefab/utils.ts index 3654e68850..3958ef6442 100644 --- a/cocos/core/utils/prefab/utils.ts +++ b/cocos/core/utils/prefab/utils.ts @@ -186,7 +186,8 @@ export function applyMountedChildren (node: Node, mountedChildren: MountedChildr for (let i = 0; i < childInfo.nodes.length; i++) { const childNode = childInfo.nodes[i]; - if (!childNode) { + // @ts-expect-error private member access + if (!childNode || target._children.includes(childNode)) { continue; } From 2789c2e6e92c110e2ea72502936917ae162145fb Mon Sep 17 00:00:00 2001 From: hyde zhou Date: Wed, 25 May 2022 10:50:02 +0800 Subject: [PATCH 3/5] fix terrain index buffer sharing bug (#11206) --- cocos/core/assets/rendering-sub-mesh.ts | 8 +++++++- cocos/terrain/terrain.ts | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cocos/core/assets/rendering-sub-mesh.ts b/cocos/core/assets/rendering-sub-mesh.ts index 278ace8f55..d180160d3b 100644 --- a/cocos/core/assets/rendering-sub-mesh.ts +++ b/cocos/core/assets/rendering-sub-mesh.ts @@ -109,12 +109,15 @@ export class RenderingSubMesh { private _iaInfo: InputAssemblerInfo; + private _isOwnerOfIndexBuffer = true; + private _init () { } constructor ( vertexBuffers: Buffer[], attributes: Attribute[], primitiveMode: PrimitiveMode, indexBuffer: Buffer | null = null, indirectBuffer: Buffer | null = null, + isOwnerOfIndexBuffer = true, ) { this._attributes = attributes; this._vertexBuffers = vertexBuffers; @@ -122,6 +125,7 @@ export class RenderingSubMesh { this._indirectBuffer = indirectBuffer; this._primitiveMode = primitiveMode; this._iaInfo = new InputAssemblerInfo(attributes, vertexBuffers, indexBuffer, indirectBuffer); + this._isOwnerOfIndexBuffer = isOwnerOfIndexBuffer; this._init(); } @@ -306,7 +310,9 @@ export class RenderingSubMesh { } this.vertexBuffers.length = 0; if (this._indexBuffer) { - this._indexBuffer.destroy(); + if (this._isOwnerOfIndexBuffer) { + this._indexBuffer.destroy(); + } this._indexBuffer = null; } if (this._jointMappedBuffers && this._jointMappedBufferIndices) { diff --git a/cocos/terrain/terrain.ts b/cocos/terrain/terrain.ts index 8e9989a740..d1961b2053 100644 --- a/cocos/terrain/terrain.ts +++ b/cocos/terrain/terrain.ts @@ -393,7 +393,7 @@ export class TerrainBlock { ]; this._renderable._meshData = new RenderingSubMesh([vertexBuffer], gfxAttributes, - PrimitiveMode.TRIANGLE_LIST, this._terrain._getSharedIndexBuffer()); + PrimitiveMode.TRIANGLE_LIST, this._terrain._getSharedIndexBuffer(), null, false); this._renderable._model = (legacyCC.director.root as Root).createModel(scene.Model); this._renderable._model.createBoundingShape(this._bbMin, this._bbMax); this._renderable._model.node = this._renderable._model.transform = this._node; From 6f83995e576317d2fd2f92667c4b954e9c700346 Mon Sep 17 00:00:00 2001 From: Santy-Wang Date: Wed, 25 May 2022 11:00:52 +0800 Subject: [PATCH 4/5] adjust docs i18n (#11166) * adjust docs * adjust docs * refine * adjust docs --- cocos/core/geometry/intersect.ts | 201 ++++++++++++++++--------------- cocos/primitive/box.ts | 2 +- cocos/primitive/capsule.ts | 6 +- cocos/primitive/circle.ts | 2 +- cocos/primitive/cone.ts | 6 +- cocos/primitive/cylinder.ts | 2 +- cocos/primitive/plane.ts | 2 +- cocos/primitive/quad.ts | 2 +- cocos/primitive/torus.ts | 10 +- cocos/primitive/transform.ts | 10 +- cocos/terrain/terrain.ts | 4 +- 11 files changed, 128 insertions(+), 119 deletions(-) diff --git a/cocos/core/geometry/intersect.ts b/cocos/core/geometry/intersect.ts index af18f99efc..e557214b40 100644 --- a/cocos/core/geometry/intersect.ts +++ b/cocos/core/geometry/intersect.ts @@ -47,9 +47,9 @@ import { scene } from '../renderer'; * ray-plane intersect detect. * @zh * 射线与平面的相交性检测。 - * @param {Ray} ray 射线 - * @param {Plane} plane 平面 - * @return {number} 0 或 非0 + * @param ray @zh 射线 @en The ray to test + * @param plane @zh 平面 @en The plane to test + * @return @zh 0 或 非0 @en 0 or not 0, 0 indicates there is no intersection */ const rayPlane = (function () { const pt = new Vec3(0, 0, 0); @@ -70,10 +70,10 @@ const rayPlane = (function () { * ray-triangle intersect detect. * @zh * 射线与三角形的相交性检测。 - * @param {Ray} ray 射线 - * @param {Triangle} triangle 三角形 - * @param {boolean} doubleSided 三角形是否为双面 - * @return {number} 0 或 非0 + * @param ray @zh 射线 @en The ray to test + * @param triangle @zh 三角形 @en The triangle to test + * @param doubleSided @zh 三角形是否为双面 @en Indicates whether it is double sided + * @return @zh 0 或 非0 @en 0 or not 0, 0 indicates there is no intersection */ const rayTriangle = (function () { const ab = new Vec3(0, 0, 0); @@ -110,9 +110,9 @@ const rayTriangle = (function () { * ray-sphere intersect detect. * @zh * 射线和球的相交性检测。 - * @param {Ray} ray 射线 - * @param {Sphere} sphere 球 - * @return {number} 0 或 非0 + * @param ray @zh 射线 @en The ray to test + * @param sphere @zh 球 @en The sphere to test + * @return @zh 0 或 非0 @en 0 or not 0, 0 indicates there is no intersection */ const raySphere = (function () { const e = new Vec3(0, 0, 0); @@ -141,9 +141,9 @@ const raySphere = (function () { * ray-aabb intersect detect. * @zh * 射线和轴对齐包围盒的相交性检测。 - * @param {Ray} ray 射线 - * @param {AABB} aabb 轴对齐包围盒 - * @return {number} 0 或 非0 + * @param ray @zh 射线 @en The ray to test + * @param aabb @zh 轴对齐包围盒 @en The aabb to test + * @return @zh 0 或 非0 @en 0 or not 0, 0 indicates there is no intersection */ const rayAABB = (function () { const min = new Vec3(); @@ -175,9 +175,9 @@ function rayAABB2 (ray: Ray, min: IVec3Like, max: IVec3Like) { * ray-obb intersect detect. * @zh * 射线和方向包围盒的相交性检测。 - * @param {Ray} ray 射线 - * @param {OBB} obb 方向包围盒 - * @return {number} 0 或 非0 + * @param ray @zh 射线 @en The ray + * @param obb @zh 方向包围盒 @en The obb to test + * @return @zh 0 或非 0 @en 0 or not 0, 0 indicates there is no intersection */ const rayOBB = (function () { let center = new Vec3(); @@ -255,9 +255,9 @@ const rayOBB = (function () { * ray-capsule intersect detect. * @zh * 射线和胶囊体的相交性检测。 - * @param {Ray} ray 射线 - * @param {Capsule} capsule 胶囊体 - * @return {number} 0 或 非0 + * @param ray @zh 射线 @en The ray to test + * @param capsule @zh 胶囊体 @en The capsule to test + * @return @zh 0 或非 0 @en 0 or not 0, 0 indicates there is no intersection */ const rayCapsule = (function () { const v3_0 = new Vec3(); @@ -341,10 +341,10 @@ const rayCapsule = (function () { * ray-subMesh intersect detect, in model space. * @zh * 在模型空间中,射线和子三角网格的相交性检测。 - * @param {Ray} ray - * @param {RenderingSubMesh} subMesh - * @param {IRaySubMeshOptions} options - * @return {number} 0 or !0 + * @param ray @zh 射线 @en The ray to test + * @param subMesh @zh 子网格 @en The sub mesh to test + * @param options @zh 额外选项 @en Optional params + * @return @zh 0 或非 0 @en 0 or not 0, 0 indicates there is no intersection */ const raySubMesh = (function () { const tri = Triangle.create(); @@ -437,10 +437,10 @@ const raySubMesh = (function () { * ray-mesh intersect detect, in model space. * @zh * 在模型空间中,射线和三角网格资源的相交性检测。 - * @param {Ray} ray - * @param {Mesh} mesh - * @param {IRayMeshOptions} options - * @return {number} 0 or !0 + * @param ray @zh 射线 @en The ray to test + * @param mesh @zh 网格 @en The mesh to test + * @param options @zh 可选参数 @en Optional param + * @return @zh 0 或非 0 @en 0 or not 0, 0 indicates there is no intersection */ const rayMesh = (function () { let minDis = 0; @@ -486,10 +486,10 @@ const rayMesh = (function () { * ray-model intersect detect, in world space. * @zh * 在世界空间中,射线和渲染模型的相交性检测。 - * @param ray - * @param model - * @param options - * @return 0 or !0 + * @param ray @zh 射线 @en The ray to test + * @param model @zh model @en The model to test + * @param options @zh 可选参数 @en Optional param + * @return @zh 0 或非 0 @en 0 or not 0, 0 indicates there is no intersection */ const rayModel = (function () { let minDis = 0; @@ -542,9 +542,9 @@ const rayModel = (function () { * line-plane intersect detect. * @zh * 线段与平面的相交性检测。 - * @param {line} line 线段 - * @param {Plane} plane 平面 - * @return {number} 0 或 非0 + * @param line @zh 线段 @en The line to test + * @param plane @zh 平面 @en The plane to test + * @return @zh 0 或非 0 @en 0 or not 0, 0 indicates there is no intersection */ const linePlane = (function () { const ab = new Vec3(0, 0, 0); @@ -562,10 +562,10 @@ const linePlane = (function () { * line-triangle intersect detect. * @zh * 线段与三角形的相交性检测。 - * @param {line} line 线段 - * @param {Triangle} triangle 三角形 - * @param {Vec3} outPt 可选,相交点 - * @return {number} 0 或 非0 + * @param line @zh 线段 @en The line to test + * @param triangle @zh 三角形 @en The triangle to test + * @param outPt @zh 可选,相交点 @en Optional out param, indicates the intersection point + * @return @zh 0 或非 0 @en 0 or not 0, 0 indicates there is no intersection */ const lineTriangle = (function () { const ab = new Vec3(0, 0, 0); @@ -627,9 +627,9 @@ const r_t = new Ray(); * line-aabb intersect detect. * @zh * 线段与轴对齐包围盒的相交性检测 - * @param line 线段 - * @param aabb 轴对齐包围盒 - * @return {number} 0 或 非0 + * @param line @zh 线段 @en The line to test + * @param aabb @zh 轴对齐包围盒 @en The aabb to test + * @return @zh 0 或非 0 @en 0 or not 0, 0 indicates there is no intersection */ function lineAABB (line: Line, aabb: AABB): number { r_t.o.set(line.s); @@ -649,9 +649,9 @@ function lineAABB (line: Line, aabb: AABB): number { * line-obb intersect detect. * @zh * 线段与方向包围盒的相交性检测 - * @param line 线段 - * @param obb 方向包围盒 - * @return {number} 0 或 非0 + * @param line @zh 线段 @en The line to test + * @param obb @zh 方向包围盒 @en The obb + * @return @zh 0 或非 0 @en 0 or not 0, 0 indicates there is no intersection */ function lineOBB (line: Line, obb: OBB): number { r_t.o.set(line.s); @@ -671,9 +671,9 @@ function lineOBB (line: Line, obb: OBB): number { * line-sphere intersect detect. * @zh * 线段与球的相交性检测 - * @param line 线段 - * @param sphere 球 - * @return {number} 0 或 非0 + * @param line @zh 线段 @en The line to test + * @param sphere @zh 球 @en The sphere to test + * @return @zh 0 或非 0 @en 0 or not 0, 0 indicates there is no intersection */ function lineSphere (line: Line, sphere: Sphere): number { r_t.o.set(line.s); @@ -693,9 +693,9 @@ function lineSphere (line: Line, sphere: Sphere): number { * aabb-aabb intersect detect. * @zh * 轴对齐包围盒和轴对齐包围盒的相交性检测。 - * @param {AABB} aabb1 轴对齐包围盒1 - * @param {AABB} aabb2 轴对齐包围盒2 - * @return {number} 0 或 非0 + * @param aabb1 @zh 轴对齐包围盒1 @en aabb 1 to test + * @param aabb2 @zh 轴对齐包围盒2 @en aabb 2 to test + * @return @zh 0 或非 0 @en 0 or not 0, 0 indicates there is no intersection */ const aabbWithAABB = (function () { const aMin = new Vec3(); @@ -774,9 +774,9 @@ function getInterval (vertices: any[] | Vec3[], axis: Vec3) { * aabb-obb intersect detect. * @zh * 轴对齐包围盒和方向包围盒的相交性检测。 - * @param {AABB} aabb 轴对齐包围盒 - * @param {OBB} obb 方向包围盒 - * @return {number} 0 或 非0 + * @param aabb @zh 轴对齐包围盒 @en The aabb to test + * @param obb @zh 方向包围盒 @en The obb to test + * @return @zh 0 或非 0 @en 0 or not 0, 0 indicates there is no intersection */ const aabbWithOBB = (function () { const test = new Array(15); @@ -827,9 +827,9 @@ const aabbWithOBB = (function () { * aabb-plane intersect detect. * @zh * 轴对齐包围盒和平面的相交性检测。 - * @param {AABB} aabb 轴对齐包围盒 - * @param {Plane} plane 平面 - * @return {number} inside(back) = -1, outside(front) = 0, intersect = 1 + * @param aabb @zh 轴对齐包围盒 @en The aabb to test + * @param plane @zh 平面 @en The plane to test + * @return @zh 检测结果, 包含为 -1, 不包含为 0, 相交为 1 @en Test result, inside(back) = -1, outside(front) = 0, intersect = 1 */ const aabbPlane = function (aabb: AABB, plane: Plane): number { const r = aabb.halfExtents.x * Math.abs(plane.n.x) @@ -845,9 +845,9 @@ const aabbPlane = function (aabb: AABB, plane: Plane): number { * aabb-frustum intersect detect, faster but has false positive corner cases. * @zh * 轴对齐包围盒和锥台相交性检测,速度快,但有错误情况。 - * @param {AABB} aabb 轴对齐包围盒 - * @param {Frustum} frustum 锥台 - * @return {number} 0 或 非0 + * @param aabb @zh 轴对齐包围盒 @en The aabb to test + * @param frustum @zh 锥台 @en The frustum to test + * @return @zh 0 或非 0 @en 0 or not 0, 0 indicates there is no intersection */ const aabbFrustum = function (aabb: AABB, frustum: Frustum): number { for (let i = 0; i < frustum.planes.length; i++) { @@ -865,9 +865,9 @@ const aabbFrustum = function (aabb: AABB, frustum: Frustum): number { * aabb-frustum intersect, handles most of the false positives correctly. * @zh * 轴对齐包围盒和锥台相交性检测,正确处理大多数错误情况。 - * @param {AABB} aabb 轴对齐包围盒 - * @param {Frustum} frustum 锥台 - * @return {number} + * @param aabb @zh 轴对齐包围盒 @en The aabb to test + * @param frustum @zh 锥台 @en The frustum to test + * @return @zh 0 或非 0 @en 0 or not 0, 0 indicates there is no intersection */ const aabbFrustumAccurate = (function () { const tmp = new Array(8); @@ -914,9 +914,9 @@ const aabbFrustumAccurate = (function () { * obb contains the point. * @zh * 方向包围盒和点的相交性检测。 - * @param {OBB} obb 方向包围盒 - * @param {Vec3} point 点 - * @return {boolean} true or false + * @param obb @zh 方向包围盒 @en The obb to test + * @param point @zh 点 @en The point to test + * @return @zh 布尔值 @en The value indicates if there is a intersection */ const obbPoint = (function () { const tmp = new Vec3(0, 0, 0); const m3 = new Mat3(); @@ -933,9 +933,9 @@ const obbPoint = (function () { * obb-plane intersect detect. * @zh * 方向包围盒和平面的相交性检测。 - * @param {OBB} obb 方向包围盒 - * @param {Plane} plane 平面 - * @return {number} inside(back) = -1, outside(front) = 0, intersect = 1 + * @param obb @zh 方向包围盒 @en The obb to test + * @param plane @zh 平面 @en The plane to test + * @return @zh 检测结果, 包含为 -1, 不包含为 0, 相交为 1 @en Test result, inside(back) = -1, outside(front) = 0, intersect = 1 */ const obbPlane = (function () { const absDot = function (n: Vec3, x: number, y: number, z: number) { @@ -958,9 +958,9 @@ const obbPlane = (function () { * obb-frustum intersect, faster but has false positive corner cases. * @zh * 方向包围盒和锥台相交性检测,速度快,但有错误情况。 - * @param {OBB} obb 方向包围盒 - * @param {Frustum} frustum 锥台 - * @return {number} 0 或 非0 + * @param obb @zh 方向包围盒 @en The obb to test + * @param frustum @zh 锥台 @en The frustum to test + * @return @zh 0 或非 0 @en 0 or not 0, 0 indicates there is no intersection */ const obbFrustum = function (obb: OBB, frustum: Frustum): number { for (let i = 0; i < frustum.planes.length; i++) { @@ -978,9 +978,9 @@ const obbFrustum = function (obb: OBB, frustum: Frustum): number { * obb-frustum intersect, handles most of the false positives correctly. * @zh * 方向包围盒和锥台相交性检测,正确处理大多数错误情况。 - * @param {OBB} obb 方向包围盒 - * @param {Frustum} frustum 锥台 - * @return {number} 0 或 非0 + * @param obb @zh 方向包围盒 @en The obb to test + * @param frustum @zh 锥台 @en The frustum to test + * @return @zh 0 或非 0 @en 0 or not 0, 0 indicates there is no intersection */ const obbFrustumAccurate = (function () { const tmp = new Array(8); @@ -1033,9 +1033,9 @@ const obbFrustumAccurate = (function () { * obb-obb intersect detect. * @zh * 方向包围盒和方向包围盒的相交性检测。 - * @param {OBB} obb1 方向包围盒1 - * @param {OBB} obb2 方向包围盒2 - * @return {number} 0 或 非0 + * @param obb1 @zh 方向包围盒1 @en Obb 1 to test + * @param obb2 @zh 方向包围盒2 @en Obb 2 to test + * @return @zh 0 或非 0 @en 0 or not 0, 0 indicates there is no intersection */ const obbWithOBB = (function () { const test = new Array(15); @@ -1085,8 +1085,9 @@ const obbWithOBB = (function () { * obb-capsule intersect detect. * @zh * 方向包围盒和胶囊体的相交性检测。 - * @param obb 方向包围盒 - * @param capsule 胶囊体 + * @param obb @zh 方向包围盒 @en The obb to test + * @param capsule @zh 胶囊体 @en The capsule to test + * @return @zh 0 或非 0 @en 0 or not 0, 0 indicates there is no intersection */ const obbCapsule = (function () { const sphere_0 = new Sphere(); @@ -1150,9 +1151,9 @@ const obbCapsule = (function () { * plane normal to factor out the unnomalized plane distance. * @zh * 球与平面的相交性检测。 - * @param {Sphere} sphere 球 - * @param {Plane} plane 平面 - * @return {number} inside(back) = -1, outside(front) = 0, intersect = 1 + * @param sphere @zh 球 @en The sphere to test + * @param plane @zh 平面 @en The plane to test + * @return @zh 检测结果, 包含为 -1, 不包含为 0, 相交为 1 @en Test result, inside(back) = -1, outside(front) = 0, intersect = 1 */ const spherePlane = function (sphere: Sphere, plane: Plane): number { const dot = Vec3.dot(plane.n, sphere.center); @@ -1166,9 +1167,9 @@ const spherePlane = function (sphere: Sphere, plane: Plane): number { * sphere-frustum intersect, faster but has false positive corner cases. * @zh * 球和锥台的相交性检测,速度快,但有错误情况。 - * @param {Sphere} sphere 球 - * @param {Frustum} frustum 锥台 - * @return {number} 0 或 非0 + * @param sphere @zh 球 @en The sphere to test + * @param frustum @zh 锥台 @en The frustum to test + * @return @zh 0 或非 0 @en 0 or not 0, 0 indicates there is no intersection */ const sphereFrustum = function (sphere: Sphere, frustum: Frustum): number { for (let i = 0; i < frustum.planes.length; i++) { @@ -1186,9 +1187,9 @@ const sphereFrustum = function (sphere: Sphere, frustum: Frustum): number { * sphere-frustum intersect, handles the false positives correctly. * @zh * 球和锥台的相交性检测,正确处理大多数错误情况。 - * @param {Sphere} sphere 球 - * @param {Frustum} frustum 锥台 - * @return {number} 0 或 非0 + * @param sphere @zh 球 @en The sphere to test + * @param frustum @zh 锥台 @en The frustum to test + * @return @zh 0 或非 0 @en 0 or not 0, 0 indicates there is no intersection */ const sphereFrustumAccurate = (function () { const pt = new Vec3(0, 0, 0); const map = [1, -1, 1, -1, 1, -1]; @@ -1219,9 +1220,9 @@ const sphereFrustumAccurate = (function () { * sphere-sphere intersect detect. * @zh * 球和球的相交性检测。 - * @param {Sphere} sphere0 球0 - * @param {Sphere} sphere1 球1 - * @return {boolean} true or false + * @param sphere0 @zh 球 0 @en The sphere A to test + * @param sphere1 @zh 球 1 @en The sphere B to test + * @return @zh 是否发生碰撞 @en true or false which indicates if there is a intersection */ const sphereWithSphere = function (sphere0: Sphere, sphere1: Sphere): boolean { const r = sphere0.radius + sphere1.radius; @@ -1233,9 +1234,9 @@ const sphereWithSphere = function (sphere0: Sphere, sphere1: Sphere): boolean { * sphere-aabb intersect detect. * @zh * 球和轴对齐包围盒的相交性检测。 - * @param {Sphere} sphere 球 - * @param {AABB} aabb 轴对齐包围盒 - * @return {boolean} true or false + * @param sphere @zh 球 @en The sphere to test + * @param aabb @zh 轴对齐包围盒 @en The aabb to test + * @return @zh 是否发生碰撞 @en true or false which indicates if there is a intersection */ const sphereAABB = (function () { const pt = new Vec3(); @@ -1250,9 +1251,9 @@ const sphereAABB = (function () { * sphere-obb intersect detect. * @zh * 球和方向包围盒的相交性检测。 - * @param {Sphere} sphere 球 - * @param {OBB} obb 方向包围盒 - * @return {boolean} true or false + * @param sphere @zh 球 @en The sphere to test + * @param obb @zh 方向包围盒 @en The obb to test + * @return @zh 是否发生碰撞 @en true or false which indicates if there is a intersection */ const sphereOBB = (function () { const pt = new Vec3(); @@ -1267,6 +1268,9 @@ const sphereOBB = (function () { * sphere-capsule intersect detect. * @zh * 球和胶囊体的相交性检测。 + * @param sphere @zh 球 @en The sphere to test + * @param capsule @zh 胶囊体 @en The capsule to test + * @return @zh 是否发生碰撞 @en true or false which indicates if there is a intersection */ const sphereCapsule = (function () { const v3_0 = new Vec3(); @@ -1299,6 +1303,9 @@ const sphereCapsule = (function () { * capsule-capsule intersect detect. * @zh * 胶囊体和胶囊体的相交性检测。 + * @param capsuleA @zh 胶囊体 A @en The capsule A to test + * @param capsuleB @zh 胶囊体 B @en The capsule B to test + * @return @zh 是否发生碰撞 @en true or false which indicates if there is a intersection */ const capsuleWithCapsule = (function () { const v3_0 = new Vec3(); diff --git a/cocos/primitive/box.ts b/cocos/primitive/box.ts index a0f9152ac1..1ae25ee575 100644 --- a/cocos/primitive/box.ts +++ b/cocos/primitive/box.ts @@ -88,7 +88,7 @@ interface IBoxOptions extends RecursivePartial { * but may be repositioned through the `center` option. * @zh * 生成一个立方体,其大小是定义的范围且中心在原点。 - * @param options 参数选项。 + * @param options @zh 参数选项。@en The optional creation parameters of the box */ export default function box (options?: IBoxOptions): IGeometry { options = options || {}; diff --git a/cocos/primitive/capsule.ts b/cocos/primitive/capsule.ts index 54b98cb22d..38a5cdc586 100644 --- a/cocos/primitive/capsule.ts +++ b/cocos/primitive/capsule.ts @@ -46,9 +46,9 @@ const temp2 = new Vec3(0, 0, 0); * but may be repositioned through the `center` option. * @zh * 生成一个胶囊体。 - * @param radiusTop 顶部半径。 - * @param radiusBottom 底部半径。 - * @param opts 胶囊体参数选项。 + * @param radiusTop @zh 顶部半径。 @en The radius of top sphere + * @param radiusBottom @zh 底部半径。@en The radius of bottom sphere + * @param opts @zh 胶囊体参数选项。@en The optional creation parameters of the capsule */ export default function capsule (radiusTop = 0.5, radiusBottom = 0.5, height = 2, opts: RecursivePartial = {}) { const torsoHeight = height - radiusTop - radiusBottom; diff --git a/cocos/primitive/circle.ts b/cocos/primitive/circle.ts index 0c30b4a0d3..f9a51bbd8e 100644 --- a/cocos/primitive/circle.ts +++ b/cocos/primitive/circle.ts @@ -54,7 +54,7 @@ function applyDefaultCircleOptions (options?: RecursivePartial): * but may be repositioned through the `center` option. * @zh * 生成一个圆,其半径是单位1,中心点在原点。 - * @param options 参数选项。 + * @param options @zh 参数选项。 @en The optional creation parameters of the circle */ export default function circle (options?: RecursivePartial | ICircleOptions): IGeometry { const normalizedOptions = applyDefaultCircleOptions(options); diff --git a/cocos/primitive/cone.ts b/cocos/primitive/cone.ts index 9af308d4a9..433ef823e1 100644 --- a/cocos/primitive/cone.ts +++ b/cocos/primitive/cone.ts @@ -34,9 +34,9 @@ type IConeOptions = ICylinderOptions; * but may be repositioned through the `center` option. * @zh * 生成一个圆锥。 - * @param radius 圆锥半径。 - * @param height 圆锥高度。 - * @param opts 圆锥参数选项。 + * @param radius @zh 圆锥半径。 @en The radius of cone + * @param height @zh 圆锥高度。 @en The height of cone + * @param opts @zh 圆锥参数选项。@en The optional creation parameters of the cone */ export default function cone ( radius = 0.5, diff --git a/cocos/primitive/cylinder.ts b/cocos/primitive/cylinder.ts index 7d75a35666..4947cb8090 100644 --- a/cocos/primitive/cylinder.ts +++ b/cocos/primitive/cylinder.ts @@ -51,7 +51,7 @@ const temp2 = new Vec3(0, 0, 0); * @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 圆柱参数选项。 + * @param opts @en The optional creation parameters of the 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/plane.ts b/cocos/primitive/plane.ts index 1a4c069f2a..a2de1dac33 100644 --- a/cocos/primitive/plane.ts +++ b/cocos/primitive/plane.ts @@ -81,7 +81,7 @@ const c01 = new Vec3(0, 0, 0); * This function generates a plane on XOZ plane with positive Y direction. * @zh * 生成一个平面,其位于XOZ平面,方向为Y轴正方向。 - * @param options 平面参数选项。 + * @param options @zh 平面参数选项。@en The optional creation parameters of the plane */ export default function plane (options?: IPlaneOptions): IGeometry { const normalizedOptions = applyDefaultPlaneOptions(options); diff --git a/cocos/primitive/quad.ts b/cocos/primitive/quad.ts index e286315b7a..94337a53bb 100644 --- a/cocos/primitive/quad.ts +++ b/cocos/primitive/quad.ts @@ -30,7 +30,7 @@ import { applyDefaultGeometryOptions, IGeometry, IGeometryOptions } from './defi * Generate a quad with width and height both to 1, centered at origin. * @zh * 生成一个四边形,宽高都为1,中心在原点。 - * @param options 参数选项。 + * @param options @zh 参数选项。 @en The optional creation parameters of the quad */ export default function quad (options?: IGeometryOptions): IGeometry { const normalizedOptions = applyDefaultGeometryOptions(options); diff --git a/cocos/primitive/torus.ts b/cocos/primitive/torus.ts index de5ca9cefe..62fa6dd4b7 100644 --- a/cocos/primitive/torus.ts +++ b/cocos/primitive/torus.ts @@ -29,6 +29,8 @@ import { IGeometryOptions } from './define'; /** * @zh * 环面参数选项。 + * @en + * The options about torus */ interface ITorusOptions extends IGeometryOptions { radialSegments: number; @@ -38,12 +40,12 @@ interface ITorusOptions extends IGeometryOptions { /** * @en - * Generate a torus with raidus 0.4, tube 0.1 and centered at origin. + * Generate a torus with radius 0.4, tube 0.1 and centered at origin. * @zh * 生成一个环面。 - * @param radius 环面半径。 - * @param tube 管形大小。 - * @param opts 参数选项。 + * @param radius @zh 环面半径。@en The radius fo torus + * @param tube @zh 管形大小。@en The radius of tube + * @param opts @zh 参数选项。@en The optional creation parameters of the torus */ export default function torus (radius = 0.4, tube = 0.1, opts: RecursivePartial = {}) { const radialSegments = opts.radialSegments || 32; diff --git a/cocos/primitive/transform.ts b/cocos/primitive/transform.ts index a808077d02..58ddca1bde 100644 --- a/cocos/primitive/transform.ts +++ b/cocos/primitive/transform.ts @@ -31,8 +31,8 @@ import { IGeometry } from './define'; * Translate the geometry. * @zh * 平移几何体。 - * @param geometry 几何体信息。 - * @param offset 偏移量。 + * @param geometry @zh 几何体信息。@en The geometry to be translated + * @param offset @zh 偏移量。@en The translation */ export function translate (geometry: IGeometry, offset: { x?: number; y?: number; z?: number; }) { const x = offset.x || 0; @@ -65,8 +65,8 @@ export function translate (geometry: IGeometry, offset: { x?: number; y?: number * Scale the geometry. * @zh * 缩放几何体。 - * @param geometry 几何体信息。 - * @param value 缩放量。 + * @param geometry @zh 几何体信息。 @en The geometry to be scaled + * @param value @zh 缩放量。@en The scaling size */ export function scale (geometry: IGeometry, value: { x?: number; y?: number; z?: number }) { const x = value.x || 0; @@ -100,7 +100,7 @@ export function scale (geometry: IGeometry, value: { x?: number; y?: number; z?: * Converts geometry to wireframe mode. Only geometry with triangle topology is supported. * @zh * 将几何体转换为线框模式,仅支持三角形拓扑的几何体。 - * @param geometry 几何体信息。 + * @param geometry @zh 几何体信息。@en The geometry to be converted to wireframe */ export function wireframed (geometry: IGeometry) { const { indices } = geometry; diff --git a/cocos/terrain/terrain.ts b/cocos/terrain/terrain.ts index d1961b2053..d5b91dff1f 100644 --- a/cocos/terrain/terrain.ts +++ b/cocos/terrain/terrain.ts @@ -691,8 +691,8 @@ export class TerrainBlock { } /** - * @en 地形块的可见性 - * @zh block visible + * @zh 地形块的可见性 + * @en The visibility of the block */ set visible (val) { if (this._renderable._model !== null) { From 0ed8cca119aeace7c5fcfe9b7397371d55b86f74 Mon Sep 17 00:00:00 2001 From: jk20012001 Date: Wed, 25 May 2022 11:59:13 +0800 Subject: [PATCH 5/5] modify shadowmap settings in default scene (#11213) --- editor/assets/default_file_content/scene | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/editor/assets/default_file_content/scene b/editor/assets/default_file_content/scene index 26fcca53bf..56435e5f9e 100644 --- a/editor/assets/default_file_content/scene +++ b/editor/assets/default_file_content/scene @@ -273,19 +273,19 @@ }, "_firstSetCSM": false, "_fixedArea": false, - "_pcf": 0, + "_pcf": 1, "_bias": 0.00001, "_normalBias": 0, "_near": 0.1, "_far": 10, - "_shadowDistance": 100, + "_shadowDistance": 10, "_invisibleOcclusionRange": 200, "_orthoSize": 5, "_maxReceived": 4, "_size": { "__type__": "cc.Vec2", - "x": 512, - "y": 512 + "x": 1024, + "y": 1024 }, "_saturation": 0.75 },