查看: 1578|回复: 2
打印 上一主题 下一主题

[其他] 网格合并代码

[复制链接]

1602

主题

1

听众

2万

积分

资深设计师

Rank: 7Rank: 7Rank: 7

纳金币
24658
精华
6

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

跳转到指定楼层
楼主
发表于 2012-3-16 12:19:25 |只看该作者 |倒序浏览
I recently hit a problem where I needed to combine meshes into a single renderer, but the meshes were using different materials. The built-in MeshCombineUtility doesn't support multiple submeshes. So, I rewrote it.
It's also now set up as an accumulating object, so you can create a MeshCombineUtility and add instances to it one by one, instead of needing to collect them all up in a list and passing them in in one go. Though it's a little more efficient if you can do that.
It uses LINQ, so I guess it doesn't work on iOS - but this is the kind of thing that you should probably be doing in the editor or in AssetPostProcessors anyway.
MeshCombineUtility.cs
To go with this, I also amended Neodrop's Combine Children Extended to combine everything into a single mesh with multiple materials:
CombineChildren.cs
Hope you find it useful. Let me know if you come up with any improvements or can point out any bugs. I think that the triangle strip handling is a little more fragile than the original - if you tell it you're using strips, and then you give it something that doesn't have strips, then it'll crash, while UT's original version would just

分享到: QQ好友和群QQ好友和群 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
转播转播0 分享淘帖0 收藏收藏0 支持支持0 反对反对0
回复

使用道具 举报

797

主题

1

听众

1万

积分

资深设计师

Rank: 7Rank: 7Rank: 7

纳金币
5568
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

沙发
发表于 2012-3-16 18:59:09 |只看该作者
  学习
回复

使用道具 举报

nts    

3

主题

1

听众

743

积分

初级设计师

Rank: 3Rank: 3

纳金币
7
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

板凳
发表于 2013-10-17 14:20:17 |只看该作者
代码呢?为什么没有代码?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

关闭

站长推荐上一条 /1 下一条

手机版|纳金网 ( 闽ICP备08008928号

GMT+8, 2024-5-18 14:03 , Processed in 0.090823 second(s), 31 queries .

Powered by Discuz!-创意设计 X2.5

© 2008-2019 Narkii Inc.

回顶部