GetTerrainSystemResolution() private method

private GetTerrainSystemResolution ( Terrain terrain, int &width, int &height, int &numChunksInX, int &numChunksInY ) : bool
terrain UnityEngine.Terrain
width int
height int
numChunksInX int
numChunksInY int
return bool
        void ShowRealtimeLMGUI(Terrain terrain)
        {
            EditorGUI.indentLevel += 1;

            Hash128 inputSystemHash;

            if (terrain != null && LightmapEditorSettings.GetInputSystemHash(terrain.GetInstanceID(), out inputSystemHash))
            {
                ShowRealtimeLightmapPreview(inputSystemHash);
            }

            // Resolution of the system.
            int width, height;
            int numChunksInX, numChunksInY;

            if (LightmapEditorSettings.GetTerrainSystemResolution(terrain, out width, out height, out numChunksInX, out numChunksInY))
            {
                var str = width.ToString() + "x" + height.ToString();
                if (numChunksInX > 1 || numChunksInY > 1)
                {
                    str += string.Format(" ({0}x{1} chunks)", numChunksInX, numChunksInY);
                }
                EditorGUILayout.LabelField(Styles.RealtimeLMResolution, GUIContent.Temp(str));
            }

            EditorGUI.indentLevel -= 1;
        }
示例#2
0
        void ShowRealtimeLMGUI(Terrain terrain)
        {
            Hash128 inputSystemHash;

            if (terrain == null || !LightmapEditorSettings.GetInputSystemHash(terrain.GetInstanceID(), out inputSystemHash) || inputSystemHash == new Hash128())
            {
                return; // early return since we don't have any lightmaps for it
            }
            if (!UpdateRealtimeTexture(inputSystemHash, terrain.GetInstanceID()))
            {
                return;
            }

            m_ShowRealtimeLM.value = EditorGUILayout.Foldout(m_ShowRealtimeLM.value, Styles.RealtimeLM, true);

            if (!m_ShowRealtimeLM.value)
            {
                return;
            }

            EditorGUI.indentLevel += 1;

            GUILayout.BeginHorizontal();

            DrawLightmapPreview(m_CachedRealtimeTexture.texture, true, terrain.GetInstanceID());

            GUILayout.BeginVertical();

            // Resolution of the system.
            int width, height;
            int numChunksInX, numChunksInY;

            if (LightmapEditorSettings.GetTerrainSystemResolution(terrain, out width, out height, out numChunksInX, out numChunksInY))
            {
                var str = width.ToString() + "x" + height.ToString();
                if (numChunksInX > 1 || numChunksInY > 1)
                {
                    str += string.Format(" ({0}x{1} chunks)", numChunksInX, numChunksInY);
                }
                GUILayout.Label(Styles.RealtimeLMResolution.text + ": " + str);
            }

            GUILayout.EndVertical();
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            EditorGUI.indentLevel -= 1;

            GUILayout.Space(5);
        }
        private void ShowRealtimeLMGUI(Terrain terrain)
        {
            int num;
            int num2;
            int num3;
            int num4;

            EditorGUI.indentLevel++;
            if (LightmapEditorSettings.GetTerrainSystemResolution(terrain, out num, out num2, out num3, out num4))
            {
                string text = num.ToString() + "x" + num2.ToString();
                if ((num3 > 1) || (num4 > 1))
                {
                    text = text + string.Format(" ({0}x{1} chunks)", num3, num4);
                }
                EditorGUILayout.LabelField(s_Styles.RealtimeLMResolution, new GUIContent(text), new GUILayoutOption[0]);
            }
            EditorGUI.indentLevel--;
        }
        private void ShowRealtimeLMGUI(Terrain terrain)
        {
            ++EditorGUI.indentLevel;
            int width;
            int height;
            int numChunksInX;
            int numChunksInY;

            if (LightmapEditorSettings.GetTerrainSystemResolution(terrain, out width, out height, out numChunksInX, out numChunksInY))
            {
                string text = width.ToString() + "x" + height.ToString();
                if (numChunksInX > 1 || numChunksInY > 1)
                {
                    text += string.Format(" ({0}x{1} chunks)", (object)numChunksInX, (object)numChunksInY);
                }
                EditorGUILayout.LabelField(LightingWindowObjectTab.s_Styles.RealtimeLMResolution, new GUIContent(text), new GUILayoutOption[0]);
            }
            --EditorGUI.indentLevel;
        }
示例#5
0
        void ShowRealtimeLMGUI(Terrain terrain)
        {
            EditorGUI.indentLevel += 1;

            // Resolution of the system.
            int width, height;
            int numChunksInX, numChunksInY;

            if (LightmapEditorSettings.GetTerrainSystemResolution(terrain, out width, out height, out numChunksInX, out numChunksInY))
            {
                var str = width.ToString() + "x" + height.ToString();
                if (numChunksInX > 1 || numChunksInY > 1)
                {
                    str += string.Format(" ({0}x{1} chunks)", numChunksInX, numChunksInY);
                }
                EditorGUILayout.LabelField(s_Styles.RealtimeLMResolution, GUIContent.Temp(str));
            }

            EditorGUI.indentLevel -= 1;
        }