daily update on 20241002 by nitload youmu, intrinsic function rebuild, syntax style arrange
This commit is contained in:
@@ -46,52 +46,57 @@ namespace StgSharp.Graphics
|
||||
private PlainGeometry _shape;
|
||||
private TextureProvider _texture;
|
||||
|
||||
public PlainGeometryMesh([NotNull] PlainGeometry shape, [NotNull] TextureProvider texture)
|
||||
public PlainGeometryMesh(
|
||||
[NotNull] PlainGeometry shape,
|
||||
[NotNull] TextureProvider texture )
|
||||
{
|
||||
if (shape.VertexCount > texture.TextureCoordinate.Length)
|
||||
{
|
||||
throw new ArgumentException(paramName: nameof(texture), message: "Amount of texture coordination is too less");
|
||||
if( shape.VertexCount > texture.TextureCoordinate.Length ) {
|
||||
throw new ArgumentException(
|
||||
paramName: nameof( texture ),
|
||||
message: "Amount of texture coordination is too less" );
|
||||
}
|
||||
_texture = texture;
|
||||
_shape = shape;
|
||||
}
|
||||
|
||||
//private Image _texture;
|
||||
|
||||
public PlainGeometryMesh(
|
||||
PlainGeometry shape, Image texture, vec2d[] texCoord
|
||||
)
|
||||
PlainGeometry shape,
|
||||
Image texture,
|
||||
Vec2[] texCoord )
|
||||
{
|
||||
if (shape == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(shape));
|
||||
if( shape == null ) {
|
||||
throw new ArgumentNullException( nameof( shape ) );
|
||||
}
|
||||
if (texCoord == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(texCoord));
|
||||
if( texCoord == null ) {
|
||||
throw new ArgumentNullException( nameof( texCoord ) );
|
||||
}
|
||||
|
||||
if (shape.VertexCount > texCoord.Length)
|
||||
{
|
||||
throw new ArgumentException(paramName: nameof(texCoord), message: "Amount of texture coordination is too less");
|
||||
if( shape.VertexCount > texCoord.Length ) {
|
||||
throw new ArgumentException(
|
||||
paramName: nameof( texCoord ),
|
||||
message: "Amount of texture coordination is too less" );
|
||||
}
|
||||
_texture = new TextureProvider(texture, texCoord);
|
||||
_texture = new TextureProvider( texture, texCoord );
|
||||
}
|
||||
|
||||
public vec4d[] VertexArray => _shape.VertexStream;
|
||||
public Vec4[] VertexArray => _shape.VertexStream;
|
||||
|
||||
public Image TextureImage
|
||||
{
|
||||
get => _texture.ProvideImage();
|
||||
internal set => _texture.ReadImage(value);
|
||||
internal set => _texture.ReadImage( value );
|
||||
}
|
||||
|
||||
public ReadOnlySpan<int> MeshIndices => _shape.VertexIndices;
|
||||
|
||||
public ReadOnlySpan<vec4d> TextureCoord => MemoryMarshal.Cast<vec2d, vec4d>(_texture.TextureCoordinate);
|
||||
public ReadOnlySpan<Vec4> TextureCoord => MemoryMarshal.Cast<Vec2, Vec4>(
|
||||
_texture.TextureCoordinate );
|
||||
|
||||
public PlainGeometryMesh Resize(PlainGeometry newShape)
|
||||
public PlainGeometryMesh Resize( PlainGeometry newShape )
|
||||
{
|
||||
return new PlainGeometryMesh(newShape, _texture);
|
||||
return new PlainGeometryMesh( newShape, _texture );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user