// Returns false, if frameEventData holds data from previous selected frame
        public static bool GetFrameEventData(int index, FrameDebuggerEventData frameDebuggerEventData)
        {
            // native code will poke and modify the FrameDebuggerEventData object fields
            // directly via a pointer to it
            var handle = GCHandle.Alloc(frameDebuggerEventData, GCHandleType.Pinned);

            GetFrameEventDataImpl(handle.AddrOfPinnedObject());
            handle.Free();
            return(frameDebuggerEventData.frameEventIndex == index);
        }
Пример #2
0
 private static extern void INTERNAL_CALL_GetFrameEventData(out FrameDebuggerEventData value);
Пример #3
0
 public static bool GetFrameEventData(int index, out FrameDebuggerEventData frameDebuggerEventData)
 {
     frameDebuggerEventData = FrameDebuggerUtility.GetFrameEventData();
     return(frameDebuggerEventData.frameEventIndex == index);
 }
 private static extern void INTERNAL_CALL_GetFrameEventData(out FrameDebuggerEventData value);
 public static bool GetFrameEventData(int index, out FrameDebuggerEventData frameDebuggerEventData)
 {
     frameDebuggerEventData = GetFrameEventData();
     return (frameDebuggerEventData.frameEventIndex == index);
 }
Пример #6
0
 private static extern void GetFrameEventDataInternal(out FrameDebuggerEventData frameDebuggerEventData);
 public static bool GetFrameEventData(int index, out FrameDebuggerEventData frameDebuggerEventData)
 {
     GetFrameEventDataInternal(out frameDebuggerEventData);
     return(frameDebuggerEventData.frameEventIndex == index);
 }
 private void DrawStates(FrameDebuggerEventData curEventData)
 {
   FrameDebuggerBlendState blendState = curEventData.blendState;
   FrameDebuggerRasterState rasterState = curEventData.rasterState;
   FrameDebuggerDepthState depthState = curEventData.depthState;
   string str = string.Empty;
   if ((int) blendState.renderTargetWriteMask == 0)
   {
     str = "0";
   }
   else
   {
     if (((int) blendState.renderTargetWriteMask & 2) != 0)
       str += "R";
     if (((int) blendState.renderTargetWriteMask & 4) != 0)
       str += "G";
     if (((int) blendState.renderTargetWriteMask & 8) != 0)
       str += "B";
     if (((int) blendState.renderTargetWriteMask & 1) != 0)
       str += "A";
   }
   GUILayout.Label(string.Format("Blend {0} {1}, {2} {3} ColorMask {4}", (object) blendState.srcBlend, (object) blendState.dstBlend, (object) blendState.srcBlendAlpha, (object) blendState.dstBlendAlpha, (object) str), EditorStyles.miniLabel, new GUILayoutOption[0]);
   GUILayout.Label(string.Format("ZTest {0} ZWrite {1} Cull {2} Offset {3}, {4}", (object) depthState.depthFunc, (object) (depthState.depthWrite != 0 ? "On" : "Off"), (object) rasterState.cullMode, (object) rasterState.slopeScaledDepthBias, (object) rasterState.depthBias), EditorStyles.miniLabel, new GUILayoutOption[0]);
 }
 private void DrawRenderTargetControls(FrameDebuggerEventData cur)
 {
   if (cur.rtWidth <= 0 || cur.rtHeight <= 0)
     return;
   bool disabled = cur.rtFormat == 1 || cur.rtFormat == 3;
   bool flag1 = (int) cur.rtHasDepthTexture != 0;
   short rtCount = cur.rtCount;
   if (flag1)
     ++rtCount;
   GUILayout.Label("RenderTarget: " + cur.rtName, EditorStyles.boldLabel, new GUILayoutOption[0]);
   GUILayout.BeginHorizontal(EditorStyles.toolbar, new GUILayoutOption[0]);
   EditorGUI.BeginChangeCheck();
   EditorGUI.BeginDisabledGroup((int) rtCount <= 1);
   GUIContent[] displayedOptions = new GUIContent[(int) rtCount];
   for (int index = 0; index < (int) cur.rtCount; ++index)
     displayedOptions[index] = FrameDebuggerWindow.Styles.mrtLabels[index];
   if (flag1)
     displayedOptions[(int) cur.rtCount] = FrameDebuggerWindow.Styles.depthLabel;
   int num = Mathf.Clamp(this.m_RTIndex, 0, (int) rtCount - 1);
   bool flag2 = num != this.m_RTIndex;
   this.m_RTIndex = num;
   this.m_RTIndex = EditorGUILayout.Popup(this.m_RTIndex, displayedOptions, EditorStyles.toolbarPopup, new GUILayoutOption[1]
   {
     GUILayout.Width(70f)
   });
   EditorGUI.EndDisabledGroup();
   GUILayout.Space(10f);
   EditorGUI.BeginDisabledGroup(disabled);
   GUILayout.Label(FrameDebuggerWindow.Styles.channelHeader, EditorStyles.miniLabel, new GUILayoutOption[0]);
   this.m_RTChannel = GUILayout.Toolbar(this.m_RTChannel, FrameDebuggerWindow.Styles.channelLabels, EditorStyles.toolbarButton, new GUILayoutOption[0]);
   EditorGUI.EndDisabledGroup();
   GUILayout.Space(10f);
   GUILayout.Label(FrameDebuggerWindow.Styles.levelsHeader, EditorStyles.miniLabel, new GUILayoutOption[0]);
   EditorGUILayout.MinMaxSlider(ref this.m_RTBlackLevel, ref this.m_RTWhiteLevel, 0.0f, 1f, GUILayout.MaxWidth(200f));
   if (EditorGUI.EndChangeCheck() || flag2)
   {
     Vector4 channels = Vector4.zero;
     if (this.m_RTChannel == 1)
       channels.x = 1f;
     else if (this.m_RTChannel == 2)
       channels.y = 1f;
     else if (this.m_RTChannel == 3)
       channels.z = 1f;
     else if (this.m_RTChannel == 4)
       channels.w = 1f;
     else
       channels = Vector4.one;
     int rtIndex = this.m_RTIndex;
     if (rtIndex >= (int) cur.rtCount)
       rtIndex = -1;
     FrameDebuggerUtility.SetRenderTargetDisplayOptions(rtIndex, channels, this.m_RTBlackLevel, this.m_RTWhiteLevel);
     this.RepaintAllNeededThings();
   }
   GUILayout.FlexibleSpace();
   GUILayout.EndHorizontal();
   GUILayout.Label(string.Format("{0}x{1} {2}", (object) cur.rtWidth, (object) cur.rtHeight, (object) (RenderTextureFormat) cur.rtFormat));
   if (cur.rtDim == 4)
     GUILayout.Label("Rendering into cubemap");
   if (cur.rtFormat != 3 || !SystemInfo.graphicsDeviceVersion.StartsWith("Direct3D 9"))
     return;
   EditorGUILayout.HelpBox("Rendering into shadowmap on DX9, can't visualize it in the game view properly", MessageType.Info, true);
 }
 private bool DrawEventMesh(FrameDebuggerEventData curEventData)
 {
   Mesh mesh = curEventData.mesh;
   if ((UnityEngine.Object) mesh == (UnityEngine.Object) null)
     return false;
   Rect rect = GUILayoutUtility.GetRect(10f, 10f, new GUILayoutOption[1]{ GUILayout.ExpandHeight(true) });
   if ((double) rect.width < 64.0 || (double) rect.height < 64.0)
     return true;
   GameObject frameEventGameObject = FrameDebuggerUtility.GetFrameEventGameObject(curEventData.frameEventIndex);
   Rect meshInfoRect = rect;
   meshInfoRect.yMin = meshInfoRect.yMax - EditorGUIUtility.singleLineHeight * 2f;
   Rect position = meshInfoRect;
   meshInfoRect.xMin = meshInfoRect.center.x;
   position.xMax = position.center.x;
   if (Event.current.type == EventType.MouseDown)
   {
     if (meshInfoRect.Contains(Event.current.mousePosition))
     {
       EditorGUIUtility.PingObject((UnityEngine.Object) mesh);
       Event.current.Use();
     }
     if ((UnityEngine.Object) frameEventGameObject != (UnityEngine.Object) null && position.Contains(Event.current.mousePosition))
     {
       EditorGUIUtility.PingObject(frameEventGameObject.GetInstanceID());
       Event.current.Use();
     }
   }
   this.m_PreviewDir = PreviewGUI.Drag2D(this.m_PreviewDir, rect);
   if (Event.current.type == EventType.Repaint)
   {
     int meshSubset = curEventData.meshSubset;
     this.DrawMeshPreview(curEventData, rect, meshInfoRect, mesh, meshSubset);
     if ((UnityEngine.Object) frameEventGameObject != (UnityEngine.Object) null)
       EditorGUI.DropShadowLabel(position, frameEventGameObject.name);
   }
   return true;
 }
 private void DrawMeshPreview(FrameDebuggerEventData curEventData, Rect previewRect, Rect meshInfoRect, Mesh mesh, int meshSubset)
 {
   if (this.m_PreviewUtility == null)
   {
     this.m_PreviewUtility = new PreviewRenderUtility();
     this.m_PreviewUtility.m_CameraFieldOfView = 30f;
   }
   if ((UnityEngine.Object) this.m_Material == (UnityEngine.Object) null)
     this.m_Material = EditorGUIUtility.GetBuiltinExtraResource(typeof (Material), "Default-Material.mat") as Material;
   if ((UnityEngine.Object) this.m_WireMaterial == (UnityEngine.Object) null)
     this.m_WireMaterial = ModelInspector.CreateWireframeMaterial();
   this.m_PreviewUtility.BeginPreview(previewRect, (GUIStyle) "preBackground");
   ModelInspector.RenderMeshPreview(mesh, this.m_PreviewUtility, this.m_Material, this.m_WireMaterial, this.m_PreviewDir, meshSubset);
   this.m_PreviewUtility.EndAndDrawPreview(previewRect);
   string str = mesh.name;
   if (string.IsNullOrEmpty(str))
     str = "<no name>";
   string text = str + " subset " + (object) meshSubset + "\n" + (object) curEventData.vertexCount + " verts, " + (object) curEventData.indexCount + " indices";
   EditorGUI.DropShadowLabel(meshInfoRect, text);
 }
 public static bool GetFrameEventData(int index, out FrameDebuggerEventData frameDebuggerEventData)
 {
   frameDebuggerEventData = FrameDebuggerUtility.GetFrameEventData();
   return frameDebuggerEventData.frameEventIndex == index;
 }