Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Torque2D Roll in #784

Open
wants to merge 15 commits into
base: Preview4_0
Choose a base branch
from
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
14 changes: 14 additions & 0 deletions Engine/lib/Box2D/.github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

github: [erincatto]
4 changes: 4 additions & 0 deletions Engine/lib/Box2D/.github/issue_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Make sure these boxes are checked before submitting your issue - thank you!

- [ ] Ask for help on [discord](https://discord.gg/NKYgCBP) and/or [reddit](https://www.reddit.com/r/box2d)
- [ ] Consider providing a dump file using b2World::Dump
3 changes: 3 additions & 0 deletions Engine/lib/Box2D/.github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Pull requests for core Box2D code are generally not accepted. Please consider filing an issue instead.

However, pull requests for build system improvements are often accepted.
7 changes: 7 additions & 0 deletions Engine/lib/Box2D/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
build/
imgui.ini
settings.ini
.vscode/
CMakeSettings.json
out/
.vs/
32 changes: 32 additions & 0 deletions Engine/lib/Box2D/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
language: cpp

dist: bionic

# This is clang on macOS
compiler: gcc

branches:
only:
- master

addons:
apt:
packages:
- libxrandr-dev
- libxinerama-dev
- libxcursor-dev
- libxi-dev

jobs:
include:
- os: linux
env:
- os: osx
env:

script:
- mkdir build
- cd build
- cmake ..
- cmake --build .
- ./bin/unit_test
60 changes: 60 additions & 0 deletions Engine/lib/Box2D/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Changes for version 2.4.1

## API Changes
- Extended distance joint to have a minimum and maximum limit.
- Removed rope joint. Use the distance joint instead.
- B2_USER_SETTINGS and b2_user_settings.h can control user data, length units, and maximum polygon vertices.
- Default user data is now uintptr_t instead of void*
- b2FixtureDef::restitutionThreshold lets you set the restitution velocity threshold per fixture.

## BREAKING Changes
- BREAKING: distance joint 0 stiffness now means the spring is turned off rather than making the joint rigid.
- BREAKING: distance joint minimum and maximum must be set correctly to get old behavior.

## Infrastructure
- Library installation function available in CMake.
- Shared library (DLL) option available.
- Bug fixes

# Changes for version 2.4.0

## Infrastructure
- Documentation in Doxygen format
- CMake build system
- Unit test support
- Continuous integration testing using Travis CI
- Limited use of C++11 (nullptr and override)
- Restructured folders and renamed files to better match open-source standards
- MIT License
- Removed float32 and float64
- Linked the Box2D project to GitHub Sponsors

## Collision
- Chain and edge shape must now be one-sided to eliminate ghost collisions
- Broad-phase optimizations
- Added b2ShapeCast for linear shape casting

## Dynamics
- Joint limits are now predictive and not stateful
- Experimental 2D cloth (rope)
- b2Body::SetActive -> b2Body::SetEnabled
- Better support for running multiple worlds
- Handle zero density better
- The body behaves like a static body
- The body is drawn with a red color
- Added translation limit to wheel joint
- World dump now writes to box2d_dump.inl
- Static bodies are never awake
- All joints with spring-dampers now use stiffness and damping
- Added utility functions to convert frequency and damping ratio to stiffness and damping

## Testbed
- Testbed uses dear imgui
- glad OpenGL loader
- OpenGL 3.3 required

# Changes for version 2.3.0
- Polygon creation now computes the convex hull. Vertices no longer need to be ordered.
- The convex hull code will merge vertices closer than dm_linearSlop. This may lead to failure on very small polygons.
- Added b2MotorJoint.
- Bug fixes.
66 changes: 66 additions & 0 deletions Engine/lib/Box2D/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
cmake_minimum_required(VERSION 3.8)

# https://cmake.org/cmake/help/latest/command/project.html
project(box2d VERSION 2.4.1)

# set(CMAKE_CONFIGURATION_TYPES "Debug;RelWithDebInfo" CACHE STRING "" FORCE)

set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)

option(BOX2D_BUILD_UNIT_TESTS "Build the Box2D unit tests" OFF)
#messes up with Torque3D glad lib... also torque is our testbed so
#option(BOX2D_BUILD_TESTBED "Build the Box2D testbed" ON)
option(BOX2D_BUILD_DOCS "Build the Box2D documentation" OFF)
option(BOX2D_USER_SETTINGS "Override Box2D settings with b2UserSettings.h" OFF)

option(BUILD_SHARED_LIBS "Build Box2D as a shared library" OFF)

set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")

include(GNUInstallDirs)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

if (BOX2D_USER_SETTINGS)
add_compile_definitions(B2_USER_SETTINGS)
endif()

add_subdirectory(src)

if (BOX2D_BUILD_DOCS)
set(DOXYGEN_SKIP_DOT TRUE)
find_package(Doxygen)
endif()

if (DOXYGEN_FOUND AND BOX2D_BUILD_DOCS)
add_subdirectory(docs)
endif()

if (BOX2D_BUILD_UNIT_TESTS)
add_subdirectory(unit-test)
endif()

#if (BOX2D_BUILD_TESTBED)
# add_subdirectory(extern/glad)
# add_subdirectory(extern/glfw)
# add_subdirectory(extern/imgui)
# add_subdirectory(extern/sajson)
# add_subdirectory(testbed)
#
# # default startup project for Visual Studio
# if (MSVC)
# set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT testbed)
# set_property(TARGET testbed PROPERTY VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/testbed")
# endif()
#endif()

install(
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/box2d"
DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
21 changes: 21 additions & 0 deletions Engine/lib/Box2D/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Erin Catto

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.
115 changes: 115 additions & 0 deletions Engine/lib/Box2D/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
![Box2D Logo](https://box2d.org/images/logo.svg)

# Build Status
[![Build Status](https://travis-ci.org/erincatto/box2d.svg?branch=master)](https://travis-ci.org/erincatto/box2d)

# Box2D

Box2D is a 2D physics engine for games.

## Contributing

Please do not submit pull requests with new features or core library changes. Instead, please file an issue first for discussion. For bugs, I prefer detailed bug reports over pull requests.

## Features

### Collision
- Continuous collision detection
- Contact callbacks: begin, end, pre-solve, post-solve
- Convex polygons and circles
- Multiple shapes per body
- One-shot contact manifolds
- Dynamic tree broadphase
- Efficient pair management
- Fast broadphase AABB queries
- Collision groups and categories

### Physics
- Continuous physics with time of impact solver
- Persistent body-joint-contact graph
- Island solution and sleep management
- Contact, friction, and restitution
- Stable stacking with a linear-time solver
- Revolute, prismatic, distance, pulley, gear, mouse joint, and other joint types
- Joint limits, motors, and friction
- Momentum decoupled position correction
- Fairly accurate reaction forces/impulses

### System
- Small block and stack allocators
- Centralized tuning parameters
- Highly portable C++ with no use of STL containers

### Testbed
- OpenGL with GLFW
- Graphical user interface with imgui
- Extensible test framework
- Support for loading world dumps

## Building
- Install [CMake](https://cmake.org/)
- Ensure CMake is in the user `PATH`
- Visual Studio: run `build.bat` from the command prompt
- Otherwise: run `build.sh` from a bash shell
- Results are in the build sub-folder
- On Windows you can open box2d.sln

## Building Box2D - Using vcpkg
You can download and install Box2D using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager:

- git clone https://github.com/Microsoft/vcpkg.git
- cd vcpkg
- ./bootstrap-vcpkg.sh
- ./vcpkg integrate install
- ./vcpkg install box2d

The Box2D port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.

Note: vcpkg support is not provided by the Box2D project

## Building for Xcode
- Install [CMake](https://cmake.org)
- Add Cmake to the path in .zprofile (the default Terminal shell is zsh)
- export PATH="/Applications/CMake.app/Contents/bin:$PATH"
- mkdir build
- cd build
- cmake -G Xcode ..
- open box2d.xcodeproj
- Select the testbed scheme
- Edit the scheme to set a custom working directory, make this be in box2d/testbed
- You can now build and run the testbed

## Installing using CMake
You can use the CMake install feature to deploy the library to a central location that can
be accessed using:
```
find_package(box2d REQUIRED)
target_link_libraries(mytarget PRIVATE box2d)
```
You can build and install the library and docs using this command sequence (requires Doxygen):
```
mkdir build
cd build
cmake -DBOX2D_BUILD_DOCS=ON ..
cmake --build .
cmake --build . --target INSTALL
```
On Windows this tries to install in `Program Files` and thus requires admin privileges. Alternatively you can target another directory using something like this:
```
mkdir build
cd build
cmake -DBOX2D_BUILD_DOCS=ON -DCMAKE_INSTALL_PREFIX="C:/packages" ..
cmake --build .
cmake --build . --target INSTALL
```

## Documentation
- [Manual](https://box2d.org/documentation/)
- [reddit](https://www.reddit.com/r/box2d/)
- [Discord](https://discord.gg/NKYgCBP)

## License
Box2D is developed by Erin Catto, and uses the [MIT license](https://en.wikipedia.org/wiki/MIT_License).

## Sponsorship
Support development of Box2D through [Github Sponsors](https://github.com/sponsors/erincatto)
7 changes: 7 additions & 0 deletions Engine/lib/Box2D/build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
rem Use this batch file to build box2d for Visual Studio
rmdir /s /q build
mkdir build
cd build
cmake ..
cmake --build .
start box2d.sln
8 changes: 8 additions & 0 deletions Engine/lib/Box2D/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

# Use this to build box2d on any system with a bash shell
rm -rf build
mkdir build
cd build
cmake -DBOX2D_BUILD_DOCS=OFF ..
cmake --build .
8 changes: 8 additions & 0 deletions Engine/lib/Box2D/build_docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

# Builds Box2D along with documentation
rm -rf build
mkdir build
cd build
cmake -DBOX2D_BUILD_DOCS=ON ..
cmake --build .
4 changes: 4 additions & 0 deletions Engine/lib/Box2D/deploy_docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash

# Copies documentation to blog
cp -R build/docs/html/. ../blog/public/documentation/
32 changes: 32 additions & 0 deletions Engine/lib/Box2D/docs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

# NOTE: The order of this list determines the order of items in the Guides
# (i.e. Pages) list in the generated documentation

set(BOX2D_DOXYGEN_SOURCES
"include/box2d"
"docs/overview.md"
"docs/hello.md"
"docs/testbed.md"
"docs/common.md"
"docs/collision.md"
"docs/dynamics.md"
"docs/loose_ends.md"
"docs/references.md"
"docs/FAQ.md")

# Format the source list into a Doxyfile INPUT value that Doxygen can parse
foreach(path IN LISTS BOX2D_DOXYGEN_SOURCES)
set(BOX2D_DOXYGEN_INPUT "${BOX2D_DOXYGEN_INPUT} \\\n\"${CMAKE_SOURCE_DIR}/${path}\"")
endforeach()

# https://cmake.org/cmake/help/latest/command/configure_file.html
configure_file(Doxyfile.in Doxyfile @ONLY)

add_custom_target(docs ALL "${DOXYGEN_EXECUTABLE}"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/docs"
COMMENT "Generating HTML documentation" VERBATIM)

install(
DIRECTORY "${CMAKE_BINARY_DIR}/docs/html"
DESTINATION "${CMAKE_INSTALL_DOCDIR}"
)
Loading