A game framework written with osu! in mind.
1// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
2// See the LICENCE file in the repository root for full licence text.
3
4using System;
5using osuTK.Graphics.ES30;
6
7namespace osu.Framework.Graphics.OpenGL
8{
9 /// <summary>
10 /// Information for how depth should be handled.
11 /// </summary>
12 public readonly struct DepthInfo : IEquatable<DepthInfo>
13 {
14 /// <summary>
15 /// The default depth properties, as defined by OpenGL.
16 /// </summary>
17 public static DepthInfo Default => new DepthInfo(true);
18
19 /// <summary>
20 /// Whether depth testing should occur.
21 /// </summary>
22 public readonly bool DepthTest;
23
24 /// <summary>
25 /// Whether to write to the depth buffer if the depth test passed.
26 /// </summary>
27 public readonly bool WriteDepth;
28
29 /// <summary>
30 /// The depth test function.
31 /// </summary>
32 public readonly DepthFunction Function;
33
34 public DepthInfo(bool depthTest = true, bool writeDepth = true, DepthFunction function = DepthFunction.Less)
35 {
36 DepthTest = depthTest;
37 WriteDepth = writeDepth;
38 Function = function;
39 }
40
41 public bool Equals(DepthInfo other) => DepthTest == other.DepthTest && WriteDepth == other.WriteDepth && Function == other.Function;
42 }
43}