數百個 HTML5 例子學習 HT 圖形組件 – WebGL 3D 篇

數百個 HTML5 例子學習 HT 圖形組件 – 拓撲圖篇》一文讓讀者瞭解了 HT 的 2D 拓撲圖組件使用,本文將對 HT 的 3D 功能作個綜合性的介紹,以便初學者可快速上手使用 HT 構建例如電信網管 3D 機房應用、水務燃氣 SCADA 監控應用及智能樓宇等應用場景。html

HT for Web 的 3D 是徹底基於 WebGL 技術實現的渲染引擎,但開發者幾乎不須要瞭解 3D 圖形數學或 Shader 渲染的底層技術,只須要掌握基本的 3D 座標系和相機  Camera 的概念,剩下須要掌握的也就是基本 JavaScript 的面對對象編程知識,便可快速開發各類豐富的 3D 場景應用。git

對於座標系、相機和投影概念,以及 HT 的 2D 模型和 3D 模型之間的關係在 《HT for Web 3D 手冊》中有詳細描述:http://www.hightopo.com/guide/guide/core/3d/ht-3d-guide.html。HT 封裝得很人性化,因此大部分狀況下你都不須要調整或深刻了解這些晦澀的 3D 參數,例如對於燈光,不少 HT 用戶開發完 3D 的應用場景,都徹底不須要學習任何燈光相關的技術知識。github

3DrNQNgFNYYAAAAASUVORK5CYII=

初學者即便只使用 HT for Web 開發 3D 應用的,咱們通常也會建議先閱讀一遍《數百個 HTML5 例子學習 HT 圖形組件 – 拓撲圖篇》文章,由於 HT 的全部組件採用的都是統一的 DataModel 數據模型,採用相同的 MVP 設計模型,類 Flux 的單向流設計理念,因此只要掌握了拓撲圖篇的介紹的幾個技術點後,你基本就掌握了全部 HT 組件的使用方式。算法

除了拓撲圖篇的內容外,你也能夠經過《HT for Web 入門手冊》掌握 HT 使用的基本思路,而後你就能夠閱讀《HT for Web 3D 手冊》了,先入爲主的就是下圖這個電信網管 3D 機房監控的綜合性例子:http://www.hightopo.com/guide/guide/core/3d/examples/example_3droom.html編程

Screen Shot 2016-08-26 at 1.07.27 AM

 

該 3D 機房例子徹底用 API 構建,展現了門、窗、服務器、告警、燈光等基本場景內容,並支持移動、編輯、雙擊開門等交互動做,對於機房的不少內容均可以經過六面體、球體、圓柱體等基礎模型,像構建樂高積木那樣組合而成。可能有人會好奇全用 API 的方式能整出多少花樣呢?服務器

好吧,我就列舉些採用 HT 的純 API 方式構建的 3D 例子供參考:網絡

A星尋路算法 3D 模擬:http://www.hightopo.com/demo/astar/astar.html編輯器

Screen Shot 2014-11-24 at 5.09.13 PM

 

3D 漢諾塔算法演示:http://www.hightopo.com/demo/hanoi_20151106/index.htmlide

Screen Shot 2016-08-26 at 1.53.51 AM

3D 熱力圖:http://www.hightopo.com/guide/guide/plugin/forcelayout/examples/example_heatmap3d.html工具

IMG_1036

 

Box2D 物理碰撞 3D 例子:http://www.hightopo.com/demo/box2djs/ht-box2d-demo.html

Screen Shot 2014-11-25 at 8.06.57 PM

設備管理 EMS 系統:http://www.hightopo.com/guide/guide/core/databinding/examples/example_ems.html

Screen Shot 2015-01-07 at 11.50.54 PM

Easing 動畫類型:http://www.hightopo.com/guide/guide/plugin/form/examples/example_easing.html

Screen Shot 2014-05-29 at 3.07.23 PM

3D 網絡拓撲圖:http://www.hightopo.com/guide/guide/plugin/forcelayout/examples/example_forcelayout3.html

Screen Shot 2016-08-26 at 1.41.50 AM

書架場景,亮點自尋:http://www.hightopo.com/guide/guide/plugin/modeling/examples/example_bookshelf.html

Screen Shot 2014-12-25 at 12.19.17 AM

燈光舞臺流動場景:http://www.hightopo.com/guide/guide/core/lighting/examples/example_flowing.html

Screen Shot 2016-08-26 at 1.33.11 AM

2D 和 3D 模型聯動的可編輯房間場景:http://www.hightopo.com/guide/guide/plugin/modeling/examples/example_csgshape.html

Screen Shot 2016-08-26 at 1.28.21 AM

各類樣式的茶杯座椅場景:http://www.hightopo.com/guide/guide/plugin/modeling/examples/example_custommodel.html

Screen Shot 2015-01-07 at 11.46.14 PM

 

一百行代碼實現的 3D 貪吃蛇遊戲:http://www.hightopo.com/demo/snake_20151106/GreedySnake.html

060128389406803

帶可控制端口的 3D 服務器演示:http://www.hightopo.com/demo/hp5406/hp5406-rotation.html

Screen Shot 2016-08-26 at 1.47.43 AM

腦洞打開了吧,其實純 3D API 仍是能作不少效果的,更多例子參考:http://www.hightopo.com/demos/index.html。另外你也能夠採用 HT 輔助的 3D 編輯器所見即所得的快速搭建出三維場景:

Screen Shot 2016-08-26 at 1.17.13 AM

固然不一樣的行業客戶也會根據本身須要打造更適合本身項目的 3D 編輯器:

63E8D17A-24C7-433B-BAB6-5773F51876D4

但純 API 的方式對於複雜的模型就很難實現了,因此對於複雜的模型咱們就能夠利用主流的 3D 設計工具如 3DMaxs,Maya 或 Blender 等進行設計,而後導出 OBJ 格式供 HT 讀入使用,可參考《HT for Web 的 OBJ 手冊http://www.hightopo.com/guide/guide/plugin/obj/ht-obj-guide.html ,HT 手冊中也有衆多采用 OBJ 的應用例子:

可控指針的燃氣表記:http://www.hightopo.com/guide/guide/plugin/obj/examples/example_meter.html

Screen Shot 2016-08-26 at 2.22.14 AM

飛機飛行軌道例子:http://www.hightopo.com/guide/guide/plugin/obj/examples/example_path.html

Screen Shot 2014-10-08 at 7.45.25 PM

摩托車模型結合燈光例子:http://www.hightopo.com/guide/guide/core/lighting/examples/example_pointlight.html

Screen Shot 2016-08-26 at 2.25.50 AM

可開關複雜 3D 門窗:http://www.hightopo.com/guide/guide/plugin/obj/examples/example_room.html

Screen Shot 2016-08-26 at 2.28.02 AM

跑道飛馳汽車:http://www.hightopo.com/demo/media/index.html

Screen Shot 2016-08-26 at 2.28.42 AM

筆記本模型例子:http://www.hightopo.com/guide/guide/core/schedule/examples/example_network.html

Screen Shot 2016-08-09 at 10.37.04 PM

 

可控燃氣監控系統 http://www.hightopo.com/guide/guide/core/serialization/examples/example_exportimport.html

IMG_0282

而且 OBJ 導入的模型依然能夠進行數據綁定和動態實時驅動,這個話題後續我再以服務器扇葉旋轉爲例子展開詳細介紹,本篇先到此爲止,你們可玩下電信網管 3D 機房監控系統場景中,常見的服務器機櫃和帶風扇旋轉功能的例子:http://www.hightopo.com/demo/fan3d/demo-enhanced.html

Screen Shot 2016-08-26 at 2.41.04 AM

相關文章
相關標籤/搜索