Skip to content

Commit af6c8ae

Browse files
committed
Assets: Working on GLTF2 loading.
1 parent e60734b commit af6c8ae

File tree

11 files changed

+1135
-916
lines changed

11 files changed

+1135
-916
lines changed

assets/Shaders/IBL.slang

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ Texture2D<float4> inputTexture : register(t0);
4949
RWTexture2DArray<float4> outputTexture : register(u0);
5050
// SamplerState defaultSampler : register(s0);
5151

52+
// Utility kernel for converting from an equirectangular environment map (LDR or HDR) to a cube map
5253
[shader("compute")]
5354
[numthreads(32, 32, 1)]
54-
// Utility kernel for converting from an equirectangular environment map (LDR or HDR) to a cube map
5555
void CubeFromEquirectangular(uint3 ThreadID: SV_DispatchThreadID)
5656
{
5757
const SamplerState equirectSampler = SamplerLinearClamp;

src/Alimer/Engine/Components/MeshComponent.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55

66
namespace Alimer.Engine;
77

8-
public sealed partial class MeshComponent : RenderableComponent
8+
/// <summary>
9+
/// A component that contains a mesh and materials for the visual appearance of an entity.
10+
/// </summary>
11+
[DefaultEntitySystem(typeof(RenderSystem))]
12+
public sealed partial class MeshComponent : Component
913
{
1014
/// Local-space bounding box.
1115
private BoundingBox _localBoundingBox;

src/Alimer/Engine/Components/RenderableComponent.cs

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/Alimer/Rendering/RenderSystem.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88

99
namespace Alimer.Rendering;
1010

11-
public sealed unsafe partial class RenderSystem : EntitySystem<MeshComponent>
11+
// TODO: Add support for RenderableComponent (ParticleSystem or other?)
12+
13+
public sealed partial class RenderSystem : EntitySystem<MeshComponent>
1214
{
1315
// ShaderTypes.h
1416
public const int FrameBindGroupSpace = 3;

src/Alimer/Utilities/UnsafeUtilities.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,6 @@ public static ref readonly TTo AsReadonly<TFrom, TTo>(in TFrom source)
4848
public static Span<T> AsSpan<T>(this ReadOnlySpan<T> span)
4949
=> MemoryMarshal.CreateSpan(ref Unsafe.AsRef(in MemoryMarshal.GetReference(span)), span.Length);
5050

51-
/// <inheritdoc cref="MemoryMarshal.Cast{TFrom, TTo}(Span{TFrom})" />
52-
public static Span<TTo> Cast<TFrom, TTo>(this Span<TFrom> span)
53-
where TFrom : struct
54-
where TTo : struct => MemoryMarshal.Cast<TFrom, TTo>(span);
55-
56-
/// <inheritdoc cref="MemoryMarshal.Cast{TFrom, TTo}(ReadOnlySpan{TFrom})" />
57-
public static ReadOnlySpan<TTo> Cast<TFrom, TTo>(this ReadOnlySpan<TFrom> span)
58-
where TFrom : struct
59-
where TTo : struct => MemoryMarshal.Cast<TFrom, TTo>(span);
60-
6151
/// <inheritdoc cref="MemoryMarshal.CreateSpan{T}(ref T, int)" />
6252
public static Span<T> CreateSpan<T>(scoped ref T reference, int length) => MemoryMarshal.CreateSpan(ref reference, length);
6353

src/assets/Alimer.Assets/Compiler/AssetCompilerContext.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,7 @@ public async Task<bool> Run(string inputDirectory, string outputDirectory, TextW
7878
metadata.FileRelativePath = Path.GetRelativePath(inputDirectory, metadata.FileFullPath);
7979

8080
//string json = metadata.ToJson();
81-
Asset? asset = await Import(metadata);
82-
83-
if (asset is null)
84-
throw new NullReferenceException("Asset is null");
85-
81+
Asset? asset = await Import(metadata) ?? throw new NullReferenceException("Asset is null");
8682
if (_writers.TryGetValue(asset.GetType(), out IAssetTypeWriter? assetWriter))
8783
{
8884
string outputFileName = Path.ChangeExtension(Path.GetFileNameWithoutExtension(assetFileName), assetWriter.FileExtension);

0 commit comments

Comments
 (0)