public Vector2Value(Vector2Parameter parameter) { value = new float[2] { parameter.value[0], parameter.value[1] }; overrideState = parameter.overrideState; }
private void Start() { //Finds PostProcessing layer to apply effect. //Must have PostProcessing layer added in order for effect to work properly. layerIndex = LayerMask.NameToLayer("PostProcessing"); camera.GetComponent <PostProcessLayer>().volumeLayer = LayerMask.GetMask("PostProcessing"); //Creates vignette effect and sets default settings. vignette = ScriptableObject.CreateInstance <Vignette>(); vignette.enabled.Override(false); vignette.intensity.Override(0f); //Creates color grading effect and sets default settings. colorGrading = ScriptableObject.CreateInstance <ColorGrading>(); colorGrading.enabled.Override(false); //Gets settings to use from effect profile provided. vColor = postProfile.GetSetting <Vignette>().color; vCenter = postProfile.GetSetting <Vignette>().center; vSmoothness = postProfile.GetSetting <Vignette>().smoothness; vRoundness = postProfile.GetSetting <Vignette>().roundness; vRounded = postProfile.GetSetting <Vignette>().rounded; //Sets settings to approprate values. vignette.color.Override(vColor); vignette.center.Override(vCenter); vignette.smoothness.Override(vSmoothness); vignette.roundness.Override(vRoundness); vignette.rounded.Override(vRounded); //Creates volume for effect to be applied. volume = PostProcessManager.instance.QuickVolume(layerIndex, 0, vignette, colorGrading); volume.isGlobal = true; }
public static void Convert(this BIRPRendering.Vector2Parameter birpSource, Vector2Parameter target) { if (target == null) { return; } target.value = birpSource.value; target.overrideState = birpSource.overrideState; }
public static Vector2 GetVector2(this AIRuntimeController controller, string name) { NamedParameter param = controller.GetParameter(name); if (param is GameObjectParameter) { return(((GameObjectParameter)param).Value.transform.position); } Vector2Parameter v = (Vector2Parameter)controller.GetParameter(name); return(v != null ? v.Value : Vector2.zero); }
public void Fill(Vector2Parameter parameter) { parameter.value = new Vector2(value[0], value[1]); 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 static void SetVector2(this AIRuntimeController controller, string name, Vector2 value) { Vector2Parameter param = (Vector2Parameter)controller.GetParameter(name); param.Value = value; }
public static Vector2 GetValue(this AIRuntimeController controller, Vector2Parameter param) { return(string.IsNullOrEmpty(param.Name) ? param.Value : controller.GetVector2(param.Name)); }