alanmacleod / wasm-render

Software 3D renderer & rasteriser written in WASM/C & TypeScript to test / showcase WebAssembly and compare performance

Home Page:https://medium.com/@lady_shapes/webassembly-workout-back-to-the-future-part-1-compilation-and-memory-8265e634ef90

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

wasm-render

Software rasteriser written in WASM/C & TypeScript to test WebAssembly and compare performance

Rasteriser draws a single texture-mapped polygon onto each face of a simple 3D mesh. The same code has been written in pure Javascript (well... TypeScript) and then again in WebAssembly / C.

Try the demo running here (link fixed again! - SSL cert problem, sorry!)

Read the article about all of this here

alt tag

You can switch between C and JS at run time to visually compare performance, and a realtime latency graph is included to measure each frame time in milliseconds.

Click the graph to switch between JS and WebAssembly/C.

Using the rather awesome wasm-init tool which relieved me of many, many headaches.

How to build and run

Install Emscripten
git clone https://github.com/juj/emsdk.git
cd emsdk
./emsdk install sdk-incoming-64bit binaryen-master-64bit
./emsdk activate sdk-incoming-64bit binaryen-master-64bit

warning: this takes about an hour or more!

Clone and install
git clone https://github.com/alanmacleod/wasm-render.git
npm install

npm run buildall

node server

If all went well, it should be running: http://localhost:3000/

About

Software 3D renderer & rasteriser written in WASM/C & TypeScript to test / showcase WebAssembly and compare performance

https://medium.com/@lady_shapes/webassembly-workout-back-to-the-future-part-1-compilation-and-memory-8265e634ef90

License:MIT License


Languages

Language:TypeScript 66.1%Language:JavaScript 14.9%Language:C 13.3%Language:HTML 4.9%Language:C++ 0.8%