Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# to support the typical cmake process
build


# Linux Object Files
src/*.o
Expand Down
70 changes: 70 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@

cmake_minimum_required(VERSION 3.10)

# Project name
project(CyclonePhysics)

# Set C++ standard
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)

# Include directories
include_directories(${PROJECT_SOURCE_DIR}/include)

# Source files
set(CYCLONEFILES
src/body.cpp
src/collide_coarse.cpp
src/collide_fine.cpp
src/contacts.cpp
src/core.cpp
src/fgen.cpp
src/joints.cpp
src/particle.cpp
src/pcontacts.cpp
src/pfgen.cpp
src/plinks.cpp
src/pworld.cpp
src/random.cpp
src/world.cpp
)

# Demo core files
set(DEMOCOREFILES
src/demos/main.cpp
src/demos/app.cpp
src/demos/timing.cpp
)

# List of demos
set(DEMOLIST
ballistic
bigballistic
blob
bridge
explosion
fireworks
flightsim
fracture
platform
ragdoll
sailboat
)

# Linker flags for Linux
if(UNIX AND NOT APPLE)
set(LDFLAGS -lGL -lGLU -lglut)
else()
message(FATAL_ERROR "This OS is not Ubuntu Linux. Aborting")
endif()

# Create executables for each demo
foreach(DEMO ${DEMOLIST})
add_executable(${DEMO} ${DEMOCOREFILES} ${CYCLONEFILES} src/demos/${DEMO}/${DEMO}.cpp)
target_link_libraries(${DEMO} ${LDFLAGS})
endforeach()

# Clean up build files
add_custom_target(clean-all
COMMAND ${CMAKE_COMMAND} --build . --target clean
)
72 changes: 72 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Cyclone Physics Engine

This project is an implementation of the Cyclone Physics engine, accompanying the book "Game Physics Engine Design" by Ian Millington. The engine is implemented in C++ and demonstrates various physics concepts through different demos.

## Features

- Rigid body and particle physics.
- Collision detection and response.
- Force generators, including gravity and springs.
- Various demo applications showcasing physics simulations.

## Prerequisites

### Ubuntu

To build the project on Ubuntu, you need to have the following dependencies installed:

```bash
sudo apt-get update
sudo apt-get install build-essential cmake freeglut3-dev
```

### Other Platforms

The project is theoretically cross-platform but has only been tested on Ubuntu. On other platforms, you may need to install equivalent OpenGL/GLUT libraries.

- **Windows**: You might need to install "freeglut" and configure your compiler to link against OpenGL and GLUT.
- **macOS**: Install the required libraries using Homebrew:
```bash
brew install freeglut
```

## Building the Project

1. Clone the repository:
```bash
git clone https://github.com/idmillington/cyclone-physics.git
cd cyclone-physics
```

2. Generate the build files using CMake:
```bash
cmake .
```

3. Build the project:
```bash
make
```

## Running the Demos

Each demo is built as a separate executable. After building, you can run any demo from the command line:

```bash
./ballistic
./bridge
# and so on...
```

## Platform-Specific Notes

- **Ubuntu**: The project has been fully tested on Ubuntu.
- **Windows/macOS**: The project has not been tested on these platforms. Additional setup might be required.

## Contributing

Contributions are welcome! If you test the project on other platforms, please report back with any issues or improvements.

## License

This project is licensed under the MIT License. See the "LICENSE" file for more details.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.