go3dprint
is a needlessly distributed phallic object generator.
It's an educational demo project made to showcase the basics of creating and rendering 3D mesh with Go. It uses the sdfx
and fauxgl
libraries.
This project was presented at dotGo 2019, in Paris.
For the live demo a simpler version was used. This is the "full version," which has the following key differences:
- Functionality is split into loosely coupled microservices
- Running as lightweight containers
- That communicate via API calls and websockets.
And thanks to Garden, the workflow is configured so that it:
- Re-builds and re-deploys on every code change
- Can use hot reload, so containers can be update without restarting
- Uses the same tooling for all environments—local, CI, remote.
The differences and the conversion process are explained in detail in the article Needlessly Distributed Phallic Object Generator.
This project is split into three microservices: mesh
, render
, and web
.
The way it works is:
web
constantly pollsmesh
for 2D and 3D objects.- If it receives a 2D object, it displays it on the browser.
- If it receives a 3D object, it POSTs it to the
render
service. - The
render
service, in turn, returns an image of the rendered mesh, which is then displayed on the browser.
To enable live feedback as one explores different 2D/3D forms, this project uses Garden to re-build and re-deploy services whenever the source code changes.
Simply install Garden, clone this repository, and garden dev
.
- Install Garden.
- Clone this repo.
- Run
garden dev --hot=mesh
, and leave it running. - You should see the ingress endpoint for the
web
service in the output. Open that in your browser. - Now go and mess around! Open
mesh/main.go
and look for the commented out lines in themagic()
function. Try uncommenting the sections one by one and observe the results in the browser (it takes a few seconds to rebuild each time).