Appearance
Add-on packs
The library ships with indoor furniture and five indoor plants. Add-on packs add more items to the editor's furniture panel, the 2D viewer and the 3D viewer. Install only the packs you need: each one is its own npm package, and its 3D models load only when you use the 3D viewer.
Packs are included in your licence (free or commercial) at no extra cost. They work with all three packages: Vue, React and the HTML elements. Each pack has its own version; its peer dependency says which versions of the library it works with.
| Pack | Package | Contents |
|---|---|---|
| Office | @jbaysolutions/floorplan-pack-office | 40 workplace items: desks with monitors and bench desks, screens and dividers, office chairs, meeting tables, phone booths and pods, storage, equipment, plants |
| Garden | @jbaysolutions/floorplan-pack-garden | 48 outdoor items: trees, shrubs and flowers, garden seating, shade and structures, garden features, pool accessories |
| Supermarket | @jbaysolutions/floorplan-pack-supermarket | 39 store items: gondola and wall shelving, open multideck fridges, glass-door fridges and freezers, chest and island freezers, butcher, fish, deli and hot-food counters, a salt cod stand, produce stands, checkouts and self-checkouts, trolleys and baskets |
| Events | @jbaysolutions/floorplan-pack-events | 48 items for trade shows, conferences, conventions and symposiums: shell scheme booths, corner, peninsula and island stands, stand furniture, stages, screens, LED walls, truss and AV, theatre, classroom, banquet, cabaret and U-shape seating, registration and catering, queues and signage |
| Mobility | @jbaysolutions/floorplan-pack-mobility | 43 items for car parks and streets: rows of parking bays (straight, angled, double), accessible, EV, motorbike and loading bays, cars, vans, buses, trucks, motorbikes and bicycles, road markings, EV chargers, barriers and pay machines, street lamps, traffic lights and bus shelters (library 2.4+) |
The editor below has the garden pack registered. Click Garden in the toolbar (or press G) to open its panel, then drag a tree or a parasol into the garden.
Loading the live demo…
Using a pack
bash
npm install @jbaysolutions/floorplan-pack-gardenRegister the pack once, before you mount your app or render the components (for example in main.ts). Import registerPack from the package you use:
ts
import { registerPack } from '@jbaysolutions/floorplan-vue'
import { garden } from '@jbaysolutions/floorplan-pack-garden'
registerPack(garden)ts
import { registerPack } from '@jbaysolutions/floorplan-react'
import { garden } from '@jbaysolutions/floorplan-pack-garden'
registerPack(garden)js
import { registerPack } from '@jbaysolutions/floorplan-elements'
import { garden } from '@jbaysolutions/floorplan-pack-garden'
registerPack(garden)That's all the editor and the 2D viewer need. The editor's toolbar gets a button for the pack, below Furniture: the garden pack's is Garden (a tree icon, shortcut G). It opens the pack's own panel with its categories. Plans that contain the pack's items draw them with the pack's own symbols.
If you also use the 3D viewer, register the pack's 3D models too, with registerPack3D from the package's /3d entry:
ts
import { registerPack3D } from '@jbaysolutions/floorplan-vue/3d'
import { garden3D } from '@jbaysolutions/floorplan-pack-garden/3d'
registerPack3D(garden3D)ts
import { registerPack3D } from '@jbaysolutions/floorplan-react/3d'
import { garden3D } from '@jbaysolutions/floorplan-pack-garden/3d'
registerPack3D(garden3D)js
import { registerPack3D } from '@jbaysolutions/floorplan-elements/3d'
import { garden3D } from '@jbaysolutions/floorplan-pack-garden/3d'
registerPack3D(garden3D)The 2D part (@jbaysolutions/floorplan-pack-garden) never imports three.js. Only the /3d part does.
Register with the package you render with
Each package has its own registry. Call registerPack and registerPack3D from the same package as your components: the React components and the HTML elements don't see packs registered through @jbaysolutions/floorplan-vue.
Pack items in the plan
A pack item is ordinary furniture whose kind is namespaced by its pack:
ts
{ id: 'f1', kind: 'garden/oak', x: 230, y: 1440, width: 420, depth: 420, rotation: 0 }Sizes work like any other furniture. Trees, shrubs and other plants grow taller as you make them wider, and benches, sheds and other built items keep their height. As with the built-in plants, every tree and shrub is slightly different (based on its id) and always looks the same.
If a plan uses a pack you haven't registered, nothing breaks. The item keeps its place and size and shows as a placeholder: a dashed outline in 2D and a plain block in 3D. Register the pack and it appears properly.
The hotel's grounds are planted with garden-pack trees, hedges and furniture:
Loading the live demo…
The office pack
bash
npm install @jbaysolutions/floorplan-pack-officets
import { office } from '@jbaysolutions/floorplan-pack-office'
import { office3D } from '@jbaysolutions/floorplan-pack-office/3d'
registerPack(office) // the editor's Office button (a desk icon, shortcut O)
registerPack3D(office3D) // only if you use the 3D viewerThe office below is furnished with the office pack: bench desks with monitors and dividers, meeting tables, a boardroom table, phone-booth chairs, a server room. Drag it around in 3D, or switch floors:
Loading the live demo…
Item kinds are office/<key>. Sizes are the defaults in cm (width × depth).
Desks: desk (desk with monitor, 160 × 80), desk-dual (desk with two monitors, 160 × 80), standing-desk (height-adjustable desk, 160 × 80), corner-desk (L-shaped corner desk, 180 × 160), hot-desk (140 × 70), bench-2 (bench desk for 2, 160 × 250), bench-4 (bench desk for 4, 320 × 250), bench-6 (bench desk for 6, 480 × 250), reception (reception desk, 300 × 110).
Screens & dividers: desk-divider (160 × 6), partition (free-standing partition, 120 × 50), acoustic-screen (curved acoustic screen, 180 × 50), glass-partition (120 × 12).
Chairs: task-chair (ergonomic task chair, 66 × 66), executive-chair (72 × 74), meeting-chair (56 × 56), visitor-chair (55 × 58), stool (bar stool, 42 × 42), lounge-chair (lounge armchair, 85 × 85).
Meeting: meeting-4 (meeting table, 4 seats, 160 × 200), meeting-6 (240 × 200), meeting-8 (330 × 210), boardroom-12 (boardroom table, 12 seats, 590 × 240), round-meeting (round meeting table, 230 × 230), high-table (high table with stools, 200 × 150), video-screen (video conference screen, 180 × 60), whiteboard (mobile whiteboard, 180 × 60).
Focus & lounge: phone-booth (110 × 110), meeting-pod (240 × 200), acoustic-sofa (high-back acoustic sofa, 200 × 85).
Storage: pedestal (pedestal drawers, 42 × 58), lockers (120 × 50), filing-cabinet (80 × 45), shelving (low shelving, 160 × 40).
Equipment: printer (multifunction printer, 70 × 65), server-rack (60 × 110), water-cooler (35 × 35), coffee-station (180 × 65).
Plants: planter-box (160 × 45), office-plant (tall office plant, 70 × 70).
Desks face +y like the built-in desk: the monitor is at the back (−y at rotation 0) and the person sits on the +y side. Single desks come without a chair (add a task-chair); sets include their chairs: the bench desks, the meeting and boardroom tables, the round table and the high table. A bench is one item for the whole cluster, with a felt divider down the middle. The desk divider sits on a desk top; the other screens stand on the floor.
One marker per seat. For desk booking, officeSeats(item) returns where the people sit on a set, in plan coordinates, ready to use as markers. It works for any size and rotation and returns [] for other items:
ts
import { officeSeats } from '@jbaysolutions/floorplan-pack-office'
const bench = floor.furniture.find((f) => f.kind === 'office/bench-4')!
const markers = officeSeats(bench).map((s, i) => ({ id: `${bench.id}-${i}`, x: s.x, y: s.y, floor: floor.id, variant: 'dot', color: '#22c55e' }))The supermarket pack
bash
npm install @jbaysolutions/floorplan-pack-supermarketts
import { registerPack } from '@jbaysolutions/floorplan-vue'
import { supermarket } from '@jbaysolutions/floorplan-pack-supermarket'
registerPack(supermarket) // the editor's Supermarket button (a trolley icon, shortcut M)
import { registerPack3D } from '@jbaysolutions/floorplan-vue/3d'
import { supermarket3D } from '@jbaysolutions/floorplan-pack-supermarket/3d'
registerPack3D(supermarket3D) // only if you use the 3D viewerThe supermarket below is furnished with the supermarket pack: service counters with their prep rooms, multideck fridges, grocery aisles, frozen food, checkouts and self-checkouts, and trolley bays in the car park:
Loading the live demo…
Item kinds are supermarket/<key>. Sizes are the defaults in cm (width × depth).
Shelving: gondola (gondola shelving, 1 module, 125 × 100), gondola-run (gondola shelving, 3 modules, 375 × 100), gondola-end (gondola end cap, 100 × 45), wall-shelf (wall shelving, 1 module, 125 × 55), wall-shelf-run (wall shelving, 3 modules, 375 × 55), promo-bin (promotion bin, 120 × 80), pallet-display (pallet display, 120 × 80).
Refrigeration: multideck (open multideck fridge, 2.5 m, 250 × 100), multideck-long (open multideck fridge, 3.75 m, 375 × 100), glass-door-fridge (glass-door fridge, 240 × 100), glass-door-freezer (glass-door freezer, 240 × 100), chest-freezer (chest freezer, 200 × 90), island-freezer (island freezer, 250 × 160), combi-freezer (combi freezer, 250 × 110), drinks-cooler (drinks cooler, 65 × 70).
Fresh counters: butcher-counter (butcher counter, 250 × 115), fish-counter (fish counter on ice, 250 × 120), deli-counter (deli and cheese counter, 250 × 115), hot-food-counter (hot food counter, 200 × 110), butcher-block (butcher's block, 150 × 75), fish-prep (fish preparation sink, 200 × 75), salt-cod-stand (salt cod stand, 200 × 100), ticket-dispenser (take-a-number dispenser, 40 × 40), bread-shelf (bread shelf, 200 × 60).
Produce: produce-stand (produce stand, 200 × 120), produce-island (produce island, 200 × 180), produce-table (produce crate table, 160 × 100), produce-scale (self-service scale, 45 × 45).
Checkouts: checkout (checkout lane, 360 × 100), checkout-express (express checkout, 220 × 90), impulse-rack (checkout impulse rack, 80 × 40), self-checkout (self-checkout kiosk, 100 × 70), self-checkout-pod (self-checkout pod of 4, 210 × 150), service-desk (customer service desk, 250 × 90), entry-gate (entry gate, 100 × 20).
Trolleys & baskets: trolley (shopping trolley, 55 × 100), trolley-line (line of trolleys, 60 × 325), trolley-bay (trolley bay, 160 × 360), basket-stack (basket stack, 50 × 40).
Orientation, like all furniture: the back faces −y at rotation 0. Wall units (wall shelving, multidecks, glass-door fridges and freezers, the combi freezer, drinks coolers, bread shelves) stand with their back to the wall and open towards +y. Counters (butcher, fish, deli, hot food, the service desk, checkouts) have the staff on the −y side and the customers on +y; a checkout's belt runs from its −x end to the scanner, with the bagging area past it, and the customers walk along its +y side. Gondolas, island freezers and the produce island are double-sided. A trolley's handle is at −y.
Modular units use real module lengths: shelving 125 cm, multidecks 250 and 375 cm, counters 250 cm (two 125 cm modules). Place them end to end to make a run, or give one unit any length: the 2D symbol adds or drops modules to match, and the 3D model stretches.
The events pack
bash
npm install @jbaysolutions/floorplan-pack-eventsts
import { registerPack } from '@jbaysolutions/floorplan-vue'
import { events } from '@jbaysolutions/floorplan-pack-events'
registerPack(events) // the editor's Events button (a screen on a stand, shortcut T)
import { registerPack3D } from '@jbaysolutions/floorplan-vue/3d'
import { events3D } from '@jbaysolutions/floorplan-pack-events/3d'
registerPack3D(events3D) // only if you use the 3D viewerThe convention centre below is furnished with the events pack: an exhibition hall of shell scheme booths with an island stand and an open theatre, a plenary hall with a stage and 400 seats, a gala dinner, a foyer with registration, and workshop and breakout rooms:
Loading the live demo…
Item kinds are events/<key>. Sizes are the defaults in cm (width × depth).
Booths & stands: booth-shell (shell scheme booth, 3 × 3 m, 300 × 300), booth-shell-small (shell scheme booth, 3 × 2 m, 300 × 200), booth-corner (corner booth, 3 × 3 m, 300 × 300), booth-peninsula (peninsula stand, 6 × 3 m, 600 × 300), booth-island (island stand, 6 × 6 m, 600 × 600), shell-wall (shell scheme wall, 3 panels, 300 × 10), pipe-drape (pipe and drape, 3 m, 300 × 45).
Stand furniture: exhibition-counter (exhibition counter, 100 × 50), brochure-stand (brochure stand, 45 × 40), plinth (display plinth, 50 × 50), showcase (glass showcase, 100 × 50), rollup-banner (roll-up banner, 85 × 35), screen-stand (screen on stand, 120 × 60), media-wall (media wall (step and repeat), 300 × 40).
Stage & AV: stage (stage, 6 × 4 m, 600 × 400), stage-steps (stage steps, 120 × 90), lectern (lectern, 60 × 50), panel-set (panel discussion set, 4 armchairs, 400 × 130), projection-screen (projection screen, 4 m, 420 × 80), led-wall (LED video wall, 5 m, 500 × 80), pa-speaker (PA speaker on stand, 60 × 60), foh-desk (sound and lighting desk, 240 × 150), truss-goalpost (truss goalpost, 6 m, 600 × 40), interpreter-booth (interpreter booth, 200 × 180).
Seating layouts: chair (banquet chair, 45 × 52), theatre-row (theatre row, 10 seats, 500 × 55), theatre-block (theatre block, 10 × 5 seats, 500 × 415), classroom-table (classroom table, 3 seats, 180 × 110), classroom-block (classroom block, 6 tables, 380 × 350), banquet-8 (banquet round, 8 seats, 270 × 270), banquet-10 (banquet round, 10 seats, 300 × 300), cabaret (cabaret round, 6 seats, 270 × 215), u-shape (u-shape conference, 14 seats, 520 × 480), lounge-set (lounge set, 300 × 240).
Registration & catering: registration-desk (registration desk, 3 m, 300 × 110), check-in-kiosk (self check-in kiosk, 60 × 55), buffet-table (buffet table, 240 × 90), coffee-station (coffee station, 180 × 75), bar (mobile bar, 240 × 100), cocktail-table (cocktail table, 70 × 70), high-table-set (high table with 4 stools, 150 × 150), cloakroom-rail (cloakroom rail, 150 × 60).
Queues & signage: stanchion (queue barrier, 3 m, 300 × 35), queue-maze (queue maze, 4 lanes, 400 × 300), crowd-barrier (crowd barrier, 230 × 60), signage-totem (digital signage totem, 60 × 45), easel-sign (easel sign, 70 × 60), photo-booth (photo booth backdrop, 300 × 250).
Orientation, like all furniture: the back faces −y at rotation 0. Booths and stands have their back wall at −y and open towards the aisle at +y (a corner booth is also open on its +x side). A stage's front edge is at +y; screens, LED walls, lecterns and the panel face +y, towards the audience. Seats face +y (their backs at −y): to face a stage at the top of the plan, turn the seating 180°. A cabaret round leaves its +y side free, towards the stage. The registration desk and the bar have the staff at −y and the guests at +y; the sound desk's consoles face the stage at −y, with the operators at +y.
Modular items use real module sizes (shell scheme panels 100 cm, stage decks 200 × 100 cm, seats 50 cm wide in rows 90 cm apart). Give a booth, a stage, a theatre row or block, a classroom block or a queue maze any size: the layout adds walls, decks, seats or posts to match, and furniture keeps its real size.
Seats: eventsSeats(item) returns where each person sits on the seating items (theatre rows and blocks, classroom tables and blocks, banquet and cabaret rounds, the U-shape, the panel, the high table, a chair), in plan coordinates, for one marker per seat, a seating plan or bookings:
ts
import { eventsSeats } from '@jbaysolutions/floorplan-pack-events'
const seats = floor.furniture.flatMap((f) => eventsSeats(f))
const markers = seats.map((s, i) => ({ id: `seat-${i}`, x: s.x, y: s.y, floor: floor.id, variant: 'dot', color: '#22c55e' }))The mobility pack
bash
npm install @jbaysolutions/floorplan-pack-mobilityts
import { registerPack } from '@jbaysolutions/floorplan-vue'
import { mobility } from '@jbaysolutions/floorplan-pack-mobility'
registerPack(mobility) // the editor's Mobility button (a car, shortcut P)
import { registerPack3D } from '@jbaysolutions/floorplan-vue/3d'
import { mobility3D } from '@jbaysolutions/floorplan-pack-mobility/3d'
registerPack3D(mobility3D) // only if you use the 3D viewerIt needs library 2.4 or later, which adds roads and the asphalt floor. The car park below is furnished with the mobility pack: rows and a double row of bays, accessible and EV bays, a barrier gate and a height barrier on the access road, a main road with a zebra crossing and a bus stop, and a forecourt with a loading bay and a bike shelter:
Loading the live demo…
Item kinds are mobility/<key>. Sizes are the defaults in cm (width × depth).
Parking bays: bay (parking bay, 250 × 500), bay-row (row of parking bays, 5, 1250 × 500), bay-double (double row of bays, 2 × 5, 1250 × 1000), bay-angled (angled bays, 60°, 5, 1770 × 560), bay-accessible (accessible bay, 360 × 500), bay-ev (EV charging bay, 250 × 500), bay-motorbike (motorbike bays, 4, 400 × 250), bay-loading (loading bay, 350 × 1000).
Vehicles: car (car, 180 × 450), hatchback (hatchback, 175 × 405), suv (SUV, 195 × 480), taxi (taxi, 180 × 455), van (van, 205 × 530), pickup (pickup truck, 200 × 540), bus (bus, 255 × 1200), truck (truck, 255 × 1000), motorbike (motorbike, 80 × 215), bicycle (bicycle, 60 × 175).
Road markings: zebra (zebra crossing, 650 × 300), arrow-straight (arrow, straight on, 100 × 500), arrow-left (arrow, turn left, 160 × 500), arrow-right (arrow, turn right, 160 × 500), stop-line (stop line, 325 × 40), box-junction (box junction, 650 × 650), speed-bump (speed bump, 650 × 120).
Parking equipment: ev-charger (EV charger, twin post, 60 × 40), ev-wallbox (EV wallbox, 45 × 25), barrier-gate (barrier gate, 400 × 60), ticket-machine (ticket machine, 60 × 50), pay-station (pay station, 70 × 55), bollard (bollard, 25 × 25), wheel-stop (wheel stop, 180 × 20), height-barrier (height barrier, 620 × 20), parking-sign (parking sign, 50 × 12).
Street furniture: street-lamp (street lamp, 40 × 180), traffic-light (traffic light, 30 × 30), bus-shelter (bus shelter, 400 × 160), bus-stop (bus stop sign, 40 × 12), bike-shelter (bike shelter, 500 × 220), litter-bin (litter bin, 50 × 50), fire-hydrant (fire hydrant, 30 × 30), road-sign (road sign, 60 × 15), traffic-cone (traffic cone, 40 × 40).
Orientation, like all furniture: the back faces −y at rotation 0. A bay's back line is at −y and cars drive in from +y. A vehicle's rear is at −y and its front at +y (it drives towards +y): to park one nose-in, turn it to the bay's rotation + 180°. Arrows point to −y. Signs, machines and chargers face +y. The street lamp's pole is at −y and its arm reaches over +y (stand it on the pavement, arm over the road). The EV wallbox hangs 90 cm up on a wall behind it (−y).
On roads: anything placed on a road's carriageway stands on the road's surface in 3D (cars, markings, cones). Draw car parks as areas with the asphalt floor and put the bays on them.
Modular bays: a row of bays adds 2.5 m bays as it gets longer; the double row, the angled row (60°) and the motorbike bays (1 m) too. Spaces: parkingSpots(item) returns where each parking space is (one per bay), in plan coordinates, for occupancy markers or bookings:
ts
import { parkingSpots } from '@jbaysolutions/floorplan-pack-mobility'
const spaces = floor.furniture.flatMap((f) => parkingSpots(f)) // [{ x, y, rot }, …]
const markers = spaces.map((s, i) => ({ id: `space-${i}`, x: s.x, y: s.y, floor: floor.id, variant: 'dot', color: '#22c55e' }))The garden pack
Item kinds are garden/<key>. Sizes are the defaults in cm (width × depth).
Trees
| Key | Item | Size |
|---|---|---|
oak | Oak | 650 × 650 |
birch | Birch | 300 × 300 |
spruce | Spruce | 550 × 550 |
cypress | Italian cypress | 160 × 160 |
date-palm | Date palm | 600 × 600 |
olive | Olive tree | 550 × 500 |
cherry | Cherry blossom | 680 × 680 |
willow | Weeping willow | 640 × 640 |
maple | Japanese maple | 500 × 500 |
apple | Apple tree | 480 × 480 |
A tree's size is its crown spread. Its height follows: the default oak is about 7 m tall, and the cypress about 10 m.
Shrubs & flowers: hedge (clipped hedge, 254 × 84), topiary (topiary cone, 85 × 85), lavender (125 × 125), hydrangea (160 × 160), rose (rose bush, 90 × 90), vegetable-bed (240 × 100), tulip-planter (121 × 42).
Garden seating: park-bench (180 × 73), modern-bench (204 × 45), picnic-table (180 × 150), bistro-set (163 × 70), dining-set (teak dining set for six, 303 × 191), adirondack (adirondack chair, 89 × 97), sun-lounger (74 × 201), lounge-sofa (220 × 90), egg-chair (hanging egg chair, 90 × 101), hammock (352 × 118).
Shade & structures: parasol (300 × 300), cantilever-parasol (360 × 300), pergola (pergola with wisteria, 390 × 360), gazebo (416 × 480), shed (garden shed, 274 × 213), greenhouse (303 × 223).
Garden features: fountain (250 × 250), bird-bath (72 × 72), fire-pit (143 × 143), barbecue (kettle barbecue, 67 × 76), lamp-post (48 × 48), bollard (bollard light, 20 × 20), stepping-stones (445 × 140), swing-set (310 × 166), trampoline (368 × 368), bike-rack (75 × 245).
Pool: pool-ladder (68 × 71), diving-board (70 × 405), hot-tub (224 × 264), outdoor-shower (90 × 90), pool-lounger (76 × 173). The ladder and diving board stand on the edge with their back on the deck (−y at rotation 0) and reach over the water. Pools themselves are areas: see swimming pools.
Like all furniture, an item's back faces −y (the top of the plan) at rotation 0: the back of a bench, the head of a sun lounger, the door of the shed faces +y.
Making your own pack
You can register your own items in the same way, for example your company's products or equipment. A pack is plain data and functions, so the same pack works with every package. Only the imports change:
ts
import { registerPack, type FurniturePack } from '@jbaysolutions/floorplan-vue'
import { registerPack3D, type FurniturePack3D } from '@jbaysolutions/floorplan-vue/3d'ts
import { registerPack, type FurniturePack } from '@jbaysolutions/floorplan-react'
import { registerPack3D, type FurniturePack3D } from '@jbaysolutions/floorplan-react/3d'ts
import { registerPack, type FurniturePack } from '@jbaysolutions/floorplan-elements'
import { registerPack3D, type FurniturePack3D } from '@jbaysolutions/floorplan-elements/3d'2D: catalogue entries and symbols
ts
const acme: FurniturePack = {
name: 'acme', // namespace: kinds start with 'acme/'
label: 'Acme', // the editor's button and panel
icon: 'M4 4h16v16H4z M9 9h6v6H9z', // 24 × 24 path data, drawn as a line icon
key: 'A', // optional shortcut; avoid V H W R D N F E, which the editor uses
items: [
{
kind: 'acme/charger',
label: 'EV charger',
category: 'Acme',
width: 40,
depth: 30,
// SVG markup centred on (0, 0), back towards −y, for an item of this width × depth
symbol: (w, d) => `<rect class="fp-f" x="${-w / 2}" y="${-d / 2}" width="${w}" height="${d}" rx="4"/>
<circle class="fp-fire" r="${Math.min(w, d) / 5}"/>`,
},
],
}
registerPack(acme)Use the library's classes in symbols so they follow the theme: fp-f and fp-f2 (furniture fills), fp-fl (detail lines), fp-leaf, fp-leaf2, fp-leaf3, fp-leaf-line, fp-blade (plants), fp-canopy (see-through tree crowns), fp-flower, fp-flower-2, fp-bloom, fp-autumn, fp-fruit, fp-water, fp-fire, fp-glow, fp-soil, fp-tv (dark solid).
3D: models
ts
import * as THREE from 'three'
const acme3D: FurniturePack3D = {
name: 'acme',
models: [
{
kind: 'acme/charger',
width: 40, // the size the model is built at
depth: 30,
build(group, ctx) {
const body = new THREE.Mesh(new THREE.BoxGeometry(40, 120, 30), ctx.color('#2f3a4a'))
body.position.y = 60
group.add(body)
},
},
],
}
registerPack3D(acme3D)- Build in cm, with y up and the item's back towards −z.
- Use
ctx.color(hex, options)orctx.theme(key)for materials. They adapt to the theme: darker in dark, x-ray in blueprint.optionscoversroughness,metalness,emissive,foliage,glass,waterandopacity. ctx.rnd()gives random numbers seeded by the item's id.ctx.modellinghas the library's geometry helpers (arc,ribbon,leafWidth,curve,tube…). Using them throughctxkeeps a pack free of any runtime dependency on a framework package.- Meshes are merged per material afterwards, and items are scaled from
width×depthto their actual size. Setheight: 'scale'for plants, which should grow taller when they're made bigger. modelling(exported from each package's/3dentry, e.g.@jbaysolutions/floorplan-vue/3d) has the helpers the built-in plants use:arc,ribbon,leafWidth,curve,tube,seededand more.