Git Product home page Git Product logo

voxelspacesdl's Introduction

Voxel Space in C

Description

Comanche's Voxel Space rendering algorithm written in C using SDL. You can try it here (browser demo).

Code_2022-02-02_14-48-09

Bindings

Keyboard + Mouse

  • G - Toggle gravitation
  • LMB (hold) - Free look
  • LMB (double click) - Enable persist free look
  • ESC - Close application
  • W/S - Move camera forward/backward
  • A/D - Rotate camera or strafe (if LMB pressed)
  • E/Q - Adjust camera height (Jump if gravtitation enabled)
  • R/F - Adjust camera pitch
  • J/K - Adjust details level
  • LShift - Increase camera movement speed
  • C - Reset camera pitch
  • Space - Increase render distance
  • Shift + Space - Decrease render distance
  • LCTRL + Space - Reset render distance to default value
  • Alt + Enter - Toggle fullscreen

Game Controller

  • BACK - Toggle gravitation
  • LS - Move camera
  • RS - Rotate camera
  • RSB - Reset camera pitch
  • LT - Increase camera movement speed
  • RT - Increase camera rotation speed
  • LB - Decrease render distance
  • RB - Increase render distance
  • A - Jump (if gravitation enabled)
  • B - Close application
  • Y - Reset render distance to default value
  • D-Pad Up/Down - Adjust camera height
  • Touchpad - Free look

Building

Arguments supported by build scripts

  • dbg - Build with debug symbols;
  • wall - Enable all compiler warnings;
  • winf - Increase warning level;
  • woff - Disable all compiler warnings;
  • threaded - Build with multithreaded renderer;
  • sdlimage - Build with png/jpg/... images support;
  • overlay - Build with onscreen information module;
  • web - Build for browsers using emscripten;
  • run - Run compiled app if build successful.

Build scripts usage

  • On Windows you need to run the build.bat batch script in Visual Studio Developer Environment. Or... just open Visual Studio Code and press F5 button. If you need png image support, run build.bat sdlimage.
  • On Linux you need to run the build.sh bash script. If you need png image support, run build.sh sdlimage;
  • Almost all build agrguments can be combined.

Notes

  • You can change map by dropping two images (height map and diffuse map) on the Voxel Space window;
  • The first letter in file name tells to the VoxelSpace how to use dropped file. D - use as a height map, and C - use as a diffuse map;
  • Also you can change default map by passing commandline arguments to VoxelSpace: vs.exe -dm "path/to/diffuse.png" -hm "path/to/height.png" or vs.exe /diffuse "path/to/image.png" /height "path/to/image.png";
  • So far there are no VoxelSpace commandline arguments list, see src/argparse.c for more information.

Thanks

Thanks to s-macke for the inspiration and excellent technology explanation :)

License

The software part of the repository is under the MIT license. Please read the license file for more information. Please keep in mind, that the Voxel Space technology might be still patented in some countries. The color and height maps are reverse engineered from the game Comanche and are therefore excluded from the license.

voxelspacesdl's People

Contributors

igor725 avatar

Stargazers

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

Watchers

 avatar

voxelspacesdl's Issues

Distorted geometry facing down.

Thanks for this, much better than my implementation from 2008.
One problem with the algorithm is the geometry when facing down. Stretched about 2:1
persp_fwd
persp_down
Have you any ideas how to render downward facing with less distortion?
Cheers igor.

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.