EditorContentManager Part 1

This commit is contained in:
Simon Lübeß
2023-01-01 16:53:45 +01:00
parent dffd43a36f
commit c389a77274
29 changed files with 3774 additions and 81 deletions
+10 -4
View File
@@ -2,12 +2,14 @@ using System;
using GlitchyEngine.Core;
using GlitchyEngine.Math;
using System.Collections;
using Bon;
namespace GlitchyEngine.Renderer
{
/**
* Defines the filter function used when sampling from a texture.
*/
[BonTarget, Reflect]
public enum FilterFunction
{
/// Use point filtering (nearest neighbor) for sampling.
@@ -17,7 +19,8 @@ namespace GlitchyEngine.Renderer
/// Use anisotropic interpolation for sampling.
Anisotropic
}
[BonTarget, Reflect]
public enum FilterMode
{
/// Just sample the texture.
@@ -29,7 +32,8 @@ namespace GlitchyEngine.Renderer
/// Return the maximum value of the fetched texels.
Maximum
}
[BonTarget, Reflect]
public enum ComparisonFunction
{
/**
@@ -65,7 +69,8 @@ namespace GlitchyEngine.Renderer
*/
Always = 8
}
[BonTarget, Reflect]
public enum TextureAddressMode
{
/// Tile the texture at every (u,v) integer junction.
@@ -92,7 +97,8 @@ namespace GlitchyEngine.Renderer
*/
MirrorOnce
}
[BonTarget]
public struct SamplerStateDescription : IHashable
{
public FilterFunction MinFilter = .Linear;
+9 -3
View File
@@ -65,11 +65,17 @@ namespace GlitchyEngine.Renderer
//public override extern uint32 ArraySize {get;}
//public override extern uint32 MipLevels {get;}
public this(StringView path, bool pngSrgb = false)
private this(StringView path, bool pngSrgb = false)
{
_path = new String(path);
LoadTexture(pngSrgb);
}
// TODO: remove
private this(Stream data)
{
LoadDds(data);
}
const String PngMagicWord = "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A";
const String DdsMagicWord = "DDS ";
@@ -78,7 +84,7 @@ namespace GlitchyEngine.Renderer
{
Debug.Profiler.ProfileResourceFunction!();
Stream data = Application.Get().ContentManager.GetFile(_path);
Stream data = Application.Get().ContentManager.GetStream(_path);
defer delete data;
var readResult = data.Read<char8[8]>();
@@ -214,7 +220,7 @@ namespace GlitchyEngine.Renderer
{
Debug.Profiler.ProfileResourceFunction!();
Stream data = Application.Get().ContentManager.GetFile(_path);
Stream data = Application.Get().ContentManager.GetStream(_path);
defer delete data;
LoadTexturePlatform(data);