Files
GhostEngine/Ghost.Graphics/Data/Vertex.cs
Misaki 5ae4128baf Enhance graphics engine and code organization
Added `InternalsVisibleTo` attribute for "Ghost.Graphics" and "Ghost.Editor" in `AssemblyInfo.cs`.
Added a new `EngineAssemblyAttribute` in `EngineAssemblyAttribute.cs`.
Added a reference to `Misaki.HighPerformance.Unsafe` in `Ghost.Core.csproj`.
Added a new `Bounds` struct to represent axis-aligned bounding boxes in `Bounds.cs`.
Added new `Color32` and `Color128` structs for color representation in `Color.cs`.

Changed the namespace from `Ghost.Editor.Controls` to `Ghost.Editor.Core.Controls` in multiple files.
Changed the implicit conversion operator in `ConstPtr<T>` to use a more descriptive parameter name in `ConstPtr.cs`.
Changed the `Mesh` class to use `Color128` instead of `Color32` for color representation.

Enhanced the `TypeCache` class to load types from assemblies marked with `EngineAssemblyAttribute`.
Enhanced the `ProjectService` class to improve the `GetAllProjectAsync` method by filtering out bad projects.
Enhanced the `GraphicsPipeline` class to support both DX12 and D3D12 graphics APIs.
Enhanced the `Shader` class to include methods for compiling HLSL shaders and managing root signatures.
Enhanced the `MeshRenderPass` class to utilize the new shader compilation methods.

Refactored the `AppStateMachine` class to use private fields instead of static fields for state management.
Refactored the `ComponentDataView` class to use the new namespace and improve organization.
Refactored project references in `Ghost.Graphics.csproj` to include new dependencies and remove outdated ones.

Made various adjustments to ensure consistency and improve code quality across multiple files.
2025-07-02 21:30:10 +09:00

56 lines
1.6 KiB
C#

using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
using Win32.Graphics.Dxgi.Common;
namespace Ghost.Graphics.Data;
public struct Vertex(Vector4 position, Vector4 normal, Vector4 tangent, Color128 color, Vector4 uv)
{
public unsafe struct Semantic
{
public const Format ALIGNED_FORMAT = Format.R32G32B32A32Float;
private static readonly byte[] s_positionBytes = Encoding.UTF8.GetBytes("POSITION");
private static readonly byte[] s_normalBytes = Encoding.UTF8.GetBytes("NORMAL");
private static readonly byte[] s_tangentBytes = Encoding.UTF8.GetBytes("TANGENT");
private static readonly byte[] s_colorBytes = Encoding.UTF8.GetBytes("COLOR");
private static readonly byte[] s_uvBytes = Encoding.UTF8.GetBytes("UV");
public static byte* PositionName => (byte*)Unsafe.AsPointer(ref s_positionBytes[0]);
public static byte* NormalName => (byte*)Unsafe.AsPointer(ref s_normalBytes[0]);
public static byte* TangentName => (byte*)Unsafe.AsPointer(ref s_tangentBytes[0]);
public static byte* ColorName => (byte*)Unsafe.AsPointer(ref s_colorBytes[0]);
public static byte* UVName => (byte*)Unsafe.AsPointer(ref s_uvBytes[0]);
}
public Vector4 Position
{
get;
set;
} = position;
public Vector4 Normal
{
get;
set;
} = normal;
public Vector4 Tangent
{
get;
set;
} = tangent;
public Color128 Color
{
get;
set;
} = color;
public Vector4 UV
{
get;
set;
} = uv;
}