示例#1
0
    /// <summary>
    /// Instanciates the necessary datastructures for the rendering of the velocity buffer and the post-processing effect.
    /// Basically it finds every gameobject that contains a MeshRenderer component and adds the ObjectEffectHandler script to that object.
    /// </summary>
    override protected void Start()
    {
        //sets up the ObjectEffectHandler script for each object that is rendered by the mesh renderer
        Object[] sceneObjects = GameObject.FindObjectsOfType(typeof(MeshRenderer));

        foreach (Object obj in sceneObjects)
        {
            if (obj is MeshRenderer)
            {
                GameObject gmObj = ((MeshRenderer)obj).gameObject;

                ObjectEffectHandler component = gmObj.GetComponent <ObjectEffectHandler>();
                if (component == null)
                {
                    gmObj.AddComponent <ObjectEffectHandler>();
                }
                else if (!component.enabled)
                {
                    component.enabled = true;
                }
            }
        }

        base.Start();
    }
示例#2
0
 /// <summary>
 /// Static function so that each ObjectEffectHandler can remove itself from the list of objects to be rendered
 /// to the velocity buffer. (OnDisable)
 /// </summary>
 /// <param name="obj">The instance of the ObjectEffectHandler</param>
 public static void RemoveEffectObject(ObjectEffectHandler obj)
 {
     if (EffectObjects.Contains(obj))
     {
         EffectObjects.Remove(obj);
     }
 }
示例#3
0
 /// <summary>
 /// Static function so that each ObjectEffectHandler can remove itself from the list of objects to be rendered
 /// to the velocity buffer. (OnDisable)
 /// </summary>
 /// <param name="obj">The instance of the ObjectEffectHandler</param>
 public static void RemoveEffectObject(ObjectEffectHandler obj)
 {
     if (EffectObjects.Contains(obj))
         EffectObjects.Remove(obj);
 }
示例#4
0
 /// <summary>
 /// Static function so that each ObjectEffectHandler can add itself into the list of objects to be rendered
 /// to the velocity buffer. (OnEnable)
 /// </summary>
 /// <param name="obj">The instance of the ObjectEffectHandler</param>
 public static void AddEffectObject(ObjectEffectHandler obj)
 {
     EffectObjects.Add(obj);
 }
示例#5
0
 /// <summary>
 /// Static function so that each ObjectEffectHandler can add itself into the list of objects to be rendered
 /// to the velocity buffer. (OnEnable)
 /// </summary>
 /// <param name="obj">The instance of the ObjectEffectHandler</param>
 public static void AddEffectObject(ObjectEffectHandler obj)
 {
     EffectObjects.Add(obj);
 }