mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 16:12:40 +08:00
Optimize the shader acquisition of planar shadows (#8234)
* Optimize the shader acquisition of planar shadows * update memeory-pool
This commit is contained in:
committed by
GitHub
parent
910c6233cb
commit
2f325e336d
@@ -1175,11 +1175,11 @@ export enum ShadowsView {
|
||||
BIAS,
|
||||
ORTHO_SIZE,
|
||||
AUTO_ADAPT, // boolean
|
||||
COLOR = 15, // Vec4
|
||||
SIZE = 19, // Vec2
|
||||
NORMAL = 21, // Vec3
|
||||
MAT_LIGHT = 24, // Mat4
|
||||
COUNT = 40
|
||||
COLOR = 14, // Vec4
|
||||
SIZE = 18, // Vec2
|
||||
NORMAL = 20, // Vec3
|
||||
MAT_LIGHT = 23, // Mat4
|
||||
COUNT = 39
|
||||
}
|
||||
interface IShadowsViewType extends BufferTypeManifest<typeof ShadowsView> {
|
||||
[ShadowsView.ENABLE]: number;
|
||||
|
||||
@@ -319,9 +319,13 @@ export class Shadows {
|
||||
}
|
||||
|
||||
public getPlanarShader (patches: IMacroPatch[] | null): ShaderHandle {
|
||||
this._updatePlanarInfo();
|
||||
if (!this._material) {
|
||||
this._material = new Material();
|
||||
this._material.initialize({ effectName: 'planar-shadow' });
|
||||
ShadowsPool.set(this._handle, ShadowsView.PLANAR_PASS, this._material.passes[0].handle);
|
||||
}
|
||||
|
||||
return this._material!.passes[0].getShaderVariant(patches);
|
||||
return this._material.passes[0].getShaderVariant(patches);
|
||||
}
|
||||
|
||||
public initialize (shadowsInfo: ShadowsInfo) {
|
||||
|
||||
Reference in New Issue
Block a user