国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

x01.Weiqi.9: 點目功能

2019-11-17 02:22:02
字體:
來源:轉載
供稿:網友

x01.Weiqi.9: 點目功能

添加點目功能,雖不中,不遠也。還是先看看截圖吧。

確保其可行,再看一張:

其點目結果,還是比較令人滿意的。這主要得益于多遍掃描,如編譯器的詞法分析階段,下面的代碼可以證明:

 1                PRivate void InitMeshes() 2         { 3             UpdateMeshes1(); 4              5             if (StepCount < 120) return; 6  7             UpdateMeshes2(); 8             UpdateMeshes3(); 9             UpdateMeshes4(5);10             UpdateMeshes4(8); // 二次掃描有必要11             UpdateMeshes5();12             UpdateMeshes6();13         }
InitMeshes()

主要思路,也不過如此,實現的關鍵點,在于 UpdateMeshBlocks() 方法:

 1                 void UpdateMeshBlocks(List<Pos> poses, List<PosBlock> blocks) 2         { 3             List<Pos> copyPoses = poses.ToList(); 4             if (copyPoses.Count == 0) return; 5  6             List<Pos> tmp = new List<Pos>(); 7             foreach (var pos in copyPoses) { 8                 if (tmp.Count == 0) tmp.Add(pos); 9                 var links = LinkPoses(pos);10                 if (tmp.Intersect(links).Count() > 0) {11                     links.ForEach(l => {12                         if (copyPoses.Contains(l) && !tmp.Contains(l))13                             tmp.Add(l);14                     });15                 }16             }17             for (int i = 0; i < 4; i++) {    // 確保不遺漏到瘋狂程度18                 foreach (var pos in copyPoses) {19                     var links = LinkPoses(pos);20                     if (tmp.Intersect(links).Count() > 0) {21                         links.ForEach(l => {22                             if (copyPoses.Contains(l) && !tmp.Contains(l))23                                 tmp.Add(l);24                         });25                     }26                 }27             }28 29             PosBlock block = new PosBlock();30             block.Poses = tmp;31             blocks.Add(block);32 33             copyPoses.RemoveAll(p => tmp.Contains(p));34             UpdateMeshBlocks(copyPoses, blocks);35         }
UpdaeMeshBlocks()

這同 UpdateStepBlocks() 相同,只是為確保不遺漏,多了幾遍而已。

整個程序都是建立在集合的基礎上的,更新塊成為關鍵,也就不足為奇了。

完整代碼下載鏈接:https://github.com/chinax01/x01.Weiqi


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 乡城县| 垣曲县| 石景山区| 陵川县| 恩平市| 龙井市| 冷水江市| 邻水| 台北市| 阿克陶县| 灵丘县| 乌兰浩特市| 汽车| 隆回县| 六安市| 子长县| 斗六市| 乌鲁木齐市| 广河县| 开远市| 客服| 宁明县| 简阳市| 剑河县| 呼伦贝尔市| 凯里市| 南丹县| 元江| 获嘉县| 香格里拉县| 龙泉市| 桃园市| 大荔县| 邵阳县| 惠水县| 黄冈市| 正宁县| 巫山县| 潼南县| 会同县| 栖霞市|