Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VL.ImGui.Stride.Viewports] #673

Open
wants to merge 60 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
09bf3cc
BUGFIX:
kopffarben Mar 12, 2024
9ee818e
BUGFIX:
kopffarben Mar 12, 2024
482e798
working SceneWidget and remove Properties/launchSettings.json
kopffarben Mar 12, 2024
93ec848
WIP RenderWidget with IInputSource Out
kopffarben Mar 14, 2024
3e251e6
WIP
kopffarben Mar 19, 2024
a065910
WIP CleanUp
kopffarben Mar 19, 2024
aede9c9
WIP
kopffarben Mar 20, 2024
e423c20
Merge remote-tracking branch 'remotes/origin/main' into feature/VL.Im…
kopffarben Mar 20, 2024
fdc69fb
WIP
kopffarben Mar 20, 2024
1318fee
Merge remote-tracking branch 'remotes/origin/main' into feature/VL.Im…
kopffarben Mar 20, 2024
4d30715
WIP
kopffarben Mar 20, 2024
e53e513
WIP
kopffarben Mar 21, 2024
75dffb6
WIP
kopffarben Mar 25, 2024
74d07a3
WIP
kopffarben Mar 27, 2024
04d9e0d
Merge remote-tracking branch 'remotes/origin/main' into feature/VL.Im…
kopffarben Mar 27, 2024
53688ac
WIP
kopffarben Mar 27, 2024
163e258
CleanUP
kopffarben Mar 27, 2024
9edf8bd
remove InputManager from StrideContext ... not needed
kopffarben Apr 4, 2024
f28bf90
Merge remote-tracking branch 'remotes/origin/main' into feature/VL.Im…
kopffarben Apr 4, 2024
893137c
Move Stride Pipeline Stuff to StrideDeviceContext
kopffarben Apr 4, 2024
777c985
CleanUp
kopffarben Apr 5, 2024
4a57a14
WIP
kopffarben Apr 5, 2024
d2410ea
WIP
kopffarben Apr 13, 2024
347b9f3
WIP first buggy working version ...
kopffarben Apr 13, 2024
7011c91
Working Version for Viewports
kopffarben Apr 14, 2024
0f363eb
some CleanUp
kopffarben Apr 14, 2024
4cfd87a
Merge remote-tracking branch 'remotes/origin/main' into feature/VL.Im…
kopffarben Apr 15, 2024
e27cb98
SkiaRendererWithOffset
kopffarben Apr 15, 2024
9e05b53
WIP
kopffarben Apr 16, 2024
060c2d2
ADD Bound to Document
kopffarben Apr 16, 2024
cd90ed0
revert launchSettings.json
kopffarben Apr 16, 2024
9d77ae2
Closing MainWindow will close all other Windows
kopffarben Apr 16, 2024
c78d9ab
Add MousButtons to globalMouseState
kopffarben Apr 16, 2024
60e4025
Merge remote-tracking branch 'remotes/origin/main' into feature/VL.Im…
kopffarben May 3, 2024
d9d4a7a
WIP fixed null ref on Closeing
kopffarben May 3, 2024
57254be
fix InputSource Handeling
kopffarben May 3, 2024
2b92219
[ImGui.Stride] Gets rid of earlier introduced hack by using same code…
azeno May 23, 2024
679e1f8
VL.ImGui.Stride TargetFramework net8.0-windows
kopffarben May 23, 2024
6f46662
Merge remote-tracking branch 'remotes/origin/main' into feature/VL.Im…
kopffarben May 23, 2024
bdafce1
[VL.ImGui.Skia]
kopffarben May 23, 2024
cec33a3
Merge remote-tracking branch 'remotes/origin/bugfix/issue-672' into f…
kopffarben May 23, 2024
524c1a8
IMappedDevice add SetSourceDevice
kopffarben May 30, 2024
71e475a
Merge branch 'main' into feature/VL.ImGui.Stride.Viewports
kopffarben Aug 28, 2024
a71b894
small bug-fix
kopffarben Aug 28, 2024
aa800be
BugFix InputManager.Remove ... breaks after a while
kopffarben Aug 29, 2024
0d538d9
WIP
kopffarben Sep 4, 2024
3c8c945
Add Option for Constructor(NodeContext nodeContext) to SourceGenerato…
kopffarben Nov 5, 2024
72f9f29
Merge remote-tracking branch 'remotes/origin/main' into feature/VL.Im…
kopffarben Nov 5, 2024
6d3f50d
fix move to second screen ... DesktopBounds from Stride for second Sc…
kopffarben Nov 6, 2024
085b92a
revert launchSettings.json
kopffarben Nov 6, 2024
c171198
Merge remote-tracking branch 'remotes/origin/main' into feature/VL.Im…
kopffarben Dec 13, 2024
fda0109
so improvements in ImGuiWindows.cs
kopffarben Dec 13, 2024
5623600
Refactor and improve resource management
kopffarben Dec 16, 2024
a461a82
Add UniqueId to RenderWidget for unique naming
kopffarben Dec 16, 2024
28975d5
Enhance ImGui functionality and layout
kopffarben Dec 16, 2024
2197d3e
Nicer Layout
kopffarben Dec 17, 2024
5311019
Merge remote-tracking branch 'remotes/origin/main' into feature/VL.Im…
kopffarben Dec 18, 2024
ddfc695
Work on Helppatch
kopffarben Dec 18, 2024
831f878
Bugfix KeyboardInput
kopffarben Jan 13, 2025
f859daf
Merge remote-tracking branch 'remotes/origin/main' into feature/VL.Im…
kopffarben Jan 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions VL.ImGui.Skia/src/SkiaWidget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ protected override void Draw(Context context, in ImDrawListPtr drawList, in Syst
//if (context.DrawList == DrawList.AtCursor)
// ImGui.Image(0, size);

// because we use Callback instead of Image


drawList.AddCallback(id, IntPtr.Zero);
}
}
Expand All @@ -60,13 +63,14 @@ protected override void Draw(Context context, in ImDrawListPtr drawList, in Syst
public RectangleF? Bounds => !_disposed ? Layer?.Bounds : default;

// What is this for?
//SKMatrix? trans;
// it is somehow necessary for the Stride/Skia inputHandleing to work ... is a strange workaround
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm ok, can you point to a patch where these lines of code do make a difference?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the CallerInfo in Notify has the wrong transformation ... The CallerInfo in Render has the correct ... just set a breakpoint in Notify ... then you can see it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting - so this might be a bug in the Stride-Skia bridge then?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, probably that

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will have a look..

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just pushed a fix for the SkiaRenderer - like you say, it was indeed broken, as one could see with the Stride/Skia overlay help patch. Using a Skia Button there didn't work. Thanks for the pointer. You should be able to remove that above hack now.

SKMatrix? trans;

public void Render(CallerInfo caller)
{
if (_disposed || Layer is null)
return;
//trans = caller.Transformation;
trans = caller.Transformation;
Layer.Render(caller);
}

Expand All @@ -83,9 +87,9 @@ public bool Notify(INotification notification, CallerInfo caller)
return false;


//if (trans != null)
// return Layer.Notify(notification, caller.WithTransformation((SKMatrix)trans));
//else
if (trans != null)
return Layer.Notify(notification, caller.WithTransformation((SKMatrix)trans));
else
return Layer.Notify(notification, caller); ;
}

Expand Down
862 changes: 838 additions & 24 deletions VL.ImGui.Stride/VL.ImGui.Stride.vl

Large diffs are not rendered by default.

2,249 changes: 2,249 additions & 0 deletions VL.ImGui.Stride/help/Basics/HowTo ImGui Windows.vl

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion VL.ImGui.Stride/src/Effects/ImGuiEffectShader.sdsl
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
internal shader ImGuiEffectShader<bool TSRgb> : ShaderBase, PositionStream2, ColorBase, Texturing
{
matrix proj;
float2 offset;

override stage void VSMain()
{
streams.ShadingPosition = mul(proj, float4(streams.Position2, 0.0, 1.0f)) + float4(-1.0f, 1.0f, 0.0f, 0.0f);
streams.ShadingPosition = mul(proj, float4(streams.Position2 - offset, 0.0, 1.0f)) + float4( -1.0f, 1.0f, 0.0f, 0.0f);

if (TSRgb)
{
Expand Down
1 change: 1 addition & 0 deletions VL.ImGui.Stride/src/Effects/ImGuiEffectShader.sdsl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ namespace VL.ImGui.Stride.Effects
internal static partial class ImGuiEffectShaderKeys
{
public static readonly ValueParameterKey<Matrix> proj = ParameterKeys.NewValue<Matrix>();
public static readonly ValueParameterKey<Vector2> offset = ParameterKeys.NewValue<Vector2>();
}
}
27 changes: 27 additions & 0 deletions VL.ImGui.Stride/src/FixedAsciiString.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System;
using System.Runtime.InteropServices;
using System.Text;

namespace VL.ImGui.Stride
{
public class FixedAsciiString : IDisposable
{
public IntPtr DataPtr { get; }

public unsafe FixedAsciiString(string s)
{
int byteCount = Encoding.ASCII.GetByteCount(s);
DataPtr = Marshal.AllocHGlobal(byteCount + 1);
fixed (char* sPtr = s)
{
int end = Encoding.ASCII.GetBytes(sPtr, s.Length, (byte*)DataPtr, byteCount);
((byte*)DataPtr)[end] = 0;
}
}

public void Dispose()
{
Marshal.FreeHGlobal(DataPtr);
}
}
}
4 changes: 2 additions & 2 deletions VL.ImGui.Stride/src/ImGuiRenderer.InputHandling.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ IDisposable SubscribeToInputSource(IInputSource inputSource, RenderDrawContext c
return inputManager.GetNotifications(inputSource, sender: this)
.Subscribe(notification =>
{
using (_context.MakeCurrent())
using (_strideDeviceContext.MakeCurrent())
{
_io.HandleNotification(notification, useWorldSpace: false);
_strideDeviceContext.IO.HandleNotification(notification, useWorldSpace: false);
}
});
}
Expand Down
Loading