Skip to content

Commit

Permalink
Packable Poser3D dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
Neakita committed Sep 5, 2024
1 parent 204d8cf commit 9fb8d8f
Show file tree
Hide file tree
Showing 9 changed files with 105 additions and 20 deletions.
13 changes: 0 additions & 13 deletions SightKeeper.Data/Binary/Model/DataSets/Assets/KeyPoint2D.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using MemoryPack;
using SightKeeper.Domain.Model;

namespace SightKeeper.Data.Binary.Model.DataSets.Assets;

// TODO ISSUE KeyPoint2D actually doesn't exist right now
/// <summary>
/// MemoryPackable version of <see cref="KeyPoint2D"/>
/// </summary>
[MemoryPackable]
internal sealed partial class PackableKeyPoint2D
{
public Vector2<double> Position { get; }

public PackableKeyPoint2D(Vector2<double> position)
{
Position = position;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using MemoryPack;
using SightKeeper.Domain.Model;
using SightKeeper.Domain.Model.DataSets.Poser3D;

namespace SightKeeper.Data.Binary.Model.DataSets.Assets;

/// <summary>
/// MemoryPackable version of <see cref="KeyPoint3D"/>
/// </summary>
[MemoryPackable]
internal sealed partial class PackableKeyPoint3D
{
public Vector2<double> Position { get; }
public bool IsVisible { get; }

public PackableKeyPoint3D(Vector2<double> position, bool isVisible)
{
Position = position;
IsVisible = isVisible;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ internal sealed partial class PackablePoser2DItem
{
public byte TagId { get; }
public Bounding Bounding { get; }
public ImmutableArray<KeyPoint2D> KeyPoints { get; }
public ImmutableArray<PackableKeyPoint2D> KeyPoints { get; }

public PackablePoser2DItem(byte tagId, Bounding bounding, ImmutableArray<KeyPoint2D> keyPoints)
public PackablePoser2DItem(byte tagId, Bounding bounding, ImmutableArray<PackableKeyPoint2D> keyPoints)
{
TagId = tagId;
Bounding = bounding;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System.Collections.Immutable;
using SightKeeper.Domain.Model.DataSets.Assets;
using SightKeeper.Domain.Model.DataSets.Poser3D;

namespace SightKeeper.Data.Binary.Model.DataSets.Assets;

/// <summary>
/// MemoryPackable version of <see cref="Poser3DItem"/>
/// </summary>
internal sealed class PackablePoser3DItem
{
public byte TagId { get; }
public Bounding Bounding { get; }
public ImmutableArray<PackableKeyPoint3D> KeyPoints { get; }

public PackablePoser3DItem(byte tagId, Bounding bounding, ImmutableArray<PackableKeyPoint3D> keyPoints)
{
TagId = tagId;
Bounding = bounding;
KeyPoints = keyPoints;
}
}
1 change: 1 addition & 0 deletions SightKeeper.Data/Binary/Model/DataSets/PackableDataSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace SightKeeper.Data.Binary.Model.DataSets;
[MemoryPackUnion(0, typeof(PackableDataSet<PackableTag, PackableClassifierAsset, PackablePlainWeights>))]
[MemoryPackUnion(1, typeof(PackableDataSet<PackableTag, PackableItemsAsset<PackableDetectorItem>, PackablePlainWeights>))]
[MemoryPackUnion(2, typeof(PackableDataSet<PackablePoser2DTag, PackableItemsAsset<PackablePoser2DItem>, PackablePoserWeights>))]
[MemoryPackUnion(3, typeof(PackableDataSet<PackablePoser3DTag, PackableItemsAsset<PackablePoser3DItem>, PackablePoserWeights>))]
internal abstract partial class PackableDataSet
{
public string Name { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,14 @@ namespace SightKeeper.Data.Binary.Model.DataSets.Tags;
/// MemoryPackable version of <see cref="PoserTag"/>
/// </summary>
[MemoryPackable]
internal sealed partial class PackablePoser2DTag : PackableTag
internal sealed partial class PackablePoser2DTag : PackablePoserTag
{
public ImmutableArray<PackableTag> KeyPointTags { get; }

public PackablePoser2DTag(
byte id,
string name,
uint color,
ImmutableArray<PackableTag> keyPointTags)
: base(id, name, color)
: base(id, name, color, keyPointTags)
{
KeyPointTags = keyPointTags;
}
}
21 changes: 21 additions & 0 deletions SightKeeper.Data/Binary/Model/DataSets/Tags/PackablePoser3DTag.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System.Collections.Immutable;
using MemoryPack;
using SightKeeper.Domain.Model.DataSets.Poser3D;

namespace SightKeeper.Data.Binary.Model.DataSets.Tags;

/// <summary>
/// MemoryPackable version of <see cref="Poser3DTag"/>
/// </summary>
[MemoryPackable]
internal sealed partial class PackablePoser3DTag : PackablePoserTag
{
public PackablePoser3DTag(
byte id,
string name,
uint color,
ImmutableArray<PackableTag> keyPointTags)
: base(id, name, color, keyPointTags)
{
}
}
17 changes: 17 additions & 0 deletions SightKeeper.Data/Binary/Model/DataSets/Tags/PackablePoserTag.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System.Collections.Immutable;
using SightKeeper.Domain.Model.DataSets.Poser;

namespace SightKeeper.Data.Binary.Model.DataSets.Tags;

/// <summary>
/// MemoryPackable version of <see cref="PoserTag"/>
/// </summary>
internal abstract partial class PackablePoserTag : PackableTag
{
public ImmutableArray<PackableTag> KeyPointTags { get; }

protected PackablePoserTag(byte id, string name, uint color, ImmutableArray<PackableTag> keyPointTags) : base(id, name, color)
{
KeyPointTags = keyPointTags;
}
}

0 comments on commit 9fb8d8f

Please sign in to comment.