• Stars
    star
    109
  • Rank 319,077 (Top 7 %)
  • Language
    Rust
  • License
    MIT License
  • Created almost 9 years ago
  • Updated over 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Software rasterization, N-Body simulation and Game of Life in Rust + Haskell

Rust Experiments

This project contains a number of experiments in the simulation / graphics category. I frequently write Haskell projects where I delegate the performance critical, numerical code to C/C++ or offload it to the GPU. I wanted to try using Rust as a safer and more functional alternative. The application itself is written in Haskell, doing the display, user interaction and non-inner-loop parts with the actual computations done in a Rust library.

rust-exp

Experiments include...

  • Software rasterizer using half-space functions, doing perspective and sub-pixel correct, gap-less rasterization, depth buffering, switchable between vertex and pixel shading, many different shaders implemented, does IBL based on pre-filtered irradiance cubemaps, different environments included, a selection of scenes, many with baked ambient occlusion or radiosity, build-in benchmarking, gamma corrected output, selectable backgrounds, parallelized
  • Gravitational N-Body simulation, both a brute force O(N^2) and the O(n log n) Barnes-Hut algorithm are implemented, adjustable time step and cutoff criteria, rendering of alpha blended particles with tails, parallelized, multiple interesting initial configurations to choose from
  • The famous 'Game of Life' cellular automata, optimized and parallelized implementation, library of recallable patterns

If you want to read actual algorithm descriptions and references for these experiments, including more, higher quality images visit the following link to my website

Rust projects on Blitzcode.net

The Haskell application itself might also be of interests. It features a pluggable experiment framework, modern OpenGL 3/4.x style rendering, text, quad rendering, screenshots, framebuffer system, FPS counter, GLSL, logging etc. A good starting point for your own Haskell + OpenGL adventures. Also see my other Haskell and GLSL program containing my distance field / ray marching related experiments.

Building

This project uses the Stack / Cabal tools (stack build) for building the Haskell code and Cargo (cargo build --release) for building the Rust code. There's a top-level Makefile invoking both, simply do

make

once you have Stack and Cargo / Rust installed.

Legal

This program is published under the MIT License.

Author

Developed by Tim C. Schroeder, visit my website to learn more.

More Repositories

1

hue-dashboard

A web interface for monitoring and controlling Philips Hue lights
Haskell
280
star
2

neskell

A Haskell 6502 Emulator
Assembly
69
star
3

ghc-stack

Hacking GHC's Stack for Fun and Profit (featuring The Glorious Haskell Debugger v0.0.1 Pre-alpha)
C++
68
star
4

hackage-diff

Compare the public API of different versions of a Hackage library
Haskell
63
star
5

ray-marching-distance-fields

Haskell and GLSL program containing my distance field / ray marching related experiments
Haskell
35
star
6

hue-dash

Control Hue lights with Amazon Dash buttons
C
25
star
7

rsvp

rsvp - Realtime Sampling Visual Profiler
C++
25
star
8

crt-240p-scale-shader

RetroArch GLSL shader for 240p CRT output
GLSL
18
star
9

term-gfx

Terminal Graphics
Rust
9
star
10

jacky

Haskell Twitter Newsreader
C
8
star
11

hue-watchdog

Turn on the alarm lights when things go offline
7
star
12

trinitron-tv-cheat-sheet

Cheat sheet for calibrating Sony Trinitron CRT TVs
5
star
13

cpp-11-ray-trace-march-framework

C++11 Ray Tracing / Marching Framework
C++
5
star
14

haskell-gol

Three 'Game of Life' Implementations in Haskell
Haskell
4
star
15

lru-bounded-map

Haskell implementations of associative containers (maps / dictionaries) which retire elements in least recently used (LRU) order when growing past a specified limit
HTML
3
star
16

conduit-chunked

Efficiently processing data byte-by-byte with conduit
Haskell
3
star
17

retropie-setup-notes

Notes for setting up a RPi 3B with RetroPie 4.7.1 & a PI2SCART hat
1
star
18

http-conduit-bug-reproducer

Bug reproducer for an issue I've encountered with http-conduit 2.0.0.1
Haskell
1
star