switch root namespace name to NITLOAD

This commit is contained in:
Youmu Liu
2026-09-02 18:15:03 +08:00
parent 4218baad48
commit 7c7101ee48
502 changed files with 710 additions and 721 deletions
+60
View File
@@ -0,0 +1,60 @@
// -----------------------------------------------------------------------------
// file="PlainGeometryMesh"
// Project: StgSharp
// Copyright (c) Nitload.
// SPDX-License-Identifier: MIT
// -----------------------------------------------------------------------------
using Nitload.Geometries;
using Nitload.Mathematics;
using Nitload.Mathematics.Numeric.Graphics;
using System;
using System.Runtime.InteropServices;
namespace Nitload.Graphics
{
public class PlainGeometryMesh
{
private readonly PlainGeometry _shape;
private readonly Vec2[] _textureCoordinates;
private readonly Image<Rgba8> _textureImage;
public PlainGeometryMesh(
PlainGeometry shape,
Image<Rgba8> texture,
Vec2[] texCoord
)
{
ArgumentNullException.ThrowIfNull(shape);
ArgumentNullException.ThrowIfNull(texture);
ArgumentNullException.ThrowIfNull(texCoord);
if (shape.VertexCount > texCoord.Length) {
throw new ArgumentException(
paramName:nameof(texCoord),
message:"Amount of texture coordination is too less");
}
_shape = shape;
_textureImage = texture;
_textureCoordinates = texCoord;
}
public Vec4[] VertexArray => _shape.VertexStream;
public Image<Rgba8> TextureImage => _textureImage;
public ReadOnlySpan<int> MeshIndices => _shape.VertexIndices;
public ReadOnlySpan<Vec4> TextureCoord => MemoryMarshal.Cast<Vec2, Vec4>(
_textureCoordinates);
public PlainGeometryMesh Resize(
PlainGeometry newShape
)
{
return new PlainGeometryMesh(newShape, _textureImage, _textureCoordinates);
}
}
}