daily update on 20240610 by nitload youmu
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user