Skip to content

Commit e431c86

Browse files
committed
Simplify Material constructor
1 parent 7317969 commit e431c86

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

Engine/Components/Material.cs

+10-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using Engine.Assets;
22
using Engine.ECS;
3+
using JetBrains.Annotations;
4+
using LiteGuard;
35
using Veldrid;
46
using Veldrid.SPIRV;
57

@@ -9,24 +11,20 @@ public class Material : Component, IResource, IAsset
911
{
1012
private ResourceFactory _factory;
1113

12-
public Material(
13-
string name,
14-
string shaderFilename,
15-
BlendStateDescription blendState,
16-
DepthStencilStateDescription depthStencilState,
17-
PolygonFillMode fillMode = PolygonFillMode.Solid,
18-
bool depthClipEnabled = true)
19-
: base(name)
14+
public Material([NotNull] string name, string shaderFilename) : base(name)
2015
{
16+
Guard.AgainstNullArgument(nameof(name), name);
17+
Guard.AgainstNullArgument(nameof(shaderFilename), shaderFilename);
2118
ShaderFilename = shaderFilename;
22-
DepthStencilState = depthStencilState;
23-
FillMode = fillMode;
24-
DepthClipEnabled = depthClipEnabled;
25-
BlendState = blendState;
19+
DepthStencilState = DefaultDepthStencilState;
20+
FillMode = PolygonFillMode.Solid;
21+
DepthClipEnabled = true;
22+
BlendState = DefaultBlendState;
2623
}
2724

2825
public static readonly DepthStencilStateDescription DefaultDepthStencilState = new DepthStencilStateDescription(
2926
depthTestEnabled: true, depthWriteEnabled: true, comparisonKind: ComparisonKind.LessEqual);
27+
public static readonly BlendStateDescription DefaultBlendState = BlendStateDescription.SingleOverrideBlend;
3028

3129
public string ShaderFilename { get; }
3230
public Shader[] Shaders { get; private set; }

0 commit comments

Comments
 (0)