parent
1c5ac42c37
commit
29bf523ce7
5 changed files with 113 additions and 91 deletions
100
CONTRIBUTING.md
Normal file
100
CONTRIBUTING.md
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
# Contributing to Box3D
|
||||
|
||||
This project is open source under the [MIT License](LICENSE). Please read this document
|
||||
before opening a pull request — **PRs that skip these steps will be closed.**
|
||||
|
||||
---
|
||||
|
||||
## TL;DR
|
||||
|
||||
1. **Discuss first.** Open an issue (or a [Discussion](../../discussions)) and
|
||||
wait for it to be labeled `ready-for-pr` before writing code.
|
||||
2. **Sign the CLA.** A bot will prompt you on your first PR. One signature
|
||||
covers all future contributions.
|
||||
3. **Link the issue.** Put `Closes #123` in your PR description. A required
|
||||
check enforces this.
|
||||
4. **Follow the style.** C17, no compiler warnings, formatted with
|
||||
`clang-format`.
|
||||
|
||||
---
|
||||
|
||||
## 1. Discuss before you build
|
||||
|
||||
Open an issue or discussion before creating a PR.
|
||||
|
||||
I will review the issue or discussion and apply the **`ready-for-pr`** label. Please don't open
|
||||
a PR until you get the label.
|
||||
|
||||
Please wait follow this process. I don't want people wasting time writing a PR that won't be accepted.
|
||||
|
||||
---
|
||||
|
||||
## 2. Contributor License Agreement (CLA)
|
||||
|
||||
Before your first contribution can be merged, you must sign the project's
|
||||
**Individual Contributor License Agreement**. When you open your first pull
|
||||
request, a bot will post a link; signing takes about a minute and covers all
|
||||
your future contributions.
|
||||
|
||||
**What this means:** you retain the copyright to your contribution. The CLA
|
||||
grants the project maintainer a broad, perpetual, irrevocable license to use,
|
||||
modify, sublicense, and **relicense** your contribution. This lets the project
|
||||
adapt its licensing in the future (for example, offering a commercial edition)
|
||||
without having to track down every past contributor.
|
||||
|
||||
If you're contributing on behalf of an employer, make sure you have the right
|
||||
to do so — some employment agreements assign your work to your employer, in
|
||||
which case a Corporate CLA may be required. Contact the maintainer if you're
|
||||
unsure.
|
||||
|
||||
By submitting a contribution you also confirm that it is your original work and
|
||||
that you have the right to submit it under these terms.
|
||||
|
||||
---
|
||||
|
||||
## 3. Opening a pull request
|
||||
|
||||
Once your issue is labeled `ready-for-pr`:
|
||||
|
||||
1. **Fork** the repository and create a branch from `main`:
|
||||
|
||||
```bash
|
||||
git checkout -b fix/short-description
|
||||
```
|
||||
|
||||
2. Make your change in small, focused commits.
|
||||
3. **Reference the issue** in your PR description using a closing keyword:
|
||||
|
||||
```text
|
||||
Closes #(Issue Number)
|
||||
```
|
||||
|
||||
A required status check parses this and will fail if no linked, approved
|
||||
issue is found — the PR cannot be merged without it.
|
||||
4. Ensure the full test suite and CI pass.
|
||||
5. Fill out the PR template completely.
|
||||
|
||||
Keep PRs scoped to a single logical change. If you find yourself touching
|
||||
unrelated things, split them into separate PRs (each with its own approved
|
||||
issue).
|
||||
|
||||
---
|
||||
|
||||
## 4. Coding conventions
|
||||
|
||||
Source files must be in C17. Samples use C++20. Please follow existing coding
|
||||
conventions and use clang format.
|
||||
|
||||
---
|
||||
|
||||
## 5. Tests and documentation
|
||||
|
||||
- Comment your code.
|
||||
- Public API must have Doxygen comments.
|
||||
|
||||
---
|
||||
|
||||
## Questions?
|
||||
|
||||
Open a [Discussion](../../discussions) — that's the best place for anything not
|
||||
covered here. Thanks for helping make PROJECT_NAME better!
|
||||
|
|
@ -1,15 +1,14 @@
|
|||
# Box3D
|
||||
|
||||
[](https://github.com/erincatto/box3d/actions)
|
||||
[](https://cla-assistant.io/erincatto/box3d)
|
||||
|
||||

|
||||
|
||||
Box3D is a 3D physics engine for games.
|
||||
|
||||
[](https://www.youtube.com/watch?v=jr_Fzl2XwKU)
|
||||
|
||||
## Build status
|
||||
|
||||
[](https://github.com/erincatto/box3d/actions)
|
||||
|
||||
## Features
|
||||
|
||||
### Collision
|
||||
|
|
|
|||
|
|
@ -194,6 +194,12 @@ target_include_directories(samples PRIVATE
|
|||
# benchmark/determinism helpers the samples lean on.
|
||||
target_link_libraries(samples PRIVATE gfx shared imgui implot sokol nfd)
|
||||
|
||||
# MSVC auto-links winmm via a #pragma comment in main.cpp. MinGW ignores that
|
||||
# pragma, so link the timeBeginPeriod/timeEndPeriod library explicitly.
|
||||
if (MINGW)
|
||||
target_link_libraries(samples PRIVATE winmm)
|
||||
endif()
|
||||
|
||||
set_target_properties(samples PROPERTIES
|
||||
CXX_STANDARD 20
|
||||
CXX_STANDARD_REQUIRED ON
|
||||
|
|
|
|||
|
|
@ -78,28 +78,12 @@ public:
|
|||
m_height = 0;
|
||||
m_tree = {};
|
||||
|
||||
m_aabbMinX = nullptr;
|
||||
m_aabbMinY = nullptr;
|
||||
m_aabbMinZ = nullptr;
|
||||
m_aabbMaxX = nullptr;
|
||||
m_aabbMaxY = nullptr;
|
||||
m_aabbMaxZ = nullptr;
|
||||
|
||||
CreateTree();
|
||||
}
|
||||
|
||||
~TreeBenchmark() override
|
||||
{
|
||||
b3DynamicTree_Destroy( &m_tree );
|
||||
|
||||
#ifdef _WIN32
|
||||
_aligned_free( m_aabbMinX );
|
||||
_aligned_free( m_aabbMinY );
|
||||
_aligned_free( m_aabbMinZ );
|
||||
_aligned_free( m_aabbMaxX );
|
||||
_aligned_free( m_aabbMaxY );
|
||||
_aligned_free( m_aabbMaxZ );
|
||||
#endif
|
||||
}
|
||||
|
||||
// Breath-first search to compute node depth values start with 0 at the root.
|
||||
|
|
@ -155,15 +139,6 @@ public:
|
|||
|
||||
m_proxies.clear();
|
||||
|
||||
#ifdef _WIN32
|
||||
_aligned_free( m_aabbMinX );
|
||||
_aligned_free( m_aabbMinY );
|
||||
_aligned_free( m_aabbMinZ );
|
||||
_aligned_free( m_aabbMaxX );
|
||||
_aligned_free( m_aabbMaxY );
|
||||
_aligned_free( m_aabbMaxZ );
|
||||
#endif
|
||||
|
||||
m_tree = b3DynamicTree_Create( 512 );
|
||||
|
||||
char filePath[64] = {};
|
||||
|
|
@ -242,29 +217,6 @@ public:
|
|||
// }
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
int proxyCount = m_proxies.size();
|
||||
m_aabbMinX = (float*)_aligned_malloc( proxyCount * sizeof( float ), 32 );
|
||||
m_aabbMinY = (float*)_aligned_malloc( proxyCount * sizeof( float ), 32 );
|
||||
m_aabbMinZ = (float*)_aligned_malloc( proxyCount * sizeof( float ), 32 );
|
||||
m_aabbMaxX = (float*)_aligned_malloc( proxyCount * sizeof( float ), 32 );
|
||||
m_aabbMaxY = (float*)_aligned_malloc( proxyCount * sizeof( float ), 32 );
|
||||
m_aabbMaxZ = (float*)_aligned_malloc( proxyCount * sizeof( float ), 32 );
|
||||
|
||||
for ( int i = 0; i < proxyCount; ++i )
|
||||
{
|
||||
b3Vec3 lb = m_proxies[i].aabb.lowerBound;
|
||||
b3Vec3 ub = m_proxies[i].aabb.upperBound;
|
||||
|
||||
m_aabbMinX[i] = lb.x;
|
||||
m_aabbMinY[i] = lb.y;
|
||||
m_aabbMinZ[i] = lb.z;
|
||||
m_aabbMaxX[i] = ub.x;
|
||||
m_aabbMaxY[i] = ub.y;
|
||||
m_aabbMaxZ[i] = ub.z;
|
||||
}
|
||||
#endif
|
||||
|
||||
printf( "max index = %d\n", maxAreaIndex );
|
||||
|
||||
// constexpr int n = m_isDebug ? 1000 : INT_MAX;
|
||||
|
|
@ -299,15 +251,6 @@ public:
|
|||
|
||||
m_proxies.clear();
|
||||
|
||||
#ifdef _WIN32
|
||||
_aligned_free( m_aabbMinX );
|
||||
_aligned_free( m_aabbMinY );
|
||||
_aligned_free( m_aabbMinZ );
|
||||
_aligned_free( m_aabbMaxX );
|
||||
_aligned_free( m_aabbMaxY );
|
||||
_aligned_free( m_aabbMaxZ );
|
||||
#endif
|
||||
|
||||
{
|
||||
//bool zUp = true;
|
||||
m_tree = b3DynamicTree_Load( m_saveFileName, m_loadScale );
|
||||
|
|
@ -344,29 +287,6 @@ public:
|
|||
m_proxies[node->userData] = proxy;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
int proxyCount = m_proxies.size();
|
||||
m_aabbMinX = (float*)_aligned_malloc( proxyCount * sizeof( float ), 32 );
|
||||
m_aabbMinY = (float*)_aligned_malloc( proxyCount * sizeof( float ), 32 );
|
||||
m_aabbMinZ = (float*)_aligned_malloc( proxyCount * sizeof( float ), 32 );
|
||||
m_aabbMaxX = (float*)_aligned_malloc( proxyCount * sizeof( float ), 32 );
|
||||
m_aabbMaxY = (float*)_aligned_malloc( proxyCount * sizeof( float ), 32 );
|
||||
m_aabbMaxZ = (float*)_aligned_malloc( proxyCount * sizeof( float ), 32 );
|
||||
|
||||
for ( int i = 0; i < proxyCount; ++i )
|
||||
{
|
||||
b3Vec3 lb = m_proxies[i].aabb.lowerBound;
|
||||
b3Vec3 ub = m_proxies[i].aabb.upperBound;
|
||||
|
||||
m_aabbMinX[i] = lb.x;
|
||||
m_aabbMinY[i] = lb.y;
|
||||
m_aabbMinZ[i] = lb.z;
|
||||
m_aabbMaxX[i] = ub.x;
|
||||
m_aabbMaxY[i] = ub.y;
|
||||
m_aabbMaxZ[i] = ub.z;
|
||||
}
|
||||
#endif
|
||||
|
||||
printf( "max index = %d\n", maxAreaIndex );
|
||||
|
||||
// constexpr int n = m_isDebug ? 1000 : INT_MAX;
|
||||
|
|
@ -676,13 +596,6 @@ public:
|
|||
FileConfig m_config[m_fileCount];
|
||||
int m_fileIndex;
|
||||
|
||||
float* m_aabbMinX;
|
||||
float* m_aabbMinY;
|
||||
float* m_aabbMinZ;
|
||||
float* m_aabbMaxX;
|
||||
float* m_aabbMaxY;
|
||||
float* m_aabbMaxZ;
|
||||
|
||||
std::unordered_map<uint64_t, Proxy> m_proxies;
|
||||
std::vector<uint16_t> m_depths;
|
||||
b3DynamicTree m_tree;
|
||||
|
|
|
|||
|
|
@ -40,6 +40,10 @@ if(BOX3D_VALIDATE)
|
|||
target_compile_definitions(test PRIVATE BOX3D_VALIDATE)
|
||||
endif()
|
||||
|
||||
if(BOX3D_DISABLE_SIMD)
|
||||
target_compile_definitions(test PRIVATE BOX3D_DISABLE_SIMD)
|
||||
endif()
|
||||
|
||||
target_link_libraries(test PRIVATE box3d shared)
|
||||
|
||||
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" PREFIX "" FILES ${BOX3D_TEST_FILES})
|
||||
|
|
|
|||
Loading…
Reference in a new issue