Skip to content

Commit 4cd48d0

Browse files
committed
Try to integrate a test Material with a HLSL shader resource
It didn't work, hence veldrid/veldrid-spirv#2
1 parent e431c86 commit 4cd48d0

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

Engine/Entities/EntityFactory.cs

+7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ namespace Engine.Entities
55
{
66
public static class EntityFactory
77
{
8+
/// <summary>
9+
/// Create a new <see cref="Entity"/> containing only a single given <see cref="Component"/> instance.
10+
/// </summary>
11+
/// <param name="component"></param>
12+
/// <returns></returns>
13+
public static Entity Create(Component component) => new Entity(new[] {component});
14+
815
/// <summary>
916
/// Create a new <see cref="Entity"/> containing only a single <see cref="Component"/> instance.
1017
/// </summary>

Game/Content/Shaders.cs

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace Game.Content
2+
{
3+
// TODO: Generate these constants via build script
4+
public static class Shaders
5+
{
6+
public const string Flat = "flat.hlsl";
7+
}
8+
}

Game/Game.cs

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using Engine.Assets;
77
using Engine.Components;
88
using Engine.Entities;
9+
using Game.Content;
910
using Veldrid;
1011
using Veldrid.OpenGL;
1112
using Veldrid.Sdl2;
@@ -58,6 +59,7 @@ protected override void Initialize()
5859
AssetDirectoryPaths.Add(AssetType.Shader, "Game.Content.Shaders");
5960

6061
World.Add(EntityFactory.Create<Camera>());
62+
World.Add(EntityFactory.Create(new Material("TestMaterial", Shaders.Flat)));
6163

6264
_commandList = ResourceFactory.CreateCommandList();
6365
}

0 commit comments

Comments
 (0)