一個將 Three.js 和 three_dart 強大功能帶到 Flutter 的套件,讓開發者能在多個平台渲染、操控和互動 3D 模型。它為熟悉 Three.js 的開發者提供熟悉的 API,可輕鬆將 3D 圖形整合到 Flutter 應用中。該套件支援即時渲染與場景管理,非常適合用於視覺化、遊戲和互動式產品預覽。
適用情境
3D 模型檢視器
互動產品示範
教育類3D視覺化
遊戲開發
虛擬遊覽
主要特色
跨平台3D渲染
熟悉的 Three.js API
即時場景操作
支援 GLTF 和 OBJ 模型
內建照明和攝影機控制
適合對象
具有 Three.js 經驗的開發人員
需要豐富3D內容的應用程式
原型設計 3D 界面
帶有3D元素的網頁和行動應用
使用建議
更高的性能要求
與原始 Three.js 相比,文件有限
初學者可能面臨的複雜性
需要理解三維概念
未針對低階設備優化
原始 README
以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。
three_js
A 3D rendering engine for dart (based on three.js and three_dart) that allows users to view, edit and manipulate their 3D objects. The current builds uses angle for desktop and mobile, and WebGL2 for web applications.
Features
This is a dart conversion of three.js and three_dart, originally created by @mrdoob and has a coverted dart fork by @wasabia.
Requirements
MacOS
Minimum os Deployment Target: 10.15
Xcode 13 or newer
Swift 5
Metal supported
iOS
Minimum os Deployment Target: 13.0
Xcode 13 or newer
Swift 5
Metal supported
iOS-Simulator
Minimum os Deployment Target: 13.0
Xcode 13 or newer
Swift 5
Metal supported
Android
compileSdkVersion: 34
minSdk: 21
OpenGL supported
Vulkan supported
Android Emulator
compileSdkVersion: 34
minSdk: 21
OpenGL supported
Windows
Intel supported
AMD supported
Qualcom supported
Direct3D 11 supported
OpenGL supported
Web
WebGL2 supported. please add <script src="https://cdn.jsdelivr.net/gh/Knightro63/flutter_angle/assets/gles_bindings.js"></script> to your index.html to load the js_interop file.
WASM
WebGL2 supported. please add <script src="https://cdn.jsdelivr.net/gh/Knightro63/flutter_angle/assets/gles_bindings.js"></script> to your index.html to load the js_interop file.
Linux
Currenlty only works for flutter < 3.27
Ubuntu supported (Tested on Linux Mint)
OpenGL supported
Getting started
To get started add three_js to your pubspec.yaml file. Adding permissions for audio and video is required if using either item.
Please use Permission Handler package to help with this.
Usage
This project is a simple 3D rendering engine for flutter to view, edit, or manipulate 3D models.
As this project moves twards impeller renderer google's ANGLE will be removed and this version will be moved to three_js_angle, which currenly does not exists.
Example
Find the example for this API here, for more examples you can click here, and for a preview go here.
Know Issues
All
MD2 annimations do not work
Collada animations do not work
Collada kinnametics does not work
PMREM gives weird artifacts or is completely black
Contributions are welcome.
In case of any problems look at existing issues, if you cannot find anything related to your problem then open an issue.
Create an issue before opening a pull request for non trivial fixes.
In case of trivial fixes open a pull request directly.
Supported Features
All of the current webgl2 core features are supported at this time.
GPU is currently under development, so it is currently not supported.
Please review the following table for all the supported Modules.