public void Unregister(IParameterTexture target) { if (0 < target.parameterIndex) { _stack.Push(target.parameterIndex); target.parameterIndex = 0; } }
public void Register(IParameterTexture target) { Initialize(); if (target.parameterIndex <= 0 && 0 < _stack.Count) { target.parameterIndex = _stack.Pop(); } }
/// <summary> /// 注册一个参数图片 /// </summary> public void Register(IParameterTexture target) { Initialize(); if (target.ParameterIndex <= 0 && effectStack.Count > 0) { target.ParameterIndex = effectStack.Pop(); } }
/// <summary> /// Unregister the specified target. /// </summary> /// <param name="target">Target.</param> public void Unregister(IParameterTexture target) { if (0 < target.parameterIndex) { // Debug.LogFormat("<color=red>@@@ Unregister {0} : {1}</color>", target, target.parameterIndex); _stack.Push(target.parameterIndex); target.parameterIndex = 0; } }
/// <summary> /// Register the specified target. /// </summary> /// <param name="target">Target.</param> public void Register(IParameterTexture target) { Initialize(); if (target.parameterIndex <= 0 && 0 < _stack.Count) { target.parameterIndex = _stack.Pop(); // Debug.LogFormat("<color=green>@@@ Register {0} : {1}</color>", target, target.parameterIndex); } }
/// <summary> /// Sets the data. /// </summary> /// <param name="target">Target.</param> /// <param name="channelId">Channel identifier.</param> /// <param name="value">Value.</param> public void SetData(IParameterTexture target, int channelId, byte value) { int index = (target.parameterIndex - 1) * _channels + channelId; if (0 < target.parameterIndex && _data[index] != value) { _data[index] = value; _needUpload = true; } }
/// <summary> /// 数值参数图片数据 /// </summary> /// <param name="target">目标</param> /// <param name="channelId">参数位置</param> /// <param name="value">参数值值</param> public void SetData(IParameterTexture target, int channelId, byte value) { //如果在缓存池就不用更新了 if (target.ParameterIndex <= 0) { return; } int index = (target.ParameterIndex - 1) * channels + channelId; //数据没有改变不用更新 if (data[index] != value) { data[index] = value; needUpdate = true; } }
/// <summary> /// Sets the data. /// </summary> /// <param name="target">Target.</param> /// <param name="channelId">Channel identifier.</param> /// <param name="value">Value.</param> public void SetData(IParameterTexture target, int channelId, float value) { SetData(target, channelId, (byte)(Mathf.Clamp01(value) * 255)); }
/// <summary> /// Gets the index of the normalized. /// </summary> /// <returns>The normalized index.</returns> /// <param name="target">Target.</param> public float GetNormalizedIndex(IParameterTexture target) { return(((float)target.parameterIndex - 0.5f) / _instanceLimit); }