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

Merge app/polar into develop #869

Merged
merged 63 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
6c0580c
MeshMaker: removed unused param octantId
RedImp1470 Sep 14, 2023
dca211e
PointCloudDatahandler: moved CreateGpuDataHandler to base class
RedImp1470 Sep 14, 2023
ebd768c
Removed UpdateGpuDataCache from IPointCloudImp
RedImp1470 Sep 14, 2023
9d3a6dd
Cleanup
RedImp1470 Sep 14, 2023
8888bb2
Potree2Writer is able to handle more than one attribute
RedImp1470 Sep 20, 2023
cec6f1e
Get all bytes of specific attribute
RedImp1470 Sep 26, 2023
b5b4be6
GetAllBytesForAttribute for only one node
RedImp1470 Sep 28, 2023
e148648
Delete unused OctantPicker
RedImp1470 Oct 2, 2023
82bb3ca
Point cloud picking: uses spacing and distance to ray
RedImp1470 Oct 2, 2023
de1793d
Cleanup
RedImp1470 Oct 2, 2023
14ee6c7
Potree2Reader: don't calculate principal axis in ReadNewFile
RedImp1470 Oct 2, 2023
4294d05
Automatic cleanup
RedImp1470 Oct 2, 2023
0646485
PointCloudPotree2Core: adaptations due to picker changes
RedImp1470 Oct 2, 2023
48d25c9
Potree2Reader: GetAllBytesForAttribute returns byte[]
RedImp1470 Oct 4, 2023
7dc2604
RayF: normalize inverse direction
RedImp1470 Oct 5, 2023
a82808c
ScenePicker: PickPosClip set is private
RedImp1470 Oct 6, 2023
b6f4909
RayF: calc from clip pos without perspective division
RedImp1470 Oct 6, 2023
aad2431
AABBf: IntersectsRay handles parallality (slab/ray)
RedImp1470 Oct 6, 2023
65ab481
WIP: PointCache is of type MemoryMappedFile
RedImp1470 Oct 10, 2023
6d43d49
Potree2AccessBase: Potree-file-unique mmf names
RedImp1470 Oct 11, 2023
186cde3
MeshMaker: fixed loading of unlabaled points clouds
RedImp1470 Oct 11, 2023
9a5c50f
Cleanup
RedImp1470 Oct 11, 2023
a8703b5
Preliminary fix for processing empty (numPoints = 0) PotreeNodes
RedImp1470 Oct 11, 2023
643c027
PointCloudDataHandler: reworked, is using Concurrent Collections
RedImp1470 Oct 12, 2023
a1325d6
Updated OpenTk to v4.8.1 (fixes linux publishing issue)
RedImp1470 Oct 12, 2023
1f15a6b
Moved GpuDataState handling to Data Handler
RedImp1470 Oct 12, 2023
4305108
Revert "Removed UpdateGpuDataCache from IPointCloudImp"
RedImp1470 Oct 13, 2023
ea790d2
Reverted deletion of Visualization Point in various files
RedImp1470 Oct 13, 2023
455341c
Added Visualization Point Cache
RedImp1470 Oct 13, 2023
6bf1c0c
Potree2Writer: fixed WriteArray offset
RedImp1470 Oct 13, 2023
993ca2d
PointCloudDataHandler: don't add to caches in GetAllBytesForAttib
RedImp1470 Oct 13, 2023
9ed9ac5
Removed GpuDataState
RedImp1470 Oct 13, 2023
e9a6bb9
Potree2CloudDynamic: re-added mesh name reset
RedImp1470 Oct 16, 2023
2db3331
Rayf: version of "from clip pos" ctor that also works for ortho proj …
RedImp1470 Oct 16, 2023
a31a32f
PointCloudDataHandler: using synch context to manage mesh creation
RedImp1470 Oct 17, 2023
57f1d02
MeshManager: uses a concurrent dict
RedImp1470 Oct 17, 2023
dd6856e
Removed custom Suid in favor of System.Guid
RedImp1470 Oct 18, 2023
6f7864f
PointCloudDataHandler: only raw point loading runs as task
RedImp1470 Oct 19, 2023
fec9c2e
Revert "MeshManager: uses a concurrent dict"
RedImp1470 Oct 19, 2023
69a9b0a
Cleanup
RedImp1470 Oct 20, 2023
20c161d
Data Handler: force disposal on main thread
RedImp1470 Oct 20, 2023
fb15eea
TriggerPointLoading correctly checks for existing raw points
RedImp1470 Oct 20, 2023
919c5c9
Refactoring
RedImp1470 Oct 24, 2023
779a45a
Fixed comments
RedImp1470 Oct 24, 2023
064ea7b
File & Folder Picker: made RootFolder settable
RedImp1470 Nov 27, 2023
1bcff65
Potree2Las: changed guards to IsLessThanOrEqual
RedImp1470 Nov 29, 2023
ac22e9b
Downgraded OpenTk to v4.7.7 (fixes missing glfw error under linux)
RedImp1470 Dec 6, 2023
c29f658
Get correct AABB size (not octree root size) in PointCloudImp
RedImp1470 Dec 11, 2023
d2dbe05
Potree2Cloud: removed init using collection literals
RedImp1470 Dec 12, 2023
9aeeff3
PointCloudOctant Size is now float3 to support Anisotropic Octrees
RedImp1470 Dec 13, 2023
8e96580
ScenePicker: early out if mouse isn't inside the canvas
RedImp1470 Dec 13, 2023
cd1aaac
MeshMaker: fixed bug that caused the MemoryOwner<ViewPoints> getting …
RedImp1470 Dec 13, 2023
81fd306
Merge branch 'develop' into app/polar
RedImp1470 Mar 19, 2024
bd62ba8
RenderTests: updated reference images
RedImp1470 Mar 19, 2024
0c9c1be
Fixed rci Android and Blazor
RedImp1470 Mar 19, 2024
2fc8c20
CI build Blazor: install wasm-tools-net7
RedImp1470 Mar 19, 2024
7fe2222
CI buildandroid: setup-java
RedImp1470 Mar 20, 2024
704dcfd
CI test Android v12.0
RedImp1470 Mar 15, 2024
0513261
CI test Android v12.0
RedImp1470 Mar 20, 2024
dd960b2
CI buildnuget: setup-java
RedImp1470 Mar 20, 2024
2ae0a2d
dis/Nuget/Android.csproj to monoandroid12
RedImp1470 Mar 20, 2024
c968834
Merge branch 'develop' into app/polar
RedImp1470 Mar 20, 2024
9be1457
Merge branch 'develop' into app/polar
RedImp1470 Mar 21, 2024
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 @@ -282,29 +282,17 @@ public void Update(bool allowInput)

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


if (!_keys && Input.Mouse.RightButton && PointRenderMode == RenderMode.DynamicMesh)
{
var size = RenderToTexture ? ExternalCanvasSize : new int2(_rc.ViewportWidth, _rc.ViewportHeight);
var mousePos = RenderToTexture ? ExternalMousePosition : Input.Mouse.Position;
var result = _picker?.Pick(mousePos, size.x, size.y).Where(x => x is PointCloudPickResult).Cast<PointCloudPickResult>();
var result = _picker?.Pick(mousePos, size.x, size.y).Where(x => x is PointCloudPickResult).Cast<PointCloudPickResult>().OrderBy(res => res.DistanceToRay);
if (result != null && result.Any())
{
var minElement = result.FirstOrDefault();

// get min x/y distance point
foreach (var r in result)
{
if (r.DistanceToRay.x < minElement.DistanceToRay.x && r.DistanceToRay.y < minElement.DistanceToRay.y)
{
minElement = r;
}
}
_pickResultTransform.Translation = minElement.Mesh.Vertices[minElement.VertIdx];
}

}

}

private void OnThresholdChanged(int newValue)
Expand Down
30 changes: 19 additions & 11 deletions src/Base/Core/MemoryCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Threading;

namespace Fusee.Base.Core
{
Expand Down Expand Up @@ -105,6 +106,7 @@ public class MemoryCache<TKey, TItem> : IDisposable
private readonly MemoryCache _cache;

private bool _disposed = false;
private readonly SemaphoreSlim _cacheLock = new(1);

/// <summary>
/// Creates a new instance and initializes the internal <see cref="MemoryCache"/>.
Expand Down Expand Up @@ -135,20 +137,26 @@ public bool TryGetValue(TKey key, out TItem item)
/// </summary>
/// <param name="key">The key of the cache item.</param>
/// <param name="cacheEntry">The cache item.</param>
public void AddOrUpdate(TKey key, TItem cacheEntry)
public async void AddOrUpdate(TKey key, TItem cacheEntry)
{
var cacheEntryOptions = new MemoryCacheEntryOptions()
.SetPriority(CacheItemPriority.High)
// Keep in cache for this time, reset time if accessed.
.SetSlidingExpiration(TimeSpan.FromSeconds(SlidingExpiration));

cacheEntryOptions.RegisterPostEvictionCallback((subkey, subValue, reason, state) =>
try
{
HandleEvictedItem?.Invoke(subkey, subValue, reason, state);
});
await _cacheLock.WaitAsync();
var cacheEntryOptions = new MemoryCacheEntryOptions()
.SetPriority(CacheItemPriority.High)
// Keep in cache for this time, reset time if accessed.
.SetSlidingExpiration(TimeSpan.FromSeconds(SlidingExpiration));

cacheEntryOptions.RegisterPostEvictionCallback((subkey, subValue, reason, state) =>
{
HandleEvictedItem?.Invoke(subkey, subValue, reason, state);
});

// Key not in cache, so get data.
_cache.Set(key, cacheEntry, cacheEntryOptions);

// Key not in cache, so get data.
_cache.Set(key, cacheEntry, cacheEntryOptions);
}
finally { _cacheLock.Release(); }
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Engine/Common/IManagedInstanceData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public interface IManagedInstanceData : IDisposable
/// <summary>
/// The unique id of the object.
/// </summary>
public Suid SessionUniqueId
public Guid UniqueId
{
get;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Engine/Common/IManagedMesh.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public interface IManagedMesh : IDisposable
/// <summary>
/// SessionUniqueIdentifier is used to verify a Mesh's uniqueness in the current session.
/// </summary>
public Suid SessionUniqueIdentifier { get; }
public Guid UniqueIdentifier { get; }

/// <summary>
/// The primitive type this mesh is composed of.
Expand Down
2 changes: 2 additions & 0 deletions src/Engine/Common/IMeshImp.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using ProtoBuf;
using System;

namespace Fusee.Engine.Common
{
/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Engine/Common/IRenderContextImp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ public interface IRenderContextImp
/// </summary>
/// <param name="instanceImp">The <see cref="IInstanceDataImp"/> instance.</param>
/// <param name="instanceColors">The instance colors.</param>
public void SetInstanceColor(IInstanceDataImp instanceImp, float4[] instanceColors);
public void SetInstanceColor(IInstanceDataImp instanceImp, uint[] instanceColors);

/// <summary>
/// Binds the tangents onto the GL render context and assigns an TangentBuffer index to the passed <see cref="IMeshImp" /> instance.
Expand Down
2 changes: 1 addition & 1 deletion src/Engine/Common/ITextureBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public interface ITextureBase : IDisposable
/// <summary>
/// SessionUniqueIdentifier is used to verify a Textures's uniqueness in the current session.
/// </summary>
Suid SessionUniqueIdentifier { get; }
Guid UniqueIdentifier { get; }

/// <summary>
/// Defines if Mipmaps are generated for this texture.
Expand Down
59 changes: 0 additions & 59 deletions src/Engine/Common/Suid.cs

This file was deleted.

15 changes: 6 additions & 9 deletions src/Engine/Core/EffectManager.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Fusee.Base.Core;
using Fusee.Engine.Common;
using Fusee.Base.Core;
using Fusee.Engine.Core.Effects;
using System;
using System.Collections.Generic;
Expand All @@ -10,15 +9,13 @@ internal class EffectManager
{
private readonly RenderContext _rc;
private readonly Stack<Effect> _effectsToBeDeleted = new();
private readonly Dictionary<Suid, Effect> _allEffects = new();
private readonly Dictionary<Guid, Effect> _allEffects = new();

private void EffectChanged(object? sender, EffectManagerEventArgs args)
{
if (args == null || sender == null) return;

var senderSF = sender as Effect;

if (senderSF == null)
if (sender is not Effect senderSF)
{
Diagnostics.Warn("Casting changed effect to type Effect failed!");
return;
Expand All @@ -43,7 +40,7 @@ public void RegisterEffect(Effect ef)
// Setup handler to observe changes of the mesh data and dispose event (deallocation)
ef.EffectChanged += EffectChanged;

_allEffects.Add(ef.SessionUniqueIdentifier, ef);
_allEffects.Add(ef.UniqueIdentifier, ef);
}

/// <summary>
Expand All @@ -57,7 +54,7 @@ public EffectManager(RenderContext renderContextImp)

public Effect? GetEffect(Effect ef)
{
return _allEffects.TryGetValue(ef.SessionUniqueIdentifier, out var effect) ? effect : null;
return _allEffects.TryGetValue(ef.UniqueIdentifier, out var effect) ? effect : null;
}

/// <summary>
Expand All @@ -69,7 +66,7 @@ public void Cleanup()
{
var tmPop = _effectsToBeDeleted.Pop();
// Remove one Effect from _allEffects
_allEffects.Remove(tmPop.SessionUniqueIdentifier);
_allEffects.Remove(tmPop.UniqueIdentifier);
// Remove one Effect from Memory
_rc.RemoveShader(tmPop);
}
Expand Down
8 changes: 4 additions & 4 deletions src/Engine/Core/Effects/Effect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
/// <summary>
/// SessionUniqueIdentifier is used to verify a Mesh's uniqueness in the current session.
/// </summary>
public Suid SessionUniqueIdentifier { get; } = Suid.GenerateSuid();
public Guid UniqueIdentifier { get; } = Guid.NewGuid();

private bool _disposed;

Expand All @@ -61,7 +61,7 @@
{
if (UniformParameters.ContainsKey(hash))
{
if (!UniformParameters[hash].SetValue(value)) return;

Check warning on line 64 in src/Engine/Core/Effects/Effect.cs

View workflow job for this annotation

GitHub Actions / Tests (windows-latest)

Possible null reference argument for parameter 'val' in 'bool IFxParamDeclaration.SetValue(object val)'.

Check warning on line 64 in src/Engine/Core/Effects/Effect.cs

View workflow job for this annotation

GitHub Actions / Build NuGet (windows-latest)

Possible null reference argument for parameter 'val' in 'bool IFxParamDeclaration.SetValue(object val)'.

EffectManagerEventArgs.Changed = UniformChangedEnum.Update;
EffectManagerEventArgs.ChangedUniformHash = hash;
Expand All @@ -84,7 +84,7 @@
var hash = name.GetHashCode();
if (UniformParameters.TryGetValue(hash, out var dcl))
{
return ((FxParamDeclaration<T>)dcl).Value;

Check warning on line 87 in src/Engine/Core/Effects/Effect.cs

View workflow job for this annotation

GitHub Actions / Tests (windows-latest)

Possible null reference return.
}
return default;
}
Expand All @@ -108,7 +108,7 @@
}

// Return true if the fields match:
return (SessionUniqueIdentifier == p.SessionUniqueIdentifier);
return (UniqueIdentifier == p.UniqueIdentifier);
}

/// <summary>
Expand All @@ -124,7 +124,7 @@
}

// Return true if the fields match:
return (SessionUniqueIdentifier == p.SessionUniqueIdentifier);
return (UniqueIdentifier == p.UniqueIdentifier);
}

/// <summary>
Expand All @@ -133,7 +133,7 @@
/// <returns>A hash code for the current object.</returns>
public override int GetHashCode()
{
return SessionUniqueIdentifier.GetHashCode();
return UniqueIdentifier.GetHashCode();
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Engine/Core/GpuMesh.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class GpuMesh : SceneComponent, IManagedMesh
/// <summary>
/// SessionUniqueIdentifier is used to verify a Mesh's uniqueness in the current session.
/// </summary>
public Suid SessionUniqueIdentifier { get; } = Suid.GenerateSuid();
public Guid UniqueIdentifier { get; } = Guid.NewGuid();

/// <summary>
/// Type of data of this mesh (e.g. Triangles, Points, Lines, etc.)
Expand Down
7 changes: 4 additions & 3 deletions src/Engine/Core/LightResult.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Fusee.Engine.Common;
using Fusee.Engine.Core.Scene;
using Fusee.Math.Core;
using System;

namespace Fusee.Engine.Core
{
Expand Down Expand Up @@ -50,7 +51,7 @@ public float4x4 Rotation
/// <summary>
/// The session unique identifier of tis LightResult.
/// </summary>
public Suid Id;
public Guid Id;

/// <summary>
/// Creates a new instance of type LightResult.
Expand All @@ -61,7 +62,7 @@ public LightResult(Light light)
Light = light;
WorldSpacePos = float3.Zero;
Rotation = float4x4.Identity;
Id = Suid.GenerateSuid();
Id = Guid.NewGuid();
}

/// <summary>
Expand All @@ -72,7 +73,7 @@ public LightResult()
Light = new Light();
WorldSpacePos = float3.Zero;
Rotation = float4x4.Identity;
Id = Suid.GenerateSuid();
Id = Guid.NewGuid();
}

/// <summary>
Expand Down
Loading
Loading