插件推荐unity

[Unity 3d] EzySlice(便捷剖切工具) - Gi

2019-08-20  本文已影响7人  雨落随风

再推荐一个 剖切 工具包。切西瓜嘛,测试一下这个玩意呗~

GitHub 上的工程多如繁星,有些好的仓库,但凡不经意间错过了就很难找回,故稍作采撷,希望能帮助到有心人。

简介:

笔者今天推荐的仓库叫 EzySlice。 - 便捷剖切工具

功能:

使用:

  1. 仓库作者提供的示例:https://github.com/DavidArayan/EzySlice-Example-Scenes

  2. 下面这两个示例告诉你如何使用 贴图 和 材质球的API 。

如何使用贴图
/**
 * Example on how to calculate a custom TextureRegion to reference a different part of a texture
 * 
 * px -> The start X Position in Pixel Coordinates
 * py -> The start Y Position in Pixel Coordinates
 * width -> The width of the texture in Pixel Coordinates
 * height -> The height of the texture in Pixel Coordinates
 */
public TextureRegion CalculateCustomRegion(Texture myTexture, int px, int py, int width, int height) {
    return myTexture.GetTextureRegion(px, py, width, height);
}
如何使用材质球
/**
 * Example on how to calculate a custom TextureRegion to reference a different part of a texture
 * This example will use the mainTexture component of a Material
 * 
 * px -> The start X Position in Pixel Coordinates
 * py -> The start Y Position in Pixel Coordinates
 * width -> The width of the texture in Pixel Coordinates
 * height -> The height of the texture in Pixel Coordinates
 */
public TextureRegion CalculateCustomRegion(Material myMaterial, int px, int py, int width, int height) {
    return myMaterial.GetTextureRegion(px, py, width, height);
}

演示:

链接:

DavidArayan/ezy-slice: An open source mesh slicer framework for Unity3D Game Engine. Written in C#.

结语:

扩展阅读:

本文集持续更新ing,喜欢记得点赞关注哦!

上一篇下一篇

猜你喜欢

热点阅读