Exemplo n.º 1
0
        public void OnGUI()
        {
            if (m_SceneManager == null)
            {
                m_SceneManager = FindObjectOfType <RaytracingSceneManager>();
                m_SceneManager.UpdateWorld();
                m_SceneManager.onSceneChanged += OnSceneChange;
            }

            if (m_TracerRenderTexture == null)
            {
                m_TracerRenderTexture = m_RayTracer.texture;
            }

            EditorGUILayout.HelpBox(k_HintBoxText, MessageType.Info);

            var tex = m_TracerRenderTexture;

            if (tex == null)
            {
                return;
            }

            var rect = GUILayoutUtility.GetRect(tex.width, tex.height);

            EditorGUI.DrawPreviewTexture(rect, m_TracerRenderTexture, null, ScaleMode.ScaleToFit);
        }
Exemplo n.º 2
0
        void OnEnable()
        {
            minSize = new Vector2(200, 100);
            maxSize = new Vector2(1600, 800);
            EnsureRaySceneManager();

            m_RayTracer = new BatchedTracer(m_SceneManager.Spheres, CameraFrame.Default, 400, 200)
            {
                ClearOnDraw = true
            };
            m_TracerRenderTexture = m_RayTracer.texture;
            m_SceneManager        = FindObjectOfType <RaytracingSceneManager>();
            m_SceneManager.UpdateWorld();
            m_SceneManager.onSceneChanged += OnSceneChange;

            if (FindObjectOfType <RaytracingSceneManager>() == null)
            {
                EditorSceneManager.LoadScene("ChapterEight");
            }

            m_SceneManager.UpdateWorld();
            OnSceneChange();
        }