Beispiel #1
0
        void ShowAtlasGUI(int instanceID)
        {
            EditorGUI.indentLevel += 1;

            Hash128 instanceHash;

            LightmapEditorSettings.GetPVRInstanceHash(instanceID, out instanceHash);
            EditorGUILayout.LabelField(s_Styles.PVRInstanceHash, GUIContent.Temp(instanceHash.ToString()));

            Hash128 atlasHash;

            LightmapEditorSettings.GetPVRAtlasHash(instanceID, out atlasHash);
            EditorGUILayout.LabelField(s_Styles.PVRAtlasHash, GUIContent.Temp(atlasHash.ToString()));

            int atlasInstanceOffset;

            LightmapEditorSettings.GetPVRAtlasInstanceOffset(instanceID, out atlasInstanceOffset);
            EditorGUILayout.LabelField(s_Styles.PVRAtlasInstanceOffset, GUIContent.Temp(atlasInstanceOffset.ToString()));

            EditorGUILayout.LabelField(s_Styles.AtlasIndex, GUIContent.Temp(m_LightmapIndex.intValue.ToString()));
            EditorGUILayout.LabelField(s_Styles.AtlasTilingX, GUIContent.Temp(m_LightmapTilingOffsetX.floatValue.ToString()));
            EditorGUILayout.LabelField(s_Styles.AtlasTilingY, GUIContent.Temp(m_LightmapTilingOffsetY.floatValue.ToString()));
            EditorGUILayout.LabelField(s_Styles.AtlasOffsetX, GUIContent.Temp(m_LightmapTilingOffsetZ.floatValue.ToString()));
            EditorGUILayout.LabelField(s_Styles.AtlasOffsetY, GUIContent.Temp(m_LightmapTilingOffsetW.floatValue.ToString()));
            EditorGUI.indentLevel -= 1;
        }
Beispiel #2
0
        private void ShowAtlasGUI(int instanceID)
        {
            EditorGUI.indentLevel++;
            Hash128 hash;

            LightmapEditorSettings.GetPVRInstanceHash(instanceID, out hash);
            EditorGUILayout.LabelField(LightingSettingsInspector.s_Styles.PVRInstanceHash, GUIContent.Temp(hash.ToString()), new GUILayoutOption[0]);
            Hash128 hash2;

            LightmapEditorSettings.GetPVRAtlasHash(instanceID, out hash2);
            EditorGUILayout.LabelField(LightingSettingsInspector.s_Styles.PVRAtlasHash, GUIContent.Temp(hash2.ToString()), new GUILayoutOption[0]);
            int num;

            LightmapEditorSettings.GetPVRAtlasInstanceOffset(instanceID, out num);
            EditorGUILayout.LabelField(LightingSettingsInspector.s_Styles.PVRAtlasInstanceOffset, GUIContent.Temp(num.ToString()), new GUILayoutOption[0]);
            EditorGUILayout.LabelField(LightingSettingsInspector.s_Styles.AtlasIndex, GUIContent.Temp(this.m_LightmapIndex.intValue.ToString()), new GUILayoutOption[0]);
            EditorGUILayout.LabelField(LightingSettingsInspector.s_Styles.AtlasTilingX, GUIContent.Temp(this.m_LightmapTilingOffsetX.floatValue.ToString()), new GUILayoutOption[0]);
            EditorGUILayout.LabelField(LightingSettingsInspector.s_Styles.AtlasTilingY, GUIContent.Temp(this.m_LightmapTilingOffsetY.floatValue.ToString()), new GUILayoutOption[0]);
            EditorGUILayout.LabelField(LightingSettingsInspector.s_Styles.AtlasOffsetX, GUIContent.Temp(this.m_LightmapTilingOffsetZ.floatValue.ToString()), new GUILayoutOption[0]);
            EditorGUILayout.LabelField(LightingSettingsInspector.s_Styles.AtlasOffsetY, GUIContent.Temp(this.m_LightmapTilingOffsetW.floatValue.ToString()), new GUILayoutOption[0]);
            EditorGUI.indentLevel--;
        }
        void ShowAtlasGUI(int instanceID)
        {
            if (m_LightmapIndex == null)
            {
                return;
            }

            Hash128 contentHash = LightmapVisualizationUtility.GetBakedGITextureHash(m_LightmapIndex.intValue, 0, GITextureType.Baked);

            // if we need to fetch a new texture
            if (m_CachedBakedTexture.texture == null || m_CachedBakedTexture.contentHash != contentHash)
            {
                m_CachedBakedTexture = LightmapVisualizationUtility.GetBakedGITexture(m_LightmapIndex.intValue, 0, GITextureType.Baked);
            }

            if (m_CachedBakedTexture.texture == null)
            {
                return;
            }

            EditorGUI.indentLevel += 1;

            GUILayout.BeginHorizontal();
            GUILayout.Space(30);

            Rect rect = GUILayoutUtility.GetRect(100, 100, EditorStyles.objectField);

            EditorGUI.Toggle(rect, false, EditorStyles.objectFieldThumb);

            if (rect.Contains(Event.current.mousePosition))
            {
                Object    actualTargetObject = m_CachedBakedTexture.texture;
                Component com = actualTargetObject as Component;

                if (com)
                {
                    actualTargetObject = com.gameObject;
                }

                if (Event.current.clickCount == 2)
                {
                    LightmapPreviewWindow.CreateLightmapPreviewWindow(m_Renderers[0].GetInstanceID(), false, false);
                }
                else if (Event.current.clickCount == 1)
                {
                    EditorGUI.PingObjectOrShowPreviewOnClick(actualTargetObject, GUILayoutUtility.GetLastRect());
                }
            }

            if (Event.current.type == EventType.Repaint)
            {
                rect = EditorStyles.objectFieldThumb.padding.Remove(rect);
                EditorGUI.DrawPreviewTexture(rect, m_CachedBakedTexture.texture);
            }

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

            EditorGUILayout.LabelField(Styles.AtlasIndex, GUIContent.Temp(m_LightmapIndex.intValue.ToString()));
            EditorGUILayout.LabelField(Styles.AtlasTilingX, GUIContent.Temp(m_LightmapTilingOffsetX.floatValue.ToString()));
            EditorGUILayout.LabelField(Styles.AtlasTilingY, GUIContent.Temp(m_LightmapTilingOffsetY.floatValue.ToString()));
            EditorGUILayout.LabelField(Styles.AtlasOffsetX, GUIContent.Temp(m_LightmapTilingOffsetZ.floatValue.ToString()));
            EditorGUILayout.LabelField(Styles.AtlasOffsetY, GUIContent.Temp(m_LightmapTilingOffsetW.floatValue.ToString()));

            bool showProgressiveInfo = isPrefabAsset || (m_EnabledBakedGI.boolValue && LightmapEditorSettings.lightmapper != LightmapEditorSettings.Lightmapper.Enlighten);

            if (showProgressiveInfo && Unsupported.IsDeveloperMode())
            {
                Hash128 instanceHash;
                LightmapEditorSettings.GetPVRInstanceHash(instanceID, out instanceHash);
                EditorGUILayout.LabelField(Styles.PVRInstanceHash, GUIContent.Temp(instanceHash.ToString()));

                Hash128 atlasHash;
                LightmapEditorSettings.GetPVRAtlasHash(instanceID, out atlasHash);
                EditorGUILayout.LabelField(Styles.PVRAtlasHash, GUIContent.Temp(atlasHash.ToString()));

                int atlasInstanceOffset;
                LightmapEditorSettings.GetPVRAtlasInstanceOffset(instanceID, out atlasInstanceOffset);
                EditorGUILayout.LabelField(Styles.PVRAtlasInstanceOffset, GUIContent.Temp(atlasInstanceOffset.ToString()));
            }

            EditorGUI.indentLevel -= 1;
        }
Beispiel #4
0
        void ShowAtlasGUI(int instanceID)
        {
            if (m_LightmapIndex == null)
            {
                return;
            }

            Hash128 contentHash = LightmapVisualizationUtility.GetBakedGITextureHash(m_LightmapIndex.intValue, 0, GITextureType.Baked);

            // if we need to fetch a new texture
            if (m_CachedBakedTexture.texture == null || m_CachedBakedTexture.contentHash != contentHash)
            {
                m_CachedBakedTexture = LightmapVisualizationUtility.GetBakedGITexture(m_LightmapIndex.intValue, 0, GITextureType.Baked);
            }

            if (m_CachedBakedTexture.texture == null)
            {
                return;
            }

            m_ShowBakedLM.value = EditorGUILayout.Foldout(m_ShowBakedLM.value, Styles.Atlas, true);

            if (!m_ShowBakedLM.value)
            {
                return;
            }

            EditorGUI.indentLevel += 1;

            GUILayout.BeginHorizontal();

            DrawLightmapPreview(m_CachedBakedTexture.texture, false, instanceID);

            GUILayout.BeginVertical();

            GUILayout.Label(Styles.AtlasIndex.text + ": " + m_LightmapIndex.intValue.ToString());
            GUILayout.Label(Styles.AtlasTilingX.text + ": " + m_LightmapTilingOffsetX.floatValue.ToString(CultureInfo.InvariantCulture.NumberFormat));
            GUILayout.Label(Styles.AtlasTilingY.text + ": " + m_LightmapTilingOffsetY.floatValue.ToString(CultureInfo.InvariantCulture.NumberFormat));
            GUILayout.Label(Styles.AtlasOffsetX.text + ": " + m_LightmapTilingOffsetZ.floatValue.ToString(CultureInfo.InvariantCulture.NumberFormat));
            GUILayout.Label(Styles.AtlasOffsetY.text + ": " + m_LightmapTilingOffsetW.floatValue.ToString(CultureInfo.InvariantCulture.NumberFormat));

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

            bool showProgressiveInfo = isPrefabAsset || (m_EnabledBakedGI.boolValue && LightmapEditorSettings.lightmapper != LightmapEditorSettings.Lightmapper.Enlighten);

            if (showProgressiveInfo && Unsupported.IsDeveloperMode())
            {
                Hash128 instanceHash;
                LightmapEditorSettings.GetPVRInstanceHash(instanceID, out instanceHash);
                EditorGUILayout.LabelField(Styles.PVRInstanceHash, GUIContent.Temp(instanceHash.ToString()));

                Hash128 atlasHash;
                LightmapEditorSettings.GetPVRAtlasHash(instanceID, out atlasHash);
                EditorGUILayout.LabelField(Styles.PVRAtlasHash, GUIContent.Temp(atlasHash.ToString()));

                int atlasInstanceOffset;
                LightmapEditorSettings.GetPVRAtlasInstanceOffset(instanceID, out atlasInstanceOffset);
                EditorGUILayout.LabelField(Styles.PVRAtlasInstanceOffset, GUIContent.Temp(atlasInstanceOffset.ToString()));
            }
            EditorGUI.indentLevel -= 1;

            GUILayout.Space(5);
        }