MCPcopy Create free account
hub / github.com/electric-sql/electric / queueShell

Function queueShell

website/src/components/home/iso/render.ts:255–320  ·  view source on GitHub ↗
(
  cmds: DrawCmd[],
  origin: Vec3,
  size: Vec3,
  opts: RenderOptions,
  proj: ProjectorOpts
)

Source from the content-addressed store, hash-verified

253}
254
255function queueShell(
256 cmds: DrawCmd[],
257 origin: Vec3,
258 size: Vec3,
259 opts: RenderOptions,
260 proj: ProjectorOpts
261): void {
262 const [x, y, z] = origin
263 const [dx, dy, dz] = size
264 const edges: [Vec3, Vec3][] = [
265 [
266 [x, y, z],
267 [x, y, z + dz],
268 ],
269 [
270 [x + dx, y, z],
271 [x + dx, y, z + dz],
272 ],
273 [
274 [x, y + dy, z],
275 [x, y + dy, z + dz],
276 ],
277 [
278 [x + dx, y + dy, z],
279 [x + dx, y + dy, z + dz],
280 ],
281 [
282 [x, y, z + dz],
283 [x + dx, y, z + dz],
284 ],
285 [
286 [x, y, z + dz],
287 [x, y + dy, z + dz],
288 ],
289 [
290 [x, y, z],
291 [x + dx, y, z],
292 ],
293 [
294 [x, y, z],
295 [x, y + dy, z],
296 ],
297 ]
298 for (const [a, b] of edges) {
299 const mid = midpoint(a, b)
300 cmds.push({
301 depth: mid[0] + mid[1] - mid[2],
302 draw: (ctx) => {
303 ctx.lineWidth = 1
304 ctx.strokeStyle = neutralColor(opts.dark, 0.13)
305 const pa = projectXY(a, proj)
306 const pb = projectXY(b, proj)
307 const fa = fadeForPoint(a, proj.bounds, proj.fadeMargin)
308 const fb = fadeForPoint(b, proj.bounds, proj.fadeMargin)
309 const fade = (fa + fb) * 0.5
310 if (fade < 0.01) return
311 ctx.globalAlpha = fade
312 ctx.beginPath()

Callers 1

queueBuildingFunction · 0.85

Calls 4

projectXYFunction · 0.90
fadeForPointFunction · 0.90
midpointFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected