您好,欢迎来到二三娱乐。
搜索
您的当前位置:首页[Unity 3d] EzySlice(便捷剖切工具) - Gi

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

来源:二三娱乐

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

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
    -使用 MIT 开源协议

使用:

  1. 下面这两个示例告诉你如何使用 贴图 和 材质球的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);
}

演示:

链接:

结语:

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

扩展阅读:

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

Copyright © 2019- yule263.com 版权所有 湘ICP备2023023988号-1

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务