mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-19 14:52:40 +08:00
Optimize effect dependency and package size (#15650)
This commit is contained in:
committed by
GitHub
parent
4b62d5d813
commit
50d9179bbe
+9
-13
@@ -8,9 +8,7 @@
|
||||
"970b0598-bcb0-4714-91fb-2e81440dccd8",
|
||||
"bcd64cc6-2dd9-43f6-abbe-66318d332032",
|
||||
"d930590d-bb92-4cc8-8bd1-23cd027f9edf",
|
||||
"a3cd009f-0ab0-420d-9278-b9fdab939bbc",
|
||||
"5c601d96-e4c7-4698-991b-7ee674b11079",
|
||||
"9361fd90-ba52-4f84-aa93-6e878fd576ca"
|
||||
"a3cd009f-0ab0-420d-9278-b9fdab939bbc"
|
||||
]
|
||||
},
|
||||
"gfx-webgl": {
|
||||
@@ -25,17 +23,9 @@
|
||||
"3d": {
|
||||
"modules": ["3d"],
|
||||
"dependentAssets": [
|
||||
"1baf0fc9-befa-459c-8bdd-af1a450a0319",
|
||||
"511d2633-09a7-4bdd-ac42-f778032124b3",
|
||||
"5d45aa00-e064-4938-b314-4265f0c2258c",
|
||||
"28d6d6b8-3f66-4a73-9795-17a0852ba2d4",
|
||||
"ec8106fe-05bf-4e94-943c-e0d3b7bb5e45",
|
||||
"620b6bf3-0369-4560-837f-2a2c00b73c26",
|
||||
"2df0a40b-26c2-47ce-be0d-4d3cd4164737",
|
||||
"39f74202-ead5-4a45-b966-273d526adbf1",
|
||||
"8f6ac413-2f1e-4b88-b26f-54556b5dd510",
|
||||
"45e7c0c8-2699-4912-b45f-d42bb8384189",
|
||||
"84ac6f69-3086-455a-86a4-561da8ee710b"
|
||||
"9361fd90-ba52-4f84-aa93-6e878fd576ca"
|
||||
]
|
||||
},
|
||||
"animation": {
|
||||
@@ -199,7 +189,13 @@
|
||||
"cafd95c9-c558-46f9-9812-1224b65c09ee",
|
||||
"28d6d6b8-3f66-4a73-9795-17a0852ba2d4",
|
||||
"2df0a40b-26c2-47ce-be0d-4d3cd4164737",
|
||||
"dace6a58-1705-48c7-a275-70afc9534e88"
|
||||
"dace6a58-1705-48c7-a275-70afc9534e88",
|
||||
"ec8106fe-05bf-4e94-943c-e0d3b7bb5e45",
|
||||
"39f74202-ead5-4a45-b966-273d526adbf1",
|
||||
"8f6ac413-2f1e-4b88-b26f-54556b5dd510",
|
||||
"45e7c0c8-2699-4912-b45f-d42bb8384189",
|
||||
"84ac6f69-3086-455a-86a4-561da8ee710b",
|
||||
"5c601d96-e4c7-4698-991b-7ee674b11079"
|
||||
]
|
||||
},
|
||||
"websocket": {
|
||||
|
||||
@@ -189,7 +189,6 @@ const legacyBuiltinEffectNames = [
|
||||
'post-process',
|
||||
'profiler',
|
||||
'splash-screen',
|
||||
'standard',
|
||||
'unlit',
|
||||
'sprite',
|
||||
'particle',
|
||||
|
||||
@@ -26,7 +26,7 @@ import { EDITOR_NOT_IN_PREVIEW } from 'internal:constants';
|
||||
import { builtinResMgr } from '../../asset/asset-manager';
|
||||
import { Material } from '../../asset/assets';
|
||||
import { AttributeName, Format, Attribute, FormatInfos } from '../../gfx';
|
||||
import { Mat4, Vec2, Vec3, Vec4, pseudoRandom, Quat, EPSILON, approx, RecyclePool } from '../../core';
|
||||
import { Mat4, Vec2, Vec3, Vec4, pseudoRandom, Quat, EPSILON, approx, RecyclePool, warn } from '../../core';
|
||||
import { MaterialInstance, IMaterialInstanceInfo } from '../../render-scene/core/material-instance';
|
||||
import { MacroRecord } from '../../render-scene/core/pass-utils';
|
||||
import { AlignmentSpace, RenderMode, Space } from '../enum';
|
||||
@@ -680,7 +680,7 @@ export default class ParticleSystemRendererCPU extends ParticleSystemRendererBas
|
||||
} else if (renderMode === RenderMode.Mesh) {
|
||||
this._defines[CC_RENDER_MODE] = RENDER_MODE_MESH;
|
||||
} else {
|
||||
console.warn(`particle system renderMode ${renderMode} not support.`);
|
||||
warn(`particle system renderMode ${renderMode} not support.`);
|
||||
}
|
||||
const textureModule = ps._textureAnimationModule;
|
||||
if (textureModule && textureModule.enable) {
|
||||
|
||||
@@ -27,7 +27,7 @@ import { builtinResMgr } from '../../asset/asset-manager';
|
||||
import { Material, Texture2D } from '../../asset/assets';
|
||||
import { Component } from '../../scene-graph';
|
||||
import { AttributeName, Format, Attribute, API, deviceManager, FormatInfos } from '../../gfx';
|
||||
import { Mat4, Vec2, Vec4, Quat, Vec3 } from '../../core';
|
||||
import { Mat4, Vec2, Vec4, Quat, Vec3, warn } from '../../core';
|
||||
import { MaterialInstance, IMaterialInstanceInfo } from '../../render-scene/core/material-instance';
|
||||
import { MacroRecord } from '../../render-scene/core/pass-utils';
|
||||
import { AlignmentSpace, RenderMode, Space } from '../enum';
|
||||
@@ -611,7 +611,7 @@ export default class ParticleSystemRendererGPU extends ParticleSystemRendererBas
|
||||
} else if (renderMode === RenderMode.Mesh) {
|
||||
this._defines[CC_RENDER_MODE] = RENDER_MODE_MESH;
|
||||
} else {
|
||||
console.warn(`particle system renderMode ${renderMode} not support.`);
|
||||
warn(`particle system renderMode ${renderMode} not support.`);
|
||||
}
|
||||
const textureModule = ps._textureAnimationModule;
|
||||
if (textureModule && textureModule.enable) {
|
||||
|
||||
@@ -350,25 +350,6 @@ export class Shadows {
|
||||
return passes.length > 0 ? passes[0].getShaderVariant(patches) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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();
|
||||
this._instancingMaterial.initialize({ effectName: 'pipeline/planar-shadow', defines: { USE_INSTANCING: true } });
|
||||
}
|
||||
|
||||
const passes = this._instancingMaterial.passes;
|
||||
if (DEBUG) {
|
||||
assert(passes.length > 0, 'passes should not be empty!');
|
||||
}
|
||||
return passes.length > 0 ? passes[0].getShaderVariant(patches) : null;
|
||||
}
|
||||
|
||||
public initialize (shadowsInfo: ShadowsInfo) {
|
||||
this._enabled = shadowsInfo.enabled;
|
||||
this._type = this.enabled ? shadowsInfo.type : SHADOW_TYPE_NONE;
|
||||
@@ -406,10 +387,6 @@ export class Shadows {
|
||||
this._material = new Material();
|
||||
this._material.initialize({ effectName: 'pipeline/planar-shadow' });
|
||||
}
|
||||
if (!this._instancingMaterial) {
|
||||
this._instancingMaterial = new Material();
|
||||
this._instancingMaterial.initialize({ effectName: 'pipeline/planar-shadow', defines: { USE_INSTANCING: true } });
|
||||
}
|
||||
const root = cclegacy.director.root;
|
||||
const pipeline = root.pipeline;
|
||||
pipeline.macros.CC_SHADOW_TYPE = 1;
|
||||
|
||||
Vendored
-9
@@ -6,15 +6,6 @@ import { game, Game } from "../../cocos/game";
|
||||
export function initBuiltinMaterial () {
|
||||
const materialsToBeCompiled: any[] = [];
|
||||
|
||||
// standard material
|
||||
const standardMtl = new Material();
|
||||
standardMtl._uuid = 'standard-material';
|
||||
standardMtl.initialize({
|
||||
effectName: 'builtin-standard',
|
||||
});
|
||||
builtinResMgr.addAsset(standardMtl._uuid, standardMtl);
|
||||
materialsToBeCompiled.push(standardMtl);
|
||||
|
||||
// material indicating missing effect (yellow)
|
||||
const missingEfxMtl = new Material();
|
||||
missingEfxMtl._uuid = 'missing-effect-material';
|
||||
|
||||
Reference in New Issue
Block a user