mirror of
https://github.com/DCFApixels/DragonECS.git
synced 2025-09-18 18:14:37 +08:00
refactoring debug attribute
This commit is contained in:
parent
a53fa7e717
commit
7951cf27a8
@ -10,17 +10,11 @@ namespace DCFApixels.DragonECS
|
|||||||
public byte r => color.r;
|
public byte r => color.r;
|
||||||
public byte g => color.g;
|
public byte g => color.g;
|
||||||
public byte b => color.b;
|
public byte b => color.b;
|
||||||
/// <summary>normalized R channel </summary>
|
|
||||||
public float rn => color.r / 255f;
|
|
||||||
/// <summary>normalized G channel </summary>
|
|
||||||
public float gn => color.g / 255f;
|
|
||||||
/// <summary>normalized B channel </summary>
|
|
||||||
public float bn => color.b / 255f;
|
|
||||||
public DebugColorAttribute(byte r, byte g, byte b) => color = new ColorRecord(r, g, b);
|
public DebugColorAttribute(byte r, byte g, byte b) => color = new ColorRecord(r, g, b);
|
||||||
public DebugColorAttribute(DebugColor color) => this.color = new ColorRecord((int)color);
|
public DebugColorAttribute(DebugColor color) => this.color = new ColorRecord((int)color);
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Explicit, Pack = 1, Size = 4)]
|
[StructLayout(LayoutKind.Explicit, Pack = 1, Size = 4)]
|
||||||
private readonly struct ColorRecord // Union
|
private readonly struct ColorRecord
|
||||||
{
|
{
|
||||||
[FieldOffset(0)] public readonly int full;
|
[FieldOffset(0)] public readonly int full;
|
||||||
[FieldOffset(3)] public readonly byte r;
|
[FieldOffset(3)] public readonly byte r;
|
||||||
|
Loading…
Reference in New Issue
Block a user