daily update on 20241002 by nitload youmu, intrinsic function rebuild, syntax style arrange
This commit is contained in:
@@ -40,23 +40,23 @@ namespace StgSharp.Graphics
|
||||
public class TextureProvider : IImageProvider
|
||||
{
|
||||
|
||||
private vec2d[] _texCoord;
|
||||
private Vec2[] _texCoord;
|
||||
private Image _tex;
|
||||
|
||||
public TextureProvider(Image image, vec2d[] coord)
|
||||
public TextureProvider( Image image, Vec2[] coord )
|
||||
{
|
||||
_tex = image;
|
||||
_texCoord = coord;
|
||||
}
|
||||
|
||||
public ref vec2d this[int index]
|
||||
public ref Vec2 this[ int index ]
|
||||
{
|
||||
get => ref _texCoord[index];
|
||||
get => ref _texCoord[ index ];
|
||||
}
|
||||
|
||||
public Span<vec2d> TextureCoordinate
|
||||
public Span<Vec2> TextureCoordinate
|
||||
{
|
||||
get => new Span<vec2d>(_texCoord);
|
||||
get => new Span<Vec2>( _texCoord );
|
||||
}
|
||||
|
||||
public Image ProvideImage()
|
||||
@@ -64,26 +64,22 @@ namespace StgSharp.Graphics
|
||||
return _tex;
|
||||
}
|
||||
|
||||
public void ReadImage(IImageProvider provider)
|
||||
public void ReadImage( IImageProvider provider )
|
||||
{
|
||||
_tex = provider.ProvideImage();
|
||||
}
|
||||
|
||||
public void UpdateFromImage(Image i)
|
||||
public void UpdateFromImage( Image i )
|
||||
{
|
||||
if (i == _tex)
|
||||
{
|
||||
if( i == _tex ) {
|
||||
return;
|
||||
}
|
||||
if (i.Size == _tex.Size)
|
||||
{
|
||||
if( i.Size == _tex.Size ) {
|
||||
_tex = i;
|
||||
} else {
|
||||
throw new ArgumentException(
|
||||
$"Size of {nameof(i)} does not equals to current image." );
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentException($"Size of {nameof(i)} does not equals to current image.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user