daily update on 20240610 by nitload youmu

This commit is contained in:
Nitload
2024-06-10 15:11:01 +08:00
parent c0093f7b5c
commit f6963b8e00
96 changed files with 2927 additions and 2290 deletions
@@ -10,12 +10,12 @@ namespace StgSharp.Graphics
{
public class PlainGeometryMesh
{
private IGeometry _shape;
private PlainGeometry _shape;
private Image _texture;
private vec2d[] textureCoord;
private vec4d[] textureCoord;
public PlainGeometryMesh(
IGeometry shape, Image texture, IEnumerable<vec2d> texCoord
PlainGeometry shape, Image texture, vec4d[] texCoord
)
{
if (shape==null)
@@ -28,31 +28,30 @@ namespace StgSharp.Graphics
}
_shape = shape;
textureCoord = new vec2d[shape.VertexCount];
_texture = texture;
if (texCoord is not vec2d[] source)
{
source = texCoord.ToArray();
}
if (textureCoord.Length > source.Length)
if (shape.VertexCount > texCoord.Length)
{
throw new ArgumentException(paramName: nameof(texCoord), message: "Amount of texture coordination is too less");
}
Array.Copy(sourceArray: source, textureCoord, textureCoord.Length);
textureCoord = texCoord;
return;
}
public PlainGeometryMesh Resize(PlainGeometry newShape)
{
return new PlainGeometryMesh(newShape, _texture, textureCoord);
}
public ReadOnlySpan<int> MeshIndices => _shape.VertexIndices;
public vec4d[] VertexArray => _shape.VertexStream;
public Image Texture
public Image TextureImage
{
get => _texture;
internal set => _texture = value;
}
public vec2d[] TextureCoord => textureCoord;
public vec4d[] TextureCoord => textureCoord;
}
}