mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-23 22:25:55 +00:00
Implement multi-instance mesh picking
This commit is contained in:
committed by
Baldur Karlsson
parent
a41c35b764
commit
87adee1bf1
@@ -152,7 +152,7 @@ namespace renderdoc
|
||||
private static extern bool ReplayOutput_PickPixel(IntPtr real, ResourceId texID, bool customShader,
|
||||
UInt32 x, UInt32 y, UInt32 sliceFace, UInt32 mip, UInt32 sample, IntPtr outval);
|
||||
[DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern UInt32 ReplayOutput_PickVertex(IntPtr real, UInt32 eventID, UInt32 x, UInt32 y);
|
||||
private static extern UInt32 ReplayOutput_PickVertex(IntPtr real, UInt32 eventID, UInt32 x, UInt32 y, IntPtr outPickedInstance);
|
||||
|
||||
private IntPtr m_Real = IntPtr.Zero;
|
||||
|
||||
@@ -269,9 +269,16 @@ namespace renderdoc
|
||||
return ret;
|
||||
}
|
||||
|
||||
public UInt32 PickVertex(UInt32 eventID, UInt32 x, UInt32 y)
|
||||
public UInt32 PickVertex(UInt32 eventID, UInt32 x, UInt32 y, out UInt32 pickedInstance)
|
||||
{
|
||||
return ReplayOutput_PickVertex(m_Real, eventID, x, y);
|
||||
IntPtr mem = CustomMarshal.Alloc(typeof(UInt32));
|
||||
|
||||
UInt32 pickedVertex = ReplayOutput_PickVertex(m_Real, eventID, x, y, mem);
|
||||
pickedInstance = (UInt32)CustomMarshal.PtrToStructure(mem, typeof(UInt32), true);
|
||||
|
||||
CustomMarshal.Free(mem);
|
||||
|
||||
return pickedVertex;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -2379,12 +2379,21 @@ namespace renderdocui.Windows
|
||||
|
||||
m_Core.Renderer.BeginInvoke((ReplayRenderer r) =>
|
||||
{
|
||||
UInt32 vertSelected = m_Output.PickVertex(m_Core.CurEvent, (UInt32)p.X, (UInt32)p.Y);
|
||||
UInt32 instanceSelected = 0;
|
||||
UInt32 vertSelected = m_Output.PickVertex(m_Core.CurEvent, (UInt32)p.X, (UInt32)p.Y, out instanceSelected);
|
||||
|
||||
if (vertSelected != UInt32.MaxValue)
|
||||
{
|
||||
this.BeginInvoke(new Action(() =>
|
||||
{
|
||||
if (instanceSelected != m_MeshDisplay.curInstance)
|
||||
{
|
||||
m_MeshDisplay.curInstance = instanceSelected;
|
||||
instanceIdx.Text = instanceSelected.ToString();
|
||||
instanceIdxToolitem.Text = instanceIdx.Text;
|
||||
OnEventSelected(m_Core.CurEvent);
|
||||
}
|
||||
|
||||
var ui = GetUIState(m_MeshDisplay.type);
|
||||
|
||||
int row = (int)vertSelected;
|
||||
@@ -2401,6 +2410,7 @@ namespace renderdocui.Windows
|
||||
|
||||
SyncViews(ui.m_GridView, true, true);
|
||||
}
|
||||
|
||||
}));
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user