美文网首页插件推荐unity
[Unity 3d] EzySlice(便捷剖切工具) - Gi

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

作者: 雨落随风 | 来源:发表于2019-08-20 23:33 被阅读7次

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

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

简介:

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

功能:

  • Ability to slice any convex Mesh using a Plane
    - 支持使用一个面片对任意的 Convex Mesh 进行剖切。
  • UV/Normal/Tangent Space Interpolation for seamless cuts
    - UV / Normal / Tangent Space插值,用于无缝切割
  • Flexible and Documented API
    - 灵活且文档化的API
  • No external plugin dependencies, fully written in C#
    - 无需外部拆件支持,全部使用 C# 实现
  • Updated for Unity3D 2018
    - 支持到 Unity 2018
  • MIT Open Source License
    -使用 MIT 开源协议

使用:

  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#.

结语:

  • 这个仓库还在持续更新,且仓库作者许诺会有更多的示例出来,喜欢的可以关注下。
  • 这个功能可以用在所以涉及到剖切功能的场景。切西瓜,且 齿轮,切淫(ren),都行。

扩展阅读:

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

相关文章

网友评论

    本文标题:[Unity 3d] EzySlice(便捷剖切工具) - Gi

    本文链接:https://www.haomeiwen.com/subject/onxvsctx.html