Skip to content

Instantly share code, notes, and snippets.

View cliffhall's full-sized avatar
💥
Technology pivot appearing onscreen now, captain.

Cliff Hall cliffhall

💥
Technology pivot appearing onscreen now, captain.
View GitHub Profile
@cliffhall
cliffhall / a-render-and-transmit-test.md
Last active February 1, 2024 16:26
A Three.js / Socket.io / Node.js render and transmit test.

This example renders thirty frames of the Three.js 'your first scene' example and sends them to a Node.js microservice, which saves them to the filesystem.

test-render-client.html

  • Creates the scene, camera, renderer, and kicks off the render loop, which stops after 30 frames have been rendered.
  • As an optimization, it doesn't add the Three.js canvas to the browser DOM, rendering it offscreen, but reporting progress.
  • It extracts the data for each frame using canvas.toDataURL(), sending that to a web worker process for transmission.
  • When all frames are rendered, it sends a 'done' message to the worker.

test-render-worker.js

  • Sets up a queue for incoming frames to be sent to the server.
@cliffhall
cliffhall / a-simple-socket-io-test.md
Last active November 5, 2016 21:27
A simple Socket.io test with client and server (Node.js) parts.