Skip to content

Godlike/Pegasus

Repository files navigation

Pegasus

Linux Build Status
Windows Build status

About

Pegasus is a cross-platform C++ game physics engine that is written with the data-oriented design in mind with minimum external dependencies (GLM and SPDLog). The aim of this project is to implement a robust, modern and simple to use API for game physics computations. The main motivation to write this engine was curiosity and desire to write physics code that utilizes a modern approach to software development, such as cache friendly code, high parallelization ability (CPU and GPU with CS), robust memory management with model C++ standard versions.

Join discord chat.

Building

Ubuntu:

Tested on Ubuntu 16.04.

  1. Install essential components:
    sudo apt-get install build-essential git cmake gcc g++

  2. Install dependencies:
    sudo apt-get install freeglut3 freeglut3-dev libglew1.5 libglew1.5-dev libglu1-mesa libglu1-mesa-dev libgl1-mesa-glx libgl1-mesa-dev libxtst-dev xvfb libxmu-dev libxi-dev libxinerama-dev

  3. Clone and initialize:
    git clone [email protected]:Godlike/Pegasus.git && cd Pegasus
    git submodule init && git submodule update --init --recursive

  4. Build:
    mkdir build && cd build && cmake .. && make && chmod +x ./output/PegasusPhysics

  5. Run the demo:
    ./output/PegasusPhysics

Windows:

Tested on Windows 10 VS 2017.

  1. Download GitHub Windows client
  2. Clone repository with the application from [email protected]:Godlike/Pegasus.git
  3. Download CMake GUI for Windows
  4. Create a Visual Studio Project using CMake GUI
  5. Open the solution in VS, build it and run PegasusDemo project.

Mac OS:

Tested on Mac OS High Sierra.

  1. Install CMake
  2. Install Git
  3. Clone and initialize:
    git clone [email protected]:Godlike/Pegasus.git && cd Pegasus
    git submodule init && git submodule update --init --recursive
  4. Build:
    mkdir build && cd build && cmake .. && make && chmod +x ./output/PegasusPhysics
  5. Run the demo:
    ./output/PegasusPhysics

Overview

Collision primitives

Plane

Box

Sphere

Collision detection

Collision detection is handled using custom implementations of Jacobi Eigenvalue, Quickhull Convex Hull, Half-Edge Data Structure, CSO, GJK and EPA algorithms.

Collision resolution

Collision resolution is based on the constraint collision model and implemented using such techniques as Sequential Impules, Restitution Slop, and Warm Starting to help improve overall stabity of the system.

Integration

Pegasus provides an API for creation of Dynamic and Static rigid bodies. Creating new simulation is as simple as creation new Scene object, and population of the new Scene could be peformd trought high-level OOP based API or trough low level Functional handle-based API, which provides developer with the flexibily when performas is needed.

Feature list

Done

Collision detector

  • Discrete collision detection
  • Primitives: Plane, Ray, Sphere, Box
  • Intersection, Contact normal, Penetration depth, Contact point calculation (GJK, EPA)
  • Bounding sphere, AABB, OBB
  • Ray tracing

Collision resolver

  • Static rigid bodies
  • Dynamic rigid bodies
  • Stable stacking
  • Constraint-Based resolution

Integrator

  • Static bodies
  • Dynamic bodies
  • Linear motion
  • Force generators
  • Object groups
  • Angular motion
  • Friction

Planned

Collision detector

  • Swept sphere based continuous collision detection
  • Primitives: Triangle, Cone, Cylinder, 8-DOP, Convex hull
  • Sphere tree, AABB tree, OBB tree, 8-DOP tree, Convex Hull tree
  • Space partitioning tree
  • Narrow phase collision detection
  • Broad phase collision detection
  • Compound geometries

Collision resolver

  • Island based sleeping
  • The time of impact
  • Constraints

Integrator

  • Kinematic bodies
  • Impulse generators
  • Soft Body Physics
  • Liquids Physics
  • Gases Physics
  • Clothes Physics
  • Ragdolls