Skip to content

A raylib demo to visualize the Model, View, and Projection (MVP) matrices.

License

Notifications You must be signed in to change notification settings

jdeokkim/mvp-demo

Repository files navigation

MVP Transform Visualizer

"The engines don’t move the ship at all.

The ship stays where it is and the engines move the universe around it."

— Futurama

A raylib demo to visualize the Model, View, and Projection (MVP) matrices.

This project is a C rewrite of @diskhkme's MVP Transform Visualizer with additional features, for the "Computer Graphics" (1214-3005) course at Chungnam National University.

Feel free to try the WebAssembly version here!

mvp-demo-v0.2.0.mp4

Controls

  • ALT + 0: Draw All Spaces
  • ALT + 1: Draw Local Space
  • ALT + 2: Draw World Space
  • ALT + 3: Draw View Space
  • ALT + 4: Draw Clip Space
  • ESC: Lock/Unlock Observer Camera
  • V: Show/Hide Player Model Vertices

Prerequisites

  • GCC version 11.4.0+
  • Git version 2.34.0+
  • GNU Make version 4.3+
  • raylib 5.5+

Building

Compiling for Windows

Download the latest release of w64devkit from here, extract the .zip file to your working directory, and run w64devkit.exe.

$ wget -O raylib.zip https://github.com/raysan5/raylib/archive/refs/tags/5.5.zip
$ unzip raylib.zip && mv raylib-5.5 raylib
$ make -C raylib/src
$ wget https://github.com/jdeokkim/mvp-demo/archive/refs/heads/main.zip
$ unzip main.zip && mv mvp-demo-main mvp-demo
$ make -C mvp-demo -f Makefile.mingw
Compiling for GNU/Linux

Debian / Ubuntu

$ sudo apt update && sudo apt install libasound2-dev libgl1-mesa-dev \
  libglu1-mesa-dev libx11-dev libxrandr-dev libxi-dev libxcursor-dev \
  libxinerama-dev libxkbcommon-dev
$ git clone https://github.com/raysan5/raylib ~/raylib && cd ~/raylib/src
$ make PLATFORM=PLATFORM_DESKTOP GLFW_LINUX_ENABLE_WAYLAND=OFF && make install
$ git clone https://github.com/jdeokkim/mvp-demo
$ cd mvp-demo && make
Compiling for the Web (LLVM-to-WebAssembly)

Debian / Ubuntu

Compiling for the Web requires installation of the Emscripten SDK.

$ git clone git clone https://github.com/emscripten-core/emsdk && cd emsdk
$ ./emsdk install latest
$ ./emsdk activate latest
$ source ./emsdk_env.sh

Then, you must recompile raylib for the Web:

$ git clone https://github.com/raysan5/raylib && cd raylib/src
$ make -j`nproc` PLATFORM=PLATFORM_WEB GRAPHICS=GRAPHICS_API_OPENGL_ES3 -B

Finally, in order to build this project, do:

$ git clone https://github.com/jdeokkim/mvp-demo
$ cd mvp-demo && make -f Makefile.emcc
Cross-compiling from GNU/Linux to Windows (WSL2)

Debian / Ubuntu

$ sudo apt install mingw-w64
$ git clone https://github.com/raysan5/raylib && cd raylib/src
$ make CC=x86_64-w64-mingw32-gcc AR=x86_64-w64-mingw32-ar OS=Windows_NT
$ git clone https://github.com/jdeokkim/mvp-demo
$ cd mvp-demo && make -f Makefile.mingw

License

MIT License

Copyright (c) 2024 Jaedeok Kim <jdeokkim@protonmail.com>
Copyright (c) 2024 Minhu Lee <fghkk12d@gmail.com>

Copyright (c) 2024 Hyungki Kim <diskhkme@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.