public Vector4Value(Vector4Parameter parameter) { value = new float[4] { parameter.value[0], parameter.value[1], parameter.value[2], parameter.value[3] }; overrideState = parameter.overrideState; }
public static void Convert(this BIRPRendering.Vector4Parameter birpSource, Vector4Parameter target, bool enabledState = true) { if (target == null) { return; } target.value = enabledState ? birpSource.value : new Vector4(1f, 1f, 1f, 0f); target.overrideState = birpSource.overrideState; }
public void AddParameter(Vector4Parameter ParameterName, Vector4 Value, bool IsPing) { if (IsPing) { if (Vector4ParametersPing.ContainsKey(ParameterName)) { Vector4ParametersPing.Remove(ParameterName); } Vector4ParametersPing.Add(ParameterName, Value); } else { if (Vector4ParametersPong.ContainsKey(ParameterName)) { Vector4ParametersPong.Remove(ParameterName); } Vector4ParametersPong.Add(ParameterName, Value); } }
private void Update() { playing = manager.players.Count > 0; rules += Time.deltaTime * (playing ? -1 : (manager.endGame ? -0.5f : 0.5f)); rules = Mathf.Clamp(rules, 0, 1); rulesImage.color = new Color(1, 1, 1, rules); if (on) { value += Time.deltaTime * (playing ? 1 : -0.5f); saturation += Time.deltaTime * (playing ? 200 : -100); value = Mathf.Clamp(value, -0.4f, 0.5f); saturation = Mathf.Clamp(saturation, -100, 75); customParameter.w = value; Vector4Parameter parameter = new Vector4Parameter(); parameter.value = customParameter; colorGradingLayer.gamma.value = parameter; colorGradingLayer.saturation.value = saturation; } }
public void Fill(Vector4Parameter parameter) { parameter.value = new Vector4(value[0], value[1], value[2], value[3]); parameter.overrideState = overrideState; }
private List <ConstantBuffer> ReflectConstantBuffers(ShaderReflection reflection) { var constantBuffers = new List <ConstantBuffer>(); for (int cBufferIndex = 0; cBufferIndex < reflection.Description.ConstantBuffers; cBufferIndex++) { var cb = reflection.GetConstantBuffer(cBufferIndex); var bindingDesc = reflection.GetResourceBindingDescription(cb.Description.Name); var buf = new Buffer(renderer.Device, cb.Description.Size, ResourceUsage.Dynamic, BindFlags.ConstantBuffer, CpuAccessFlags.Write, ResourceOptionFlags.None, sizeof(float)); var constantBuffer = new ConstantBuffer(buf, bindingDesc.BindPoint); for (int i = 0; i < cb.Description.VariableCount; i++) { var refVar = cb.GetVariable(i); var type = refVar.GetVariableType(); switch (type.Description.Type) { case ShaderVariableType.Float: if (type.Description.RowCount == 4 && type.Description.ColumnCount == 4) { var matParam = new MatrixParameter(refVar.Description.StartOffset); if (matParam.Size != refVar.Description.Size) { throw CargoEngineException.Create("Error ConstantBufferParamtersize"); } constantBuffer.AddParameter(refVar.Description.Name, matParam); } if (type.Description.RowCount == 1) { switch (type.Description.ColumnCount) { case 2: var vec2Param = new Vector2Parameter(refVar.Description.StartOffset); if (vec2Param.Size != refVar.Description.Size) { throw CargoEngineException.Create("Error ConstantBufferParamtersize"); } constantBuffer.AddParameter(refVar.Description.Name, vec2Param); break; case 3: var vec3Param = new Vector3Parameter(refVar.Description.StartOffset); if (vec3Param.Size != refVar.Description.Size) { throw CargoEngineException.Create("Error ConstantBufferParamtersize"); } constantBuffer.AddParameter(refVar.Description.Name, vec3Param); break; case 4: var vec4Param = new Vector4Parameter(refVar.Description.StartOffset); if (vec4Param.Size != refVar.Description.Size) { throw CargoEngineException.Create("Error ConstantBufferParamtersize"); } constantBuffer.AddParameter(refVar.Description.Name, vec4Param); break; } } break; } constantBuffers.Add(constantBuffer); } } return(constantBuffers); }
public void AddParameter(Vector4Parameter ValueParameter, Vector4 Value) { AddParameter(ValueParameter, Value, true); }