Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<OutputPath>$(BaseOutputPath)\Examples\PointCloudPotree2\Core\</OutputPath>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>

<ItemGroup>
Expand Down
26 changes: 25 additions & 1 deletion Examples/Complete/PointCloudPotree2/Core/PointCloudPotree2.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Fusee.Engine.Common;
using Fusee.Engine.Core;
using Fusee.Engine.Core.Scene;
using Fusee.PointCloud.Common;

namespace Fusee.Examples.PointCloudPotree2.Core
Expand All @@ -22,16 +23,39 @@ public bool ClosingRequested

private PointCloudPotree2Core _pointRenderingCore;

public PointCloudPotree2()
// Changed for SLIRP
public Camera MainCamera => _pointRenderingCore?.MainCamera;
public Transform MainCameraTransform => _pointRenderingCore?.MainCameraTransform;
public SceneNode MainCameraSceneNode => _pointRenderingCore?.MainCameraNode;
public PointCloudPotree2Core Core => _pointRenderingCore;

public bool RenderToTexture
{
get => _pointRenderingCore?.RenderToTexture ?? false;
set
{
if (_pointRenderingCore != null) _pointRenderingCore.RenderToTexture = value;
}
}

public WritableTexture CurRenderTexture
{
get => _pointRenderingCore.RenderTexture;
set => _pointRenderingCore.RenderTexture = value;
}

public PointCloudPotree2()
{

}

public override void Init()
{
VSync = false;
_pointRenderingCore = new PointCloudPotree2Core(RC)
{
// SLIRP
// RenderToTexture = true
RenderToTexture = false
};

Expand Down
25 changes: 21 additions & 4 deletions Examples/Complete/PointCloudPotree2/Core/PointCloudPotree2Core.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Fusee.Base.Common;
using Fusee.Engine.Common;
using Fusee.Engine.Core;
using Fusee.Engine.Core.Scene;
using Fusee.Math.Core;
Expand All @@ -15,7 +16,12 @@ public class PointCloudPotree2Core
{
public bool RenderToTexture { get; set; }

public WritableTexture RenderTexture { get; private set; }
public WritableTexture RenderTexture
{
get;
// SLIRP
set;
}

public bool ClosingRequested
{
Expand Down Expand Up @@ -52,6 +58,11 @@ public bool ClosingRequested

private readonly RenderContext _rc;

//Expose camera to use it in SLIRP
public Camera MainCamera => _cam;
public Transform MainCameraTransform => _camTransform;
public SceneNode MainCameraNode => _camNode;

public void OnLoadNewFile(object sender, EventArgs e)
{
var path = PointRenderingParams.Instance.PathToOocFile;
Expand Down Expand Up @@ -111,8 +122,9 @@ public void Init()

_cam = new(ProjectionMethod.Perspective, ZNear, ZFar, _fovy)
{
BackgroundColor = float4.One,
RenderTexture = RenderTexture
//SLIRP
BackgroundColor = float4.Zero,
//RenderTexture = RenderTexture
};

_camNode = new SceneNode()
Expand Down Expand Up @@ -199,6 +211,9 @@ public void Update(bool allowInput)
OocLoader.IsUserMoving = false;*/
//--------------------------------------------------------------------------------------------

// SLIRP
// in SLIRP we take the input from the SLIRP Client
/*
// Mouse and keyboard movement
if (Input.Keyboard.LeftRightAxis != 0 || Input.Keyboard.UpDownAxis != 0)
_keys = true;
Expand All @@ -225,8 +240,10 @@ public void Update(bool allowInput)
_angleVert += _angleVelVert;
_angleVelHorz = 0;
_angleVelVert = 0;

_camTransform.FpsView(_angleHorz, _angleVert, Input.Keyboard.WSAxis, Input.Keyboard.ADAxis, Time.DeltaTimeUpdate * 20);
´*/

}

private void OnThresholdChanged(int newValue)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public sealed class PointRenderingParams
public PointThresholdHandler PointThresholdHandler;
public ProjectedSizeModifierHandler ProjectedSizeModifierHandler;

public string PathToOocFile = Path.Combine("Assets", "Cube1030301", "Potree");
public string PathToOocFile = Path.Combine("Assets", "Rose", "Potree");

public ShaderEffect DepthPassEf;
public SurfaceEffectPointCloud ColorPassEf;
Expand Down
269 changes: 269 additions & 0 deletions Fusee.sln

Large diffs are not rendered by default.

14 changes: 13 additions & 1 deletion src/Base/Common/ColorFormat.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Fusee.Base.Common
namespace Fusee.Base.Common
{
/// <summary>
/// ColorFormat information in enum representation. Entries are hints for Color channel encoding.
Expand Down Expand Up @@ -59,5 +59,17 @@ public enum ColorFormat
/// RGBA int, 32bit.
/// </summary>
iRGBA32,

/// <summary>
/// SLIRP
/// BGRA, 32bit.
/// </summary>
//BGRA,

/// <summary>
/// SLIRP
/// YUV 420, 32bit.
/// </summary>
//YUV420,
}
}
1 change: 1 addition & 0 deletions src/Base/Common/Fusee.Base.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

<IsPackable>true</IsPackable>
<Description>Fusee Base Common</Description>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>

<ItemGroup>
Expand Down
5 changes: 4 additions & 1 deletion src/Base/Common/ImagePixelFormat.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;

namespace Fusee.Base.Common
{
Expand Down Expand Up @@ -38,6 +38,9 @@ public int BytesPerPixel
ColorFormat == ColorFormat.uiRgb8
? 3 :
ColorFormat == ColorFormat.RGBA
// SLIRP
//|| ColorFormat == ColorFormat.BGRA
//|| ColorFormat == ColorFormat.YUV420
? 4 :
ColorFormat == ColorFormat.fRGB16
? 6 :
Expand Down
6 changes: 5 additions & 1 deletion src/Base/Common/ScanLine.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;

namespace Fusee.Base.Common
{
Expand Down Expand Up @@ -64,6 +64,10 @@ public int BytesPerPixel
ColorFormat.Depth24 => 3,
ColorFormat.uiRgb8 => 3,
ColorFormat.RGBA => 4,
// SLIRP
// ColorFormat.BGRA => 4,
// ColorFormat.YUV420 => 4,
// SLIRP close
ColorFormat.fRGB16 => 6,
ColorFormat.fRGBA16 => 8,
ColorFormat.fRGB32 => 12,
Expand Down
1 change: 1 addition & 0 deletions src/Base/Core/Fusee.Base.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

<IsPackable>true</IsPackable>
<Description>Fusee Base Core</Description>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/Base/Imp/Desktop/Fusee.Base.Imp.Desktop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

<IsPackable>true</IsPackable>
<Description>Fusee Base Imp Desktop</Description>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/Engine/Common/Fusee.Engine.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

<IsPackable>true</IsPackable>
<Description>Fusee Engine Common</Description>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/Engine/Common/IRenderCanvasImp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ public interface IRenderCanvasImp
/// </summary>
public void DoRender();


/// <summary>
/// Does the resize on this instance.
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions src/Engine/Core/Fusee.Engine.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<IsPackable>true</IsPackable>
<Description>Fusee Engine Core</Description>
<Nullable>enable</Nullable>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 0 additions & 2 deletions src/Engine/Core/Input.cs
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,6 @@ public void AddInputDriverImp(IInputDriverImp inputDriver)
/// </remarks>
public static void AddDriverImp(IInputDriverImp inputDriver) => Instance.AddInputDriverImp(inputDriver);



private void OnNewDeviceImpConnected(object sender, NewDeviceImpConnectedArgs args)
{
if (sender == null) throw new ArgumentNullException(nameof(sender));
Expand Down
8 changes: 3 additions & 5 deletions src/Engine/Core/RenderCanvas.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public class RenderCanvas
/// The canvas implementor.
/// </value>
[InjectMe]
public IRenderCanvasImp CanvasImplementor { set; get; }
public IRenderCanvasImp CanvasImplementor {
set; get; }

/// <summary>
/// Gets and sets the RenderContext implementor.
Expand Down Expand Up @@ -63,10 +64,6 @@ public class RenderCanvas

#endregion

#region Constructors

#endregion

#region Members

/// <summary>
Expand Down Expand Up @@ -243,6 +240,7 @@ public void InitApp()
};
}


/// <summary>
/// Callback method to invoke user code for updating a frame.
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions src/Engine/GUI/Fusee.Engine.Gui.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

<IsPackable>true</IsPackable>
<Description>Fusee Engine GUI</Description>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>

<ItemGroup>
Expand Down
11 changes: 11 additions & 0 deletions src/Engine/Imp/Graphics/Android/RenderCanvasImp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,11 @@ public void Run()
/// </summary>
public event EventHandler<RenderEventArgs> Render;

/// <summary>
/// Occurs when [postrender].
/// </summary>
public event EventHandler<PostRenderEventArgs> PostRender;

/// <summary>
/// Occurs when [resize].
/// </summary>
Expand Down Expand Up @@ -342,6 +347,11 @@ public void DoRender()
Render?.Invoke(this, new RenderEventArgs());
}

public void DoPostRender()
{
PostRender?.Invoke(this, new PostRenderEventArgs());
}

/// <summary>
/// Does the resize on this instance.
/// </summary>
Expand All @@ -350,6 +360,7 @@ public void DoResize(int width, int height)
Resize?.Invoke(this, new ResizeEventArgs(width, height));
}


}

internal class RenderCanvasGameView : AndroidGameView
Expand Down
15 changes: 15 additions & 0 deletions src/Engine/Imp/Graphics/Blazor/RenderCanvasImp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ public RenderCanvasImp(IJSObjectReference canvas, IJSRuntime runtime, WebGL2Rend
/// </summary>
public event EventHandler<RenderEventArgs> Render;

/// <summary>
/// Occurs when [postrender].
/// </summary>
public event EventHandler<PostRenderEventArgs> PostRender;

/// <summary>
/// Occurs when resizing.
/// </summary>
Expand Down Expand Up @@ -187,6 +192,14 @@ public void DoRender()
Render?.Invoke(this, new RenderEventArgs());
}

/// <summary>
/// Does the postrender of this instance.
/// </summary>
public void DoPostRender()
{
throw new NotImplementedException();
}

/// <summary>
/// Does initialize this instance.
/// </summary>
Expand Down Expand Up @@ -223,5 +236,7 @@ public void DoResize(int w, int h)

Resize?.Invoke(this, new ResizeEventArgs(w, h));
}


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
<Description>Fusee Engine Imp Graphics Desktop</Description>

<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>

<ItemGroup>
Expand Down
3 changes: 3 additions & 0 deletions src/Engine/Imp/Graphics/Desktop/RenderCanvasImp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@ public int TryptMonitorSetupHorizontal

internal RenderCanvasGameWindow _gameWindow;

// SLIRP
// has to be exposed so that the SLIRP program can map new input resources
protected GameWindow GW => _gameWindow;
#endregion

#region Constructors
Expand Down
5 changes: 5 additions & 0 deletions src/Engine/Imp/Graphics/Desktop/RenderContextImp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,12 @@ private SizedInternalFormat GetSizedInteralFormat(ImagePixelFormat format)
ColorFormat.Depth16 => (SizedInternalFormat)All.DepthComponent16,
ColorFormat.RGB => (SizedInternalFormat)All.Rgb8,
ColorFormat.Intensity => (SizedInternalFormat)All.R8,
// SLIRP
// ColorFormat.BGRA => (SizedInternalFormat)All.Bgra,
// ColorFormat.YUV420 => (SizedInternalFormat)All.YUV420,
// SLIRP close
_ => throw new ArgumentOutOfRangeException("SizedInternalFormat not supported. Try to use a format with r,g,b and a components."),

};
}

Expand Down
1 change: 1 addition & 0 deletions src/Jometri/Fusee.Jometri.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

<IsPackable>true</IsPackable>
<Description>Fusee Jometri</Description>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/Math/Core/Fusee.Math.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading