项目分享:https://github.com/Claymoreno1/RenderTexture
这一次添加了水平翻转、垂直翻转、顺时针旋转、逆时针旋转,关闭图像,保存,退出功能;对RT的创建和销毁做了一些更改。
界面如下:



关于选择的C#部分
public void clockwise()
{
clockw = true;
rotate();
}
public void anticlockwise()
{
anclockw = true;
rotate();
}
private void rotate()//旋转shader更新
{
if (Gamevars.textureisable)
{
rotatematerial.SetInt("_Clockwise", clockw ? 1 : 0);
rotatematerial.SetInt("_AnuiClockwise", anclockw? 1:0);
RenderTexture Disttexture =RenderTexture.GetTemporary(texture.height, texture.width, 0);//因为旋转之后宽高对调
Graphics.Blit(texture, Disttexture, rotatematerial);
int width = Disttexture.width;
int height = Disttexture.height;
Gamevars.imagewidth = width;
Gamevars.imageheight = height;//更新控制结构体
Viewtexture = new Texture2D(width, height, TextureFormat.ARGB32, false);
RenderTexture

本文介绍了一个使用Unity制作的简易图像处理软件,包括水平翻转、垂直翻转、顺时针和逆时针旋转等功能。项目源码已开源在GitHub。文章提到了内存管理问题,当前解决方案是在关闭图像时重新加载场景,作者期待有更优的内存优化建议,并计划在未来添加裁剪功能。
最低0.47元/天 解锁文章
1771

被折叠的 条评论
为什么被折叠?



