Skip to content
Open

POC #19

Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions Examples/Complete/Integrations/Wpf/View/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private void Position_PropertyChanged(object sender, System.ComponentModel.Prope

private void OpenFusee()
{
Task.Run(() =>
Task.Run((System.Action)(() =>
{
IO.IOImp = new Fusee.Base.Imp.Desktop.IOImp();

Expand Down Expand Up @@ -100,8 +100,8 @@ private void OpenFusee()
// Inject Fusee.Engine InjectMe dependencies (hard coded)
fuseeApp.CanvasImplementor = new Fusee.Engine.Imp.Graphics.Desktop.RenderCanvasImp();
fuseeApp.ContextImplementor = new Fusee.Engine.Imp.Graphics.Desktop.RenderContextImp(fuseeApp.CanvasImplementor);
Input.AddDriverImp(new Fusee.Engine.Imp.Graphics.Desktop.RenderCanvasInputDriverImp(fuseeApp.CanvasImplementor));
Input.AddDriverImp(new Fusee.Engine.Imp.Graphics.Desktop.WindowsTouchInputDriverImp(fuseeApp.CanvasImplementor));
Input.AddDriverImp((Engine.Common.IInputDriverImp)new Fusee.Engine.Imp.Graphics.Desktop.RenderCanvasInputDriverImp(fuseeApp.CanvasImplementor));
Input.AddDriverImp((Engine.Common.IInputDriverImp)new Fusee.Engine.Imp.Graphics.Desktop.WindowsTouchInputDriverImp(fuseeApp.CanvasImplementor));
// app.InputImplementor = new Fusee.Engine.Imp.Graphics.Desktop.InputImp(app.CanvasImplementor);
// app.InputDriverImplementor = new Fusee.Engine.Imp.Input.Desktop.InputDriverImp();
// app.VideoManagerImplementor = ImpFactory.CreateIVideoManagerImp();
Expand All @@ -110,7 +110,7 @@ private void OpenFusee()

// Start the app
fuseeApp.Run();
});
}));
}

private void FusToWpfEvents(object sender, Core.FusEvent e)
Expand Down
16 changes: 16 additions & 0 deletions Examples/Complete/Simple/Silk/Fusee.Examples.Simple.Silk.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<OutputPath>$(BaseOutputPath)\Examples\Simple\Desktop\</OutputPath>

<OutputType>Exe</OutputType>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="$(FuseeEngineRoot)\src\Base\Imp\Desktop\Fusee.Base.Imp.Desktop.csproj" />
<ProjectReference Include="$(FuseeEngineRoot)\src\Engine\Imp\Graphics\Silk\Fusee.Engine.Imp.Graphics.Silk.csproj" />
<ProjectReference Include="..\Core\Fusee.Examples.Simple.Core.csproj" />
</ItemGroup>

</Project>
Binary file added Examples/Complete/Simple/Silk/FuseeLogo.ico
Binary file not shown.
79 changes: 79 additions & 0 deletions Examples/Complete/Simple/Silk/Main.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
using Fusee.Base.Common;
using Fusee.Base.Core;
using Fusee.Base.Imp.Desktop;
using Fusee.Engine.Core;
using Fusee.Engine.Core.Scene;
using Fusee.Serialization;
using System.IO;
using System.Threading.Tasks;

namespace Fusee.Examples.Simple.Silk
{
public class Simple
{
public static void Main()
{
// Inject Fusee.Engine.Base InjectMe dependencies
IO.IOImp = new IOImp();

var fap = new FileAssetProvider("Assets");
fap.RegisterTypeHandler(
new AssetHandler
{
ReturnedType = typeof(Font),
DecoderAsync = async (string id, object storage) =>
{
if (!Path.GetExtension(id).Contains("ttf", System.StringComparison.OrdinalIgnoreCase)) return null;
return await Task.FromResult(new Font { _fontImp = new FontImp((Stream)storage) });
},
Decoder = (string id, object storage) =>
{
if (!Path.GetExtension(id).Contains("ttf", System.StringComparison.OrdinalIgnoreCase)) return null;
return new Font { _fontImp = new FontImp((Stream)storage) };
},
Checker = id => Path.GetExtension(id).Contains("ttf", System.StringComparison.OrdinalIgnoreCase)
});
fap.RegisterTypeHandler(
new AssetHandler
{
ReturnedType = typeof(SceneContainer),
DecoderAsync = async (string id, object storage) =>
{
if (!Path.GetExtension(id).Contains("fus", System.StringComparison.OrdinalIgnoreCase)) return null;
return await FusSceneConverter.ConvertFromAsync(ProtoBuf.Serializer.Deserialize<FusFile>((Stream)storage), id);
},
Decoder = (string id, object storage) =>
{
if (!Path.GetExtension(id).Contains("fus", System.StringComparison.OrdinalIgnoreCase)) return null;
return FusSceneConverter.ConvertFrom(ProtoBuf.Serializer.Deserialize<FusFile>((Stream)storage), id);
},
Checker = id => Path.GetExtension(id).Contains("fus", System.StringComparison.OrdinalIgnoreCase)
});

AssetStorage.RegisterProvider(fap);

var app = new Core.Simple();

// Inject Fusee.Engine InjectMe dependencies (hard coded)
var icon = AssetStorage.Get<ImageData>("FuseeIconTop32.png");
app.CanvasImplementor = new Fusee.Engine.Imp.Graphics.SilkDesktop.RenderCanvasImp(icon);
app.ContextImplementor = new Fusee.Engine.Imp.Graphics.SilkDesktop.RenderContextImp(app.CanvasImplementor);
//Input.AddDriverImp(new Fusee.Engine.Imp.Graphics.SilkDesktop.RenderCanvasInputDriverImp(app.CanvasImplementor));
//Input.AddDriverImp(new Fusee.Engine.Imp.Graphics.SilkDesktop.WindowsTouchInputDriverImp(app.CanvasImplementor));
// app.InputImplementor = new Fusee.Engine.Imp.Graphics.Desktop.InputImp(app.CanvasImplementor);
// app.InputDriverImplementor = new Fusee.Engine.Imp.Input.Desktop.InputDriverImp();
// app.VideoManagerImplementor = ImpFactory.CreateIVideoManagerImp();

app.CanvasImplementor.Init += (s, e) =>
{

app.InitApp();
};



// Start the app
app.Run();
}
}
}
57 changes: 50 additions & 7 deletions Fusee.sln
Original file line number Diff line number Diff line change
Expand Up @@ -296,14 +296,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Fusee.Examples.RenderContex
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Fusee.Examples.PickingRayCast.Blazor", "Examples\Complete\PickingRayCast\Blazor\Fusee.Examples.PickingRayCast.Blazor.csproj", "{3AFEF2ED-6325-4C11-9B87-A32514FD5AE1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Fusee.Engine.Imp.Graphics.Silk", "src\Engine\Imp\Graphics\Silk\Fusee.Engine.Imp.Graphics.Silk.csproj", "{29B228C2-2168-46A0-BAB4-BDA0D7ABDDB1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Fusee.Examples.Simple.Silk", "Examples\Complete\Simple\Silk\Fusee.Examples.Simple.Silk.csproj", "{DEE03C44-A421-43FE-8267-0A9A5BC4E7C3}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
src\Engine\Imp\Graphics\Shared\Fusee.Engine.Imp.Graphics.Shared.projitems*{253263c9-9c67-44a5-94d3-51c586bbdaec}*SharedItemsImports = 13
src\Engine\Imp\Graphics\Shared\Fusee.Engine.Imp.Graphics.Shared.projitems*{b3ce4f39-fcc4-4388-8130-9d0b9d65d034}*SharedItemsImports = 5
src\PointCloud\Las\Shared\Fusee.PointCloud.Las.Shared.projitems*{dcc7da71-3e2e-476c-8391-1f9651637503}*SharedItemsImports = 13
src\PointCloud\Las\Shared\Fusee.PointCloud.Las.Shared.projitems*{f28634e7-52b8-4935-b19e-cb8a6844e6f1}*SharedItemsImports = 5
src\Engine\Imp\Graphics\Shared\Fusee.Engine.Imp.Graphics.Shared.projitems*{f7ad2bb5-d2b0-4697-bddb-4cc26152a6b6}*SharedItemsImports = 5
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug-Android|Any CPU = Debug-Android|Any CPU
Expand Down Expand Up @@ -1714,6 +1711,42 @@ Global
{3AFEF2ED-6325-4C11-9B87-A32514FD5AE1}.Release-Blazor|Any CPU.Build.0 = Release|Any CPU
{3AFEF2ED-6325-4C11-9B87-A32514FD5AE1}.Release-Desktop|Any CPU.ActiveCfg = Release|Any CPU
{3AFEF2ED-6325-4C11-9B87-A32514FD5AE1}.Release-NuGet|Any CPU.ActiveCfg = Release|Any CPU
{29B228C2-2168-46A0-BAB4-BDA0D7ABDDB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{29B228C2-2168-46A0-BAB4-BDA0D7ABDDB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{29B228C2-2168-46A0-BAB4-BDA0D7ABDDB1}.Debug-Android|Any CPU.ActiveCfg = Debug|Any CPU
{29B228C2-2168-46A0-BAB4-BDA0D7ABDDB1}.Debug-Android|Any CPU.Build.0 = Debug|Any CPU
{29B228C2-2168-46A0-BAB4-BDA0D7ABDDB1}.Debug-Blazor|Any CPU.ActiveCfg = Debug|Any CPU
{29B228C2-2168-46A0-BAB4-BDA0D7ABDDB1}.Debug-Blazor|Any CPU.Build.0 = Debug|Any CPU
{29B228C2-2168-46A0-BAB4-BDA0D7ABDDB1}.Debug-Desktop|Any CPU.ActiveCfg = Debug|Any CPU
{29B228C2-2168-46A0-BAB4-BDA0D7ABDDB1}.Debug-Desktop|Any CPU.Build.0 = Debug|Any CPU
{29B228C2-2168-46A0-BAB4-BDA0D7ABDDB1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{29B228C2-2168-46A0-BAB4-BDA0D7ABDDB1}.Release|Any CPU.Build.0 = Release|Any CPU
{29B228C2-2168-46A0-BAB4-BDA0D7ABDDB1}.Release-Android|Any CPU.ActiveCfg = Release|Any CPU
{29B228C2-2168-46A0-BAB4-BDA0D7ABDDB1}.Release-Android|Any CPU.Build.0 = Release|Any CPU
{29B228C2-2168-46A0-BAB4-BDA0D7ABDDB1}.Release-Blazor|Any CPU.ActiveCfg = Release|Any CPU
{29B228C2-2168-46A0-BAB4-BDA0D7ABDDB1}.Release-Blazor|Any CPU.Build.0 = Release|Any CPU
{29B228C2-2168-46A0-BAB4-BDA0D7ABDDB1}.Release-Desktop|Any CPU.ActiveCfg = Release|Any CPU
{29B228C2-2168-46A0-BAB4-BDA0D7ABDDB1}.Release-Desktop|Any CPU.Build.0 = Release|Any CPU
{29B228C2-2168-46A0-BAB4-BDA0D7ABDDB1}.Release-NuGet|Any CPU.ActiveCfg = Release|Any CPU
{29B228C2-2168-46A0-BAB4-BDA0D7ABDDB1}.Release-NuGet|Any CPU.Build.0 = Release|Any CPU
{DEE03C44-A421-43FE-8267-0A9A5BC4E7C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DEE03C44-A421-43FE-8267-0A9A5BC4E7C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DEE03C44-A421-43FE-8267-0A9A5BC4E7C3}.Debug-Android|Any CPU.ActiveCfg = Debug|Any CPU
{DEE03C44-A421-43FE-8267-0A9A5BC4E7C3}.Debug-Android|Any CPU.Build.0 = Debug|Any CPU
{DEE03C44-A421-43FE-8267-0A9A5BC4E7C3}.Debug-Blazor|Any CPU.ActiveCfg = Debug|Any CPU
{DEE03C44-A421-43FE-8267-0A9A5BC4E7C3}.Debug-Blazor|Any CPU.Build.0 = Debug|Any CPU
{DEE03C44-A421-43FE-8267-0A9A5BC4E7C3}.Debug-Desktop|Any CPU.ActiveCfg = Debug|Any CPU
{DEE03C44-A421-43FE-8267-0A9A5BC4E7C3}.Debug-Desktop|Any CPU.Build.0 = Debug|Any CPU
{DEE03C44-A421-43FE-8267-0A9A5BC4E7C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DEE03C44-A421-43FE-8267-0A9A5BC4E7C3}.Release|Any CPU.Build.0 = Release|Any CPU
{DEE03C44-A421-43FE-8267-0A9A5BC4E7C3}.Release-Android|Any CPU.ActiveCfg = Release|Any CPU
{DEE03C44-A421-43FE-8267-0A9A5BC4E7C3}.Release-Android|Any CPU.Build.0 = Release|Any CPU
{DEE03C44-A421-43FE-8267-0A9A5BC4E7C3}.Release-Blazor|Any CPU.ActiveCfg = Release|Any CPU
{DEE03C44-A421-43FE-8267-0A9A5BC4E7C3}.Release-Blazor|Any CPU.Build.0 = Release|Any CPU
{DEE03C44-A421-43FE-8267-0A9A5BC4E7C3}.Release-Desktop|Any CPU.ActiveCfg = Release|Any CPU
{DEE03C44-A421-43FE-8267-0A9A5BC4E7C3}.Release-Desktop|Any CPU.Build.0 = Release|Any CPU
{DEE03C44-A421-43FE-8267-0A9A5BC4E7C3}.Release-NuGet|Any CPU.ActiveCfg = Release|Any CPU
{DEE03C44-A421-43FE-8267-0A9A5BC4E7C3}.Release-NuGet|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -1845,8 +1878,18 @@ Global
{FF0DEE54-C91E-480F-B103-593FB00E92FF} = {E6E73351-7DED-4B97-B254-A0E903D769C1}
{ED0AC25F-615E-4AE6-A491-ADD41ABEB2D2} = {E6E73351-7DED-4B97-B254-A0E903D769C1}
{3AFEF2ED-6325-4C11-9B87-A32514FD5AE1} = {425DDCA8-659F-44FB-832E-117C7DED152E}
{29B228C2-2168-46A0-BAB4-BDA0D7ABDDB1} = {6295AB06-EBE4-4887-A811-20737F6F8645}
{DEE03C44-A421-43FE-8267-0A9A5BC4E7C3} = {F799DB2B-D7BA-4B88-A16F-F8E2317137D3}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CC1775C2-579F-4897-8770-592966D00E3D}
EndGlobalSection
GlobalSection(SharedMSBuildProjectFiles) = preSolution
src\Engine\Imp\Graphics\Shared\Fusee.Engine.Imp.Graphics.Shared.projitems*{253263c9-9c67-44a5-94d3-51c586bbdaec}*SharedItemsImports = 13
src\Engine\Imp\Graphics\Shared\Fusee.Engine.Imp.Graphics.Shared.projitems*{29b228c2-2168-46a0-bab4-bda0d7abddb1}*SharedItemsImports = 5
src\Engine\Imp\Graphics\Shared\Fusee.Engine.Imp.Graphics.Shared.projitems*{b3ce4f39-fcc4-4388-8130-9d0b9d65d034}*SharedItemsImports = 5
src\PointCloud\Las\Shared\Fusee.PointCloud.Las.Shared.projitems*{dcc7da71-3e2e-476c-8391-1f9651637503}*SharedItemsImports = 13
src\PointCloud\Las\Shared\Fusee.PointCloud.Las.Shared.projitems*{f28634e7-52b8-4935-b19e-cb8a6844e6f1}*SharedItemsImports = 5
src\Engine\Imp\Graphics\Shared\Fusee.Engine.Imp.Graphics.Shared.projitems*{f7ad2bb5-d2b0-4697-bddb-4cc26152a6b6}*SharedItemsImports = 5
EndGlobalSection
EndGlobal
9 changes: 7 additions & 2 deletions src/Engine/Core/RenderCanvas.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ protected int GetWindowHeight()
/// </summary>
public EventHandler<EventArgs> LoadingCompleted;

/// <summary>
/// This event is usually triggered when loading is completed (after init() method)
/// </summary>
public EventHandler<EventArgs> InitComplete;

/// <summary>
/// Called after <see cref="RenderCanvas.Init"/> can be used to await async tasks (e.g. loading methods)
/// </summary>
Expand Down Expand Up @@ -309,8 +314,8 @@ public void OpenLink(string link)
/// necessary initialization, call the Init method and enter the application main loop.
/// </remarks>
public void Run()
{
CanvasImplementor.Run();
{
CanvasImplementor.Run();
}

/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions src/Engine/Imp/Graphics/Shared/BufferHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
namespace Fusee.Engine.Imp.Graphics.Desktop
#elif PLATFORM_ANDROID
namespace Fusee.Engine.Imp.Graphics.Android
#elif PLATFORM_SILK
namespace Fusee.Engine.Imp.Graphics.SilkDesktop
#endif
{
/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions src/Engine/Imp/Graphics/Shared/Font.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
namespace Fusee.Engine.Imp.Graphics.Desktop
#elif PLATFORM_ANDROID
namespace Fusee.Engine.Imp.Graphics.Android
#elif PLATFORM_SILK
namespace Fusee.Engine.Imp.Graphics.SilkDesktop
#endif
{
internal class Font : IFont
Expand Down
3 changes: 2 additions & 1 deletion src/Engine/Imp/Graphics/Shared/MeshImp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

namespace Fusee.Engine.Imp.Graphics.Desktop
#elif PLATFORM_ANDROID

namespace Fusee.Engine.Imp.Graphics.Android
#elif PLATFORM_SILK
namespace Fusee.Engine.Imp.Graphics.SilkDesktop
#endif
{
/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions src/Engine/Imp/Graphics/Shared/ShaderHandleImp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
namespace Fusee.Engine.Imp.Graphics.Desktop
#elif PLATFORM_ANDROID
namespace Fusee.Engine.Imp.Graphics.Android
#elif PLATFORM_SILK
namespace Fusee.Engine.Imp.Graphics.SilkDesktop
#endif
{
/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions src/Engine/Imp/Graphics/Shared/ShaderParam.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
namespace Fusee.Engine.Imp.Graphics.Desktop
#elif PLATFORM_ANDROID
namespace Fusee.Engine.Imp.Graphics.Android
#elif PLATFORM_SILK
namespace Fusee.Engine.Imp.Graphics.SilkDesktop
#endif
{
/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions src/Engine/Imp/Graphics/Shared/TextureHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
namespace Fusee.Engine.Imp.Graphics.Desktop
#elif PLATFORM_ANDROID
namespace Fusee.Engine.Imp.Graphics.Android
#elif PLATFORM_SILK
namespace Fusee.Engine.Imp.Graphics.SilkDesktop
#endif
{
/// <summary>
Expand Down
43 changes: 43 additions & 0 deletions src/Engine/Imp/Graphics/Silk/Fusee.Engine.Imp.Graphics.Silk.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<DefineConstants>$(DefineConstants);PLATFORM_SILK</DefineConstants>
<DocumentationFile>$(OutputPath)\$(RootNamespace).xml</DocumentationFile>

<IsPackable>true</IsPackable>
<Description>Fusee Engine Imp Graphics Silk</Description>

<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="$(FuseeEngineRoot)\src\Base\Common\Fusee.Base.Common.csproj">
<PrivateAssets>analyzers</PrivateAssets>
</ProjectReference>
<ProjectReference Include="$(FuseeEngineRoot)\src\Base\Core\Fusee.Base.Core.csproj">
<PrivateAssets>analyzers</PrivateAssets>
</ProjectReference>
<ProjectReference Include="$(FuseeEngineRoot)\src\Engine\Common\Fusee.Engine.Common.csproj">
<PrivateAssets>analyzers</PrivateAssets>
</ProjectReference>
<ProjectReference Include="$(FuseeEngineRoot)\src\Engine\Core\Fusee.Engine.Core.csproj">
<PrivateAssets>analyzers</PrivateAssets>
</ProjectReference>
<ProjectReference Include="$(FuseeEngineRoot)\src\Math\Core\Fusee.Math.Core.csproj">
<PrivateAssets>analyzers</PrivateAssets>
</ProjectReference>
<PackageReference Include="Silk.NET.Core" Version="2.15.0" />
<PackageReference Include="Silk.NET.GLFW" Version="2.15.0" />
<PackageReference Include="Silk.NET.Input.Common" Version="2.15.0" />
<PackageReference Include="Silk.NET.OpenGL" Version="2.15.0" />
<PackageReference Include="Silk.NET.OpenGL.Extensions.ARB" Version="2.15.0" />
<PackageReference Include="Silk.NET.OpenGLES" Version="2.15.0" />
<PackageReference Include="Silk.NET.Windowing" Version="2.15.0" />
<PackageReference Include="Silk.NET.Windowing.Common" Version="2.15.0" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
</ItemGroup>

<Import Project="$(FuseeEngineRoot)\src\Engine\Imp\Graphics\Shared\Fusee.Engine.Imp.Graphics.Shared.projitems" Label="Shared" />

</Project>
Loading