mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 07:42:38 +08:00
add a switch for planar shadow
This commit is contained in:
@@ -983,8 +983,10 @@ export abstract class RenderPipeline {
|
||||
this._globalBindings.get(UBOGlobal.BLOCK.name)!.buffer!.update(this._defaultUboGlobal.view.buffer);
|
||||
|
||||
const planarShadow = scene.planarShadow;
|
||||
planarShadow.updateDirLight(scene.mainLight);
|
||||
this._globalBindings.get(UBOShadow.BLOCK.name)!.buffer!.update(planarShadow.data);
|
||||
if (planarShadow.enabled) {
|
||||
planarShadow.updateDirLight(scene.mainLight);
|
||||
this._globalBindings.get(UBOShadow.BLOCK.name)!.buffer!.update(planarShadow.data);
|
||||
}
|
||||
}
|
||||
|
||||
protected sceneCulling (view: RenderView) {
|
||||
|
||||
@@ -11,6 +11,14 @@ const _qt = new Quat();
|
||||
|
||||
export class PlanarShadow {
|
||||
|
||||
set enabled (enable: boolean) {
|
||||
this._enabled = enable;
|
||||
}
|
||||
|
||||
get enabled (): boolean {
|
||||
return this._enabled;
|
||||
}
|
||||
|
||||
set normal (val: Vec3) {
|
||||
vec3.copy(this._normal, val);
|
||||
}
|
||||
@@ -38,6 +46,7 @@ export class PlanarShadow {
|
||||
}
|
||||
|
||||
protected _scene: RenderScene;
|
||||
protected _enabled: boolean = false;
|
||||
protected _normal = new Vec3(0, 1, 0);
|
||||
protected _distance = 0;
|
||||
protected _matLight = new Mat4();
|
||||
|
||||
@@ -133,6 +133,8 @@ cc.SkyboxInfo = SkyboxInfo;
|
||||
|
||||
@ccclass('cc.PlanarShadowInfo')
|
||||
export class PlanarShadowInfo {
|
||||
@property
|
||||
protected _enabled = false;
|
||||
@property
|
||||
protected _normal = new Vec3(0, 1, 0);
|
||||
@property
|
||||
@@ -142,6 +144,15 @@ export class PlanarShadowInfo {
|
||||
|
||||
protected _resource: PlanarShadow | null = null;
|
||||
|
||||
@property({ type: Boolean })
|
||||
set enabled (val: boolean) {
|
||||
this._enabled = val;
|
||||
if (this._resource) { this._resource.enabled = val; }
|
||||
}
|
||||
get enabled () {
|
||||
return this._enabled;
|
||||
}
|
||||
|
||||
@property({ type: Vec3 })
|
||||
set normal (val: Vec3) {
|
||||
vec3.copy(this._normal, val);
|
||||
|
||||
Reference in New Issue
Block a user