mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 16:12:40 +08:00
509d73b27d
* PR1: add explicit function return type (#15311) * PR4: add explicit function return type (#15314) * [ci skip][AUTO]: Automated code generating update: 8843bfe54cd3f8e6f84432948716c8d130ecb233 (#15314) (#15357) Co-authored-by: cocos-robot <cocos-robot@cocos.com> * add function return type * fix version checking * fix return type --------- Co-authored-by: Cocos Robot <48829427+cocos-robot@users.noreply.github.com> Co-authored-by: cocos-robot <cocos-robot@cocos.com>
25 lines
926 B
TypeScript
25 lines
926 B
TypeScript
import { Camera } from '../../../render-scene/scene';
|
|
import { PostProcessSetting } from '../components/post-process-setting';
|
|
import { passContext } from '../utils/pass-context';
|
|
import { BasePass } from './base-pass';
|
|
|
|
export function getSetting<T extends PostProcessSetting> (settingClass: new () => T): T {
|
|
const cls: typeof PostProcessSetting = settingClass as any;
|
|
let setting = passContext.postProcess && passContext.postProcess.getSetting(cls) as T;
|
|
if (!setting) {
|
|
setting = cls.default as T;
|
|
}
|
|
return setting;
|
|
}
|
|
|
|
export abstract class SettingPass extends BasePass {
|
|
getSetting = getSetting
|
|
get setting (): PostProcessSetting { return this.getSetting(PostProcessSetting); }
|
|
|
|
checkEnable (camera: Camera): boolean {
|
|
const enable = super.checkEnable(camera);
|
|
const setting = this.setting;
|
|
return enable && !!setting && setting.enabledInHierarchy;
|
|
}
|
|
}
|