Draw shapes and texts using webgl2
npm install @bimdata/engine-2dFor development, just serve the index.js root file.
To Add GLSL syntax highlighting for JavaScript template literals, use the VSCode extension: glsl-literal
VSCode Vitest extension is highly recommended.
``bash`
npm run test
`bash``
npm run types
LOW PRIORITY TODOs
- [ ] move/translate/rotate/scale methods on dynamic entity
- [ ] tests
- [ ] fill holes
- [ ] b2d binary format
- [ ] compressed textures
DONE
- [x] cleaner SVG parser (the current one is the previous 2d-engine version + adapter) https://github.com/bimdata/engine-2d/pull/43
- [x] Better Inputs API (handle "click" and picking) https://github.com/bimdata/engine-2d/pull/42
- [x] select and highlight rendering logic rework https://github.com/bimdata/engine-2d/pull/41
- [x] renderer offset or model/entity origin to handle full f64 precision for point coordinate https://github.com/bimdata/engine-2d/pull/40 + FIX
- [x] touch controller https://github.com/bimdata/engine-2d/pull/39
- [x] groups (entity.group and max texture units exceeded) PART 1 https://github.com/bimdata/engine-2d/pull/35 PART 2 https://github.com/bimdata/engine-2d/pull/37
- [x] texts https://github.com/bimdata/engine-2d/pull/29
- [x] TypedArrays in Builder.js https://github.com/bimdata/engine-2d/pull/28
- [x] remove de-instancing feature if not useful https://github.com/bimdata/engine-2d/pull/27
- [x] dash rework https://github.com/bimdata/engine-2d/pull/26
- [x] snap picking (edge + vertex) https://github.com/bimdata/engine-2d/pull/14
- [x] shape attribute change => scene redraw + proper resource cleaning --- hard update https://github.com/bimdata/engine-2d/pull/18
- [x] better picking API https://github.com/bimdata/engine-2d/pull/19
- [x] camera fit view https://github.com/bimdata/engine-2d/pull/23
- [x] packed color https://github.com/bimdata/engine-2d/pull/3
- [x] picking https://github.com/bimdata/engine-2d/pull/6
- [x] entity flags update (performant batch update + tint for selected or highlighted entities & need redraw) - soft update https://github.com/bimdata/engine-2d/pull/4
- [x] render target resize = redraw (cache projection matrix) https://github.com/bimdata/engine-2d/pull/13
- [x] fill style texture https://github.com/bimdata/engine-2d/pull/12
- [x] line style dash array + dash offset https://github.com/bimdata/engine-2d/pull/7
- [x] properly manage WebGL integer buffer & texture precision https://github.com/bimdata/pixi-lines/pull/2
- [x] auto generated types d.ts https://github.com/bimdata/engine-2d/pull/4
- [ ] compositing with canvas2D for texts https://css-tricks.com/techniques-for-rendering-text-with-webgl/ Replaced by simple "texts"
- [ ] model entities sorting by z-index last added object drawn last
- [ ] picking margin & picking z-index https://github.com/bimdata/engine-2d/pull/11
They are point indices read by four. The "reading window" (represented by the "|- - - -|" symbol) comes forward of one index for the subsequent segment. Zero means a cap. -(index) is for closed path.
[0 ,1, 2, 0] single segment[0, 1, 2, 3, 0] two consecutive segments
|- - - -| first
|- - - -| second[-3 ,1, 2, 3, 1, -2] two segments closed (= triangle) -(index) allows correct join