Exemple #1
0
        public void SetupCullingSetsBoundingSpheresAndCullingIndices()
        {
            Light2D.SetupCulling(default(ScriptableRenderContext), Camera.main);

            Assert.NotNull(Light2DManager.boundingSpheres);
            Assert.AreEqual(1024, Light2DManager.boundingSpheres.Length);
            Assert.AreEqual(0, m_TestLight.lightCullingIndex);
        }
Exemple #2
0
        public IEnumerator IsLightVisibleReturnsTrueIfInCameraView()
        {
            var camera = m_TestObject1.AddComponent <Camera>();
            var light  = m_TestObject2.AddComponent <Light2D>();

            light.transform.position = camera.transform.position;
            Light2D.SetupCulling(camera);

            yield return(null);

            Assert.IsTrue(light.IsLightVisible(camera));
        }
Exemple #3
0
        public IEnumerator IsLightVisibleReturnsFalseIfNotInCameraView()
        {
            var camera = m_TestObject1.AddComponent <Camera>();
            var light  = m_TestObject2.AddComponent <Light2D>();

            light.transform.position = camera.transform.position + new Vector3(9999.0f, 0.0f, 0.0f);
            Light2D.SetupCulling(camera);

            yield return(null);

            Assert.IsFalse(light.IsLightVisible(camera));
        }
Exemple #4
0
        public void IsLightVisibleReturnsTrueIfInCameraView()
        {
            var camera = m_TestObject1.AddComponent <Camera>();
            var light  = m_TestObject2.AddComponent <Light2D>();

            light.transform.position = camera.transform.position;
            Light2D.SetupCulling(default(ScriptableRenderContext), camera);

            // We can only verify the results after culling is done on this camera.
            camera.Render();

            Assert.IsTrue(light.IsLightVisible(camera));
        }