Skip to content

Commit

Permalink
[PixImageCube] Add constructor and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
hyazinthh committed Jun 25, 2024
1 parent a299ee6 commit 6d4c148
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
38 changes: 31 additions & 7 deletions src/Aardvark.Base.Tensors.CSharp/PixImage/PixImageCube.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,50 @@ public enum CubeSideFlags
All = 0x3f,
}

/// <summary>
/// A cube map consisting of six image mipmaps.
/// </summary>
public class PixImageCube
{
public PixImageMipMap[] MipMapArray;
/// <summary>
/// Array of image mipmaps representing the cube sides.
/// </summary>
public PixImageMipMap[] Sides;

#region Constructor
#region Constructors

public PixImageCube(PixImageMipMap[] mipMapArray)
{
MipMapArray = mipMapArray;
}
/// <summary>
/// Creates a cube map from a mipmap array.
/// The order of the array follows the <see cref="CubeSide"/> enumeration.
/// </summary>
/// <param name="sides">An array of mipmaps representing the sides of the mipmap.</param>
public PixImageCube(PixImageMipMap[] sides)
=> Sides = sides;

/// <summary>
/// Creates a cube map from an image array.
/// The order of the array follows the <see cref="CubeSide"/> enumeration.
/// </summary>
/// <param name="sides">An array of images representing the sides of the mipmap.</param>
public PixImageCube(PixImage[] sides)
=> Sides = sides.Map(image => new PixImageMipMap(image));

#endregion

#region Properties

/// <summary>
/// Gets or sets an image mipmap of the sides array.
/// </summary>
public PixImageMipMap this[CubeSide side]
{
get { return MipMapArray[(int)side]; }
get => Sides[(int)side];
set => Sides[(int)side] = value;
}

[Obsolete("Use Sides instead.")]
public PixImageMipMap[] MipMapArray => Sides;

#endregion
}
}
2 changes: 1 addition & 1 deletion src/Aardvark.Base.Tensors/PixImage/PixImageCube.fs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module FSharpPixImageCubeExtensions =

member x.Transformed (m : CubeSide -> CubeSide * ImageTrafo) =
PixImageCube(
x.MipMapArray
x.Sides
|> Array.mapi (fun i mipMap ->
let side = unbox<CubeSide> i
let (newSide, trafo) = m side
Expand Down

0 comments on commit 6d4c148

Please sign in to comment.