1
1
using Engine . Assets ;
2
2
using Engine . ECS ;
3
+ using JetBrains . Annotations ;
4
+ using LiteGuard ;
3
5
using Veldrid ;
4
6
using Veldrid . SPIRV ;
5
7
@@ -9,24 +11,20 @@ public class Material : Component, IResource, IAsset
9
11
{
10
12
private ResourceFactory _factory ;
11
13
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 )
20
15
{
16
+ Guard . AgainstNullArgument ( nameof ( name ) , name ) ;
17
+ Guard . AgainstNullArgument ( nameof ( shaderFilename ) , shaderFilename ) ;
21
18
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 ;
26
23
}
27
24
28
25
public static readonly DepthStencilStateDescription DefaultDepthStencilState = new DepthStencilStateDescription (
29
26
depthTestEnabled : true , depthWriteEnabled : true , comparisonKind : ComparisonKind . LessEqual ) ;
27
+ public static readonly BlendStateDescription DefaultBlendState = BlendStateDescription . SingleOverrideBlend ;
30
28
31
29
public string ShaderFilename { get ; }
32
30
public Shader [ ] Shaders { get ; private set ; }
0 commit comments