Ejemplo n.º 1
0
    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);
    }
Ejemplo n.º 2
0
 private void Window_SourceInitialized(object sender, EventArgs ea)
 {
     WindowAspectRatio.Register((Window)sender);
 }
Ejemplo n.º 3
0
 private void OnLoad(object sender, System.Windows.RoutedEventArgs e)
 {
     WindowAspectRatio.Register((Window)this);
 }
Ejemplo n.º 4
0
 public static void Register(ViewWindow window)
 {
     _ = new WindowAspectRatio(window);
 }
Ejemplo n.º 5
0
        /* Aspect Ratio */

        private void Window_SourceInitialized(object sender, EventArgs e)
        {
            WindowAspectRatio.Register((Window)sender, new Rect(0, TitleBar.ActualHeight, 0, 0));
        }