UnityEditor.InternalMeshUtil.GetCachedMeshSurfaceArea C# (CSharp) Method

GetCachedMeshSurfaceArea() private method

private GetCachedMeshSurfaceArea ( MeshRenderer meshRenderer ) : float
meshRenderer UnityEngine.MeshRenderer
return float
        public static extern float GetCachedMeshSurfaceArea(MeshRenderer meshRenderer);
        [MethodImpl(MethodImplOptions.InternalCall)]

Usage Example

示例#1
0
        void LightmapScaleGUI(bool meshRenderer, GUIContent title, bool isSSD)
        {
            // SSDs (with the exception of those being computed with Enlighten) do not end up in a lightmap,
            // therefore we do not show clamping information.
            if (isSSD && LightmapEditorSettings.lightmapper != LightmapEditorSettings.Lightmapper.Enlighten)
            {
                return;
            }

            float lodScale = 1.0f;

            if (meshRenderer)
            {
                lodScale = LightmapVisualization.GetLightmapLODLevelScale(m_Renderers[0]);
                for (int i = 1; i < m_Renderers.Length; i++)
                {
                    if (!Mathf.Approximately(lodScale, LightmapVisualization.GetLightmapLODLevelScale(m_Renderers[i])))
                    {
                        lodScale = 1.0F;
                    }
                }
            }

            float lightmapScale = lodScale * m_LightmapScale.floatValue;

            Rect rect = EditorGUILayout.GetControlRect();

            EditorGUI.BeginProperty(rect, Styles.ScaleInLightmap, m_LightmapScale);
            EditorGUI.BeginChangeCheck();
            lightmapScale = EditorGUI.FloatField(rect, title, lightmapScale);
            if (EditorGUI.EndChangeCheck())
            {
                m_LightmapScale.floatValue = Mathf.Max(lightmapScale / Mathf.Max(lodScale, float.Epsilon), 0.0f);
            }
            EditorGUI.EndProperty();

            float cachedSurfaceArea;

            if (meshRenderer)
            {
                lightmapScale = lightmapScale * LightmapVisualization.GetLightmapLODLevelScale(m_Renderers[0]);

                // tell the user if the object's size in lightmap has reached the max atlas size
                cachedSurfaceArea = InternalMeshUtil.GetCachedMeshSurfaceArea((MeshRenderer)m_Renderers[0]);
            }
            else //terrain
            {
                // tell the user if the object's size in lightmap has reached the max atlas size
                var terrainData = m_Terrains[0].terrainData;
                cachedSurfaceArea = terrainData != null ? terrainData.size.x * terrainData.size.z : 0;
            }

            ShowClampedSizeInLightmapGUI(lightmapScale, cachedSurfaceArea, isSSD);
        }
All Usage Examples Of UnityEditor.InternalMeshUtil::GetCachedMeshSurfaceArea