private void Start() { //No environmental lighting per default Shader.SetGlobalFloat("_ZEDExposure", -1); //Load the materials matStencilToMask = new Material(Resources.Load("Materials/PostProcessing/Mat_ZED_Stencil2Mask") as Material); matComposeMask = new Material(Resources.Load("Materials/PostProcessing/Mat_ZED_MaskCompositor") as Material); //Load and configure the post process postprocessMaterial = new Material(Resources.Load("Materials/PostProcessing/Mat_ZED_PostProcessing") as Material); postprocessMaterial.SetFloat("_gamma", 1.0f / (0.87f * 0.9f)); postprocessMaterial.SetFloat("_MinBlack", 15.0f / 255.0f); postprocessMaterial.SetInt("_NoiseSize", 2); //Configure the weights for the blur float[] weights; float[] offsets; ZEDPostProcessingTools.ComputeWeights(0.3f, out weights, out offsets); //Set the blur config to the shader, should be constant blurMaterial = new Material(Resources.Load("Materials/PostProcessing/Mat_ZED_Blur") as Material); blurMaterial.SetFloatArray("weights", weights); blurMaterial.SetFloatArray("offset", offsets); blurMaterial.SetTexture("_Mask", mask); // set up render texture for hands depth data to pass into the texture //handsDepthMapRenderTex = new RenderTexture (LeftHandsDepthMap.width, LeftHandsDepthMap.height, LeftHandsDepthMap.depth, LeftHandsDepthMap.format); //Force unity the 16:9 mode #if UNITY_EDITOR UnityEditor.PlayerSettings.SetAspectRatio(UnityEditor.AspectRatio.Aspect16by9, true); UnityEditor.PlayerSettings.SetAspectRatio(UnityEditor.AspectRatio.Aspect16by10, false); UnityEditor.PlayerSettings.SetAspectRatio(UnityEditor.AspectRatio.Aspect4by3, false); UnityEditor.PlayerSettings.SetAspectRatio(UnityEditor.AspectRatio.Aspect5by4, false); #endif CreateRenderTexture(); //Load the blender for the zedmesher blender = new Material(Resources.Load("Materials/SpatialMapping/Mat_ZED_PostProcess_Blend") as Material); //Set the bounds larger bounds = new Bounds(transform.position, new Vector3(20, 20, 20)); // If AR REMOVE aspectRatio = new WindowAspectRatio(mainCamera); }
private void Window_SourceInitialized(object sender, EventArgs ea) { WindowAspectRatio.Register((Window)sender); }
private void OnLoad(object sender, System.Windows.RoutedEventArgs e) { WindowAspectRatio.Register((Window)this); }
public static void Register(ViewWindow window) { _ = new WindowAspectRatio(window); }
/* Aspect Ratio */ private void Window_SourceInitialized(object sender, EventArgs e) { WindowAspectRatio.Register((Window)sender, new Rect(0, TitleBar.ActualHeight, 0, 0)); }