Merge branch 'v3.4.0' into v3.4.1

# Conflicts:
#	cocos/core/builtin/effects.ts
#	cocos/core/builtin/shader-sources/glsl1.ts
This commit is contained in:
pandamicro
2021-12-16 14:51:39 +08:00
63 changed files with 350 additions and 284 deletions
+27 -3
View File
@@ -17,8 +17,12 @@ jobs:
working-directory: ./engine
run: |
git fetch origin ${{ github.base_ref }}
git checkout -b ${{ github.base_ref }} remotes/origin/${{ github.base_ref }}
git checkout -b ${{ github.base_ref }}_BASE remotes/origin/${{ github.base_ref }}
git branch
- name: npm install BASE branch
working-directory: ./engine
run: |
npm install --ignore-scripts
- name: build BASE declaration
@@ -27,12 +31,32 @@ jobs:
npm run build-declaration
cp ./bin/.declarations/cc.d.ts ./bin/cc_base.d.ts
- name: rebase HEAD branch
- name: clear dependencies
working-directory: ./engine
run: |
git checkout .
rm -r ./node_modules
rm ./package-lock.json
ls -la
- name: checkout HEAD branch
working-directory: ./engine
run: |
git remote add HEAD_REPO https://github.com/${{ github.event.pull_request.head.repo.full_name }}.git
git pull --rebase HEAD_REPO ${{ github.head_ref }}
git fetch HEAD_REPO ${{ github.head_ref }}
git checkout -b ${{ github.head_ref }}_HEAD remotes/HEAD_REPO/${{ github.head_ref }}
git branch
- name: rebase BASE branch
working-directory: ./engine
run: |
git checkout .
git pull --rebase origin ${{ github.base_ref }}
- name: npm install HEAD branch
working-directory: ./engine
run: |
npm install --ignore-scripts
- name: build HEAD declaration
working-directory: ./engine
+5 -5
View File
@@ -200,7 +200,7 @@ export const bmfontUtils = {
}
},
_multilineTextWrap (nextTokenFunc: Function) {
_multilineTextWrap (nextTokenFunc: (arg0: string, arg1: number, arg2: number) => number) {
const textLen = _string.length;
let lineIndex = 0;
@@ -397,7 +397,7 @@ export const bmfontUtils = {
}
_lettersInfo[letterIndex].char = char;
_lettersInfo[letterIndex].hash = char.charCodeAt(0) + shareLabelInfo.hash;
_lettersInfo[letterIndex].hash = `${char.charCodeAt(0)}${shareLabelInfo.hash}`;
_lettersInfo[letterIndex].valid = false;
},
@@ -408,7 +408,7 @@ export const bmfontUtils = {
}
const char = character.charCodeAt(0);
const key = char + shareLabelInfo.hash;
const key = `${char}${shareLabelInfo.hash}`;
_lettersInfo[letterIndex].line = lineIndex;
_lettersInfo[letterIndex].char = character;
@@ -457,7 +457,7 @@ export const bmfontUtils = {
}
},
_shrinkLabelToContentSize (lambda: Function) {
_shrinkLabelToContentSize (lambda: () => boolean) {
const fontSize = _fontSize;
let left = 0;
@@ -510,7 +510,7 @@ export const bmfontUtils = {
continue;
}
const px = letterInfo.x + letterDef.w / 2 * _bmfontScale;
const px = letterInfo.x + letterDef.w * _bmfontScale;
const lineIndex = letterInfo.line;
if (_labelWidth > 0) {
if (!_isWrapText) {
+5 -12
View File
@@ -40,7 +40,7 @@ import { Root } from '../../core/root';
import { Node } from '../../core/scene-graph';
import { MeshBuffer } from './mesh-buffer';
import { Stage, StencilManager } from './stencil-manager';
import { DrawBatch2D, DrawCall } from './draw-batch';
import { DrawBatch2D } from './draw-batch';
import * as VertexFormat from './vertex-format';
import { legacyCC } from '../../core/global-exports';
import { ModelLocalBindings, UBOLocal } from '../../core/pipeline/define';
@@ -264,9 +264,7 @@ export class Batcher2D implements IBatcher {
subModels[j].priority = batchPriority++;
}
} else {
for (let i = 0; i < batch.drawCalls.length; i++) {
batch.drawCalls[i].descriptorSet = this._descriptorSetCache.getDescriptorSet(batch, batch.drawCalls[i]);
}
batch.descriptorSet = this._descriptorSetCache.getDescriptorSet(batch);
}
batch.renderScene.addBatch(batch);
}
@@ -302,7 +300,6 @@ export class Batcher2D implements IBatcher {
continue;
}
DrawBatch2D.drawcallPool.freeArray(batch.drawCalls);
batch.clear();
this._drawBatchPool.free(batch);
}
@@ -451,8 +448,7 @@ export class Batcher2D implements IBatcher {
curDrawBatch.fillPasses(mat, depthStencil, dssHash, null, 0, subModel.patches, this);
curDrawBatch.inputAssembler = subModel.inputAssembler;
curDrawBatch.model!.visFlags = curDrawBatch.visFlags;
curDrawBatch.fillDrawCallAssembler();
curDrawBatch.drawCalls[0].descriptorSet = subModel.descriptorSet;
curDrawBatch.descriptorSet = subModel.descriptorSet;
this._batches.push(curDrawBatch);
}
@@ -521,7 +517,6 @@ export class Batcher2D implements IBatcher {
curDrawBatch.textureHash = this._currTextureHash;
curDrawBatch.samplerHash = this._currSamplerHash;
curDrawBatch.fillPasses(this._currMaterial, depthStencil, dssHash, blendState, bsHash, null, this);
curDrawBatch.fillDrawCallAssembler();
this._batches.push(curDrawBatch);
@@ -595,7 +590,6 @@ export class Batcher2D implements IBatcher {
}
public walk (node: Node, level = 0) {
const len = node.children.length;
this._preProcess(node);
if (len > 0 && !node._static) {
@@ -803,7 +797,7 @@ class DescriptorSetCache {
this._localCachePool = new Pool(() => new LocalDescriptorSet(), 16, (obj) => obj.destroy());
}
public getDescriptorSet (batch: DrawBatch2D, drawCall: DrawCall): DescriptorSet {
public getDescriptorSet (batch: DrawBatch2D): DescriptorSet {
const root = legacyCC.director.root;
let hash;
if (batch.useLocalData) {
@@ -819,11 +813,10 @@ class DescriptorSetCache {
this._localDescriptorSetCache.push(localDs);
return localDs.descriptorSet!;
} else {
hash = batch.textureHash ^ batch.samplerHash ^ drawCall.bufferHash;
hash = batch.textureHash ^ batch.samplerHash;
if (this._descriptorSetCache.has(hash)) {
return this._descriptorSetCache.get(hash)!;
} else {
const device = legacyCC.director.root.device;
_dsInfo.layout = batch.passes[0].localSetLayout;
const descriptorSet = root.device.createDescriptorSet(_dsInfo) as DescriptorSet;
const binding = ModelLocalBindings.SAMPLER_SPRITE;
+2 -101
View File
@@ -31,7 +31,7 @@
import { JSB } from 'internal:constants';
import { MeshBuffer } from './mesh-buffer';
import { Material } from '../../core/assets/material';
import { Texture, Sampler, DrawInfo, Buffer, InputAssembler, DescriptorSet, Shader } from '../../core/gfx';
import { Texture, Sampler, InputAssembler, DescriptorSet, Shader } from '../../core/gfx';
import { Node } from '../../core/scene-graph';
import { Camera } from '../../core/renderer/scene/camera';
import { RenderScene } from '../../core/renderer/scene/render-scene';
@@ -39,84 +39,12 @@ import { Model } from '../../core/renderer/scene/model';
import { Layers } from '../../core/scene-graph/layers';
import { legacyCC } from '../../core/global-exports';
import { Pass } from '../../core/renderer/core/pass';
import { NativeDrawBatch2D, NativeDrawCall, NativePass } from '../../core/renderer/scene';
import { NativeDrawBatch2D, NativePass } from '../../core/renderer/scene';
import { IBatcher } from './i-batcher';
import { Pool } from '../../core/memop';
const UI_VIS_FLAG = Layers.Enum.NONE | Layers.Enum.UI_3D;
export class DrawCall {
// UBO info
public bufferHash = 0;
public bufferUboIndex = 0;
public _bufferView: Buffer | null = null;
// actual draw call info
private _descriptorSet: DescriptorSet | null = null;
private _dynamicOffsets = [0, 0];// uboindex * _uniformBufferStride
private _drawInfo: DrawInfo| null = null;
private declare _nativeObj: NativeDrawCall | null;
public get native (): NativeDrawCall {
return this._nativeObj!;
}
public get bufferView () {
return this._bufferView;
}
public set bufferView (buffer: Buffer | null) {
this._bufferView = buffer;
if (JSB) {
this._nativeObj!.bufferView = buffer;
}
}
public get descriptorSet () {
return this._descriptorSet;
}
public set descriptorSet (ds: DescriptorSet | null) {
this._descriptorSet = ds;
if (JSB) {
this._nativeObj!.descriptorSet = ds;
}
}
public get drawInfo () {
return this._drawInfo;
}
public get dynamicOffsets () {
return this._dynamicOffsets;
}
public set dynamicOffsets (offsets: number[]) {
this._dynamicOffsets = offsets;
if (JSB) {
this._nativeObj!.dynamicOffsets = this._dynamicOffsets;
}
}
public setDynamicOffsets (value: number) {
this._dynamicOffsets[1] = value;
if (JSB) {
this._nativeObj!.setDynamicOffsets(value);
}
}
constructor () {
if (JSB) {
this._drawInfo = new gfx.DrawInfo();
this._nativeObj = new NativeDrawCall();
this._nativeObj.drawInfo = this.drawInfo;
} else {
this._drawInfo = new DrawInfo();
}
}
}
export class DrawBatch2D {
static drawcallPool = new Pool(() => new DrawCall(), 100);
public get native (): NativeDrawBatch2D {
return this._nativeObj!;
}
@@ -175,10 +103,6 @@ export class DrawBatch2D {
private _descriptorSet: DescriptorSet | null = null;
private declare _nativeObj: NativeDrawBatch2D | null;
protected _drawCalls: DrawCall[] = [];
get drawCalls () { return this._drawCalls; }
constructor () {
if (JSB) {
this._nativeObj = new NativeDrawBatch2D();
@@ -205,13 +129,6 @@ export class DrawBatch2D {
this.useLocalData = null;
this.visFlags = UI_VIS_FLAG;
this.renderScene = null;
this._drawCalls.length = 0;
if (JSB) { this._nativeObj!.clearDrawCalls(); }
}
protected _pushDrawCall (dc: DrawCall) {
this._drawCalls.push(dc);
if (JSB) { this._nativeObj!.pushDrawCall(dc.native); }
}
// object version
@@ -262,20 +179,4 @@ export class DrawBatch2D {
}
}
}
public fillDrawCallAssembler () {
let dc = this._drawCalls[0];
const ia = this.inputAssembler;
if (!dc) {
dc = DrawBatch2D.drawcallPool.alloc();
dc.bufferHash = 0;
dc.bufferView = null;
dc.bufferUboIndex = 0;
this._pushDrawCall(dc);
}
if (ia) {
dc.drawInfo!.firstIndex = ia.drawInfo.firstIndex;
dc.drawInfo!.indexCount = ia.drawInfo.indexCount;
}
}
}
@@ -206,12 +206,12 @@ export class StateMachine extends EditorExtendable {
}
/**
* Gets the transition between specified states.
* Gets the transitions between specified states.
* @param from Transition source.
* @param to Transition target.
* @returns The transition, if one existed.
* @returns Iterator to the transitions
*/
public getTransition (from: State, to: State): Iterable<Transition> {
public getTransitionsBetween (from: State, to: State): Iterable<Transition> {
assertsOwnedBy(from, this);
assertsOwnedBy(to, this);
return from[outgoingsSymbol].filter((transition) => transition.to === to);
@@ -322,19 +322,25 @@ export class StateMachine extends EditorExtendable {
assertsOwnedBy(to, this);
const oTransitions = from[outgoingsSymbol];
for (let iOTransition = 0; iOTransition < oTransitions.length; ++iOTransition) {
const oTransition = oTransitions[iOTransition];
if (oTransition.to === to) {
assertIsTrue(
remove(this._transitions, oTransition),
);
removeAt(oTransitions, iOTransition);
assertIsNonNullable(
removeIf(to[incomingsSymbol], (transition) => transition === oTransition),
);
markAsDangling(oTransition);
break;
}
const iTransitions = to[incomingsSymbol];
const transitions = this._transitions;
const oTransitionsToRemove = oTransitions
.filter((oTransition) => oTransition.to === to);
const nOTransitionToRemove = oTransitionsToRemove.length;
for (let iOTransitionToRemove = 0;
iOTransitionToRemove < nOTransitionToRemove;
++iOTransitionToRemove
) {
const oTransition = oTransitionsToRemove[iOTransitionToRemove];
remove(oTransitions, oTransition);
assertIsTrue(
remove(transitions, oTransition),
);
assertIsNonNullable(
removeIf(iTransitions, (transition) => transition === oTransition),
);
markAsDangling(oTransition);
}
}
+11 -8
View File
@@ -447,7 +447,7 @@ export const effects = [
"shaders": [
{
"name": "standard|standard-vs|standard-fs",
"hash": 4091353748,
"hash": 1626719900,
"builtins": {
"statistics": { "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 221, "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 64 },
"globals": { "blocks": [{ "name": "CCGlobal", "defines": [] }, { "name": "CCCamera", "defines": [] }, { "name": "CCShadow", "defines": [] }], "samplerTextures": [{ "name": "cc_shadowMap", "defines": ["CC_RECEIVE_SHADOW"] }, { "name": "cc_spotLightingMap", "defines": ["CC_RECEIVE_SHADOW"] }, { "name": "cc_environment", "defines": ["CC_USE_IBL"] }, { "name": "cc_diffuseMap", "defines": ["CC_USE_IBL", "CC_USE_DIFFUSEMAP"] }], "buffers": [], "images": [] },
@@ -540,7 +540,7 @@ export const effects = [
},
{
"name": "standard|shadow-caster-vs:vert|shadow-caster-fs:frag",
"hash": 3485028792,
"hash": 1774012115,
"builtins": {
"statistics": { "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 182, "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 64 },
"globals": { "blocks": [{ "name": "CCShadow", "defines": [] }, { "name": "CCGlobal", "defines": [] }, { "name": "CCCamera", "defines": [] }], "samplerTextures": [{ "name": "cc_shadowMap", "defines": ["CC_RECEIVE_SHADOW"] }, { "name": "cc_spotLightingMap", "defines": ["CC_RECEIVE_SHADOW"] }], "buffers": [], "images": [] },
@@ -610,7 +610,7 @@ export const effects = [
"shaders": [
{
"name": "terrain|terrain-vs|terrain-fs",
"hash": 956791030,
"hash": 2255044546,
"builtins": {
"statistics": { "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 69, "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 60 },
"globals": { "blocks": [{ "name": "CCGlobal", "defines": [] }, { "name": "CCCamera", "defines": [] }, { "name": "CCShadow", "defines": [] }], "samplerTextures": [{ "name": "cc_shadowMap", "defines": ["CC_RECEIVE_SHADOW"] }, { "name": "cc_spotLightingMap", "defines": ["CC_RECEIVE_SHADOW"] }, { "name": "cc_environment", "defines": ["CC_USE_IBL"] }, { "name": "cc_diffuseMap", "defines": ["CC_USE_IBL", "CC_USE_DIFFUSEMAP"] }], "buffers": [], "images": [] },
@@ -955,7 +955,7 @@ export const effects = [
"shaders": [
{
"name": "deferred-lighting|lighting-vs|lighting-fs",
"hash": 288925601,
"hash": 1506731478,
"builtins": {
"statistics": { "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 39, "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 58 },
"globals": { "blocks": [{ "name": "CCGlobal", "defines": [] }, { "name": "CCCamera", "defines": [] }, { "name": "CCShadow", "defines": [] }], "samplerTextures": [{ "name": "cc_shadowMap", "defines": ["CC_RECEIVE_SHADOW"] }, { "name": "cc_spotLightingMap", "defines": ["CC_RECEIVE_SHADOW"] }, { "name": "cc_environment", "defines": ["CC_USE_IBL"] }, { "name": "cc_diffuseMap", "defines": ["CC_USE_IBL", "CC_USE_DIFFUSEMAP"] }], "buffers": [], "images": [] },
@@ -1176,14 +1176,14 @@ export const effects = [
{
"name": "splash-screen",
"techniques": [
{ "name": "default", "passes": [{ "blendState": { "targets": [{ "blend": true, "blendSrc": 2, "blendDst": 4, "blendDstAlpha": 4 }] }, "rasterizerState": { "cullMode": 0 }, "program": "splash-screen|splash-screen-vs:vert|splash-screen-fs:frag", "depthStencilState": { "depthTest": false, "depthWrite": false }, "properties": { "mainTexture": { "value": "grey", "type": 28 }, "resolution": { "value": [640, 960], "type": 14, "handleInfo": ["u_buffer0", 0, 14] }, "precent": { "value": [0.5], "type": 13, "handleInfo": ["u_buffer0", 2, 13] }, "scale": { "value": [200, 500], "type": 14, "handleInfo": ["u_buffer1", 0, 14] }, "translate": { "value": [320, 480], "type": 14, "handleInfo": ["u_buffer1", 2, 14] }, "u_buffer0": { "type": 16, "value": [640, 960, 0.5, 0] }, "u_buffer1": { "type": 16, "value": [200, 500, 320, 480] } } }] }
{ "name": "default", "passes": [{ "blendState": { "targets": [{ "blend": true, "blendSrc": 2, "blendDst": 4, "blendDstAlpha": 4 }] }, "rasterizerState": { "cullMode": 0 }, "program": "splash-screen|splash-screen-vs:vert|splash-screen-fs:frag", "depthStencilState": { "depthTest": false, "depthWrite": false }, "properties": { "mainTexture": { "value": "grey", "type": 28 }, "resolution": { "value": [640, 960], "type": 14, "handleInfo": ["u_buffer0", 0, 14] }, "percent": { "value": [0.5], "type": 13, "handleInfo": ["u_percent", 0, 13] }, "scale": { "value": [200, 500], "type": 14, "handleInfo": ["u_buffer1", 0, 14] }, "translate": { "value": [320, 480], "type": 14, "handleInfo": ["u_buffer1", 2, 14] }, "u_buffer0": { "type": 16, "value": [640, 960, 0, 0] }, "u_percent": { "type": 13, "value": [0.5] }, "u_buffer1": { "type": 16, "value": [200, 500, 320, 480] } } }] }
],
"shaders": [
{
"name": "splash-screen|splash-screen-vs:vert|splash-screen-fs:frag",
"hash": 1349506124,
"hash": 3189094080,
"builtins": {
"statistics": { "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 6, "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 0 },
"statistics": { "CC_EFFECT_USED_VERTEX_UNIFORM_VECTORS": 6, "CC_EFFECT_USED_FRAGMENT_UNIFORM_VECTORS": 1 },
"globals": { "blocks": [], "samplerTextures": [], "buffers": [], "images": [] },
"locals": { "blocks": [], "samplerTextures": [], "buffers": [], "images": [] }
},
@@ -1197,10 +1197,13 @@ export const effects = [
{ "name": "u_buffer0", "type": 16, "count": 1 },
{ "name": "u_buffer1", "type": 16, "count": 1 },
{ "name": "u_projection", "type": 25, "count": 1 }
]},
{"name": "Factor", "defines": [], "binding": 1, "stageFlags": 16, "members": [
{ "name": "u_percent", "type": 13, "count": 1 }
]}
],
"samplerTextures": [
{ "name": "mainTexture", "type": 28, "count": 1, "defines": [], "stageFlags": 16, "binding": 1 }
{ "name": "mainTexture", "type": 28, "count": 1, "defines": [], "stageFlags": 16, "binding": 2 }
],
"buffers": [],
"images": [],
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2 -1
View File
@@ -203,7 +203,8 @@ function enumerateObject (obj, clone, parent) {
for (const key in obj) {
if (!obj.hasOwnProperty(key)
|| (key.charCodeAt(0) === 95 && key.charCodeAt(1) === 95 // starts with "__"
&& key !== '__type__')
&& key !== '__type__'
&& key !== '__prefab')
) {
continue;
}
+2 -2
View File
@@ -195,7 +195,7 @@ export class WebGL2Swapchain extends Swapchain {
Format.RGBA8,
2,
2,
TextureFlagBit.GEN_MIPMAP,
TextureFlagBit.NONE,
)) as WebGL2Texture;
this.nullTexCube = WebGL2DeviceManager.instance.createTexture(new TextureInfo(
@@ -204,7 +204,7 @@ export class WebGL2Swapchain extends Swapchain {
Format.RGBA8,
2,
2,
TextureFlagBit.GEN_MIPMAP,
TextureFlagBit.NONE,
6,
)) as WebGL2Texture;
+3 -5
View File
@@ -62,12 +62,10 @@ export class UIPhase {
const pso = PipelineStateManager.getOrCreatePipelineState(device, pass, shader, renderPass, inputAssembler);
cmdBuff.bindPipelineState(pso);
cmdBuff.bindDescriptorSet(SetIndex.MATERIAL, pass.descriptorSet);
const ds = batch.descriptorSet!;
cmdBuff.bindDescriptorSet(SetIndex.LOCAL, ds);
cmdBuff.bindInputAssembler(inputAssembler);
for (let i = 0; i < batch.drawCalls.length; i++) {
const ds = batch.drawCalls[i].descriptorSet!;
cmdBuff.bindDescriptorSet(SetIndex.LOCAL, ds, batch.drawCalls[i].dynamicOffsets);
cmdBuff.draw(batch.drawCalls[i].drawInfo!);
}
cmdBuff.draw(inputAssembler);
}
}
}
@@ -19,7 +19,6 @@ export const NativeCamera = ns.Camera;
export const NativeRenderWindow = ns.RenderWindow;
export const NativeRenderScene = ns.RenderScene;
export const NativeDrawBatch2D = ns.DrawBatch2D;
export const NativeDrawCall = ns.DrawCall;
export const NativePass = ns.Pass;
export const NativeSubModel = ns.SubModel;
export const NativeRoot = ns.Root;
+1 -14
View File
@@ -1,8 +1,7 @@
import { DrawCall } from '../../../2d/renderer/draw-batch';
import { IFlatBuffer } from '../../assets/rendering-sub-mesh';
import { Frustum } from '../../geometry';
import { Attribute, BlendState, Buffer, ClearFlags, Color as GFXColor, DepthStencilState,
DescriptorSet, DrawInfo, Framebuffer, InputAssembler, RasterizerState, Shader, Swapchain } from '../../gfx';
DescriptorSet, Framebuffer, InputAssembler, RasterizerState, Shader, Swapchain } from '../../gfx';
import { Color, Mat4, Rect, Vec2, Vec3, Vec4 } from '../../math';
import { RenderPriority } from '../../pipeline/define';
import { LightType } from './light';
@@ -239,21 +238,9 @@ export const NativeDrawBatch2D: Constructor<{
descriptorSet: DescriptorSet | null;
passes: NativePass[];
shaders: Shader[];
drawCalls: NativeDrawCall[];
pushDrawCall(dc: NativeDrawCall);
clearDrawCalls();
}> = null!;
export type NativeDrawBatch2D = InstanceType<typeof NativeDrawBatch2D>;
export const NativeDrawCall: Constructor<{
bufferView: Buffer | null;
descriptorSet: DescriptorSet | null;
dynamicOffsets: number[];
drawInfo: DrawInfo | null;
setDynamicOffsets(value: number);
}> = null!;
export type NativeDrawCall = InstanceType<typeof NativeDrawCall>;
export const NativeRenderScene: Constructor<{
activate (): void;
update(stamp: number): void;
+38 -3
View File
@@ -24,7 +24,7 @@
* @module scene-graph
*/
import { ccclass, visible, type, displayOrder, readOnly, slide, range, rangeStep, editable, serializable, rangeMin, tooltip, formerlySerializedAs, displayName } from 'cc.decorator';
import { ccclass, visible, type, displayOrder, readOnly, slide, range, rangeStep, editable, serializable, rangeMin, tooltip, formerlySerializedAs, displayName, help } from 'cc.decorator';
import { EDITOR } from 'internal:constants';
import { TextureCube } from '../assets/texture-cube';
import { CCFloat, CCBoolean, CCInteger } from '../data/utils/attribute';
@@ -58,6 +58,7 @@ const normalizeHDRColor = (color : Vec4) => {
* @zh 场景的环境光照相关信息
*/
@ccclass('cc.AmbientInfo')
@help('i18n:cc.Ambient')
export class AmbientInfo {
@serializable
@formerlySerializedAs('_skyColor')
@@ -116,6 +117,7 @@ export class AmbientInfo {
}
})
@editable
@tooltip('i18n:ambient.skyLightingColor')
set skyLightingColor (val: Color) {
_v4.set(val.x, val.y, val.z, val.w);
if ((legacyCC.director.root as Root).pipeline.pipelineSceneData.isHDR) {
@@ -147,6 +149,7 @@ export class AmbientInfo {
*/
@editable
@type(CCFloat)
@tooltip('i18n:ambient.skyIllum')
set skyIllum (val: number) {
if ((legacyCC.director.root as Root).pipeline.pipelineSceneData.isHDR) {
this._skyIllumHDR = val;
@@ -178,6 +181,7 @@ export class AmbientInfo {
}
})
@editable
@tooltip('i18n:ambient.groundLightingColor')
set groundLightingColor (val: Color) {
_v4.set(val.x, val.y, val.z, val.w);
if ((legacyCC.director.root as Root).pipeline.pipelineSceneData.isHDR) {
@@ -215,6 +219,7 @@ legacyCC.AmbientInfo = AmbientInfo;
* @zh 天空盒相关信息
*/
@ccclass('cc.SkyboxInfo')
@help('i18n:cc.Skybox')
export class SkyboxInfo {
@serializable
protected _applyDiffuseMap = false;
@@ -251,6 +256,7 @@ export class SkyboxInfo {
return false;
})
@editable
@tooltip('i18n:skybox.applyDiffuseMap')
set applyDiffuseMap (val) {
this._applyDiffuseMap = val;
@@ -267,6 +273,7 @@ export class SkyboxInfo {
* @zh 是否启用天空盒?
*/
@editable
@tooltip('i18n:skybox.enabled')
set enabled (val) {
if (this._enabled === val) return;
this._enabled = val;
@@ -284,6 +291,7 @@ export class SkyboxInfo {
* @zh 是否启用环境光照?
*/
@editable
@tooltip('i18n:skybox.useIBL')
set useIBL (val) {
this._useIBL = val;
@@ -300,6 +308,7 @@ export class SkyboxInfo {
* @zh 是否启用HDR?
*/
@editable
@tooltip('i18n:skybox.useHDR')
set useHDR (val) {
(legacyCC.director.root as Root).pipeline.pipelineSceneData.isHDR = val;
this._useHDR = val;
@@ -327,6 +336,7 @@ export class SkyboxInfo {
*/
@editable
@type(TextureCube)
@tooltip('i18n:skybox.envmap')
set envmap (val) {
const isHDR = (legacyCC.director.root as Root).pipeline.pipelineSceneData.isHDR;
if (isHDR) {
@@ -406,6 +416,7 @@ legacyCC.SkyboxInfo = SkyboxInfo;
* @en Global fog info
*/
@ccclass('cc.FogInfo')
@help('i18n:cc.Fog')
export class FogInfo {
public static FogType = FogType;
@serializable
@@ -434,6 +445,7 @@ export class FogInfo {
* @en Enable global fog
*/
@editable
@tooltip('i18n:fog.enabled')
set enabled (val: boolean) {
if (this._enabled === val) return;
this._enabled = val;
@@ -454,6 +466,7 @@ export class FogInfo {
* @en Enable accurate fog (pixel fog)
*/
@editable
@tooltip('i18n:fog.accurate')
set accurate (val: boolean) {
if (this._accurate === val) return;
this._accurate = val;
@@ -474,6 +487,7 @@ export class FogInfo {
* @en Global fog color
*/
@editable
@tooltip('i18n:fog.fogColor')
set fogColor (val: Color) {
this._fogColor.set(val);
if (this._resource) { this._resource.fogColor = this._fogColor; }
@@ -489,6 +503,7 @@ export class FogInfo {
*/
@editable
@type(FogType)
@tooltip('i18n:fog.type')
get type () {
return this._type;
}
@@ -510,6 +525,7 @@ export class FogInfo {
@rangeStep(0.01)
@slide
@displayOrder(3)
@tooltip('i18n:fog.fogDensity')
get fogDensity () {
return this._fogDensity;
}
@@ -527,6 +543,7 @@ export class FogInfo {
@type(CCFloat)
@rangeStep(0.01)
@displayOrder(4)
@tooltip('i18n:fog.fogStart')
get fogStart () {
return this._fogStart;
}
@@ -544,6 +561,7 @@ export class FogInfo {
@type(CCFloat)
@rangeStep(0.01)
@displayOrder(5)
@tooltip('i18n:fog.fogEnd')
get fogEnd () {
return this._fogEnd;
}
@@ -562,6 +580,7 @@ export class FogInfo {
@rangeMin(0.01)
@rangeStep(0.01)
@displayOrder(6)
@tooltip('i18n:fog.fogAtten')
get fogAtten () {
return this._fogAtten;
}
@@ -579,6 +598,7 @@ export class FogInfo {
@type(CCFloat)
@rangeStep(0.01)
@displayOrder(7)
@tooltip('i18n:fog.fogTop')
get fogTop () {
return this._fogTop;
}
@@ -596,6 +616,7 @@ export class FogInfo {
@type(CCFloat)
@rangeStep(0.01)
@displayOrder(8)
@tooltip('i18n:fog.fogRange')
get fogRange () {
return this._fogRange;
}
@@ -617,6 +638,7 @@ export class FogInfo {
* @zh 平面阴影相关信息
*/
@ccclass('cc.ShadowsInfo')
@help('i18n:cc.Shadow')
export class ShadowsInfo {
@serializable
protected _type = ShadowType.Planar;
@@ -662,6 +684,7 @@ export class ShadowsInfo {
* @zh 是否启用平面阴影?
*/
@editable
@tooltip('i18n:shadow.enabled')
set enabled (val: boolean) {
if (this._enabled === val) return;
this._enabled = val;
@@ -704,6 +727,7 @@ export class ShadowsInfo {
* @zh 阴影接收平面的法线
*/
@visible(function (this: ShadowsInfo) { return this._type === ShadowType.Planar; })
@tooltip('i18n:shadow.normal')
set normal (val: Vec3) {
Vec3.copy(this._normal, val);
if (this._resource) { this._resource.normal = val; }
@@ -717,6 +741,7 @@ export class ShadowsInfo {
* @zh 阴影接收平面与原点的距离
*/
@type(CCFloat)
@tooltip('i18n:shadow.distance')
@visible(function (this: ShadowsInfo) { return this._type === ShadowType.Planar; })
set distance (val: number) {
this._distance = val;
@@ -734,6 +759,7 @@ export class ShadowsInfo {
@range([0.0, 1.0, 0.01])
@slide
@type(CCFloat)
@tooltip('i18n:shadow.saturation')
@visible(function (this: ShadowsInfo) { return this._type === ShadowType.ShadowMap; })
set saturation (val: number) {
if (val > 1.0) {
@@ -753,6 +779,7 @@ export class ShadowsInfo {
* @zh 阴影接收平面的法线
*/
@type(PCFType)
@tooltip('i18n:shadow.pcf')
@visible(function (this: ShadowsInfo) { return this._type === ShadowType.ShadowMap; })
set pcf (val) {
this._pcf = val;
@@ -781,6 +808,7 @@ export class ShadowsInfo {
* @zh 获取或者设置阴影纹理偏移值
*/
@type(CCFloat)
@tooltip('i18n:shadow.bias')
@visible(function (this: ShadowsInfo) { return this._type === ShadowType.ShadowMap; })
set bias (val: number) {
this._bias = val;
@@ -795,6 +823,7 @@ export class ShadowsInfo {
* @zh 打开或者关闭自阴影。
*/
@type(CCFloat)
@tooltip('i18n:shadow.normalBias')
@visible(function (this: ShadowsInfo) { return this._type === ShadowType.ShadowMap; })
set normalBias (val: number) {
this._normalBias = val;
@@ -809,6 +838,7 @@ export class ShadowsInfo {
* @zh 获取或者设置阴影纹理大小
*/
@type(ShadowSize)
@tooltip('i18n:shadow.shadowMapSize')
@visible(function (this: ShadowsInfo) { return this._type === ShadowType.ShadowMap; })
set shadowMapSize (value: number) {
this._size.set(value, value);
@@ -829,6 +859,7 @@ export class ShadowsInfo {
* @zh 是否是固定区域阴影
*/
@type(CCBoolean)
@tooltip('i18n:shadow.fixedArea')
@visible(function (this: ShadowsInfo) { return this._type === ShadowType.ShadowMap; })
set fixedArea (val) {
this._fixedArea = val;
@@ -843,6 +874,7 @@ export class ShadowsInfo {
* @zh 获取或者设置阴影相机近裁剪面
*/
@type(CCFloat)
@tooltip('i18n:shadow.near')
@visible(function (this: ShadowsInfo) { return this._type === ShadowType.ShadowMap && this._fixedArea === true; })
set near (val: number) {
this._near = val;
@@ -857,6 +889,7 @@ export class ShadowsInfo {
* @zh 获取或者设置阴影相机远裁剪面
*/
@type(CCFloat)
@tooltip('i18n:shadow.far')
@visible(function (this: ShadowsInfo) { return this._type === ShadowType.ShadowMap && this._fixedArea === true; })
set far (val: number) {
this._far = Math.min(val, Shadows.MAX_FAR);
@@ -871,10 +904,10 @@ export class ShadowsInfo {
* @zh 获取或者设置潜在阴影产生的范围
*/
@editable
@tooltip('if shadow has been culled, increase this value to fix it')
@range([0.0, 2000.0, 0.1])
@slide
@type(CCFloat)
@tooltip('i18n:shadow.invisibleOcclusionRange')
@visible(function (this: ShadowsInfo) { return this._type === ShadowType.ShadowMap && this._fixedArea === false; })
set invisibleOcclusionRange (val: number) {
this._invisibleOcclusionRange = Math.min(val, Shadows.MAX_FAR);
@@ -891,10 +924,10 @@ export class ShadowsInfo {
* @zh 获取或者设置潜在阴影产生的范围
*/
@editable
@tooltip('shadow visible distance: shadow quality is inversely proportional of the magnitude of this value')
@range([0.0, 2000.0, 0.1])
@slide
@type(CCFloat)
@tooltip('i18n:shadow.shadowDistance')
@visible(function (this: ShadowsInfo) { return this._type === ShadowType.ShadowMap && this._fixedArea === false; })
set shadowDistance (val: number) {
this._shadowDistance = Math.min(val, Shadows.MAX_FAR);
@@ -911,6 +944,7 @@ export class ShadowsInfo {
* @zh 获取或者设置阴影相机正交大小
*/
@type(CCFloat)
@tooltip('i18n:shadow.orthoSize')
@visible(function (this: ShadowsInfo) { return this._type === ShadowType.ShadowMap && this._fixedArea === true; })
set orthoSize (val: number) {
this._orthoSize = val;
@@ -963,6 +997,7 @@ export const DEFAULT_WORLD_MAX_POS = new Vec3(1024.0, 1024.0, 1024.0);
export const DEFAULT_OCTREE_DEPTH = 8;
@ccclass('cc.OctreeInfo')
@help('i18n:cc.OctreeCulling')
export class OctreeInfo {
@serializable
protected _enabled = false;
+2 -2
View File
@@ -251,7 +251,7 @@ export class SplashScreen {
this.logoMat.setProperty('resolution', v2_0.set(dw, dh), 0);
this.logoMat.setProperty('scale', v2_0.set(scaleX, scaleY), 0);
this.logoMat.setProperty('translate', v2_0.set(dw * 0.5, dh * 0.5), 0);
this.logoMat.setProperty('precent', u_p);
this.logoMat.setProperty('percent', u_p);
this.logoMat.setProperty('u_projection', this.projection);
this.logoMat.passes[0].update();
@@ -269,7 +269,7 @@ export class SplashScreen {
this.watermarkMat.setProperty('resolution', v2_0.set(dw, dh), 0);
this.watermarkMat.setProperty('scale', v2_0.set(scaleX, scaleY), 0);
this.watermarkMat.setProperty('translate', v2_0.set(dw * 0.5, dh * 0.1), 0);
this.watermarkMat.setProperty('precent', u_p);
this.watermarkMat.setProperty('percent', u_p);
this.watermarkMat.setProperty('u_projection', this.projection);
this.watermarkMat.passes[0].update();
}
+10 -2
View File
@@ -211,7 +211,7 @@ export function applyMountedChildren (node: Node, mountedChildren: MountedChildr
// siblingIndex update is in _onBatchCreated function, and it needs a parent.
// @ts-expect-error private member access
childNode._siblingIndex = target._children.length - 1;
expandPrefabInstanceNode(childNode);
expandPrefabInstanceNode(childNode, true);
}
}
}
@@ -399,7 +399,7 @@ export function applyTargetOverrides (node: BaseNode) {
}
}
export function expandPrefabInstanceNode (node: Node) {
export function expandPrefabInstanceNode (node: Node, recursively = false) {
// @ts-expect-error private member access
const prefabInfo = node._prefab;
const prefabInstance = prefabInfo?.instance;
@@ -415,6 +415,14 @@ export function expandPrefabInstanceNode (node: Node) {
applyMountedComponents(node, prefabInstance.mountedComponents, targetMap);
applyPropertyOverrides(node, prefabInstance.propertyOverrides, targetMap);
}
if (recursively) {
if (node && node.children) {
node.children.forEach((child) => {
expandPrefabInstanceNode(child, true);
});
}
}
}
export function expandNestedPrefabInstanceNode (node: BaseNode) {
@@ -63,6 +63,7 @@ export const ParticleAssembler: IAssembler = {
const isRecreate = buffer.request(renderData.vertexCount, renderData.indicesCount);
if (!isRecreate) {
buffer = renderer.currBufferBatch!;
vertexOffset = 0;
indicesOffset = 0;
vertexId = 0;
}
@@ -24,10 +24,10 @@ float CCGetViewSpaceDepth(float depthHS)
#if CC_RECEIVE_SHADOW
#pragma builtin(global)
layout(set = 0, binding = 3) uniform sampler2D cc_shadowMap;
layout(set = 0, binding = 3) uniform highp sampler2D cc_shadowMap;
#pragma builtin(global)
layout(set = 0, binding = 5) uniform sampler2D cc_spotLightingMap;
layout(set = 0, binding = 5) uniform highp sampler2D cc_spotLightingMap;
vec4 ApplyShadowDepthBias_FaceNormal(vec4 shadowPos, vec3 worldNormal)
{
@@ -1,5 +1,5 @@
{
"ver": "1.4.7",
"ver": "1.4.8",
"importer": "effect",
"imported": true,
"uuid": "711ebe11-f673-4cd9-9a83-63c60ba54c5b",
@@ -1,5 +1,5 @@
{
"ver": "1.4.7",
"ver": "1.4.8",
"importer": "effect",
"imported": true,
"uuid": "bf4078d6-d2d7-4073-83bb-cd6f1802e880",
@@ -1,5 +1,5 @@
{
"ver": "1.4.7",
"ver": "1.4.8",
"importer": "effect",
"imported": true,
"uuid": "810e96e4-e456-4468-9b59-f4e8f39732c0",
@@ -1,5 +1,5 @@
{
"ver": "1.4.7",
"ver": "1.4.8",
"importer": "effect",
"imported": true,
"uuid": "1c02ae6f-4492-4915-b8f8-7492a3b1e4cd",
@@ -1,5 +1,5 @@
{
"ver": "1.4.7",
"ver": "1.4.8",
"importer": "effect",
"imported": true,
"uuid": "d9937e59-61fe-4ec6-92ab-7ac5a19c89b0",
@@ -12,8 +12,8 @@ CCEffect %{
- blend: true
blendSrc: src_alpha
blendDst: one_minus_src_alpha
blendSrcAlpha: src_alpha
blendDstAlpha: one_minus_src_alpha
blendSrcAlpha: zero
blendDstAlpha: one
b3: &b3
targets:
- blend: true
@@ -1,5 +1,5 @@
{
"ver": "1.4.7",
"ver": "1.4.8",
"importer": "effect",
"imported": true,
"uuid": "971bdb23-3ff6-43eb-b422-1c30165a3663",
@@ -1,5 +1,5 @@
{
"ver": "1.4.7",
"ver": "1.4.8",
"importer": "effect",
"imported": true,
"uuid": "17debcc3-0a6b-4b8a-b00b-dc58b885581e",
@@ -12,8 +12,8 @@ CCEffect %{
- blend: true
blendSrc: src_alpha
blendDst: one_minus_src_alpha
blendSrcAlpha: src_alpha
blendDstAlpha: one_minus_src_alpha
blendSrcAlpha: zero
blendDstAlpha: one
b3: &b3
targets:
- blend: true
@@ -1,5 +1,5 @@
{
"ver": "1.4.7",
"ver": "1.4.8",
"importer": "effect",
"imported": true,
"uuid": "d1346436-ac96-4271-b863-1f4fdead95b0",
@@ -1,5 +1,5 @@
{
"ver": "1.4.7",
"ver": "1.4.8",
"importer": "effect",
"imported": true,
"uuid": "99498f84-efe6-43a6-a9a7-e6e93eb845c1",
@@ -1,5 +1,5 @@
{
"ver": "1.4.7",
"ver": "1.4.8",
"importer": "effect",
"imported": true,
"uuid": "c27215d8-6835-4b68-bfbb-bdeac6100c04",
@@ -1,5 +1,5 @@
{
"ver": "1.4.7",
"ver": "1.4.8",
"importer": "effect",
"imported": true,
"uuid": "ecf28c14-a31d-450b-8434-25636525fc28",
@@ -1,5 +1,5 @@
{
"ver": "1.4.7",
"ver": "1.4.8",
"importer": "effect",
"imported": true,
"uuid": "60f7195c-ec2a-45eb-ba94-8955f60e81d0",
@@ -1,5 +1,5 @@
{
"ver": "1.4.7",
"ver": "1.4.8",
"importer": "effect",
"imported": true,
"uuid": "1baf0fc9-befa-459c-8bdd-af1a450a0319",
@@ -1,5 +1,5 @@
{
"ver": "1.4.7",
"ver": "1.4.8",
"importer": "effect",
"imported": true,
"uuid": "1d08ef62-a503-4ce2-8b9a-46c90873f7d3",
@@ -1,5 +1,5 @@
{
"ver": "1.4.7",
"ver": "1.4.8",
"importer": "effect",
"imported": true,
"uuid": "a7612b54-35e3-4238-a1a9-4a7b54635839",
@@ -1,5 +1,5 @@
{
"ver": "1.4.7",
"ver": "1.4.8",
"importer": "effect",
"imported": true,
"uuid": "a3cd009f-0ab0-420d-9278-b9fdab939bbc",
@@ -1,5 +1,5 @@
{
"ver": "1.4.7",
"ver": "1.4.8",
"importer": "effect",
"imported": true,
"uuid": "81127eb0-7556-453c-b147-670782dd5e53",
@@ -1,5 +1,5 @@
{
"ver": "1.4.7",
"ver": "1.4.8",
"importer": "effect",
"imported": true,
"uuid": "9d6c6bde-2fe2-44ee-883b-909608948b04",
@@ -1,5 +1,5 @@
{
"ver": "1.4.7",
"ver": "1.4.8",
"importer": "effect",
"imported": true,
"uuid": "cb2c332a-fa5e-4235-a129-f011634bb7ad",
@@ -1,5 +1,5 @@
{
"ver": "1.4.7",
"ver": "1.4.8",
"importer": "effect",
"imported": true,
"uuid": "4736e978-c8fa-449f-9cf6-fe0158ded9d7",
@@ -1,5 +1,5 @@
{
"ver": "1.4.7",
"ver": "1.4.8",
"importer": "effect",
"imported": true,
"uuid": "ba35f02e-a81c-464c-bfc5-c788328da667",
@@ -1,5 +1,5 @@
{
"ver": "1.4.7",
"ver": "1.4.8",
"importer": "effect",
"imported": true,
"uuid": "e4e4cb19-8dd2-450d-ad20-1a818263b8d3",
@@ -1,5 +1,5 @@
{
"ver": "1.4.7",
"ver": "1.4.8",
"importer": "effect",
"imported": true,
"uuid": "a3e72674-c38f-4336-a285-1826b1799cd7",
@@ -1,5 +1,5 @@
{
"ver": "1.4.7",
"ver": "1.4.8",
"importer": "effect",
"imported": true,
"uuid": "7a115de7-2d94-4620-8b89-766d7f8cbff9",
@@ -1,5 +1,5 @@
{
"ver": "1.4.7",
"ver": "1.4.8",
"importer": "effect",
"imported": true,
"uuid": "9b4d3fa5-89bf-4715-b69a-dbbd1efaf6a5",
@@ -1,5 +1,5 @@
{
"ver": "1.4.7",
"ver": "1.4.8",
"importer": "effect",
"imported": true,
"uuid": "28d6d6b8-3f66-4a73-9795-17a0852ba2d4",
@@ -1,5 +1,5 @@
{
"ver": "1.4.7",
"ver": "1.4.8",
"importer": "effect",
"imported": true,
"uuid": "5d45aa00-e064-4938-b314-4265f0c2258c",
@@ -1,5 +1,5 @@
{
"ver": "1.4.7",
"ver": "1.4.8",
"importer": "effect",
"imported": true,
"uuid": "9361fd90-ba52-4f84-aa93-6e878fd576ca",
@@ -1,5 +1,5 @@
{
"ver": "1.4.7",
"ver": "1.4.8",
"importer": "effect",
"imported": true,
"uuid": "ec8106fe-05bf-4e94-943c-e0d3b7bb5e45",
@@ -1,5 +1,5 @@
{
"ver": "1.4.7",
"ver": "1.4.8",
"importer": "effect",
"imported": true,
"uuid": "511d2633-09a7-4bdd-ac42-f778032124b3",
@@ -1,5 +1,5 @@
{
"ver": "1.4.7",
"ver": "1.4.8",
"importer": "effect",
"imported": true,
"uuid": "6624c63c-0e3d-4d5f-bd15-a7805b71c521",
@@ -1,5 +1,5 @@
{
"ver": "1.4.7",
"ver": "1.4.8",
"importer": "effect",
"imported": true,
"uuid": "31b152ff-f689-4082-a292-3eb5a0b33014",
@@ -1,5 +1,5 @@
{
"ver": "1.4.7",
"ver": "1.4.8",
"importer": "effect",
"imported": true,
"uuid": "f1556893-88b6-4c65-8c16-a5256ef3ad25",
@@ -1,5 +1,5 @@
{
"ver": "1.4.7",
"ver": "1.4.8",
"importer": "effect",
"imported": true,
"uuid": "871c3b6c-7379-419d-bda3-794b239ab90d",
@@ -1,5 +1,5 @@
{
"ver": "1.4.7",
"ver": "1.4.8",
"importer": "effect",
"imported": true,
"uuid": "27cc5a0b-ec0b-4a67-98cf-b42d4fa971de",
@@ -8,7 +8,7 @@ CCEffect %{
properties:
mainTexture: { value: grey }
resolution: { value: [640, 960], target: u_buffer0.xy }
precent: { value: 0.5, target: u_buffer0.z }
percent: { value: 0.5, target: u_percent }
scale: { value: [200, 500], target: u_buffer1.xy }
translate: { value: [320, 480], target: u_buffer1.zw }
depthStencilState:
@@ -28,14 +28,12 @@ CCProgram splash-screen-vs %{
precision mediump float;
#define u_resolution u_buffer0.xy
#define u_precent u_buffer0.z
#define u_worldScale u_buffer1.xy
#define u_worldTranslate u_buffer1.zw
in vec2 a_position;
in vec2 a_texCoord;
out vec2 v_uv;
out float v_percent;
uniform Constant {
vec4 u_buffer0;
vec4 u_buffer1;
@@ -47,7 +45,6 @@ CCProgram splash-screen-vs %{
vec2 clipSpace = worldPos / u_resolution * 2.0 - 1.0;
vec4 screenPos = u_projection * vec4(clipSpace, 0.0, 1.0);
v_uv = a_texCoord;
v_percent = u_precent;
return screenPos;
}
}%
@@ -56,13 +53,15 @@ CCProgram splash-screen-fs %{
precision mediump float;
in vec2 v_uv;
in float v_percent;
uniform Factor {
float u_percent;
};
uniform sampler2D mainTexture;
vec4 frag () {
vec4 color = texture(mainTexture, v_uv);
float precent = clamp(v_percent, 0.0, 1.0);
color.xyz *= precent;
float percent = clamp(u_percent, 0.0, 1.0);
color.xyz *= percent;
return color;
}
}%
@@ -1,5 +1,5 @@
{
"ver": "1.4.7",
"ver": "1.4.8",
"importer": "effect",
"imported": true,
"uuid": "970b0598-bcb0-4714-91fb-2e81440dccd8",
+45 -1
View File
@@ -21,6 +21,10 @@ module.exports = {
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`,
@@ -67,8 +71,48 @@ module.exports = {
OctreeCulling: `${url}/${version}/manual/en/advanced-topics/native-scene-culling.html`,
},
},
ambient: {
skyLightingColor: 'Sky Color (Upper sphere lighting source).',
groundLightingColor: 'Ground Color (Lower sphere lighting source).',
skyIllum: 'Ambient lighting intensity.',
},
skybox: {
applyDiffuseMap: 'When checking, scene objects will use accurate diffusion map instead of hemisphere lighting.',
enabled: 'Enable or disable skybox rendering with Envmap cube texture settings.',
useIBL: 'When checking, scene objects will calculate image based lighting from Envmap settings with diffuse and specular-reflections. Otherwise objects only calculate hemisphere diffuse lighting.',
useHDR: 'Toggle HDR or LDR mode. Each mode has seperate light source settings, HDR mode uses physical luminosity unit with camera exposure attributes, and LDR mode uses none-unit without exposure calculations.',
envmap: 'Set skybox texture and environment light source. Support cross / longitude and latitude / 6-separated cube textures. Support hdr / tga / png file type.',
},
fog: {
enabled: 'Enable or disable global fog effect.',
accurate: 'Toggle vertex fog and pixel fog. Pixel fog has more accurate visual effect with low vertex count objects, but vertex fog has better performance.',
fogColor: 'Fog In-Scattering Color.',
type: 'Different calculation models.',
fogDensity: 'The larger the value, the more foggy it looks.',
fogStart: 'Fog will start with this value (world space unit). Increase this value if you want more clarity nearby.',
fogEnd: 'Further than this value (world space unit), will receive maximum fog effect.',
fogAtten: 'The smaller the value, the more foggy it looks.',
fogTop: 'Objects above this height value (world space unit) are not affected by fog.',
fogRange: 'Fog extends down this range value (world space unit) from the top point.',
},
shadow: {
enabled: 'Enable or disable real time shadows.',
normal: 'The normal of the plane which receives shadow.',
distance: 'The distance from coordinate origin to the receiving plane.',
saturation: 'Shadow saturation. This value should be 1.0, we recommend that you\'d rather increase ambient lighting than modify this value. ',
pcf: 'Enable soft shadows.',
bias: 'Bias value (world space unit) that can avoid moire artifacts with shadows. The more the value, the more the light leakage.',
normalBias: 'Bias value (world space unit) that can avoid moire artifacts with surfaces that parallel to the directional light.',
shadowMapSize: 'Shadowmap resolutions.',
fixedArea: 'Toggle CSM and fixed area shadows. When checking, shadow will not follow camera, it distributes around directional light position. It is a legacy mode that we do not recommend.',
near: 'Fix area start.',
far: 'Fix area end.',
orthoSize: 'Fix area size, the larger value, the lower precision of shadows.',
invisibleOcclusionRange: 'If some shadow near the camera is missing, increase this value (world space unit) to fix it.',
shadowDistance: 'Shadows do not appear beyond this distance (world space unit).',
},
animation: {
default_clip: 'When checking, the deault animation clip is automatically played.',
default_clip: 'When checking, the default animation clip is automatically played.',
clips: 'You can access and play animation clips via a script',
play_on_load: 'Automatically play animation clip with the scene is loaded',
use_baked_animation:
+44
View File
@@ -21,6 +21,10 @@ module.exports = {
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`,
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`,
@@ -67,6 +71,46 @@ module.exports = {
OctreeCulling: `${url}/${version}/manual/zh/advanced-topics/native-scene-culling.html`,
},
},
ambient: {
skyLightingColor: '天空颜色(上半球光照)',
groundLightingColor: '地面颜色(下半球光照)',
skyIllum: '环境光强度',
},
skybox: {
applyDiffuseMap: '勾选后,场景物体将使用更精确的漫反射图来取代默认的半球光照。',
enabled: '勾选后即可开启天空盒,使用设置的立方体贴图进行渲染',
useIBL: '勾选后,场景物体将使用设置的立方体贴图来进行环境光漫反射及镜面反射计算.',
useHDR: '切换高/低动态范围模式,每种模式都有自己独立的光源设定。\n高动态(HDR)模式会使用光度学灯光单位,配合相机镜头属性进行曝光计算,\n低动态(LDR)模式使用无单位光源和无曝光的镜头,更便于保留原图颜色',
envmap: '设置一个立方体贴图作为环境光源和天空盒,贴图类型包括十字型 HDR 贴图、经纬度图、手动创建的 CubeMap 等。目前支持 HDR/TGA/PNG 等文件格式。',
},
fog: {
enabled: '雾开关',
accurate: '切换顶点雾和像素雾。勾选该项则使用像素雾,像素雾在顶点数少面积大的物体上有更精确的雾化效果;顶点雾则有更好的性能。',
fogColor: '内散射颜色',
type: '不同的计算雾化模型,目前包括 LINEAR(线性雾)、EXP(指数雾)、EXP_SQUARED(指数平房雾)、LAYERED(层雾)。',
fogDensity: '该值越大雾气越浓',
fogStart: '雾效影响的起始位置',
fogEnd: '雾效影响的结束位置',
fogAtten: '雾化衰减系数,该值越小则雾越浓',
fogTop: '模型顶点在世界坐标系垂直方向上的位置,小于该位置时所有的顶点都会受到雾化效果的影响',
fogRange: '雾化效果从设置的 fogTop 往下所影响的范围',
},
shadow: {
enabled: '是否开启实时阴影',
normal: '阴影接收平面的法线,垂直于阴影,用于调整阴影的倾斜度',
distance: '阴影接收平面与原点的距离',
saturation: '阴影饱和度,建议设置为 1.0。若需要减小方向光阴影的饱和程度,推荐通过增加环境光来实现,而不是调节该值。',
pcf: '开启软阴影,目前支持 HARD(硬采样)、SOFT(4 倍采样)、SOFT_2X(9 倍采样)类型',
bias: '增加深度偏移值(世界空间单位)可以有效消除阴影摩尔纹,但是过大的值可能造成漏光现象',
normalBias: '法线深度偏移值(世界空间单位),可以消除物体表面朝向平行于阳光方向的阴影摩尔纹,防止曲面出现锯齿状;但是过大的值可能会造成阴影位置偏差',
shadowMapSize: '阴影贴图分辨率,目前支持 Low_256x256、Medium_512x512、High_1024x1024、Ultra_2048x2048 四种精度的纹理',
fixedArea: '切换固定区域和 CSM 模式。固定区域是一种旧模式,我们并不推荐使用。勾选该项则开启 CSM 模式,该模式下阴影会跟随方向光节点的位置,在方向光包围盒附近分布,而非跟随相机。',
near: '固定区域开始值',
far: '固定区域结束值',
orthoSize: '固定区域大小,该值越大则阴影精度越低',
invisibleOcclusionRange: '如果有背后的潜在投射物阴影丢失,请增大该值(世界空间单位)',
shadowDistance: '阴影有效距离(世界空间单位),该值越大则阴影精度越低',
},
animation: {
default_clip: '在勾选自动播放或调用 play() 时默认播放的动画 clip。',
clips: '通过脚本可以访问并播放的 AnimationClip 列表',
-11
View File
@@ -165,17 +165,6 @@ exports.ready = function() {
};
exports.methods = {
async apply() {
if (this.$.panelSection.style.display === 'none') {
return;
}
const metaList = this.$.panel.panelObject.metaList;
for (const meta of metaList) {
await Editor.Message.request('asset-db', 'save-asset-meta', meta.uuid, JSON.stringify(meta));
}
},
/**
* Update whether a data is editable in multi-select state
*/
+5 -3
View File
@@ -27,7 +27,7 @@
const NULL_PTR = BigInt(0);
// @ts-check
const isLittleEndian = new Uint8Array(new Uint32Array([0x12345678]).buffer)[0] === 0x78;
let refMap = {}; // prevent arguments from GC
let refMap = []; // prevent arguments from GC
const dataViews = [];
function getDataView (idx) {
@@ -44,7 +44,7 @@ function beginTrans (fn, minBytes) {
if (__fastMQInfo__[0] === 0 && commands === 0) {
// reset all reference at begining
refMap = {};
refMap.length = 0;
}
if (dataView.byteLength <= startPos + minBytes + 12) {
@@ -83,7 +83,9 @@ function beginTrans (fn, minBytes) {
writePointer (e) {
if (e) {
dataView.setBigUint64(startPos + offset, e.__native_ptr__, isLittleEndian);
refMap[e.__native_ptr__] ||= e;
if (refMap.indexOf(e) < 0) {
refMap.push(e);
}
} else {
dataView.setBigUint64(startPos + offset, NULL_PTR, isLittleEndian);
}
+53 -21
View File
@@ -90,24 +90,26 @@ describe('NewGen Anim', () => {
});
describe('Asset transition API', () => {
const graph = new AnimationGraph();
const layer = graph.addLayer();
const layerGraph = layer.stateMachine;
const n1 = layerGraph.addMotion();
const n2 = layerGraph.addMotion();
const trans1 = layerGraph.connect(n1, n2);
expect([...layerGraph.getOutgoings(n1)].map((t) => t.to)).toContain(n2);
expect([...layerGraph.getIncomings(n2)].map((t) => t.from)).toContain(n1);
// There may be multiple transitions between two nodes.
const trans2 = layerGraph.connect(n1, n2);
expect(trans2).not.toBe(trans1);
expect([...layerGraph.getTransition(n1, n2)]).toEqual(expect.arrayContaining([trans1, trans2]));
// Self transitions are also allowed.
const n3 = layerGraph.addMotion();
const selfTransition = layerGraph.connect(n3, n3);
expect([...layerGraph.getTransition(n3, n3)]).toMatchObject([selfTransition]);
test('Connect', () => {
const graph = new AnimationGraph();
const layer = graph.addLayer();
const layerGraph = layer.stateMachine;
const n1 = layerGraph.addMotion();
const n2 = layerGraph.addMotion();
const trans1 = layerGraph.connect(n1, n2);
expect([...layerGraph.getOutgoings(n1)].map((t) => t.to)).toContain(n2);
expect([...layerGraph.getIncomings(n2)].map((t) => t.from)).toContain(n1);
// There may be multiple transitions between two nodes.
const trans2 = layerGraph.connect(n1, n2);
expect(trans2).not.toBe(trans1);
expect([...layerGraph.getTransitionsBetween(n1, n2)]).toEqual(expect.arrayContaining([trans1, trans2]));
// Self transitions are also allowed.
const n3 = layerGraph.addMotion();
const selfTransition = layerGraph.connect(n3, n3);
expect([...layerGraph.getTransitionsBetween(n3, n3)]).toMatchObject([selfTransition]);
});
test('Remove transition by transition object', () => {
const graph = new AnimationGraph();
@@ -125,7 +127,7 @@ describe('NewGen Anim', () => {
layerGraph.removeTransition(trans2);
{
const transitions = Array.from(layerGraph.getTransition(n1, n2));
const transitions = Array.from(layerGraph.getTransitionsBetween(n1, n2));
expect(transitions).toHaveLength(2);
expect(transitions[0]).toBe(trans1);
expect(transitions[1]).toBe(trans3);
@@ -133,17 +135,47 @@ describe('NewGen Anim', () => {
layerGraph.removeTransition(trans1);
{
const transitions = Array.from(layerGraph.getTransition(n1, n2));
const transitions = Array.from(layerGraph.getTransitionsBetween(n1, n2));
expect(transitions).toHaveLength(1);
expect(transitions[0]).toBe(trans3);
}
layerGraph.removeTransition(trans3);
{
const transitions = Array.from(layerGraph.getTransition(n1, n2));
const transitions = Array.from(layerGraph.getTransitionsBetween(n1, n2));
expect(transitions).toHaveLength(0);
}
});
test('disconnect()', () => {
const graph = new AnimationGraph();
const layer = graph.addLayer();
const layerGraph = layer.stateMachine;
const n1 = layerGraph.addMotion();
const n2 = layerGraph.addMotion();
const n3 = layerGraph.addMotion();
const n4 = layerGraph.addMotion();
layerGraph.connect(n1, n1);
layerGraph.disconnect(n1, n1);
expect(Array.from(layerGraph.getTransitionsBetween(n1, n1))).toBeArrayOfSize(0);
layerGraph.connect(n1, n1);
layerGraph.connect(n1, n1);
layerGraph.disconnect(n1, n1);
expect(Array.from(layerGraph.getTransitionsBetween(n1, n1))).toBeArrayOfSize(0);
layerGraph.connect(n1, n2);
layerGraph.disconnect(n1, n2);
expect(Array.from(layerGraph.getTransitionsBetween(n1, n2))).toBeArrayOfSize(0);
layerGraph.connect(n1, n3);
layerGraph.connect(n1, n3);
layerGraph.connect(n1, n3);
layerGraph.disconnect(n1, n3);
expect(Array.from(layerGraph.getTransitionsBetween(n1, n3))).toBeArrayOfSize(0);
layerGraph.disconnect(n1, n4);
});
});
describe('Transitions', () => {