Giter Club home page Giter Club logo

alanmacleod / wasm-render Goto Github PK

View Code? Open in Web Editor NEW
31.0 3.0 5.0 669 KB

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

License: MIT License

C 13.32% HTML 4.88% JavaScript 14.89% TypeScript 66.08% C++ 0.83%
webassembly 3d rasterizer wasm rasterisation performance benchmark software-rendering graphics polygon

wasm-render's Introduction

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/

wasm-render's People

Contributors

alanmacleod avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

wasm-render's Issues

TypeError: this.wasm._malloc is not a function.

SharedMemory.ts:30 Uncaught TypeError: this.wasm._malloc is not a function
at SharedMemory.allocate (SharedMemory.ts:30)
at new SharedMemory (SharedMemory.ts:23)
at HTMLImageElement.i.onload (Texture.ts:51)

what's reason of this issue ? anybody met it? thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.