|
|
@ -15,6 +15,17 @@ using Image = SixLabors.ImageSharp.Image; |
|
|
|
|
|
|
|
namespace SemiColinGames; |
|
|
|
|
|
|
|
public class CameraInfo { |
|
|
|
public readonly Vector2i Resolution; |
|
|
|
|
|
|
|
private CameraInfo(Vector2i resolution) { |
|
|
|
Resolution = resolution; |
|
|
|
} |
|
|
|
|
|
|
|
public static readonly CameraInfo NIKON_D7000 = new CameraInfo(new Vector2i(4928, 3264)); |
|
|
|
public static readonly CameraInfo IPHONE_12_MINI = new CameraInfo(new Vector2i(4032, 3024)); |
|
|
|
} |
|
|
|
|
|
|
|
public class Shader : IDisposable { |
|
|
|
int Handle; |
|
|
|
|
|
|
@ -128,8 +139,7 @@ public class Texture : IDisposable { |
|
|
|
public int Width; |
|
|
|
public int Height; |
|
|
|
|
|
|
|
public Texture(string path) { |
|
|
|
Image<Rgba32> image = Image.Load<Rgba32>(path); |
|
|
|
public Texture(Image<Rgba32> image) { |
|
|
|
Width = image.Width; |
|
|
|
Height = image.Height; |
|
|
|
Console.WriteLine($"image loaded: {Width}x{Height}"); |
|
|
@ -178,6 +188,10 @@ public class Texture : IDisposable { |
|
|
|
public class Game : GameWindow { |
|
|
|
public Game(GameWindowSettings gwSettings, NativeWindowSettings nwSettings) : base(gwSettings, nwSettings) { } |
|
|
|
|
|
|
|
static CameraInfo activeCamera = CameraInfo.NIKON_D7000; |
|
|
|
static int thumbnailHeight = 100; |
|
|
|
static int thumbnailWidth = (int) 1.0 * thumbnailHeight * activeCamera.Resolution.X / activeCamera.Resolution.Y; |
|
|
|
|
|
|
|
int frameCount; |
|
|
|
int windowWidth; |
|
|
|
int windowHeight; |
|
|
@ -226,6 +240,8 @@ public class Game : GameWindow { |
|
|
|
protected override void OnLoad() { |
|
|
|
base.OnLoad(); |
|
|
|
|
|
|
|
Console.WriteLine($"thumbnail size: {thumbnailWidth}x{thumbnailHeight}"); |
|
|
|
|
|
|
|
GL.ClearColor(0.0f, 0.0f, 0.05f, 1.0f); |
|
|
|
|
|
|
|
VertexArrayObject = GL.GenVertexArray(); |
|
|
@ -261,7 +277,8 @@ public class Game : GameWindow { |
|
|
|
textures = new List<Texture>(); |
|
|
|
foreach (string file in files) { |
|
|
|
if (file.ToLower().EndsWith(".jpg")) { |
|
|
|
textures.Add(new Texture(file)); |
|
|
|
Image<Rgba32> image = Image.Load<Rgba32>(file); |
|
|
|
textures.Add(new Texture(image)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -275,8 +292,6 @@ public class Game : GameWindow { |
|
|
|
frameCount++; |
|
|
|
GL.Clear(ClearBufferMask.ColorBufferBit); |
|
|
|
|
|
|
|
int thumbnailWidth = 150; |
|
|
|
int thumbnailHeight = 100; |
|
|
|
int borderWidth = 2; |
|
|
|
int maxPhotoWidth = windowWidth - thumbnailWidth - borderWidth; |
|
|
|
|
|
|
|