[Unity 3d] EzySlice(一大群Mesh剖切工具) - GitHub

再推薦一個(gè) 剖切 工具包(更多同類(lèi)型的倉(cāng)庫(kù)見(jiàn)本文擴(kuò)展閱讀)。切西瓜嘛,測(cè)試一下這個(gè)玩意唄~

GitHub 上的工程多如繁星,有些好的倉(cāng)庫(kù),但凡不經(jīng)意間錯(cuò)過(guò)了就很難找回,故稍作采擷,希望能幫助到有心人。

簡(jiǎn)介:

筆者今天推薦的倉(cāng)庫(kù)叫 EzySlice。 - 便捷剖切工具

功能:

  • Ability to slice any convex Mesh using a Plane
    - 支持使用一個(gè)面片對(duì)任意的 Convex Mesh 進(jìn)行剖切。
  • UV/Normal/Tangent Space Interpolation for seamless cuts
    - UV / Normal / Tangent Space插值,用于無(wú)縫切割
  • Flexible and Documented API
    - 靈活且文檔化的API
  • No external plugin dependencies, fully written in C#
    - 無(wú)需外部拆件支持,全部使用 C# 實(shí)現(xiàn)
  • Updated for Unity3D 2018
    - 支持到 Unity 2018
  • MIT Open Source License
    -使用 MIT 開(kāi)源協(xié)議

使用:

  1. 倉(cāng)庫(kù)作者提供的示例:https://github.com/DavidArayan/EzySlice-Example-Scenes

  2. 下面這兩個(gè)示例告訴你如何使用 貼圖 和 材質(zhì)球的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);
}
如何使用材質(zhì)球
/**
 * 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#.

結(jié)語(yǔ):

  • 這個(gè)倉(cāng)庫(kù)還在持續(xù)更新,且倉(cāng)庫(kù)作者許諾會(huì)有更多的示例出來(lái),喜歡的可以關(guān)注下。
  • 這個(gè)功能可以用在所以涉及到剖切功能的場(chǎng)景。切西瓜,且 齒輪,切淫(ren),都行。

擴(kuò)展閱讀:

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容