优化发光demo

This commit is contained in:
caizhitao
2019-12-26 15:59:40 +08:00
parent 3478800732
commit 9ba4d886b7
2 changed files with 4 additions and 5 deletions

View File

@@ -83,7 +83,7 @@ export default class GlowInnerEffectScene extends cc.Component {
this._glowThresholdSliderLabel.string = `${realGlowThresholdProgress.toFixed(2)}`; this._glowThresholdSliderLabel.string = `${realGlowThresholdProgress.toFixed(2)}`;
// 更新材质 // 更新材质
this._updateRenderComponentOutterGlowMaterial({ this._updateRenderComponentMaterial({
glowColor: cc.v4(this._redSlider.progress, this._greenSlider.progress, this._blueSlider.progress, this._alphaSlider.progress), glowColor: cc.v4(this._redSlider.progress, this._greenSlider.progress, this._blueSlider.progress, this._alphaSlider.progress),
glowColorSize: realGlowWidthProgress, glowColorSize: realGlowWidthProgress,
glowThreshold: realGlowThresholdProgress glowThreshold: realGlowThresholdProgress
@@ -97,7 +97,7 @@ export default class GlowInnerEffectScene extends cc.Component {
* 2. 给材质的 unitform 变量赋值 * 2. 给材质的 unitform 变量赋值
* 3. 重新将材质赋值回去 * 3. 重新将材质赋值回去
*/ */
private _updateRenderComponentOutterGlowMaterial(param: { private _updateRenderComponentMaterial(param: {
/** /**
* 发光宽度 [0.0, 1.0] * 发光宽度 [0.0, 1.0]
*/ */

View File

@@ -26,7 +26,6 @@ export default class GlowOutterEffectScene extends cc.Component {
// 关闭动态合图 // 关闭动态合图
cc.dynamicAtlasManager.enabled = false; cc.dynamicAtlasManager.enabled = false;
// cc.dynamicAtlasManager.showDebug(true);
this._redSlider = cc.find("Canvas/Content/Sliders/ColorRedSlider/Slider").getComponent(cc.Slider); this._redSlider = cc.find("Canvas/Content/Sliders/ColorRedSlider/Slider").getComponent(cc.Slider);
this._redSliderLabel = cc.find("Canvas/Content/Sliders/ColorRedSlider/ValueLabel").getComponent(cc.Label); this._redSliderLabel = cc.find("Canvas/Content/Sliders/ColorRedSlider/ValueLabel").getComponent(cc.Label);
@@ -87,7 +86,7 @@ export default class GlowOutterEffectScene extends cc.Component {
this._glowThresholdSliderLabel.string = `${realGlowThresholdProgress.toFixed(2)}`; this._glowThresholdSliderLabel.string = `${realGlowThresholdProgress.toFixed(2)}`;
// 更新材质 // 更新材质
this._updateRenderComponentOutterGlowMaterial({ this._updateRenderComponentMaterial({
glowColor: cc.v4(this._redSlider.progress, this._greenSlider.progress, this._blueSlider.progress, this._alphaSlider.progress), glowColor: cc.v4(this._redSlider.progress, this._greenSlider.progress, this._blueSlider.progress, this._alphaSlider.progress),
glowColorSize: realGlowWidthProgress, glowColorSize: realGlowWidthProgress,
glowThreshold: realGlowThresholdProgress glowThreshold: realGlowThresholdProgress
@@ -101,7 +100,7 @@ export default class GlowOutterEffectScene extends cc.Component {
* 2. 给材质的 unitform 变量赋值 * 2. 给材质的 unitform 变量赋值
* 3. 重新将材质赋值回去 * 3. 重新将材质赋值回去
*/ */
private _updateRenderComponentOutterGlowMaterial(param: { private _updateRenderComponentMaterial(param: {
/** /**
* 发光宽度 [0.0, 1.0] * 发光宽度 [0.0, 1.0]
*/ */