Esempio n. 1
0
    /// <summary>
    /// Removes the DepthTarget from a list of depth consumers.
    /// </summary>
    /// <param name="target">A DepthTarget instance, which uses depth.</param>
    public static void RemoveDepthTarget(MyDepthTarget target)
    {
        CheckAttachedToScene();

        if (s_DepthTargets.Contains(target))
        {
            s_DepthTargets.Remove(target);
        }
    }
Esempio n. 2
0
    /// <summary>
    /// Adds the DepthTarget to a list of depth consumers.
    /// </summary>
    /// <param name="target">A DepthTarget instance, which uses depth.</param>
    public static void AddDepthTarget(MyDepthTarget target)
    {
        CheckAttachedToScene();

        if (!s_DepthTargets.Contains(target))
        {
            s_DepthTargets.Add(target);

            if (target.DepthTargetMaterial != null)
            {
                SetDepthTexture(target);
            }
        }
    }
Esempio n. 3
0
    private static void SetDepthTexture(MyDepthTarget target)
    {
        Texture2D depthTexture = DepthTexture;

        if (target.SetAsMainTexture)
        {
            if (target.DepthTargetMaterial.mainTexture != depthTexture)
            {
                target.DepthTargetMaterial.mainTexture = depthTexture;
            }
        }
        else if (target.DepthTargetMaterial.GetTexture(k_CurrentDepthTexturePropertyName) !=
                 depthTexture)
        {
            target.DepthTargetMaterial.SetTexture(k_CurrentDepthTexturePropertyName,
                                                  depthTexture);
        }
    }