生成轻量化建筑模型
Magiz 独特的体块生成逻辑可在 three.js 中通过一次 drawCall 渲染所有模型。适合在 web 端展示城市级尺度的模型场景。
For Generating Lightweight Building Models.
Magiz's unique block generation logic can render all models in Three.js with a single drawCall. Suitable for displaying city level model scenarios on the web.
Functions may change in the future.
npm iFirst install dependencies.
npm run buildBundle TS to ESM (dist\magiz.module.min.js).
Localhost example/index.html to see demo. this page can be the start point of creating new styles.
Refer to src/types for tips and type details.
To develop with ViewClass, which is a custom three.js environment, use npm run dev_ or npm run build_ instead.
To enable block only generation mode, set match to a none zero block size.
const plan = new Plan({ match: 2 })This will only use block combinations for buildings and can be presented as 'instancedMesh' in Three.js to render all models in one drawCall.
-
src/types/styleTypes.d.ts contains tips and type details for styles.
src/styles contains style examples.
-
Start watching files. Any changes will be bundled into
dist\magiz.module.min.jsnpm run dev
-
Localhost
example/index.htmlRecommend to init with VSC and Live Server extension.
-
Edit
src\styles\preset.tsto create your presetsPreset are style chunks can be reused in styles.
src/class/styleClass/utilsprovide 'check' functions to offer type checking and param tips. -
Edit
src\styles\simple.tsto create your stylessrc/class/styleClass/utilsprovide 'preset' functions to import style chunks fromsrc\styles\preset.tsand offer type checking and param tips.
If someone creates a new style and is interested in contributing, please PR to establish a public awesome style library.
Any opinions and suggestions are welcomed !
周 曦 453154007@qq.com
Wechat: Ketchup