Esempio n. 1
0
    public override void OnEnable()
    {
        base.OnEnable();
        subs.Clear();
        subs.AddRange(GetComponentsInChildren <CB_WorkerGroupSubBase> ());

                #if UNITY_5_5_OR_NEWER
        if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.Direct3D11 || SystemInfo.graphicsDeviceType == GraphicsDeviceType.Direct3D12 ||
            SystemInfo.graphicsDeviceType == GraphicsDeviceType.Metal || SystemInfo.graphicsDeviceType == GraphicsDeviceType.PlayStation4 ||
            SystemInfo.graphicsDeviceType == GraphicsDeviceType.Vulkan || SystemInfo.graphicsDeviceType == GraphicsDeviceType.XboxOne)
        {
            _reversedZ = true;
        }
                #endif

        foreach (var item in subs)
        {
            item.On_Enable(mat_1_jitterOrigin);
        }

        if (CB_Lib.MatNeedCreate(mat_2_blur, mat_2_blurOrigin))
        {
            mat_2_blur = new Material(mat_2_blurOrigin);
        }

        //testRT = new RenderTexture (Resolution, Resolution, 0);
    }
    public virtual void On_Enable(Material m)
    {
        lightCB = GetComponentInChildren <CB_LightCB> ();
        lightCB.On_Enable();

        if (CB_Lib.MatNeedCreate(mat, m))
        {
            mat = new Material(m);
        }

        SetShadowMap();
        MatSyncAll();
    }
Esempio n. 3
0
 void InitMat()
 {
     for (int i = 0; i < matOrigins.Count; i++)
     {
         if (i >= mats.Count)
         {
                             #if UNITY_EDITOR
             UnityEditor.EditorUtility.SetDirty(gameObject);
                             #endif
             Material mat = new Material(matOrigins [i]);
             mats.Add(mat);
         }
         else if (CB_Lib.MatNeedCreate(mats [i], matOrigins [i]))
         {
                             #if UNITY_EDITOR
             UnityEditor.EditorUtility.SetDirty(gameObject);
                             #endif
             Material mat = new Material(matOrigins [i]);
             mats [i] = mat;
         }
     }
 }