@@ -15,7 +15,7 @@ public static class UI
1515
1616 public static GUIContent Configuration = new GUIContent ( "Configuration" , "Toggleable control" ) ;
1717 public static GUIContent Static = new GUIContent ( "Static" , "Turn on to assume that the mesh won't change internally (ie. not procedural)" ) ;
18- public static GUIContent DepthCulling = new GUIContent ( "Depth Culling" , "Turn on to cull cues that behind the object" ) ;
18+ public static GUIContent DepthCulling = new GUIContent ( "Depth Culling" , "Turn on to cull cues which behind the object" ) ;
1919 public static GUIContent Equalize = new GUIContent ( "Equalize" , "Turn on to keep cues on scale no matter far it is\n (NOTE: does not work correctly if static is on)" ) ;
2020 public static GUIContent PartialDebug = new GUIContent ( "Partial Debug" , "" ) ;
2121
@@ -26,19 +26,29 @@ public static class UI
2626 public static GUIContent Bitangent = new GUIContent ( "Bitangent" , "Bitangent (cross of normal and tangent) vector of vertices" ) ;
2727
2828 public static GUIContent AdditionalRays = new GUIContent ( "Additional Rays" , "" ) ;
29- public static GUIContent VertsToIndice = new GUIContent ( "Vertex to Indice" , "Incomplete " ) ;
30- public static GUIContent TriangleNormal = new GUIContent ( "Triangle Normal" , "" ) ;
29+ public static GUIContent VertsToIndice = new GUIContent ( "Vertex to Indice" , "Ray from vertices to each triangles in median " ) ;
30+ public static GUIContent TriangleNormal = new GUIContent ( "Triangle Normal" , "Median Normal vector of triangles " ) ;
3131
32- public static GUIContent UseHeatmap = new GUIContent ( "Use Heatmap" , "" ) ;
33- public static GUIContent DebugVertices = new GUIContent ( "Debug Vertices" , "" ) ;
34- public static GUIContent DebugTriangles = new GUIContent ( "Debug Triangles" , "" ) ;
32+ public static GUIContent UseHeatmap = new GUIContent ( "Use Heatmap" , "Use Color indicator instead of GUI Labels " ) ;
33+ public static GUIContent DebugVertices = new GUIContent ( "Debug Vertices" , "Debug Vertice Modes " ) ;
34+ public static GUIContent DebugTriangles = new GUIContent ( "Debug Triangles" , "Debug Triangle Modes " ) ;
3535
36- public static GUIContent None = new GUIContent ( "None" , "" ) ;
37- public static GUIContent Index = new GUIContent ( "Index" , "" ) ;
38- public static GUIContent Shared = new GUIContent ( "Shared" , "" ) ;
39- public static GUIContent Duplicates = new GUIContent ( "Duplicates" , "" ) ;
40- public static GUIContent Area = new GUIContent ( "Area" , "" ) ;
41- public static GUIContent Submesh = new GUIContent ( "Submesh" , "" ) ;
36+ public static GUIContent DebugSurface = new GUIContent ( "Debug Surface" , "Debug Surface Modes" ) ;
37+ public static GUIContent SurfaceUV = new GUIContent ( "Surface UV" , "Surface UV Mode" ) ;
38+ public static GUIContent SurfaceTangent = new GUIContent ( "Surface Tangent" , "Surface Tangent Mode" ) ;
39+
40+ public static GUIContent None = new GUIContent ( "None" , "Not Activated" ) ;
41+ public static GUIContent Index = new GUIContent ( "Index" , "Debug Index in Buffer" ) ;
42+ public static GUIContent Shared = new GUIContent ( "Shared" , "Debug of how many triangles use the vertex" ) ;
43+ public static GUIContent Duplicates = new GUIContent ( "Duplicates" , "Debug of how many vertices have the same position" ) ;
44+ public static GUIContent Area = new GUIContent ( "Area" , "Debug Calculated area surface of each triangle" ) ;
45+ public static GUIContent Submesh = new GUIContent ( "Submesh" , "Debug Submesh index of each triangle" ) ;
46+
47+ public static GUIContent Facing = new GUIContent ( "Facing" ) ;
48+ public static GUIContent Color = new GUIContent ( "Color" ) ;
49+ public static GUIContent UV = new GUIContent ( "UV" ) ;
50+ public static GUIContent Tangents = new GUIContent ( "Tangents" ) ;
51+ public static int [ ] Surfaces = new int [ ] { 0 , 1 , 2 , 3 } ;
4252
4353 }
4454
@@ -119,6 +129,33 @@ void OnGUI()
119129 if ( GUILayout . Toggle ( m_DebugTris == DebugTriangle . Submesh , UI . Submesh , EditorStyles . miniButtonRight ) ) m_DebugTris = DebugTriangle . Submesh ;
120130 EditorGUILayout . EndHorizontal ( ) ;
121131 }
132+ {
133+ EditorGUI . BeginChangeCheck ( ) ;
134+ EditorGUILayout . BeginHorizontal ( ) ;
135+ EditorGUILayout . PrefixLabel ( UI . DebugSurface ) ;
136+ if ( GUILayout . Toggle ( m_DebugSurface == DebugSurface . None , UI . None , EditorStyles . miniButtonLeft ) ) m_DebugSurface = DebugSurface . None ;
137+ if ( GUILayout . Toggle ( m_DebugSurface == DebugSurface . Facing , UI . Facing , EditorStyles . miniButtonMid ) ) m_DebugSurface = DebugSurface . Facing ;
138+ if ( GUILayout . Toggle ( m_DebugSurface == DebugSurface . Color , UI . Color , EditorStyles . miniButtonMid ) ) m_DebugSurface = DebugSurface . Color ;
139+ if ( GUILayout . Toggle ( m_DebugSurface == DebugSurface . UV , UI . UV , EditorStyles . miniButtonMid ) ) m_DebugSurface = DebugSurface . UV ;
140+ if ( GUILayout . Toggle ( m_DebugSurface == DebugSurface . Tangents , UI . Tangents , EditorStyles . miniButtonRight ) ) m_DebugSurface = DebugSurface . Tangents ;
141+ EditorGUILayout . EndHorizontal ( ) ;
142+ if ( m_DebugSurface == DebugSurface . UV )
143+ {
144+ EditorGUILayout . BeginHorizontal ( ) ;
145+ EditorGUILayout . PrefixLabel ( UI . SurfaceUV ) ;
146+ m_DebugSurfaceUV = ( DebugSurfaceUV ) EditorGUILayout . EnumPopup ( m_DebugSurfaceUV ) ;
147+ EditorGUILayout . EndHorizontal ( ) ;
148+ }
149+ if ( m_DebugSurface == DebugSurface . Tangents )
150+ {
151+ EditorGUILayout . BeginHorizontal ( ) ;
152+ EditorGUILayout . PrefixLabel ( UI . SurfaceTangent ) ;
153+ m_DebugSurfaceTangents = ( DebugSurfaceTangents ) EditorGUILayout . EnumPopup ( m_DebugSurfaceTangents ) ;
154+ EditorGUILayout . EndHorizontal ( ) ;
155+ }
156+ if ( EditorGUI . EndChangeCheck ( ) )
157+ UpdateTempMaterial ( ) ;
158+ }
122159 {
123160 EditorGUILayout . Space ( ) ;
124161 if ( m_Mesh )
@@ -132,4 +169,41 @@ void OnGUI()
132169 SceneView . RepaintAll ( ) ;
133170 }
134171 }
135- }
172+
173+ Shader GetShaderForTempMaterial ( )
174+ {
175+ switch ( m_DebugSurface )
176+ {
177+ case DebugSurface . None :
178+ default :
179+ return null ;
180+ case DebugSurface . Color :
181+ return Shader . Find ( "Debug/Color" ) ;
182+ case DebugSurface . Facing :
183+ return Shader . Find ( "Debug/FrontBack" ) ;
184+ case DebugSurface . UV :
185+ return Shader . Find ( "Debug/UV" ) ;
186+ case DebugSurface . Tangents :
187+ return Shader . Find ( "Debug/Tangents" ) ;
188+ }
189+ }
190+
191+ void UpdateTempMaterial ( )
192+ {
193+ if ( m_DebugSurface == DebugSurface . None )
194+ {
195+ ChangeMaterial ( null ) ;
196+ return ;
197+ }
198+ else if ( ! m_tempMat )
199+ m_tempMat = new Material ( GetShaderForTempMaterial ( ) )
200+ {
201+ hideFlags = HideFlags . HideAndDontSave ,
202+ name = "MeshDebugger Debug Material"
203+ } ;
204+ else
205+ m_tempMat . shader = GetShaderForTempMaterial ( ) ;
206+
207+ ChangeMaterial ( m_tempMat ) ;
208+ }
209+ }
0 commit comments