整理高斯模糊代码

This commit is contained in:
caizhitao
2020-02-07 09:30:12 +08:00
parent 02d94a943d
commit b5390ea84f
9 changed files with 54 additions and 47 deletions

View File

@@ -1,27 +1,27 @@
const { ccclass, property } = cc._decorator;
@ccclass
export default class GaussianBlurEffectScene extends cc.Component {
private _grayLevelSlider: cc.Slider = null;
private _grayLevelSliderLabel: cc.Label = null;
export default class GaussianBlurV1EffectScene extends cc.Component {
private _blurSlider: cc.Slider = null;
private _blurSliderLabel: cc.Label = null;
private _examplesParentNode: cc.Node = null;
onLoad() {
cc.dynamicAtlasManager.enabled = false;
this._grayLevelSlider = cc.find("Canvas/Content/Controller/GrayLevelSlider/Slider").getComponent(cc.Slider);
this._grayLevelSliderLabel = cc.find("Canvas/Content/Controller/GrayLevelSlider/ValueLabel").getComponent(cc.Label);
this._blurSlider = cc.find("Canvas/Content/Controller/BlurSlider/Slider").getComponent(cc.Slider);
this._blurSliderLabel = cc.find("Canvas/Content/Controller/BlurSlider/ValueLabel").getComponent(cc.Label);
this._examplesParentNode = cc.find("Canvas/Content/Examples");
}
onEnable() {
this._grayLevelSlider.node.on("slide", this._onSliderChanged, this);
this._blurSlider.node.on("slide", this._onSliderChanged, this);
}
onDisable() {
this._grayLevelSlider.node.off("slide", this._onSliderChanged, this);
this._blurSlider.node.off("slide", this._onSliderChanged, this);
}
start() {
@@ -29,7 +29,7 @@ export default class GaussianBlurEffectScene extends cc.Component {
}
private _onSliderChanged() {
this._grayLevelSliderLabel.string = `${this._grayLevelSlider.progress.toFixed(2)}`;
this._blurSliderLabel.string = `${this._blurSlider.progress.toFixed(2)}`;
// 更新材质
this._updateRenderComponentMaterial({});