Optimize the shader acquisition of planar shadows (#8234)

* Optimize the shader acquisition of planar shadows

* update memeory-pool
This commit is contained in:
troublemaker52025
2021-01-28 16:36:41 +08:00
committed by GitHub
parent 910c6233cb
commit 2f325e336d
2 changed files with 11 additions and 7 deletions
+5 -5
View File
@@ -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;
+6 -2
View File
@@ -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) {