Compare commits
213 Commits
3514ac6340
...
a0f2b128d7
| Author | SHA1 | Date |
|---|---|---|
|
|
a0f2b128d7 | |
|
|
055634e77c | |
|
|
7f5f7668ec | |
|
|
f572ae06a1 | |
|
|
9f26fb00ad | |
|
|
f883305b3e | |
|
|
7b0165a7df | |
|
|
edac2e4af5 | |
|
|
7956e1552b | |
|
|
03ff328b5b | |
|
|
e5da020b55 | |
|
|
2137ddc94c | |
|
|
2d980bb304 | |
|
|
45019a0f97 | |
|
|
23ea1989ef | |
|
|
1cb1750a74 | |
|
|
f71d149785 | |
|
|
62702ec481 | |
|
|
f290cf2f9e | |
|
|
b08897628c | |
|
|
e25fbe30e6 | |
|
|
5180f24988 | |
|
|
61764dfc3d | |
|
|
f121f32873 | |
|
|
4d77a25a04 | |
|
|
76136afe76 | |
|
|
50ce9a4ea8 | |
|
|
5130a2ff84 | |
|
|
3c7e2a1685 | |
|
|
d9ad489820 | |
|
|
62a165126e | |
|
|
63c526cecc | |
|
|
194dba5002 | |
|
|
0cb376a161 | |
|
|
3756f93f51 | |
|
|
7e1c38435c | |
|
|
67904abd29 | |
|
|
ad5336eff7 | |
|
|
66e3734942 | |
|
|
e4c339293b | |
|
|
c6f87f9cd2 | |
|
|
e64c2b036e | |
|
|
965a00182c | |
|
|
8c41ac30c9 | |
|
|
9e3ca2472b | |
|
|
57ad486c01 | |
|
|
e336c8a514 | |
|
|
139bed2b0a | |
|
|
cb484a2432 | |
|
|
b65339deee | |
|
|
fe00b3fd16 | |
|
|
bc6521cb7c | |
|
|
89c08d3925 | |
|
|
23645fc398 | |
|
|
f0b4674039 | |
|
|
18b6d14670 | |
|
|
5a46ebda36 | |
|
|
37e90ecea9 | |
|
|
8a5e5f7643 | |
|
|
b889c992ea | |
|
|
993722ed0b | |
|
|
d3f7e20473 | |
|
|
99952db736 | |
|
|
17b6449472 | |
|
|
67f78b25f2 | |
|
|
ff4277e97f | |
|
|
bcd64a0ad0 | |
|
|
a4827a99a0 | |
|
|
3eae055d3a | |
|
|
a30f64ef49 | |
|
|
b69c0bb444 | |
|
|
44617bd14d | |
|
|
c148bc2851 | |
|
|
3a612d8655 | |
|
|
19935a2b07 | |
|
|
aca5a7a00d | |
|
|
e3ad9be759 | |
|
|
59e172c2ee | |
|
|
91c9706016 | |
|
|
8b9b47ba59 | |
|
|
653e56f8ce | |
|
|
d2b3b93646 | |
|
|
c303bf9283 | |
|
|
2e56bb4db4 | |
|
|
e3fa6fed89 | |
|
|
06a42b4ecb | |
|
|
adc6a5c0a5 | |
|
|
fa73e463a6 | |
|
|
44e55adcd9 | |
|
|
56751072f5 | |
|
|
7f1ef0fe41 | |
|
|
5db0c4ed09 | |
|
|
369f273894 | |
|
|
5d6a094bfe | |
|
|
9db333fa80 | |
|
|
47283776e6 | |
|
|
9d669f722e | |
|
|
2b88f50c21 | |
|
|
0191256493 | |
|
|
f06752b08d | |
|
|
01d3795dae | |
|
|
b29ecdf0db | |
|
|
aad271febe | |
|
|
33374ed0c0 | |
|
|
c931e9a509 | |
|
|
f10671ac2a | |
|
|
22a047b3b1 | |
|
|
6757de1be8 | |
|
|
63c61c0827 | |
|
|
d3fabf21d6 | |
|
|
625b4f2d9f | |
|
|
1f34bb58ea | |
|
|
2d3d7a670f | |
|
|
7f1641e4b6 | |
|
|
9ada93b995 | |
|
|
fccbaf435c | |
|
|
771ab670c0 | |
|
|
795ce90234 | |
|
|
af55f9fcdb | |
|
|
a116f1fc8d | |
|
|
e01f6730ef | |
|
|
086152c97d | |
|
|
e14614cf41 | |
|
|
0cec655af6 | |
|
|
bb3b28279b | |
|
|
3421c0f50b | |
|
|
72bd6efcc4 | |
|
|
e9c3fe270a | |
|
|
b97da658a8 | |
|
|
88ae92baa0 | |
|
|
830e167027 | |
|
|
9e9501e264 | |
|
|
496de948d2 | |
|
|
37be90b1f7 | |
|
|
020f431c72 | |
|
|
0e5e3ab9dd | |
|
|
a228325bd5 | |
|
|
a02990beff | |
|
|
b63c9fcc49 | |
|
|
b0648918a7 | |
|
|
9c102638c0 | |
|
|
65c8d2e8de | |
|
|
8ee128b475 | |
|
|
ac1422c221 | |
|
|
278e59934b | |
|
|
f4095d07a8 | |
|
|
05ee3d7a55 | |
|
|
9caaff2898 | |
|
|
639f6708b0 | |
|
|
8dab084037 | |
|
|
373309d6d9 | |
|
|
3557040246 | |
|
|
0a433a8bd6 | |
|
|
9b96503fde | |
|
|
c8e07b3f3f | |
|
|
e355144bb6 | |
|
|
964d32b34e | |
|
|
c8776bc950 | |
|
|
8ca7c2e8ee | |
|
|
bbef5cfd1d | |
|
|
ea4b8eaaea | |
|
|
d3899d71f3 | |
|
|
f1de6f9198 | |
|
|
c52ffa15c4 | |
|
|
db83413536 | |
|
|
5c7059c8fc | |
|
|
f45c2c5008 | |
|
|
6a4d3008c9 | |
|
|
2bdd6f9351 | |
|
|
201ac025e2 | |
|
|
e8a362b695 | |
|
|
7ae76b32b0 | |
|
|
1eb72af57e | |
|
|
2125b80b8d | |
|
|
0cd8cff53e | |
|
|
f46f0da12a | |
|
|
5a96ab3bf7 | |
|
|
14f51b31ca | |
|
|
cd8c1cb160 | |
|
|
6d1e7d7852 | |
|
|
7dc7104cc4 | |
|
|
d2e2c075b4 | |
|
|
448cf66846 | |
|
|
7b30c0ac5c | |
|
|
79ec135af7 | |
|
|
f7c9060364 | |
|
|
0d37e36b0c | |
|
|
69efb93671 | |
|
|
8e6ca9cb27 | |
|
|
7d0d1feea4 | |
|
|
3fa3ccc0e0 | |
|
|
8a32c748bb | |
|
|
08eaf396ed | |
|
|
3d21401569 | |
|
|
4039d16df0 | |
|
|
b37aaf6173 | |
|
|
9da6e2ef8c | |
|
|
0d3a9547fc | |
|
|
e1b3832643 | |
|
|
9fb308a531 | |
|
|
7cd1b32e95 | |
|
|
4065fbfb1a | |
|
|
754a3d3614 | |
|
|
91221a9b4a | |
|
|
6dc27e7948 | |
|
|
496800fc5c | |
|
|
92e9a75ffa | |
|
|
baaea2a33f | |
|
|
f2201404f3 | |
|
|
8efebef26c | |
|
|
83366e93d4 | |
|
|
87bf4563f2 | |
|
|
b7bdc74f3f |
|
|
@ -21,12 +21,12 @@ jobs:
|
|||
strategy:
|
||||
matrix:
|
||||
config:
|
||||
- { name: "Windows x64", os: windows-latest, arch: x64 }
|
||||
- { name: "Ubuntu x86_64", os: ubuntu-latest, arch: x86_64 }
|
||||
- { name: "Windows", os: windows-latest, arch: x64 }
|
||||
- { name: "Ubuntu", os: ubuntu-latest, arch: x86_64 }
|
||||
|
||||
name: ${{ matrix.config.name }}
|
||||
runs-on: ${{ matrix.config.os }}
|
||||
if: "!contains(github.event.head_commit.message, 'coverage skip')"
|
||||
if: ${{ !contains(github.event.head_commit.message, 'coverage skip') }}
|
||||
|
||||
steps:
|
||||
- name: Get current date as package key
|
||||
|
|
@ -71,38 +71,49 @@ jobs:
|
|||
|
||||
# Fetch xmake dephash
|
||||
- name: Retrieve dependencies hash
|
||||
if: runner.os == 'Linux'
|
||||
id: dep_hash_linux
|
||||
id: dephash
|
||||
run: echo "hash=$(xmake l utils.ci.packageskey)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Retrieve dependencies hash
|
||||
if: runner.os == 'Windows'
|
||||
id: dep_hash_windows
|
||||
run: echo "hash=$(xmake l utils.ci.packageskey)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
|
||||
shell: bash
|
||||
|
||||
# Cache xmake dependencies
|
||||
- name: Retrieve cached xmake dependencies (Linux)
|
||||
if: runner.os == 'Linux'
|
||||
uses: actions/cache@v3
|
||||
- name: Restore cached xmake dependencies
|
||||
id: restore-depcache
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages
|
||||
key: Linux-${{ matrix.config.arch }}-coverage-${{ steps.dep_hash_linux.outputs.hash }}-W${{ steps.cache_key.outputs.key }}
|
||||
|
||||
- name: Retrieve cached xmake dependencies (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ env.XMAKE_GLOBALDIR }}\.xmake\packages
|
||||
key: MSVC-${{ matrix.config.arch }}-coverage-${{ steps.dep_hash_windows.outputs.hash }}-W${{ steps.cache_key.outputs.key }}
|
||||
key: ${{ matrix.config.name}}-${{ matrix.config.arch }}-coverage-${{ steps.dephash.outputs.hash }}-W${{ steps.cache_key.outputs.key }}
|
||||
|
||||
# Setup compilation mode and install project dependencies
|
||||
- name: Configure xmake and install dependencies
|
||||
run: xmake config --arch=${{ matrix.config.arch }} --mode=coverage --ccache=n --ffmpeg=y --shadernodes=y --tests=y --unitybuild=y --yes
|
||||
|
||||
# Save dependencies
|
||||
- name: Save cached xmake dependencies
|
||||
if: ${{ !steps.restore-depcache.outputs.cache-hit }}
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages
|
||||
key: ${{ steps.restore-depcache.outputs.cache-primary-key }}
|
||||
|
||||
# Cache assets downloading
|
||||
- name: Restore cached assets
|
||||
id: restore-assets
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: assets
|
||||
key: assets-${{ hashFiles('assets/examples_version.txt', 'assets/unittests_version.txt') }}
|
||||
|
||||
# Build the engine
|
||||
- name: Build Nazara
|
||||
run: xmake --yes
|
||||
|
||||
- name: Save downloaded assets
|
||||
if: ${{ !steps.restore-assets.outputs.cache-hit }}
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: assets
|
||||
key: ${{ steps.restore-assets.outputs.cache-primary-key }}
|
||||
|
||||
# Run unit tests to generate coverage reports
|
||||
- name: Run unit tests and generate coverage output (Linux)
|
||||
if: runner.os == 'Linux'
|
||||
|
|
@ -117,7 +128,8 @@ jobs:
|
|||
"C:\Program Files\OpenCppCoverage\OpenCppCoverage.exe" --export_type cobertura:coverage.out --sources "NazaraEngine\include\Nazara\*" --sources "NazaraEngine\src\Nazara\*" --modules "NazaraEngine\bin\*" --cover_children -- xmake run UnitTests
|
||||
|
||||
- name: Upload Coverage Report to Codecov
|
||||
uses: codecov/codecov-action@v3
|
||||
uses: codecov/codecov-action@v4
|
||||
with:
|
||||
files: ./coverage.out
|
||||
fail_ci_if_error: true
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
|
|
|||
|
|
@ -23,15 +23,16 @@ jobs:
|
|||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
arch: [x86_64]
|
||||
kind: [shared, static]
|
||||
confs:
|
||||
- { mode: debug }
|
||||
- { mode: debug, config: --asan=y }
|
||||
- { mode: debug, config: --lsan=y }
|
||||
- { mode: debug, config: --tsan=y }
|
||||
- { mode: releasedbg }
|
||||
- { mode: debug, archive: yes }
|
||||
- { mode: debug, config: --asan=y, archive: false, cache_key: -asan }
|
||||
- { mode: debug, config: --lsan=y, archive: false }
|
||||
- { mode: debug, config: --tsan=y, archive: false }
|
||||
- { mode: releasedbg, archive: yes }
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
if: "!contains(github.event.head_commit.message, 'ci skip')"
|
||||
if: ${{ !contains(github.event.head_commit.message, 'ci skip') }}
|
||||
|
||||
steps:
|
||||
- name: Get current date as package key
|
||||
|
|
@ -68,35 +69,74 @@ jobs:
|
|||
run: echo "hash=$(xmake l utils.ci.packageskey)" >> $GITHUB_OUTPUT
|
||||
|
||||
# Cache xmake dependencies
|
||||
- name: Retrieve cached xmake dependencies
|
||||
uses: actions/cache@v3
|
||||
- name: Restore cached xmake dependencies
|
||||
id: restore-depcache
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages
|
||||
key: Linux-${{ matrix.arch }}-${{ matrix.confs.mode }}-${{ steps.dep_hash.outputs.hash }}-W${{ steps.cache_key.outputs.key }}
|
||||
key: Linux-${{ matrix.arch }}-${{ matrix.confs.mode }}${{ matrix.confs.cache_key }}-${{ steps.dep_hash.outputs.hash }}-W${{ steps.cache_key.outputs.key }}
|
||||
|
||||
# Setup compilation mode and install project dependencies
|
||||
- name: Configure xmake and install dependencies
|
||||
run: xmake config --arch=${{ matrix.arch }} --mode=${{ matrix.confs.mode }} ${{ matrix.confs.config }} --ccache=n --ffmpeg=y --shadernodes=y --tests=y --unitybuild=y --yes
|
||||
run: xmake config --arch=${{ matrix.arch }} --mode=${{ matrix.confs.mode }} --static=${{ matrix.kind == 'static' && 'yes' || 'no' }} ${{ matrix.confs.config }} --ccache=n --ffmpeg=y --shadernodes=y --tests=y --unitybuild=y --yes
|
||||
|
||||
# Save dependencies
|
||||
- name: Save cached xmake dependencies
|
||||
if: ${{ !steps.restore-depcache.outputs.cache-hit }}
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages
|
||||
key: ${{ steps.restore-depcache.outputs.cache-primary-key }}
|
||||
|
||||
# Cache assets downloading
|
||||
- name: Restore cached assets
|
||||
id: restore-assets
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: assets
|
||||
key: assets-${{ hashFiles('assets/examples_version.txt', 'assets/unittests_version.txt') }}
|
||||
|
||||
# Build the engine
|
||||
- name: Build Nazara
|
||||
run: xmake --yes
|
||||
|
||||
- name: Save downloaded assets
|
||||
if: ${{ !steps.restore-assets.outputs.cache-hit }}
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: assets
|
||||
key: ${{ steps.restore-assets.outputs.cache-primary-key }}
|
||||
|
||||
# Run unit tests
|
||||
- name: Run unit tests
|
||||
if: matrix.confs.mode != 'releasedbg'
|
||||
run: xmake run UnitTests
|
||||
|
||||
# Setup installation configuration
|
||||
- name: Configure xmake for installation
|
||||
run: xmake config --arch=${{ matrix.arch }} --mode=${{ matrix.confs.mode }} ${{ matrix.confs.config }} --ccache=n --ffmpeg=n --shadernodes=y --tests=y --yes
|
||||
|
||||
# Install the result files
|
||||
- name: Install Nazara
|
||||
if: ${{ (github.ref == 'refs/heads/main') && github.event_name == 'push' && matrix.confs.archive }}
|
||||
run: xmake install -vo package
|
||||
|
||||
# Upload artifacts
|
||||
- uses: actions/upload-artifact@v3
|
||||
- name: "Set PACKAGE_NAME variable"
|
||||
if: ${{ (github.ref == 'refs/heads/main') && github.event_name == 'push' && matrix.confs.archive }}
|
||||
run: echo "PACKAGE_NAME=linux_${{ matrix.arch }}_${{ matrix.confs.mode }}_${{ matrix.kind }}.tar.gz" >> $GITHUB_ENV
|
||||
shell: bash
|
||||
|
||||
- name: Archive result
|
||||
uses: ihiroky/archive-action@v1
|
||||
if: ${{ (github.ref == 'refs/heads/main') && github.event_name == 'push' && matrix.confs.archive }}
|
||||
with:
|
||||
name: nazaraengine-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.confs.mode }}
|
||||
path: package
|
||||
root_dir: package
|
||||
file_path: ${{ env.PACKAGE_NAME }}
|
||||
verbose: true
|
||||
|
||||
# Nightly tags (for commits to main branch)
|
||||
- name: Upload binaries to release (main)
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
if: ${{ (github.ref == 'refs/heads/main') && github.event_name == 'push' && matrix.confs.archive }}
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: ${{ env.PACKAGE_NAME }}
|
||||
asset_name: ${{ env.PACKAGE_NAME }}
|
||||
tag: "0.0.0-nightly"
|
||||
overwrite: true
|
||||
|
|
|
|||
|
|
@ -23,15 +23,16 @@ jobs:
|
|||
matrix:
|
||||
os: [macOS-latest]
|
||||
arch: [x86_64]
|
||||
kind: [shared, static]
|
||||
confs:
|
||||
- { mode: debug }
|
||||
- { mode: debug, config: --asan=y }
|
||||
- { mode: debug, config: --lsan=y }
|
||||
- { mode: debug, config: --tsan=y }
|
||||
- { mode: releasedbg }
|
||||
- { mode: debug, archive: yes }
|
||||
- { mode: debug, config: --asan=y, archive: false, cache_key: -asan }
|
||||
- { mode: debug, config: --lsan=y, archive: false }
|
||||
- { mode: debug, config: --tsan=y, archive: false }
|
||||
- { mode: releasedbg, archive: yes }
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
if: "!contains(github.event.head_commit.message, 'ci skip')"
|
||||
if: ${{ !contains(github.event.head_commit.message, 'ci skip') }}
|
||||
|
||||
steps:
|
||||
- name: Get current date as package key
|
||||
|
|
@ -62,35 +63,74 @@ jobs:
|
|||
run: echo "hash=$(xmake l utils.ci.packageskey)" >> $GITHUB_OUTPUT
|
||||
|
||||
# Cache xmake dependencies
|
||||
- name: Retrieve cached xmake dependencies
|
||||
uses: actions/cache@v3
|
||||
- name: Restore cached xmake dependencies
|
||||
id: restore-depcache
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages
|
||||
key: macOS-${{ matrix.arch }}-${{ matrix.confs.mode }}-${{ steps.dep_hash.outputs.hash }}-W${{ steps.cache_key.outputs.key }}
|
||||
key: macOS-${{ matrix.arch }}-${{ matrix.confs.mode }}${{ matrix.confs.cache_key }}-${{ steps.dep_hash.outputs.hash }}-W${{ steps.cache_key.outputs.key }}
|
||||
|
||||
# Setup compilation mode and install project dependencies
|
||||
- name: Configure xmake and install dependencies
|
||||
run: xmake config --arch=${{ matrix.arch }} --mode=${{ matrix.confs.mode }} ${{ matrix.confs.config }} --ccache=n --ffmpeg=y --shadernodes=y --tests=y --unitybuild=y --yes
|
||||
run: xmake config --arch=${{ matrix.arch }} --mode=${{ matrix.confs.mode }} --static=${{ matrix.kind == 'static' && 'yes' || 'no' }} ${{ matrix.confs.config }} --ccache=n --ffmpeg=y --shadernodes=y --tests=y --unitybuild=y --yes
|
||||
|
||||
# Save dependencies
|
||||
- name: Save cached xmake dependencies
|
||||
if: ${{ !steps.restore-depcache.outputs.cache-hit }}
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages
|
||||
key: ${{ steps.restore-depcache.outputs.cache-primary-key }}
|
||||
|
||||
# Cache assets downloading
|
||||
- name: Restore cached assets
|
||||
id: restore-assets
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: assets
|
||||
key: assets-${{ hashFiles('assets/examples_version.txt', 'assets/unittests_version.txt') }}
|
||||
|
||||
# Build the engine
|
||||
- name: Build Nazara
|
||||
run: xmake --yes
|
||||
|
||||
- name: Save downloaded assets
|
||||
if: ${{ !steps.restore-assets.outputs.cache-hit }}
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: assets
|
||||
key: ${{ steps.restore-assets.outputs.cache-primary-key }}
|
||||
|
||||
# Run unit tests
|
||||
- name: Run unit tests
|
||||
if: matrix.confs.mode != 'releasedbg'
|
||||
run: xmake run UnitTests
|
||||
|
||||
# Setup installation configuration
|
||||
- name: Configure xmake for installation
|
||||
run: xmake config --arch=${{ matrix.arch }} --mode=${{ matrix.confs.mode }} ${{ matrix.confs.config }} --ccache=n --ffmpeg=n --shadernodes=y --tests=y --yes
|
||||
|
||||
# Install the result files
|
||||
- name: Install Nazara
|
||||
if: ${{ (github.ref == 'refs/heads/main') && github.event_name == 'push' && matrix.confs.archive }}
|
||||
run: xmake install -vo package
|
||||
|
||||
# Upload artifacts
|
||||
- uses: actions/upload-artifact@v3
|
||||
- name: "Set PACKAGE_NAME variable"
|
||||
if: ${{ (github.ref == 'refs/heads/main') && github.event_name == 'push' && matrix.confs.archive }}
|
||||
run: echo "PACKAGE_NAME=macOS_${{ matrix.arch }}_${{ matrix.confs.mode }}_${{ matrix.kind }}.tar.gz" >> $GITHUB_ENV
|
||||
shell: bash
|
||||
|
||||
- name: Archive result
|
||||
uses: ihiroky/archive-action@v1
|
||||
if: ${{ (github.ref == 'refs/heads/main') && github.event_name == 'push' && matrix.confs.archive }}
|
||||
with:
|
||||
name: nazaraengine-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.confs.mode }}
|
||||
path: package
|
||||
root_dir: package
|
||||
file_path: ${{ env.PACKAGE_NAME }}
|
||||
verbose: true
|
||||
|
||||
# Nightly tags (for commits to main branch)
|
||||
- name: Upload binaries to release (main)
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
if: ${{ (github.ref == 'refs/heads/main') && github.event_name == 'push' && matrix.confs.archive }}
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: ${{ env.PACKAGE_NAME }}
|
||||
asset_name: ${{ env.PACKAGE_NAME }}
|
||||
tag: "0.0.0-nightly"
|
||||
overwrite: true
|
||||
|
|
|
|||
|
|
@ -24,9 +24,10 @@ jobs:
|
|||
os: [windows-latest]
|
||||
arch: [x86_64]
|
||||
mode: [debug, releasedbg]
|
||||
kind: [shared, static]
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
if: "!contains(github.event.head_commit.message, 'ci skip')"
|
||||
if: ${{ !contains(github.event.head_commit.message, 'ci skip') }}
|
||||
|
||||
defaults:
|
||||
run:
|
||||
|
|
@ -62,35 +63,74 @@ jobs:
|
|||
run: echo "hash=$(xmake l utils.ci.packageskey)" >> $GITHUB_OUTPUT
|
||||
|
||||
# Cache xmake dependencies
|
||||
- name: Retrieve cached xmake dependencies
|
||||
uses: actions/cache@v3
|
||||
- name: Restore cached xmake dependencies
|
||||
id: restore-depcache
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages
|
||||
key: MinGW-${{ matrix.arch }}-${{ matrix.mode }}-${{ steps.dep_hash.outputs.hash }}-W${{ steps.cache_key.outputs.key }}
|
||||
|
||||
# Setup compilation mode and install project dependencies
|
||||
- name: Configure xmake and install dependencies
|
||||
run: xmake config --arch=${{ matrix.arch }} --mode=${{ matrix.mode }} --ccache=n --ffmpeg=y --shadernodes=y --tests=y --unitybuild=y --yes
|
||||
run: xmake config --arch=${{ matrix.arch }} --mode=${{ matrix.mode }} --static=${{ matrix.kind == 'static' && 'yes' || 'no' }} --ccache=n --ffmpeg=y --shadernodes=y --tests=y --unitybuild=y --yes
|
||||
|
||||
# Save dependencies
|
||||
- name: Save cached xmake dependencies
|
||||
if: ${{ !steps.restore-depcache.outputs.cache-hit }}
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages
|
||||
key: ${{ steps.restore-depcache.outputs.cache-primary-key }}
|
||||
|
||||
# Cache assets downloading
|
||||
- name: Restore cached assets
|
||||
id: restore-assets
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: assets
|
||||
key: assets-${{ hashFiles('assets/examples_version.txt', 'assets/unittests_version.txt') }}
|
||||
|
||||
# Build the engine
|
||||
- name: Build Nazara
|
||||
run: xmake --yes
|
||||
|
||||
- name: Save downloaded assets
|
||||
if: ${{ !steps.restore-assets.outputs.cache-hit }}
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: assets
|
||||
key: ${{ steps.restore-assets.outputs.cache-primary-key }}
|
||||
|
||||
# Run unit tests
|
||||
- name: Run unit tests
|
||||
if: matrix.mode != 'releasedbg'
|
||||
run: xmake run UnitTests
|
||||
|
||||
# Setup installation configuration
|
||||
- name: Configure xmake for installation
|
||||
run: xmake config --arch=${{ matrix.arch }} --mode=${{ matrix.mode }} --ccache=n --ffmpeg=n --shadernodes=y --tests=y --yes
|
||||
|
||||
# Install the result files
|
||||
- name: Install Nazara
|
||||
if: ${{ (github.ref == 'refs/heads/main') && github.event_name == 'push' }}
|
||||
run: xmake install -vo package
|
||||
|
||||
# Upload artifacts
|
||||
- uses: actions/upload-artifact@v3
|
||||
- name: "Set PACKAGE_NAME variable"
|
||||
if: ${{ (github.ref == 'refs/heads/main') && github.event_name == 'push' }}
|
||||
run: echo "PACKAGE_NAME=${{ matrix.msystem }}_${{ matrix.arch }}_${{ matrix.mode }}_${{ matrix.kind }}.zip" >> $GITHUB_ENV
|
||||
shell: bash
|
||||
|
||||
- name: Archive result
|
||||
uses: ihiroky/archive-action@v1
|
||||
if: ${{ (github.ref == 'refs/heads/main') && github.event_name == 'push' }}
|
||||
with:
|
||||
name: nazaraengine-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.mode }}
|
||||
path: package
|
||||
root_dir: package
|
||||
file_path: ${{ env.PACKAGE_NAME }}
|
||||
verbose: true
|
||||
|
||||
# Nightly tags (for commits to main branch)
|
||||
- name: Upload binaries to release (main)
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
if: ${{ (github.ref == 'refs/heads/main') && github.event_name == 'push' }}
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: ${{ env.PACKAGE_NAME }}
|
||||
asset_name: ${{ env.PACKAGE_NAME }}
|
||||
tag: "0.0.0-nightly"
|
||||
overwrite: true
|
||||
|
|
|
|||
|
|
@ -22,11 +22,11 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
arch: [x86_64]
|
||||
arch: [wasm32, wasm64]
|
||||
mode: [debug, release]
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
if: "!contains(github.event.head_commit.message, 'ci skip')"
|
||||
if: ${{ !contains(github.event.head_commit.message, 'ci skip') }}
|
||||
|
||||
steps:
|
||||
- name: Get current date as package key
|
||||
|
|
@ -57,14 +57,15 @@ jobs:
|
|||
|
||||
# Setup emsdk
|
||||
- name: Setup emscripten
|
||||
uses: mymindstorm/setup-emsdk@v13
|
||||
uses: mymindstorm/setup-emsdk@v14
|
||||
with:
|
||||
version: 3.1.35
|
||||
actions-cache-folder: emsdk-cache-${{ matrix.mode }}-${{ matrix.kind }}
|
||||
|
||||
# Cache xmake dependencies
|
||||
- name: Retrieve cached xmake dependencies
|
||||
uses: actions/cache@v3
|
||||
- name: Restore cached xmake dependencies
|
||||
id: restore-depcache
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages
|
||||
key: Wasm-${{ matrix.arch }}-${{ matrix.mode }}-${{ steps.dep_hash.outputs.hash }}-W${{ steps.cache_key.outputs.key }}
|
||||
|
|
@ -73,16 +74,58 @@ jobs:
|
|||
- name: Configure xmake and install dependencies
|
||||
run: xmake config --plat=wasm --arch=${{ matrix.arch }} --mode=${{ matrix.mode }} --ccache=n --assimp=n --embed_rendererbackends=y --embed_plugins=y --link_openal=y --ffmpeg=n --shadernodes=n --tests=y --yes
|
||||
|
||||
# Save dependencies
|
||||
- name: Save cached xmake dependencies
|
||||
if: ${{ !steps.restore-depcache.outputs.cache-hit }}
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages
|
||||
key: ${{ steps.restore-depcache.outputs.cache-primary-key }}
|
||||
|
||||
# Cache assets downloading
|
||||
- name: Restore cached assets
|
||||
id: restore-assets
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: assets
|
||||
key: assets-${{ hashFiles('assets/examples_version.txt', 'assets/unittests_version.txt') }}
|
||||
|
||||
# Build the engine
|
||||
- name: Build Nazara
|
||||
run: xmake --yes
|
||||
|
||||
- name: Save downloaded assets
|
||||
if: ${{ !steps.restore-assets.outputs.cache-hit }}
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: assets
|
||||
key: ${{ steps.restore-assets.outputs.cache-primary-key }}
|
||||
|
||||
# Install the result files
|
||||
- name: Install Nazara
|
||||
if: ${{ (github.ref == 'refs/heads/main') && github.event_name == 'push' }}
|
||||
run: xmake install -vo package
|
||||
|
||||
# Upload artifacts
|
||||
- uses: actions/upload-artifact@v3
|
||||
- name: "Set PACKAGE_NAME variable"
|
||||
if: ${{ (github.ref == 'refs/heads/main') && github.event_name == 'push' }}
|
||||
run: echo "PACKAGE_NAME=emscripten_${{ matrix.arch }}_${{ matrix.mode }}_static.tar.gz" >> $GITHUB_ENV
|
||||
shell: bash
|
||||
|
||||
- name: Archive result
|
||||
uses: ihiroky/archive-action@v1
|
||||
if: ${{ (github.ref == 'refs/heads/main') && github.event_name == 'push' }}
|
||||
with:
|
||||
name: nazaraengine-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.mode }}
|
||||
path: package
|
||||
root_dir: package
|
||||
file_path: ${{ env.PACKAGE_NAME }}
|
||||
verbose: true
|
||||
|
||||
# Nightly tags (for commits to main branch)
|
||||
- name: Upload binaries to release (main)
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
if: ${{ (github.ref == 'refs/heads/main') && github.event_name == 'push' }}
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: ${{ env.PACKAGE_NAME }}
|
||||
asset_name: ${{ env.PACKAGE_NAME }}
|
||||
tag: "0.0.0-nightly"
|
||||
overwrite: true
|
||||
|
|
|
|||
|
|
@ -23,9 +23,10 @@ jobs:
|
|||
os: [windows-latest]
|
||||
arch: [x64]
|
||||
mode: [debug, releasedbg]
|
||||
kind: [shared, static]
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
if: "!contains(github.event.head_commit.message, 'ci skip')"
|
||||
if: ${{ !contains(github.event.head_commit.message, 'ci skip') }}
|
||||
|
||||
steps:
|
||||
- name: Get current date as package key
|
||||
|
|
@ -57,35 +58,74 @@ jobs:
|
|||
run: echo "hash=$(xmake l utils.ci.packageskey)" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
|
||||
|
||||
# Cache xmake dependencies
|
||||
- name: Retrieve cached xmake dependencies
|
||||
uses: actions/cache@v3
|
||||
- name: Restore cached xmake dependencies
|
||||
id: restore-depcache
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: ${{ env.XMAKE_GLOBALDIR }}\.xmake\packages
|
||||
key: MSVC-${{ matrix.arch }}-${{ matrix.mode }}-${{ steps.dep_hash.outputs.hash }}-W${{ steps.cache_key.outputs.key }}
|
||||
|
||||
# Setup compilation mode and install project dependencies
|
||||
- name: Configure xmake and install dependencies
|
||||
run: xmake config --arch=${{ matrix.arch }} --mode=${{ matrix.mode }} --ccache=n --ffmpeg=y --shadernodes=y --tests=y --unitybuild=y --yes
|
||||
run: xmake config --arch=${{ matrix.arch }} --mode=${{ matrix.mode }} --static=${{ matrix.kind == 'static' && 'yes' || 'no' }} --ccache=n --ffmpeg=y --shadernodes=y --tests=y --unitybuild=y --yes
|
||||
|
||||
# Save dependencies
|
||||
- name: Save cached xmake dependencies
|
||||
if: ${{ !steps.restore-depcache.outputs.cache-hit }}
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages
|
||||
key: ${{ steps.restore-depcache.outputs.cache-primary-key }}
|
||||
|
||||
# Cache assets downloading
|
||||
- name: Restore cached assets
|
||||
id: restore-assets
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: assets
|
||||
key: assets-${{ hashFiles('assets/examples_version.txt', 'assets/unittests_version.txt') }}
|
||||
|
||||
# Build the engine
|
||||
- name: Build Nazara
|
||||
run: xmake --yes
|
||||
|
||||
- name: Save downloaded assets
|
||||
if: ${{ !steps.restore-assets.outputs.cache-hit }}
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: assets
|
||||
key: ${{ steps.restore-assets.outputs.cache-primary-key }}
|
||||
|
||||
# Run unit tests
|
||||
- name: Run unit tests
|
||||
if: matrix.mode != 'releasedbg'
|
||||
run: xmake run UnitTests
|
||||
|
||||
# Setup installation configuration
|
||||
- name: Configure xmake for installation
|
||||
run: xmake config --arch=${{ matrix.arch }} --mode=${{ matrix.mode }} --ccache=n --ffmpeg=n --shadernodes=y --tests=y --yes
|
||||
|
||||
# Install the result files
|
||||
- name: Install Nazara
|
||||
if: ${{ (github.ref == 'refs/heads/main') && github.event_name == 'push' }}
|
||||
run: xmake install -vo package
|
||||
|
||||
# Upload artifacts
|
||||
- uses: actions/upload-artifact@v3
|
||||
- name: "Set PACKAGE_NAME variable"
|
||||
if: ${{ (github.ref == 'refs/heads/main') && github.event_name == 'push' }}
|
||||
run: echo "PACKAGE_NAME=windows_${{ matrix.arch }}_${{ matrix.mode }}_${{ matrix.kind }}.zip" >> $GITHUB_ENV
|
||||
shell: bash
|
||||
|
||||
- name: Archive result
|
||||
uses: ihiroky/archive-action@v1
|
||||
if: ${{ (github.ref == 'refs/heads/main') && github.event_name == 'push' }}
|
||||
with:
|
||||
name: nazaraengine-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.mode }}
|
||||
path: package
|
||||
root_dir: package
|
||||
file_path: ${{ env.PACKAGE_NAME }}
|
||||
verbose: true
|
||||
|
||||
# Nightly tags (for commits to main branch)
|
||||
- name: Upload binaries to release (main)
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
if: ${{ (github.ref == 'refs/heads/main') && github.event_name == 'push' }}
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
file: ${{ env.PACKAGE_NAME }}
|
||||
asset_name: ${{ env.PACKAGE_NAME }}
|
||||
tag: "0.0.0-nightly"
|
||||
overwrite: true
|
||||
|
|
|
|||
|
|
@ -370,7 +370,7 @@ Nazara Engine:
|
|||
- Added support for debug draw
|
||||
- Added support for damping
|
||||
- ⚠️ RigidBody2D created without mass are now kinematic by default instead of statics
|
||||
- https://github.com/NazaraEngine/NazaraEngine/pull/128 ⚠️ **Platform-specific classes were moved to a new module: Platform** (this means Utility module no longer needs to be linked to X11/xcb or gdi32).
|
||||
- https://github.com/NazaraEngine/NazaraEngine/pull/128 ⚠️ **Platform-specific classes were moved to a new module: Platform** (this means Core module no longer needs to be linked to X11/xcb or gdi32).
|
||||
- https://github.com/NazaraEngine/NazaraEngine/pull/135 ⚠️ Improved vertex declarations (they now checks template type with real type)
|
||||
- Mesh index buffer optimization is now disabled by default in debug mode
|
||||
- It is now possible to set the vertex declaration wanted when building/loading a mesh
|
||||
|
|
|
|||
|
|
@ -0,0 +1,165 @@
|
|||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
|
|
@ -1,674 +0,0 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
|
|
@ -29,9 +29,6 @@ Nazara also uses the following libraries at its core and for external tools, we
|
|||
- [minimp3](https://github.com/lieff/minimp3): Minimalistic MP3 decoder single header library
|
||||
- [OpenAL Soft](https://openal-soft.org): OpenAL Soft is a software implementation of the OpenAL 3D audio API
|
||||
|
||||
**Nazara Bullet physics module**:
|
||||
- [Bullet Physics](http://bulletphysics.org): Bullet Physics SDK
|
||||
|
||||
**Nazara Chipmunk physics module**:
|
||||
- [Chipmunk Physics](https://chipmunk-physics.net/): A fast and lightweight 2D game physics library
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
#include <Nazara/Math/Angle.hpp>
|
||||
#include <Nazara/Graphics.hpp>
|
||||
#include <Nazara/Renderer.hpp>
|
||||
#include <Nazara/Utility.hpp>
|
||||
#include <NZSL/Math/FieldOffsets.hpp>
|
||||
#include <NZSL/Parser.hpp>
|
||||
#include <array>
|
||||
|
|
@ -89,7 +88,7 @@ int main(int argc, char* argv[])
|
|||
std::shared_ptr<Nz::RenderDevice> device = Nz::Graphics::Instance()->GetRenderDevice();
|
||||
const Nz::RenderDeviceInfo& deviceInfo = device->GetDeviceInfo();
|
||||
|
||||
auto& windowing = app.AddComponent<Nz::AppWindowingComponent>();
|
||||
auto& windowing = app.AddComponent<Nz::WindowingAppComponent>();
|
||||
|
||||
std::string windowTitle = "Graphics Test";
|
||||
Nz::Window& window = windowing.CreateWindow(Nz::VideoMode(1920, 1080), windowTitle);
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
#include <Nazara/Graphics.hpp> // Module graphique
|
||||
#include <Nazara/Renderer.hpp> // Module de rendu
|
||||
#include <Nazara/Network.hpp> // Module utilitaire
|
||||
#include <Nazara/Utility.hpp> // Module utilitaire
|
||||
#include <Nazara/Core.hpp> // Module utilitaire
|
||||
#include <NazaraSDK/Application.hpp>
|
||||
#include <NazaraSDK/Components.hpp>
|
||||
#include <NazaraSDK/Console.hpp>
|
||||
|
|
|
|||
|
|
@ -13,6 +13,5 @@ EXAMPLE.Files = {
|
|||
EXAMPLE.Libraries = {
|
||||
"NazaraCore",
|
||||
"NazaraPlatform",
|
||||
"NazaraRenderer",
|
||||
"NazaraUtility"
|
||||
"NazaraRenderer"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,7 @@ EXAMPLE.Files = {
|
|||
|
||||
EXAMPLE.Libraries = {
|
||||
"NazaraCore",
|
||||
"NazaraPlatform",
|
||||
"NazaraUtility"
|
||||
"NazaraPlatform"
|
||||
}
|
||||
|
||||
if Config.PlatformSDL2 then
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
#include <Nazara/Core/File.hpp>
|
||||
#include <Nazara/Core/Modules.hpp>
|
||||
#include <Nazara/Math/Box.hpp>
|
||||
#include <Nazara/Utility/Animation.hpp>
|
||||
#include <Nazara/Utility/Joint.hpp>
|
||||
#include <Nazara/Utility/MaterialData.hpp>
|
||||
#include <Nazara/Utility/Mesh.hpp>
|
||||
#include <Nazara/Utility/Sequence.hpp>
|
||||
#include <Nazara/Utility/Skeleton.hpp>
|
||||
#include <Nazara/Utility/Utility.hpp>
|
||||
#include <Nazara/Core/Animation.hpp>
|
||||
#include <Nazara/Core/Joint.hpp>
|
||||
#include <Nazara/Core/MaterialData.hpp>
|
||||
#include <Nazara/Core/Mesh.hpp>
|
||||
#include <Nazara/Core/Sequence.hpp>
|
||||
#include <Nazara/Core/Skeleton.hpp>
|
||||
#include <Nazara/Core/Core.hpp>
|
||||
#include <cctype>
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
|
|
@ -15,14 +15,7 @@
|
|||
int main()
|
||||
{
|
||||
// Pour charger des ressources, il est impératif d'initialiser le module utilitaire
|
||||
Nz::Modules<Nz::Utility> nazara;
|
||||
/*if (!utility)
|
||||
{
|
||||
// Ça n'a pas fonctionné, le pourquoi se trouve dans le fichier NazaraLog.log
|
||||
std::cout << "Failed to initialize Nazara, see NazaraLog.log for further informations" << std::endl;
|
||||
std::getchar(); // On laise le temps de voir l'erreur
|
||||
return EXIT_FAILURE;
|
||||
}*/
|
||||
Nz::Modules<Nz::Core> nazara;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "Common.hpp"
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Utility/SimpleTextDrawer.hpp>
|
||||
#include <Nazara/TextRenderer/SimpleTextDrawer.hpp>
|
||||
#include <NazaraSDK/Components/ParticleGroupComponent.hpp>
|
||||
#include <NazaraSDK/Systems/RenderSystem.hpp>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "LogoDemo.hpp"
|
||||
#include <Nazara/Core/OffsetOf.hpp>
|
||||
#include <Nazara/Graphics.hpp>
|
||||
#include <Nazara/Utility.hpp>
|
||||
#include <Nazara/Core.hpp>
|
||||
#include <NazaraSDK/Components.hpp>
|
||||
#include <NazaraSDK/Systems.hpp>
|
||||
#include <iostream>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include <Nazara/Core/OffsetOf.hpp>
|
||||
#include <Nazara/Graphics.hpp>
|
||||
#include <Nazara/Platform.hpp>
|
||||
#include <Nazara/Utility.hpp>
|
||||
#include <Nazara/Core.hpp>
|
||||
#include <NazaraSDK/Components.hpp>
|
||||
#include <NazaraSDK/Systems.hpp>
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,7 @@
|
|||
#include <Nazara/Core.hpp>
|
||||
#include <Nazara/Graphics.hpp>
|
||||
#include <Nazara/Network.hpp>
|
||||
#include <Nazara/BulletPhysics3D.hpp>
|
||||
#include <Nazara/Renderer.hpp>
|
||||
#include <Nazara/Utility.hpp>
|
||||
#include <NazaraSDK/Application.hpp>
|
||||
#include <NazaraSDK/Components.hpp>
|
||||
#include <NazaraSDK/Systems.hpp>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
#include <Nazara/Platform.hpp>
|
||||
#include <Nazara/Graphics.hpp>
|
||||
#include <Nazara/Renderer.hpp>
|
||||
#include <Nazara/Utility.hpp>
|
||||
#include <chrono>
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
|
@ -17,7 +16,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
std::shared_ptr<Nz::RenderDevice> device = Nz::Graphics::Instance()->GetRenderDevice();
|
||||
|
||||
auto& windowing = app.AddComponent<Nz::AppWindowingComponent>();
|
||||
auto& windowing = app.AddComponent<Nz::WindowingAppComponent>();
|
||||
|
||||
std::string windowTitle = "Physically Based Rendering Test";
|
||||
Nz::Window& window = windowing.CreateWindow(Nz::VideoMode(1920, 1080), windowTitle);
|
||||
|
|
|
|||
|
|
@ -2,9 +2,8 @@
|
|||
#include <Nazara/Platform.hpp>
|
||||
#include <Nazara/Graphics.hpp>
|
||||
#include <Nazara/Math/PidController.hpp>
|
||||
#include <Nazara/ChipmunkPhysics2D.hpp>
|
||||
#include <Nazara/Physics2D.hpp>
|
||||
#include <Nazara/Renderer.hpp>
|
||||
#include <Nazara/Utility.hpp>
|
||||
#include <Nazara/Widgets.hpp>
|
||||
#include <entt/entt.hpp>
|
||||
#include <array>
|
||||
|
|
@ -21,14 +20,14 @@ int main(int argc, char* argv[])
|
|||
if (!std::filesystem::is_directory(resourceDir) && std::filesystem::is_directory("../.." / resourceDir))
|
||||
resourceDir = "../.." / resourceDir;
|
||||
|
||||
Nz::Application<Nz::Graphics, Nz::ChipmunkPhysics2D> app(argc, argv);
|
||||
Nz::Application<Nz::Graphics, Nz::Physics2D> app(argc, argv);
|
||||
|
||||
auto& windowing = app.AddComponent<Nz::AppWindowingComponent>();
|
||||
auto& windowing = app.AddComponent<Nz::WindowingAppComponent>();
|
||||
|
||||
auto& ecs = app.AddComponent<Nz::AppEntitySystemComponent>();
|
||||
auto& ecs = app.AddComponent<Nz::EntitySystemAppComponent>();
|
||||
|
||||
auto& world = ecs.AddWorld<Nz::EnttWorld>();
|
||||
Nz::ChipmunkPhysics2DSystem& physSytem = world.AddSystem<Nz::ChipmunkPhysics2DSystem>();
|
||||
Nz::Physics2DSystem& physSytem = world.AddSystem<Nz::Physics2DSystem>();
|
||||
Nz::RenderSystem& renderSystem = world.AddSystem<Nz::RenderSystem>();
|
||||
|
||||
std::string windowTitle = "Physics 2D";
|
||||
|
|
@ -59,9 +58,9 @@ int main(int argc, char* argv[])
|
|||
std::shared_ptr<Nz::MaterialInstance> spriteMaterial = Nz::MaterialInstance::Instantiate(Nz::MaterialType::Phong);
|
||||
spriteMaterial->SetTextureProperty("BaseColorMap", Nz::Texture::LoadFromFile(resourceDir / "box.png", texParams));
|
||||
|
||||
Nz::ChipmunkRigidBody2DComponent::DynamicSettings boxSettings;
|
||||
Nz::RigidBody2DComponent::DynamicSettings boxSettings;
|
||||
boxSettings.mass = 50.f;
|
||||
boxSettings.geom = std::make_shared<Nz::ChipmunkBoxCollider2D>(Nz::Vector2f(32.f, 32.f));
|
||||
boxSettings.geom = std::make_shared<Nz::BoxCollider2D>(Nz::Vector2f(32.f, 32.f));
|
||||
|
||||
std::shared_ptr<Nz::Sprite> boxSprite = std::make_shared<Nz::Sprite>(spriteMaterial);
|
||||
boxSprite->SetSize({ 32.f, 32.f });
|
||||
|
|
@ -76,7 +75,7 @@ int main(int argc, char* argv[])
|
|||
spriteEntity.emplace<Nz::NodeComponent>(Nz::Vector2f(windowSize.x * 0.5f + x * 32.f - 15.f * 32.f, windowSize.y / 2 + y * 48.f));
|
||||
spriteEntity.emplace<Nz::GraphicsComponent>(boxSprite, 1);
|
||||
|
||||
auto& rigidBody = spriteEntity.emplace<Nz::ChipmunkRigidBody2DComponent>(boxSettings);
|
||||
auto& rigidBody = spriteEntity.emplace<Nz::RigidBody2DComponent>(boxSettings);
|
||||
rigidBody.SetFriction(0.9f);
|
||||
//rigidBody.SetElasticity(0.99f);
|
||||
}
|
||||
|
|
@ -102,12 +101,12 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
}
|
||||
|
||||
Nz::ChipmunkRigidBody2DComponent::StaticSettings groundSettings;
|
||||
groundSettings.geom = std::make_shared<Nz::ChipmunkBoxCollider2D>(tilemap->GetSize());
|
||||
Nz::RigidBody2DComponent::StaticSettings groundSettings;
|
||||
groundSettings.geom = std::make_shared<Nz::BoxCollider2D>(tilemap->GetSize());
|
||||
|
||||
groundEntity.emplace<Nz::NodeComponent>().SetPosition(windowSize.x * 0.5f, -windowSize.y * 0.2f);
|
||||
groundEntity.emplace<Nz::NodeComponent>().SetPosition({ windowSize.x * 0.5f, -windowSize.y * 0.2f });
|
||||
groundEntity.emplace<Nz::GraphicsComponent>().AttachRenderable(tilemap, 1);
|
||||
auto& rigidBody = groundEntity.emplace<Nz::ChipmunkRigidBody2DComponent>(groundSettings);
|
||||
auto& rigidBody = groundEntity.emplace<Nz::RigidBody2DComponent>(groundSettings);
|
||||
rigidBody.SetFriction(0.9f);
|
||||
}
|
||||
|
||||
|
|
@ -122,7 +121,7 @@ int main(int argc, char* argv[])
|
|||
Nz::PidController<Nz::Vector3f> headingController(0.5f, 0.f, 0.05f);
|
||||
Nz::PidController<Nz::Vector3f> upController(1.f, 0.f, 0.1f);
|
||||
|
||||
std::optional<Nz::ChipmunkPivotConstraint2D> grabConstraint;
|
||||
std::optional<Nz::PhysPivotConstraint2D> grabConstraint;
|
||||
NazaraSlot(Nz::WindowEventHandler, OnMouseMoved, grabbedObjectMove);
|
||||
|
||||
Nz::WindowEventHandler& eventHandler = window.GetEventHandler();
|
||||
|
|
@ -139,14 +138,14 @@ int main(int argc, char* argv[])
|
|||
{
|
||||
if (nearestEntity && nearestEntity != groundEntity)
|
||||
{
|
||||
grabConstraint.emplace(nearestEntity.get<Nz::ChipmunkRigidBody2DComponent>(), worldPos);
|
||||
grabConstraint.emplace(nearestEntity.get<Nz::RigidBody2DComponent>(), worldPos);
|
||||
|
||||
grabbedObjectMove.Connect(eventHandler.OnMouseMoved, [&, nearestEntity, viewer](const Nz::WindowEventHandler*, const Nz::WindowEvent::MouseMoveEvent& event)
|
||||
{
|
||||
auto& viewerComponent = viewer.get<Nz::CameraComponent>();
|
||||
Nz::Vector2f worldPos = Nz::Vector2f(viewerComponent.Unproject(Nz::Vector3f(event.x, event.y, 0.f)));
|
||||
|
||||
auto& rigidBody = nearestEntity.get<Nz::ChipmunkRigidBody2DComponent>();
|
||||
auto& rigidBody = nearestEntity.get<Nz::RigidBody2DComponent>();
|
||||
|
||||
grabConstraint->SetFirstAnchor(worldPos);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
target("Physics2DDemo")
|
||||
add_deps("NazaraGraphics", "NazaraChipmunkPhysics2D")
|
||||
add_deps("NazaraGraphics", "NazaraPhysics2D")
|
||||
add_packages("entt")
|
||||
add_files("main.cpp")
|
||||
add_defines("NAZARA_ENTT")
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
#include <Nazara/Platform.hpp>
|
||||
#include <Nazara/Graphics.hpp>
|
||||
#include <Nazara/Math/PidController.hpp>
|
||||
#include <Nazara/BulletPhysics3D.hpp>
|
||||
#include <Nazara/Physics3D.hpp>
|
||||
#include <Nazara/Renderer.hpp>
|
||||
#include <Nazara/Utility.hpp>
|
||||
#include <Nazara/TextRenderer/SimpleTextDrawer.hpp>
|
||||
#include <entt/entt.hpp>
|
||||
#include <array>
|
||||
#include <chrono>
|
||||
|
|
@ -20,14 +20,14 @@ int main(int argc, char* argv[])
|
|||
if (!std::filesystem::is_directory(resourceDir) && std::filesystem::is_directory("../.." / resourceDir))
|
||||
resourceDir = "../.." / resourceDir;
|
||||
|
||||
Nz::Application<Nz::Graphics, Nz::BulletPhysics3D> app(argc, argv);
|
||||
Nz::Application<Nz::Graphics, Nz::Physics3D> app(argc, argv);
|
||||
|
||||
auto& windowing = app.AddComponent<Nz::AppWindowingComponent>();
|
||||
auto& windowing = app.AddComponent<Nz::WindowingAppComponent>();
|
||||
|
||||
auto& ecs = app.AddComponent<Nz::AppEntitySystemComponent>();
|
||||
auto& ecs = app.AddComponent<Nz::EntitySystemAppComponent>();
|
||||
|
||||
auto& world = ecs.AddWorld<Nz::EnttWorld>();
|
||||
Nz::BulletPhysics3DSystem& physSytem = world.AddSystem<Nz::BulletPhysics3DSystem>();
|
||||
Nz::Physics3DSystem& physSytem = world.AddSystem<Nz::Physics3DSystem>();
|
||||
physSytem.GetPhysWorld().SetGravity(Nz::Vector3f::Zero());
|
||||
|
||||
Nz::RenderSystem& renderSystem = world.AddSystem<Nz::RenderSystem>();
|
||||
|
|
@ -101,7 +101,7 @@ int main(int argc, char* argv[])
|
|||
cameraComponent.UpdateClearColor(Nz::Color(0.5f, 0.5f, 0.5f));
|
||||
}
|
||||
|
||||
auto shipCollider = std::make_shared<Nz::BulletConvexCollider3D>(vertices, vertexMapper.GetVertexCount());
|
||||
auto shipCollider = std::make_shared<Nz::ConvexHullCollider3D>(vertices, vertexMapper.GetVertexCount());
|
||||
|
||||
std::shared_ptr<Nz::MaterialInstance> colliderMat = Nz::MaterialInstance::Instantiate(Nz::MaterialType::Basic);
|
||||
colliderMat->SetValueProperty("BaseColor", Nz::Color::Green());
|
||||
|
|
@ -127,7 +127,7 @@ int main(int argc, char* argv[])
|
|||
entityGfx.AttachRenderable(sprite, 1);
|
||||
|
||||
auto& entityNode = textEntity.emplace<Nz::NodeComponent>();
|
||||
entityNode.SetPosition(0.f, 5.f, 0.f);
|
||||
entityNode.SetPosition({ 0.f, 5.f, 0.f });
|
||||
}
|
||||
entt::handle playerEntity = world.CreateEntity();
|
||||
|
||||
|
|
@ -139,7 +139,11 @@ int main(int argc, char* argv[])
|
|||
auto& entityNode = playerEntity.emplace<Nz::NodeComponent>();
|
||||
entityNode.SetPosition(Nz::Vector3f(12.5f, 0.f, 25.f));
|
||||
|
||||
auto& entityPhys = playerEntity.emplace<Nz::BulletRigidBody3DComponent>(physSytem.CreateRigidBody(shipCollider));
|
||||
Nz::RigidBody3D::DynamicSettings settings;
|
||||
settings.geom = shipCollider;
|
||||
settings.mass = 100.f;
|
||||
|
||||
auto& entityPhys = playerEntity.emplace<Nz::RigidBody3DComponent>(settings);
|
||||
entityPhys.SetMass(50.f);
|
||||
entityPhys.SetAngularDamping(0.1f);
|
||||
entityPhys.SetLinearDamping(0.5f);
|
||||
|
|
@ -178,7 +182,11 @@ int main(int argc, char* argv[])
|
|||
entityNode.SetPosition(Nz::Vector3f(x * 2.f, y * 1.5f, z * 2.f));
|
||||
entityNode.SetRotation(Nz::EulerAnglesf(0.f, Nz::TurnAnglef(0.5f), 0.f));
|
||||
|
||||
auto& entityPhys = entity.emplace<Nz::BulletRigidBody3DComponent>(physSytem.CreateRigidBody(shipCollider));
|
||||
Nz::RigidBody3D::DynamicSettings settings;
|
||||
settings.geom = shipCollider;
|
||||
settings.mass = 100.f;
|
||||
|
||||
auto& entityPhys = entity.emplace<Nz::RigidBody3DComponent>(settings);
|
||||
entityPhys.SetMass(1.f);
|
||||
entityPhys.SetAngularDamping(0.f);
|
||||
entityPhys.SetLinearDamping(0.f);
|
||||
|
|
@ -213,13 +221,13 @@ int main(int argc, char* argv[])
|
|||
showColliders = !showColliders;
|
||||
if (showColliders)
|
||||
{
|
||||
auto view = world.GetRegistry().view<Nz::GraphicsComponent, Nz::BulletRigidBody3DComponent>();
|
||||
auto view = world.GetRegistry().view<Nz::GraphicsComponent, Nz::RigidBody3DComponent>();
|
||||
for (auto [entity, gfxComponent, _] : view.each())
|
||||
gfxComponent.AttachRenderable(colliderModel, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto view = world.GetRegistry().view<Nz::GraphicsComponent, Nz::BulletRigidBody3DComponent>();
|
||||
auto view = world.GetRegistry().view<Nz::GraphicsComponent, Nz::RigidBody3DComponent>();
|
||||
for (auto [entity, gfxComponent, _] : view.each())
|
||||
gfxComponent.DetachRenderable(colliderModel);
|
||||
}
|
||||
|
|
@ -234,7 +242,11 @@ int main(int argc, char* argv[])
|
|||
|
||||
entity.emplace<Nz::NodeComponent>();
|
||||
|
||||
auto& entityPhys = entity.emplace<Nz::BulletRigidBody3DComponent>(physSytem.CreateRigidBody(shipCollider));
|
||||
Nz::RigidBody3D::DynamicSettings settings;
|
||||
settings.geom = shipCollider;
|
||||
settings.mass = 100.f;
|
||||
|
||||
auto& entityPhys = entity.emplace<Nz::RigidBody3DComponent>(settings);
|
||||
entityPhys.SetMass(1.f);
|
||||
entityPhys.SetAngularDamping(0.f);
|
||||
entityPhys.SetLinearDamping(0.f);
|
||||
|
|
@ -261,18 +273,18 @@ int main(int argc, char* argv[])
|
|||
{
|
||||
float elapsedTime = deltaTime->AsSeconds();
|
||||
|
||||
auto spaceshipView = world.GetRegistry().view<Nz::NodeComponent, Nz::BulletRigidBody3DComponent>();
|
||||
auto spaceshipView = world.GetRegistry().view<Nz::NodeComponent, Nz::RigidBody3DComponent>();
|
||||
for (auto&& [entity, node, _] : spaceshipView.each())
|
||||
{
|
||||
if (entity == playerEntity)
|
||||
continue;
|
||||
|
||||
Nz::Vector3f spaceshipPos = node.GetPosition(Nz::CoordSys::Global);
|
||||
Nz::Vector3f spaceshipPos = node.GetGlobalPosition();
|
||||
if (spaceshipPos.GetSquaredLength() > Nz::IntegralPow(20.f, 2))
|
||||
world.GetRegistry().destroy(entity);
|
||||
}
|
||||
|
||||
Nz::BulletRigidBody3DComponent& playerShipBody = playerEntity.get<Nz::BulletRigidBody3DComponent>();
|
||||
Nz::RigidBody3DComponent& playerShipBody = playerEntity.get<Nz::RigidBody3DComponent>();
|
||||
Nz::Quaternionf currentRotation = playerShipBody.GetRotation();
|
||||
|
||||
Nz::Vector3f desiredHeading = headingEntity.get<Nz::NodeComponent>().GetForward();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
target("PhysicsDemo")
|
||||
add_deps("NazaraGraphics", "NazaraBulletPhysics3D")
|
||||
add_deps("NazaraGraphics", "NazaraPhysics3D")
|
||||
add_packages("entt")
|
||||
add_files("main.cpp")
|
||||
add_defines("NAZARA_ENTT")
|
||||
|
|
|
|||
|
|
@ -1,17 +1,8 @@
|
|||
// Sources pour https://github.com/NazaraEngine/NazaraEngine/wiki/(FR)-Tutoriel:-%5B01%5D-Hello-World
|
||||
|
||||
#define USE_JOLT 1
|
||||
|
||||
#include <Nazara/Core.hpp>
|
||||
#include <Nazara/Graphics.hpp>
|
||||
#include <Nazara/Platform/AppWindowingComponent.hpp>
|
||||
#if USE_JOLT
|
||||
#include <Nazara/JoltPhysics3D.hpp>
|
||||
#else
|
||||
#include <Nazara/BulletPhysics3D.hpp>
|
||||
#endif
|
||||
#include <Nazara/Platform/WindowingAppComponent.hpp>
|
||||
#include <Nazara/Physics3D.hpp>
|
||||
#include <Nazara/Renderer.hpp>
|
||||
#include <Nazara/Utility.hpp>
|
||||
#include <iostream>
|
||||
#include <random>
|
||||
|
||||
|
|
@ -24,16 +15,12 @@ int main(int argc, char* argv[])
|
|||
Nz::Renderer::Config renderConfig;
|
||||
renderConfig.validationLevel = Nz::RenderAPIValidationLevel::None;
|
||||
|
||||
#if USE_JOLT
|
||||
Nz::Application<Nz::Graphics, Nz::JoltPhysics3D> app(argc, argv, renderConfig);
|
||||
#else
|
||||
Nz::Application<Nz::Graphics, Nz::BulletPhysics3D> app(argc, argv, renderConfig);
|
||||
#endif
|
||||
Nz::Application<Nz::Graphics, Nz::Physics3D> app(argc, argv, renderConfig);
|
||||
|
||||
auto& windowing = app.AddComponent<Nz::AppWindowingComponent>();
|
||||
auto& windowing = app.AddComponent<Nz::WindowingAppComponent>();
|
||||
Nz::Window& mainWindow = windowing.CreateWindow(Nz::VideoMode(1280, 720), "Physics playground");
|
||||
|
||||
auto& fs = app.AddComponent<Nz::AppFilesystemComponent>();
|
||||
auto& fs = app.AddComponent<Nz::FilesystemAppComponent>();
|
||||
{
|
||||
std::filesystem::path resourceDir = "assets/examples";
|
||||
if (!std::filesystem::is_directory(resourceDir) && std::filesystem::is_directory("../.." / resourceDir))
|
||||
|
|
@ -42,14 +29,10 @@ int main(int argc, char* argv[])
|
|||
fs.Mount("assets", resourceDir);
|
||||
}
|
||||
|
||||
auto& ecs = app.AddComponent<Nz::AppEntitySystemComponent>();
|
||||
auto& ecs = app.AddComponent<Nz::EntitySystemAppComponent>();
|
||||
auto& world = ecs.AddWorld<Nz::EnttWorld>();
|
||||
|
||||
#if USE_JOLT
|
||||
auto& physSystem = world.AddSystem<Nz::JoltPhysics3DSystem>();
|
||||
#else
|
||||
auto& physSystem = world.AddSystem<Nz::BulletPhysics3DSystem>();
|
||||
#endif
|
||||
auto& physSystem = world.AddSystem<Nz::Physics3DSystem>();
|
||||
physSystem.GetPhysWorld().SetMaxStepCount(1);
|
||||
physSystem.GetPhysWorld().SetStepSize(Nz::Time::TickDuration(30));
|
||||
physSystem.GetPhysWorld().SetGravity(Nz::Vector3f::Down() * 9.81f);
|
||||
|
|
@ -96,46 +79,24 @@ int main(int argc, char* argv[])
|
|||
|
||||
boxColliderEntity.emplace<Nz::NodeComponent>();
|
||||
|
||||
#if USE_JOLT
|
||||
float thickness = 1.f;
|
||||
std::shared_ptr<Nz::JoltBoxCollider3D> wallCollider = std::make_shared<Nz::JoltBoxCollider3D>(Nz::Vector3f(BoxDims + thickness * 2.f, BoxDims + thickness * 2.f, thickness));
|
||||
#else
|
||||
std::shared_ptr<Nz::BulletBoxCollider3D> wallCollider = std::make_shared<Nz::BulletBoxCollider3D>(Nz::Vector3f(BoxDims, BoxDims, 1.f));
|
||||
#endif
|
||||
|
||||
#if USE_JOLT
|
||||
std::vector<Nz::JoltCompoundCollider3D::ChildCollider> colliders;
|
||||
#else
|
||||
std::vector<Nz::BulletCompoundCollider3D::ChildCollider> colliders;
|
||||
#endif
|
||||
std::shared_ptr<Nz::BoxCollider3D> wallCollider = std::make_shared<Nz::BoxCollider3D>(Nz::Vector3f(BoxDims + thickness * 2.f, BoxDims + thickness * 2.f, thickness));
|
||||
|
||||
std::vector<Nz::CompoundCollider3D::ChildCollider> colliders;
|
||||
for (Nz::Vector3f normal : { Nz::Vector3f::Forward(), Nz::Vector3f::Backward(), Nz::Vector3f::Left(), Nz::Vector3f::Right(), Nz::Vector3f::Up(), Nz::Vector3f::Down() })
|
||||
{
|
||||
auto& colliderEntry = colliders.emplace_back();
|
||||
colliderEntry.collider = wallCollider;
|
||||
#if USE_JOLT
|
||||
colliderEntry.rotation = Nz::Quaternionf::RotationBetween(Nz::Vector3f::Forward(), normal);
|
||||
colliderEntry.offset = normal * BoxDims * 0.5f + normal * 0.5f;
|
||||
#else
|
||||
colliderEntry.offsetMatrix = Nz::Matrix4f::Transform(normal * BoxDims * 0.5f + normal * 0.5f, Nz::Quaternionf::RotationBetween(Nz::Vector3f::Forward(), normal));
|
||||
#endif
|
||||
}
|
||||
|
||||
#if USE_JOLT
|
||||
std::shared_ptr<Nz::JoltCompoundCollider3D> boxCollider = std::make_shared<Nz::JoltCompoundCollider3D>(std::move(colliders));
|
||||
#else
|
||||
std::shared_ptr<Nz::BulletCompoundCollider3D> boxCollider = std::make_shared<Nz::BulletCompoundCollider3D>(std::move(colliders));
|
||||
#endif
|
||||
std::shared_ptr<Nz::CompoundCollider3D> boxCollider = std::make_shared<Nz::CompoundCollider3D>(std::move(colliders));
|
||||
|
||||
#if USE_JOLT
|
||||
Nz::JoltRigidBody3D::StaticSettings settings;
|
||||
Nz::RigidBody3D::StaticSettings settings;
|
||||
settings.geom = boxCollider;
|
||||
|
||||
boxColliderEntity.emplace<Nz::JoltRigidBody3DComponent>(settings);
|
||||
#else
|
||||
auto& boxBody = boxColliderEntity.emplace<Nz::BulletRigidBody3DComponent>(physSystem.CreateRigidBody(boxCollider));
|
||||
boxBody.SetMass(0.f);
|
||||
#endif
|
||||
boxColliderEntity.emplace<Nz::RigidBody3DComponent>(settings);
|
||||
|
||||
std::shared_ptr<Nz::Model> colliderModel;
|
||||
{
|
||||
|
|
@ -163,11 +124,7 @@ int main(int argc, char* argv[])
|
|||
float radius = radiusDis(rd);
|
||||
std::uniform_real_distribution<float> positionRandom(-BoxDims * 0.5f + radius, BoxDims * 0.5f - radius);
|
||||
|
||||
#if USE_JOLT
|
||||
std::shared_ptr<Nz::JoltSphereCollider3D> sphereCollider = std::make_shared<Nz::JoltSphereCollider3D>(radius);
|
||||
#else
|
||||
std::shared_ptr<Nz::BulletSphereCollider3D> sphereCollider = std::make_shared<Nz::BulletSphereCollider3D>(radius);
|
||||
#endif
|
||||
std::shared_ptr<Nz::SphereCollider3D> sphereCollider = std::make_shared<Nz::SphereCollider3D>(radius);
|
||||
|
||||
entt::handle ballEntity = world.CreateEntity();
|
||||
|
||||
|
|
@ -181,18 +138,14 @@ int main(int argc, char* argv[])
|
|||
ballGfx.AttachRenderable(std::move(sphereModel));
|
||||
|
||||
auto& ballNode = ballEntity.emplace<Nz::NodeComponent>();
|
||||
ballNode.SetPosition(positionRandom(rd), positionRandom(rd), positionRandom(rd));
|
||||
ballNode.SetPosition({ positionRandom(rd), positionRandom(rd), positionRandom(rd) });
|
||||
ballNode.SetScale(radius);
|
||||
|
||||
#if USE_JOLT
|
||||
Nz::JoltRigidBody3D::DynamicSettings settings;
|
||||
Nz::RigidBody3D::DynamicSettings settings;
|
||||
settings.geom = sphereCollider;
|
||||
settings.mass = 4.f / 3.f * Nz::Pi<float> * Nz::IntegralPow(radius, 3);
|
||||
|
||||
ballEntity.emplace<Nz::JoltRigidBody3DComponent>(settings);
|
||||
#else
|
||||
ballEntity.emplace<Nz::BulletRigidBody3DComponent>(physSystem.CreateRigidBody(sphereCollider));
|
||||
#endif
|
||||
ballEntity.emplace<Nz::RigidBody3DComponent>(settings);
|
||||
}
|
||||
|
||||
std::uniform_real_distribution<float> lengthDis(0.2f, 1.5f);
|
||||
|
|
@ -220,24 +173,16 @@ int main(int argc, char* argv[])
|
|||
boxEntity.emplace<Nz::GraphicsComponent>(std::move(sphereModel));
|
||||
|
||||
auto& ballNode = boxEntity.emplace<Nz::NodeComponent>();
|
||||
ballNode.SetPosition(xRandom(rd), yRandom(rd), zRandom(rd));
|
||||
ballNode.SetScale(width, height, depth);
|
||||
ballNode.SetPosition({ xRandom(rd), yRandom(rd), zRandom(rd) });
|
||||
ballNode.SetScale({ width, height, depth });
|
||||
|
||||
#if USE_JOLT
|
||||
std::shared_ptr<Nz::JoltBoxCollider3D> boxCollider = std::make_shared<Nz::JoltBoxCollider3D>(Nz::Vector3f(width, height, depth));
|
||||
#else
|
||||
std::shared_ptr<Nz::BulletBoxCollider3D> boxCollider = std::make_shared<Nz::BulletBoxCollider3D>(Nz::Vector3f(width, height, depth));
|
||||
#endif
|
||||
std::shared_ptr<Nz::BoxCollider3D> boxCollider = std::make_shared<Nz::BoxCollider3D>(Nz::Vector3f(width, height, depth));
|
||||
|
||||
#if USE_JOLT
|
||||
Nz::JoltRigidBody3D::DynamicSettings settings;
|
||||
Nz::RigidBody3D::DynamicSettings settings;
|
||||
settings.geom = boxCollider;
|
||||
settings.mass = width * height * depth;
|
||||
|
||||
boxEntity.emplace<Nz::JoltRigidBody3DComponent>(settings);
|
||||
#else
|
||||
boxEntity.emplace<Nz::BulletRigidBody3DComponent>(physSystem.CreateRigidBody(boxCollider));
|
||||
#endif
|
||||
boxEntity.emplace<Nz::RigidBody3DComponent>(settings);
|
||||
}
|
||||
|
||||
// Spaceships
|
||||
|
|
@ -281,11 +226,7 @@ int main(int argc, char* argv[])
|
|||
Nz::VertexMapper vertexMapper(*spaceshipMesh->GetSubMesh(0));
|
||||
Nz::SparsePtr<Nz::Vector3f> vertices = vertexMapper.GetComponentPtr<Nz::Vector3f>(Nz::VertexComponent::Position);
|
||||
|
||||
#if USE_JOLT
|
||||
auto shipCollider = std::make_shared<Nz::JoltConvexHullCollider3D>(vertices, vertexMapper.GetVertexCount(), 0.1f);
|
||||
#else
|
||||
auto shipCollider = std::make_shared<Nz::BulletConvexCollider3D>(vertices, vertexMapper.GetVertexCount());
|
||||
#endif
|
||||
auto shipCollider = std::make_shared<Nz::ConvexHullCollider3D>(vertices, vertexMapper.GetVertexCount(), 0.1f);
|
||||
|
||||
std::shared_ptr<Nz::Model> colliderModel;
|
||||
{
|
||||
|
|
@ -305,17 +246,13 @@ int main(int argc, char* argv[])
|
|||
shipEntity.emplace<Nz::GraphicsComponent>(model);
|
||||
|
||||
auto& shipNode = shipEntity.emplace<Nz::NodeComponent>();
|
||||
shipNode.SetPosition(xRandom(rd), yRandom(rd), zRandom(rd));
|
||||
shipNode.SetPosition({ xRandom(rd), yRandom(rd), zRandom(rd) });
|
||||
|
||||
#if USE_JOLT
|
||||
Nz::JoltRigidBody3D::DynamicSettings settings;
|
||||
Nz::RigidBody3D::DynamicSettings settings;
|
||||
settings.geom = shipCollider;
|
||||
settings.mass = 100.f;
|
||||
|
||||
shipEntity.emplace<Nz::JoltRigidBody3DComponent>(settings);
|
||||
#else
|
||||
shipEntity.emplace<Nz::BulletRigidBody3DComponent>(physSystem.CreateRigidBody(shipCollider));
|
||||
#endif
|
||||
shipEntity.emplace<Nz::RigidBody3DComponent>(settings);
|
||||
|
||||
//shipEntity.get<Nz::GraphicsComponent>().AttachRenderable(colliderModel);
|
||||
}
|
||||
|
|
@ -363,10 +300,10 @@ int main(int argc, char* argv[])
|
|||
|
||||
NazaraSlot(Nz::WindowEventHandler, OnMouseMoved, cameraMove);
|
||||
NazaraSlot(Nz::WindowEventHandler, OnMouseMoved, grabbedObjectMove);
|
||||
#if USE_JOLT
|
||||
|
||||
struct GrabConstraint
|
||||
{
|
||||
GrabConstraint(Nz::JoltRigidBody3D& body, const Nz::Vector3f& grabPos) :
|
||||
GrabConstraint(Nz::RigidBody3D& body, const Nz::Vector3f& grabPos) :
|
||||
grabBody(body.GetWorld(), BodySettings(grabPos)),
|
||||
grabConstraint(body, grabBody, grabPos)
|
||||
{
|
||||
|
|
@ -386,9 +323,9 @@ int main(int argc, char* argv[])
|
|||
grabBody.SetPosition(pos);
|
||||
}
|
||||
|
||||
static Nz::JoltRigidBody3D::DynamicSettings BodySettings(const Nz::Vector3f& pos)
|
||||
static Nz::RigidBody3D::DynamicSettings BodySettings(const Nz::Vector3f& pos)
|
||||
{
|
||||
Nz::JoltRigidBody3D::DynamicSettings settings;
|
||||
Nz::RigidBody3D::DynamicSettings settings;
|
||||
settings.mass = 0.f; //< kinematic
|
||||
settings.isSimulationEnabled = false;
|
||||
settings.position = pos;
|
||||
|
|
@ -396,14 +333,11 @@ int main(int argc, char* argv[])
|
|||
return settings;
|
||||
}
|
||||
|
||||
Nz::JoltRigidBody3D grabBody;
|
||||
Nz::JoltDistanceConstraint3D grabConstraint;
|
||||
Nz::RigidBody3D grabBody;
|
||||
Nz::PhysDistanceConstraint3D grabConstraint;
|
||||
};
|
||||
|
||||
std::optional<GrabConstraint> grabConstraint;
|
||||
#else
|
||||
std::optional<Nz::BulletPivotConstraint3D> grabConstraint;
|
||||
#endif
|
||||
|
||||
auto mouseMoveCallback = [&](const Nz::WindowEventHandler*, const Nz::WindowEvent::MouseMoveEvent& event)
|
||||
{
|
||||
|
|
@ -430,11 +364,7 @@ int main(int argc, char* argv[])
|
|||
Nz::Vector3f from = cameraComponent.Unproject({ float(event.x), float(event.y), 0.f });
|
||||
Nz::Vector3f to = cameraComponent.Unproject({ float(event.x), float(event.y), 1.f });
|
||||
|
||||
#if USE_JOLT
|
||||
Nz::JoltPhysics3DSystem::RaycastHit lastHitInfo;
|
||||
#else
|
||||
Nz::BulletPhysics3DSystem::RaycastHit lastHitInfo;
|
||||
#endif
|
||||
Nz::Physics3DSystem::RaycastHit lastHitInfo;
|
||||
auto callback = [&](const decltype(lastHitInfo)& hitInfo) -> std::optional<float>
|
||||
{
|
||||
if (hitInfo.hitEntity == boxColliderEntity)
|
||||
|
|
@ -455,12 +385,7 @@ int main(int argc, char* argv[])
|
|||
{
|
||||
if (lastHitInfo.hitBody && lastHitInfo.hitEntity != boxColliderEntity)
|
||||
{
|
||||
#if USE_JOLT
|
||||
grabConstraint.emplace(static_cast<Nz::JoltRigidBody3D&>(*lastHitInfo.hitBody), lastHitInfo.hitPosition);
|
||||
#else
|
||||
grabConstraint.emplace(*lastHitInfo.hitBody, lastHitInfo.hitPosition);
|
||||
grabConstraint->SetImpulseClamp(30.f);
|
||||
#endif
|
||||
grabConstraint.emplace(static_cast<Nz::RigidBody3D&>(*lastHitInfo.hitBody), lastHitInfo.hitPosition);
|
||||
|
||||
grabbedObjectMove.Connect(eventHandler.OnMouseMoved, [&, distance = Nz::Vector3f::Distance(from, lastHitInfo.hitPosition)](const Nz::WindowEventHandler*, const Nz::WindowEvent::MouseMoveEvent& event)
|
||||
{
|
||||
|
|
@ -468,11 +393,7 @@ int main(int argc, char* argv[])
|
|||
Nz::Vector3f to = cameraComponent.Unproject({ float(event.x), float(event.y), 1.f });
|
||||
|
||||
Nz::Vector3f newPosition = from + (to - from).Normalize() * distance;
|
||||
#if USE_JOLT
|
||||
grabConstraint->SetPosition(newPosition);
|
||||
#else
|
||||
grabConstraint->SetSecondAnchor(newPosition);
|
||||
#endif
|
||||
});
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
target("PhysicsPlayground")
|
||||
add_deps("NazaraGraphics", "NazaraBulletPhysics3D", "NazaraJoltPhysics3D")
|
||||
add_deps("NazaraGraphics", "NazaraPhysics3D")
|
||||
add_packages("entt")
|
||||
add_files("main.cpp")
|
||||
add_defines("NAZARA_ENTT")
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
#include <Nazara/Core.hpp>
|
||||
#include <Nazara/Core/Plugins/AssimpPlugin.hpp>
|
||||
#include <Nazara/Platform.hpp>
|
||||
#include <Nazara/Graphics.hpp>
|
||||
#include <Nazara/Math/PidController.hpp>
|
||||
#include <Nazara/BulletPhysics3D.hpp>
|
||||
#include <Nazara/JoltPhysics3D.hpp>
|
||||
#include <Nazara/Physics3D.hpp>
|
||||
#include <Nazara/Renderer.hpp>
|
||||
#include <Nazara/Utility.hpp>
|
||||
#include <Nazara/Utility/Plugins/AssimpPlugin.hpp>
|
||||
#include <Nazara/TextRenderer/SimpleTextDrawer.hpp>
|
||||
#include <NazaraUtils/CallOnExit.hpp>
|
||||
#include <NZSL/Math/FieldOffsets.hpp>
|
||||
#include <entt/entt.hpp>
|
||||
|
|
@ -19,29 +18,29 @@ NAZARA_REQUEST_DEDICATED_GPU()
|
|||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
Nz::Application<Nz::Graphics, Nz::JoltPhysics3D> app(argc, argv);
|
||||
Nz::Application<Nz::Graphics, Nz::Physics3D> app(argc, argv);
|
||||
|
||||
Nz::PluginLoader loader;
|
||||
Nz::Plugin<Nz::AssimpPlugin> assimp = loader.Load<Nz::AssimpPlugin>();
|
||||
|
||||
std::shared_ptr<Nz::RenderDevice> device = Nz::Graphics::Instance()->GetRenderDevice();
|
||||
|
||||
auto& ecs = app.AddComponent<Nz::AppEntitySystemComponent>();
|
||||
auto& ecs = app.AddComponent<Nz::EntitySystemAppComponent>();
|
||||
|
||||
auto& world = ecs.AddWorld<Nz::EnttWorld>();
|
||||
world.AddSystem<Nz::SkeletonSystem>();
|
||||
|
||||
Nz::JoltPhysics3DSystem& physSytem = world.AddSystem<Nz::JoltPhysics3DSystem>();
|
||||
Nz::Physics3DSystem& physSytem = world.AddSystem<Nz::Physics3DSystem>();
|
||||
physSytem.GetPhysWorld().SetGravity(Nz::Vector3f::Zero());
|
||||
Nz::RenderSystem& renderSystem = world.AddSystem<Nz::RenderSystem>();
|
||||
|
||||
auto& windowing = app.AddComponent<Nz::AppWindowingComponent>();
|
||||
auto& windowing = app.AddComponent<Nz::WindowingAppComponent>();
|
||||
|
||||
std::string windowTitle = "Skinning test";
|
||||
Nz::Window& mainWindow = windowing.CreateWindow(Nz::VideoMode(1280, 720), windowTitle);
|
||||
auto& windowSwapchain = renderSystem.CreateSwapchain(mainWindow);
|
||||
|
||||
auto& fs = app.AddComponent<Nz::AppFilesystemComponent>();
|
||||
auto& fs = app.AddComponent<Nz::FilesystemAppComponent>();
|
||||
{
|
||||
std::filesystem::path resourceDir = "assets/examples";
|
||||
if (!std::filesystem::is_directory(resourceDir) && std::filesystem::is_directory("../.." / resourceDir))
|
||||
|
|
@ -52,21 +51,21 @@ int main(int argc, char* argv[])
|
|||
|
||||
physSytem.GetPhysWorld().SetGravity({ 0.f, -9.81f, 0.f });
|
||||
|
||||
std::optional<Nz::JoltCharacter> character;
|
||||
std::optional<Nz::PhysCharacter3D> character;
|
||||
|
||||
entt::handle playerEntity = world.CreateEntity();
|
||||
entt::handle playerRotation = world.CreateEntity();
|
||||
entt::handle playerCamera = world.CreateEntity();
|
||||
{
|
||||
auto& playerNode = playerEntity.emplace<Nz::NodeComponent>();
|
||||
playerNode.SetPosition(0.f, 1.8f, 1.f);
|
||||
playerNode.SetPosition({ 0.f, 1.8f, 1.f });
|
||||
|
||||
auto playerCollider = std::make_shared<Nz::JoltBoxCollider3D>(Nz::Vector3f(0.2f, 1.8f, 0.2f));
|
||||
auto playerCollider = std::make_shared<Nz::BoxCollider3D>(Nz::Vector3f(0.2f, 1.8f, 0.2f));
|
||||
|
||||
//auto& playerBody = playerEntity.emplace<Nz::JoltRigidBody3DComponent>(physSytem.CreateRigidBody(playerCollider));
|
||||
//auto& playerBody = playerEntity.emplace<Nz::RigidBody3DComponent>(physSytem.CreateRigidBody(playerCollider));
|
||||
//playerBody.SetMass(42.f);
|
||||
|
||||
Nz::JoltCharacter::Settings characterSettings;
|
||||
Nz::PhysCharacter3D::Settings characterSettings;
|
||||
characterSettings.collider = playerCollider;
|
||||
characterSettings.position = Nz::Vector3f::Up() * 5.f;
|
||||
|
||||
|
|
@ -287,7 +286,7 @@ int main(int argc, char* argv[])
|
|||
auto [sin, cos] = rotation.GetSinCos();
|
||||
|
||||
auto& lightNode = lightEntity3.get<Nz::NodeComponent>();
|
||||
lightNode.SetPosition(sin * radius, 1.5f, cos * radius);
|
||||
lightNode.SetPosition({ sin * radius, 1.5f, cos * radius });
|
||||
});
|
||||
|
||||
auto& cameraLight = lightEntity3.emplace<Nz::LightComponent>();
|
||||
|
|
@ -364,13 +363,13 @@ int main(int argc, char* argv[])
|
|||
|
||||
floorEntity.emplace<Nz::NodeComponent>();
|
||||
|
||||
auto floorCollider = std::make_shared<Nz::JoltBoxCollider3D>(Nz::Vector3f(planeSize.x, 1.f, planeSize.y));
|
||||
auto translatedFloorCollider = std::make_shared<Nz::JoltTranslatedRotatedCollider3D>(std::move(floorCollider), Nz::Vector3f::Down() * 0.5f);
|
||||
auto floorCollider = std::make_shared<Nz::BoxCollider3D>(Nz::Vector3f(planeSize.x, 1.f, planeSize.y));
|
||||
auto translatedFloorCollider = std::make_shared<Nz::TranslatedRotatedCollider3D>(std::move(floorCollider), Nz::Vector3f::Down() * 0.5f);
|
||||
|
||||
Nz::JoltRigidBody3D::StaticSettings floorSettings;
|
||||
Nz::RigidBody3D::StaticSettings floorSettings;
|
||||
floorSettings.geom = translatedFloorCollider;
|
||||
|
||||
floorEntity.emplace<Nz::JoltRigidBody3DComponent>(floorSettings);
|
||||
floorEntity.emplace<Nz::RigidBody3DComponent>(floorSettings);
|
||||
|
||||
std::shared_ptr<Nz::GraphicalMesh> boxMeshGfx = Nz::GraphicalMesh::Build(Nz::Primitive::Box(Nz::Vector3f(0.5f, 0.5f, 0.5f)), meshPrimitiveParams);
|
||||
|
||||
|
|
@ -530,7 +529,7 @@ int main(int argc, char* argv[])
|
|||
{
|
||||
float updateTime = deltaTime->AsSeconds();
|
||||
|
||||
//auto& playerBody = playerEntity.get<Nz::JoltRigidBody3DComponent>();
|
||||
//auto& playerBody = playerEntity.get<Nz::RigidBody3DComponent>();
|
||||
//playerBody.SetAngularDamping(std::numeric_limits<float>::max());
|
||||
|
||||
Nz::Vector3f velocity = character->GetLinearVelocity();
|
||||
|
|
@ -561,19 +560,19 @@ int main(int argc, char* argv[])
|
|||
|
||||
auto& cameraNode = playerCamera.get<Nz::NodeComponent>();
|
||||
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::Space))
|
||||
cameraNode.Move(Nz::Vector3f::Up() * cameraSpeed * updateTime, Nz::CoordSys::Global);
|
||||
cameraNode.MoveGlobal(Nz::Vector3f::Up() * cameraSpeed * updateTime);
|
||||
|
||||
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::Z))
|
||||
cameraNode.Move(Nz::Vector3f::Forward() * cameraSpeed * updateTime, Nz::CoordSys::Local);
|
||||
cameraNode.Move(Nz::Vector3f::Forward() * cameraSpeed * updateTime);
|
||||
|
||||
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::S))
|
||||
cameraNode.Move(Nz::Vector3f::Backward() * cameraSpeed * updateTime, Nz::CoordSys::Local);
|
||||
cameraNode.Move(Nz::Vector3f::Backward() * cameraSpeed * updateTime);
|
||||
|
||||
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::Q))
|
||||
cameraNode.Move(Nz::Vector3f::Left() * cameraSpeed * updateTime, Nz::CoordSys::Local);
|
||||
cameraNode.Move(Nz::Vector3f::Left() * cameraSpeed * updateTime);
|
||||
|
||||
if (Nz::Keyboard::IsKeyPressed(Nz::Keyboard::VKey::D))
|
||||
cameraNode.Move(Nz::Vector3f::Right() * cameraSpeed * updateTime, Nz::CoordSys::Local);
|
||||
cameraNode.Move(Nz::Vector3f::Right() * cameraSpeed * updateTime);
|
||||
|
||||
if (!paused)
|
||||
{
|
||||
|
|
@ -603,7 +602,7 @@ int main(int argc, char* argv[])
|
|||
if (entity == playerEntity)
|
||||
continue;
|
||||
|
||||
Nz::Vector3f spaceshipPos = node.GetPosition(Nz::CoordSys::Global);
|
||||
Nz::Vector3f spaceshipPos = node.GetGlobalPosition();
|
||||
if (spaceshipPos.GetSquaredLength() > Nz::IntegralPow(20.f, 2))
|
||||
registry.destroy(entity);
|
||||
}
|
||||
|
|
@ -646,8 +645,8 @@ int main(int argc, char* argv[])
|
|||
|
||||
Nz::DebugDrawer& debugDrawer = renderSystem.GetFramePipeline().GetDebugDrawer();
|
||||
auto& lightNode = lightEntity3.get<Nz::NodeComponent>();
|
||||
//debugDrawer.DrawLine(lightNode.GetPosition(Nz::CoordSys::Global), lightNode.GetForward() * 10.f, Nz::Color::Blue());
|
||||
Nz::Vector3f pos = lightNode.GetPosition(Nz::CoordSys::Global);
|
||||
//debugDrawer.DrawLine(lightNode.GetGlobalPosition(), lightNode.GetForward() * 10.f, Nz::Color::Blue());
|
||||
Nz::Vector3f pos = lightNode.GetGlobalPosition();
|
||||
debugDrawer.DrawPoint(pos, Nz::Color::Blue());
|
||||
/*debugDrawer.DrawBox(floorBox, Nz::Color::Red);
|
||||
Nz::Boxf intersection;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ end
|
|||
target("Showcase")
|
||||
set_group("Examples")
|
||||
set_kind("binary")
|
||||
add_deps("NazaraAudio", "NazaraGraphics", "NazaraChipmunkPhysics2D", "NazaraBulletPhysics3D", "NazaraJoltPhysics3D", "NazaraWidgets")
|
||||
add_deps("NazaraAudio", "NazaraGraphics", "NazaraPhysics2D", "NazaraPhysics3D", "NazaraWidgets")
|
||||
if has_config("embed_plugins", "static") then
|
||||
add_deps("PluginAssimp")
|
||||
else
|
||||
|
|
|
|||
|
|
@ -2,17 +2,18 @@
|
|||
#include <Nazara/Core.hpp>
|
||||
#include <Nazara/Graphics.hpp>
|
||||
#include <Nazara/Network.hpp>
|
||||
#include <Nazara/BulletPhysics3D.hpp>
|
||||
#include <Nazara/ChipmunkPhysics2D.hpp>
|
||||
#include <Nazara/Physics3D.hpp>
|
||||
#include <Nazara/Physics2D.hpp>
|
||||
#include <Nazara/Renderer.hpp>
|
||||
#include <Nazara/Utility.hpp>
|
||||
#include <Nazara/TextRenderer.hpp>
|
||||
#include <Nazara/Widgets.hpp>
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
// This "example" has only one purpose: Giving an empty project for you to test whatever you want
|
||||
// If you wish to have multiple test projects, you only have to copy/paste this directory and change the name in the xmake.lua
|
||||
Nz::Application<Nz::Audio, Nz::Core, Nz::Graphics, Nz::Network, Nz::ChipmunkPhysics2D, Nz::BulletPhysics3D, Nz::Renderer, Nz::Utility> app(argc, argv);
|
||||
Nz::Application<Nz::Audio, Nz::Core, Nz::Graphics, Nz::Network, Nz::Physics2D, Nz::Physics3D, Nz::Renderer, Nz::TextRenderer, Nz::Widgets> app(argc, argv);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
target("Tut00_EmptyProject")
|
||||
add_deps("NazaraAudio", "NazaraGraphics", "NazaraNetwork", "NazaraChipmunkPhysics2D", "NazaraBulletPhysics3D", "NazaraRenderer", "NazaraUtility")
|
||||
add_packages("entt")
|
||||
add_defines("NAZARA_ENTT")
|
||||
add_deps("NazaraAudio", "NazaraGraphics", "NazaraNetwork", "NazaraPhysics2D", "NazaraPhysics3D", "NazaraRenderer", "NazaraTextRenderer", "NazaraWidgets")
|
||||
add_files("main.cpp")
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
#include <Nazara/Core.hpp>
|
||||
#include <Nazara/Graphics.hpp>
|
||||
#include <Nazara/Platform/AppWindowingComponent.hpp>
|
||||
#include <Nazara/Platform/WindowingAppComponent.hpp>
|
||||
#include <Nazara/Renderer.hpp>
|
||||
#include <Nazara/Utility.hpp>
|
||||
#include <Nazara/TextRenderer/SimpleTextDrawer.hpp>
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
|
|
@ -12,10 +12,10 @@ int main(int argc, char* argv[])
|
|||
// Mise en place de l'application, de la fenêtre et du monde
|
||||
Nz::Application<Nz::Graphics> app(argc, argv);
|
||||
|
||||
auto& windowing = app.AddComponent<Nz::AppWindowingComponent>();
|
||||
auto& windowing = app.AddComponent<Nz::WindowingAppComponent>();
|
||||
Nz::Window& mainWindow = windowing.CreateWindow(Nz::VideoMode(1280, 720), "Tut01 - Hello world");
|
||||
|
||||
auto& ecs = app.AddComponent<Nz::AppEntitySystemComponent>();
|
||||
auto& ecs = app.AddComponent<Nz::EntitySystemAppComponent>();
|
||||
auto& world = ecs.AddWorld<Nz::EnttWorld>();
|
||||
|
||||
auto& renderSystem = world.AddSystem<Nz::RenderSystem>();
|
||||
|
|
@ -48,7 +48,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
Nz::Boxf textBox = textSprite->GetAABB();
|
||||
Nz::Vector2ui windowSize = mainWindow.GetSize();
|
||||
nodeComponent.SetPosition(windowSize.x / 2 - textBox.width / 2, windowSize.y / 2 - textBox.height / 2);
|
||||
nodeComponent.SetPosition({ windowSize.x / 2 - textBox.width / 2, windowSize.y / 2 - textBox.height / 2 });
|
||||
}
|
||||
|
||||
return app.Run();
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
#include <Nazara/Core.hpp>
|
||||
#include <Nazara/Graphics.hpp>
|
||||
#include <Nazara/Platform/AppWindowingComponent.hpp>
|
||||
#include <Nazara/Platform/WindowingAppComponent.hpp>
|
||||
#include <Nazara/Renderer.hpp>
|
||||
#include <Nazara/Utility.hpp>
|
||||
#include <Nazara/TextRenderer/SimpleTextDrawer.hpp>
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
|
|
@ -12,11 +12,11 @@ int main(int argc, char* argv[])
|
|||
Nz::Application<Nz::Graphics> app(argc, argv);
|
||||
|
||||
// Création de la fenêtre
|
||||
auto& windowing = app.AddComponent<Nz::AppWindowingComponent>();
|
||||
auto& windowing = app.AddComponent<Nz::WindowingAppComponent>();
|
||||
Nz::Window& mainWindow = windowing.CreateWindow(Nz::VideoMode(1280, 720), "Tut02 - Events");
|
||||
|
||||
// Ajout d'un monde
|
||||
auto& ecs = app.AddComponent<Nz::AppEntitySystemComponent>();
|
||||
auto& ecs = app.AddComponent<Nz::EntitySystemAppComponent>();
|
||||
auto& world = ecs.AddWorld<Nz::EnttWorld>();
|
||||
|
||||
Nz::RenderSystem& renderSystem = world.AddSystem<Nz::RenderSystem>();
|
||||
|
|
@ -53,7 +53,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
Nz::Boxf textBox = textSprite->GetAABB();
|
||||
Nz::Vector2ui windowSize = mainWindow.GetSize();
|
||||
nodeComponent.SetPosition(windowSize.x / 2 - textBox.width / 2, windowSize.y / 2 - textBox.height / 2);
|
||||
nodeComponent.SetPosition({ windowSize.x / 2 - textBox.width / 2, windowSize.y / 2 - textBox.height / 2 });
|
||||
}
|
||||
|
||||
eventHandler.OnKeyPressed.Connect([&](const Nz::WindowEventHandler*, const Nz::WindowEvent::KeyEvent& e)
|
||||
|
|
@ -65,7 +65,7 @@ int main(int argc, char* argv[])
|
|||
Nz::Vector2ui windowSize = mainWindow.GetSize();
|
||||
|
||||
auto& nodeComponent = textEntity.get<Nz::NodeComponent>();
|
||||
nodeComponent.SetPosition(windowSize.x / 2 - textBox.width / 2, windowSize.y / 2 - textBox.height / 2);
|
||||
nodeComponent.SetPosition({ windowSize.x / 2 - textBox.width / 2, windowSize.y / 2 - textBox.height / 2 });
|
||||
|
||||
// Profitons-en aussi pour nous donner un moyen de quitter le programme
|
||||
if (e.virtualKey == Nz::Keyboard::VKey::Escape)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include <Nazara/Graphics.hpp>
|
||||
#include <Nazara/Math/PidController.hpp>
|
||||
#include <Nazara/Renderer.hpp>
|
||||
#include <Nazara/Utility.hpp>
|
||||
#include <Nazara/TextRenderer.hpp>
|
||||
#include <Nazara/Widgets.hpp>
|
||||
#include <entt/entt.hpp>
|
||||
#include <array>
|
||||
|
|
@ -16,13 +16,13 @@ int main(int argc, char* argv[])
|
|||
{
|
||||
Nz::Application<Nz::Graphics, Nz::Widgets> app(argc, argv);
|
||||
|
||||
auto& windowing = app.AddComponent<Nz::AppWindowingComponent>();
|
||||
auto& windowing = app.AddComponent<Nz::WindowingAppComponent>();
|
||||
Nz::Window& mainWindow = windowing.CreateWindow(Nz::VideoMode(1920, 1080), "Widget demo");
|
||||
|
||||
auto& ecs = app.AddComponent<Nz::AppEntitySystemComponent>();
|
||||
auto& ecs = app.AddComponent<Nz::EntitySystemAppComponent>();
|
||||
auto& world = ecs.AddWorld<Nz::EnttWorld>();
|
||||
|
||||
auto& fs = app.AddComponent<Nz::AppFilesystemComponent>();
|
||||
auto& fs = app.AddComponent<Nz::FilesystemAppComponent>();
|
||||
{
|
||||
std::filesystem::path resourceDir = "assets/examples";
|
||||
if (!std::filesystem::is_directory(resourceDir) && std::filesystem::is_directory("../.." / resourceDir))
|
||||
|
|
@ -38,19 +38,15 @@ int main(int argc, char* argv[])
|
|||
canvas2D.Resize(Nz::Vector2f(mainWindow.GetSize()));
|
||||
|
||||
Nz::LabelWidget* labelWidget = canvas2D.Add<Nz::LabelWidget>();
|
||||
labelWidget->SetPosition(0.f, 200.f, 0.f);
|
||||
labelWidget->SetPosition({ 0.f, 200.f });
|
||||
labelWidget->UpdateText(Nz::SimpleTextDrawer::Draw("Je suis un LabelWidget !", 72));
|
||||
|
||||
unsigned int clickCount = 0;
|
||||
|
||||
Nz::ButtonWidget* buttonWidget = canvas2D.Add<Nz::ButtonWidget>();
|
||||
buttonWidget->SetPosition(200.f, 400.f);
|
||||
buttonWidget->SetPosition({ 200.f, 400.f });
|
||||
buttonWidget->UpdateText(Nz::SimpleTextDrawer::Draw("Press me senpai", 72));
|
||||
buttonWidget->Resize(buttonWidget->GetPreferredSize());
|
||||
buttonWidget->OnButtonTrigger.Connect([&](const Nz::ButtonWidget*)
|
||||
{
|
||||
labelWidget->UpdateText(Nz::SimpleTextDrawer::Draw("You clicked the button " + std::to_string(++clickCount) + " times", 72));
|
||||
});
|
||||
|
||||
Nz::TextureSamplerInfo samplerInfo;
|
||||
samplerInfo.anisotropyLevel = 8;
|
||||
|
|
@ -59,15 +55,15 @@ int main(int argc, char* argv[])
|
|||
materialInstance->SetTextureProperty("BaseColorMap", fs.Load<Nz::Texture>("assets/lynix.jpg"));
|
||||
|
||||
Nz::ImageWidget* imageWidget = canvas2D.Add<Nz::ImageWidget>(materialInstance);
|
||||
imageWidget->SetPosition(1200.f, 200.f);
|
||||
imageWidget->SetPosition({ 1200.f, 200.f });
|
||||
imageWidget->Resize(imageWidget->GetPreferredSize() / 4.f);
|
||||
|
||||
Nz::ImageButtonWidget* imageButtonWidget = canvas2D.Add<Nz::ImageButtonWidget>(materialInstance);
|
||||
imageButtonWidget->SetPosition(1400, 500.f);
|
||||
imageButtonWidget->SetPosition({ 1400, 500.f });
|
||||
imageButtonWidget->Resize(imageButtonWidget->GetPreferredSize() / 4.f);
|
||||
|
||||
Nz::TextAreaWidget* textAreaWidget = canvas2D.Add<Nz::TextAreaWidget>();
|
||||
textAreaWidget->SetPosition(800.f, 500.f);
|
||||
textAreaWidget->SetPosition({ 800.f, 500.f });
|
||||
textAreaWidget->SetText("Je suis un TextAreaWidget !");
|
||||
textAreaWidget->Resize(Nz::Vector2f(400.f, textAreaWidget->GetPreferredHeight() * 5.f));
|
||||
textAreaWidget->SetBackgroundColor(Nz::Color::White());
|
||||
|
|
@ -76,7 +72,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
Nz::CheckboxWidget* checkboxWidget = canvas2D.Add<Nz::CheckboxWidget>();
|
||||
//checkboxWidget->EnableTristate(true);
|
||||
checkboxWidget->SetPosition(800.f, 800.f);
|
||||
checkboxWidget->SetPosition({ 800.f, 800.f });
|
||||
checkboxWidget->Resize({ 256.f, 256 });
|
||||
checkboxWidget->SetState(true);
|
||||
|
||||
|
|
@ -88,12 +84,12 @@ int main(int argc, char* argv[])
|
|||
longTextArea->SetText("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum");
|
||||
|
||||
Nz::ScrollAreaWidget* scrollBarWidget = canvas2D.Add<Nz::ScrollAreaWidget>(longTextArea);
|
||||
scrollBarWidget->SetPosition(1400.f, 800.f);
|
||||
scrollBarWidget->SetPosition({ 1400.f, 800.f });
|
||||
scrollBarWidget->Resize({ 512.f, 256.f });
|
||||
|
||||
Nz::RichTextAreaWidget* textAreaWidget2 = canvas2D.Add<Nz::RichTextAreaWidget>();
|
||||
textAreaWidget2->EnableMultiline(true);
|
||||
textAreaWidget2->SetPosition(1000.f, 200.f);
|
||||
textAreaWidget2->SetPosition({ 1000.f, 200.f });
|
||||
textAreaWidget2->SetBackgroundColor(Nz::Color::White());
|
||||
textAreaWidget2->SetTextColor(Nz::Color::Black());
|
||||
|
||||
|
|
@ -101,6 +97,19 @@ int main(int argc, char* argv[])
|
|||
builder << Nz::Color::Blue() << "Rich " << Nz::TextStyle::Bold << "text" << Nz::TextStyle_Regular << builder.CharacterSize(36) << Nz::Color::Black() << "\nAnd a even " << builder.CharacterSize(48) << Nz::Color::Red() << "bigger" << builder.CharacterSize(24) << Nz::Color::Black() << " text";
|
||||
textAreaWidget2->Resize(Nz::Vector2f(500.f, textAreaWidget2->GetPreferredHeight()));
|
||||
|
||||
Nz::ProgressBarWidget* progressBarWidget = canvas2D.Add<Nz::ProgressBarWidget>();
|
||||
progressBarWidget->SetPosition({ 200.f, 600.f });
|
||||
progressBarWidget->Resize({ 512.f, 64.f });
|
||||
|
||||
buttonWidget->OnButtonTrigger.Connect([&](const Nz::ButtonWidget*)
|
||||
{
|
||||
labelWidget->UpdateText(Nz::SimpleTextDrawer::Draw("You clicked the button " + std::to_string(++clickCount) + " times", 72));
|
||||
if (progressBarWidget->GetFraction() >= 1.f)
|
||||
progressBarWidget->SetFraction(0.f);
|
||||
else
|
||||
progressBarWidget->SetFraction(progressBarWidget->GetFraction() + 0.1001f); //< ensures ten clicks go over 1
|
||||
});
|
||||
|
||||
entt::handle viewer2D = world.CreateEntity();
|
||||
{
|
||||
viewer2D.emplace<Nz::NodeComponent>();
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
/*
|
||||
Nazara Engine - Audio module
|
||||
|
||||
Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@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
|
||||
|
|
@ -34,17 +34,18 @@
|
|||
#include <Nazara/Audio/AudioBuffer.hpp>
|
||||
#include <Nazara/Audio/AudioDevice.hpp>
|
||||
#include <Nazara/Audio/AudioSource.hpp>
|
||||
#include <Nazara/Audio/Config.hpp>
|
||||
#include <Nazara/Audio/DummyAudioBuffer.hpp>
|
||||
#include <Nazara/Audio/DummyAudioDevice.hpp>
|
||||
#include <Nazara/Audio/DummyAudioSource.hpp>
|
||||
#include <Nazara/Audio/Enums.hpp>
|
||||
#include <Nazara/Audio/Export.hpp>
|
||||
#include <Nazara/Audio/Music.hpp>
|
||||
#include <Nazara/Audio/OpenAL.hpp>
|
||||
#include <Nazara/Audio/OpenALBuffer.hpp>
|
||||
#include <Nazara/Audio/OpenALDevice.hpp>
|
||||
#include <Nazara/Audio/OpenALLibrary.hpp>
|
||||
#include <Nazara/Audio/OpenALSource.hpp>
|
||||
#include <Nazara/Audio/OpenALUtils.hpp>
|
||||
#include <Nazara/Audio/Sound.hpp>
|
||||
#include <Nazara/Audio/SoundBuffer.hpp>
|
||||
#include <Nazara/Audio/SoundEmitter.hpp>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Audio/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
|
@ -114,4 +113,3 @@ namespace Nz
|
|||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Audio/DebugOff.hpp>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
|
|
@ -8,8 +8,8 @@
|
|||
#define NAZARA_AUDIO_HPP
|
||||
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/Audio/Config.hpp>
|
||||
#include <Nazara/Audio/Enums.hpp>
|
||||
#include <Nazara/Audio/Export.hpp>
|
||||
#include <Nazara/Audio/SoundBuffer.hpp>
|
||||
#include <Nazara/Audio/SoundStream.hpp>
|
||||
#include <Nazara/Core/Core.hpp>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
|
|
@ -8,8 +8,8 @@
|
|||
#define NAZARA_AUDIO_AUDIOBUFFER_HPP
|
||||
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/Audio/Config.hpp>
|
||||
#include <Nazara/Audio/Enums.hpp>
|
||||
#include <Nazara/Audio/Export.hpp>
|
||||
#include <memory>
|
||||
|
||||
namespace Nz
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#include <Nazara/Audio/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
|
@ -17,4 +16,3 @@ namespace Nz
|
|||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Audio/DebugOff.hpp>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
|
|
@ -8,8 +8,8 @@
|
|||
#define NAZARA_AUDIO_AUDIODEVICE_HPP
|
||||
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/Audio/Config.hpp>
|
||||
#include <Nazara/Audio/Enums.hpp>
|
||||
#include <Nazara/Audio/Export.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/Math/Quaternion.hpp>
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#include <Nazara/Audio/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
|
@ -12,4 +11,3 @@ namespace Nz
|
|||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Audio/DebugOff.hpp>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
|
|
@ -8,8 +8,8 @@
|
|||
#define NAZARA_AUDIO_AUDIOSOURCE_HPP
|
||||
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/Audio/Config.hpp>
|
||||
#include <Nazara/Audio/Enums.hpp>
|
||||
#include <Nazara/Audio/Export.hpp>
|
||||
#include <Nazara/Core/Time.hpp>
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#include <Nazara/Audio/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
|
@ -17,4 +16,3 @@ namespace Nz
|
|||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Audio/DebugOff.hpp>
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_AUDIO_CONFIGCHECK_HPP
|
||||
#define NAZARA_AUDIO_CONFIGCHECK_HPP
|
||||
|
||||
/// This file is used to check the constant values defined in Config.hpp
|
||||
|
||||
#include <type_traits>
|
||||
#define NazaraCheckTypeAndVal(name, type, op, val, err) static_assert(std::is_ ##type <decltype(name)>::value && name op val, #type err)
|
||||
|
||||
// config checks
|
||||
|
||||
#undef NazaraCheckTypeAndVal
|
||||
|
||||
#endif // NAZARA_AUDIO_CONFIGCHECK_HPP
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
// no header guards
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
// no header guards
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
|
|
@ -9,8 +9,8 @@
|
|||
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/Audio/AudioBuffer.hpp>
|
||||
#include <Nazara/Audio/Config.hpp>
|
||||
#include <Nazara/Audio/Enums.hpp>
|
||||
#include <Nazara/Audio/Export.hpp>
|
||||
#include <Nazara/Core/Time.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
|
|
|||
|
|
@ -1,11 +1,9 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#include <Nazara/Audio/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
}
|
||||
|
||||
#include <Nazara/Audio/DebugOff.hpp>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
|
|
@ -9,8 +9,8 @@
|
|||
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/Audio/AudioDevice.hpp>
|
||||
#include <Nazara/Audio/Config.hpp>
|
||||
#include <Nazara/Audio/Enums.hpp>
|
||||
#include <Nazara/Audio/Export.hpp>
|
||||
#include <array>
|
||||
#include <string>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,9 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#include <Nazara/Audio/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
}
|
||||
|
||||
#include <Nazara/Audio/DebugOff.hpp>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/Audio/AudioSource.hpp>
|
||||
#include <Nazara/Audio/Config.hpp>
|
||||
#include <Nazara/Audio/Export.hpp>
|
||||
#include <Nazara/Core/Clock.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#include <Nazara/Audio/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
|
@ -22,4 +21,3 @@ namespace Nz
|
|||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Audio/DebugOff.hpp>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
Nazara Engine - Audio module
|
||||
|
||||
Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@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
|
||||
|
|
@ -24,22 +24,14 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_AUDIO_CONFIG_HPP
|
||||
#define NAZARA_AUDIO_CONFIG_HPP
|
||||
#ifndef NAZARA_AUDIO_EXPORT_HPP
|
||||
#define NAZARA_AUDIO_EXPORT_HPP
|
||||
|
||||
/*!
|
||||
* \defgroup audio (NazaraAudio) Audio module
|
||||
* Audio/System module including classes to handle music, sound, etc...
|
||||
*/
|
||||
|
||||
/// Each modification of a parameter needs a recompilation of the module
|
||||
|
||||
// Activate the security tests based on the code (Advised for development)
|
||||
#define NAZARA_AUDIO_SAFE 1
|
||||
|
||||
/// Checking the values and types of certain constants
|
||||
#include <Nazara/Audio/ConfigCheck.hpp>
|
||||
|
||||
#if !defined(NAZARA_STATIC)
|
||||
#ifdef NAZARA_AUDIO_BUILD
|
||||
#define NAZARA_AUDIO_API NAZARA_EXPORT
|
||||
|
|
@ -50,4 +42,4 @@
|
|||
#define NAZARA_AUDIO_API
|
||||
#endif
|
||||
|
||||
#endif // NAZARA_AUDIO_CONFIG_HPP
|
||||
#endif // NAZARA_AUDIO_EXPORT_HPP
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/Audio/AudioBuffer.hpp>
|
||||
#include <Nazara/Audio/Config.hpp>
|
||||
#include <Nazara/Audio/Export.hpp>
|
||||
#include <Nazara/Audio/OpenAL.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#include <Nazara/Audio/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
|
@ -18,4 +17,3 @@ namespace Nz
|
|||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Audio/DebugOff.hpp>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
|
|
@ -11,10 +11,10 @@
|
|||
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/Audio/AudioDevice.hpp>
|
||||
#include <Nazara/Audio/Config.hpp>
|
||||
#include <Nazara/Audio/Enums.hpp>
|
||||
#include <Nazara/Audio/Export.hpp>
|
||||
#include <Nazara/Audio/OpenAL.hpp>
|
||||
#include <Nazara/Core/Algorithm.hpp>
|
||||
#include <NazaraUtils/Algorithm.hpp>
|
||||
#include <NazaraUtils/EnumArray.hpp>
|
||||
#include <NazaraUtils/MovablePtr.hpp>
|
||||
#include <array>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#include <Nazara/Core/Algorithm.hpp>
|
||||
#include <Nazara/Audio/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
|
@ -34,4 +32,3 @@ namespace Nz
|
|||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Audio/DebugOff.hpp>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
// no header guards
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
|
|
@ -10,8 +10,8 @@
|
|||
#if defined(NAZARA_AUDIO_OPENAL) || defined(NAZARA_AUDIO_BUILD)
|
||||
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/Audio/Config.hpp>
|
||||
#include <Nazara/Audio/Enums.hpp>
|
||||
#include <Nazara/Audio/Export.hpp>
|
||||
#include <Nazara/Audio/OpenAL.hpp>
|
||||
#include <Nazara/Core/DynLib.hpp>
|
||||
#include <string>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#include <Nazara/Audio/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
|
@ -23,4 +22,3 @@ namespace Nz
|
|||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Audio/DebugOff.hpp>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/Audio/AudioSource.hpp>
|
||||
#include <Nazara/Audio/Config.hpp>
|
||||
#include <Nazara/Audio/Export.hpp>
|
||||
#include <Nazara/Audio/OpenAL.hpp>
|
||||
|
||||
namespace Nz
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#include <Nazara/Audio/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
|
@ -13,4 +12,3 @@ namespace Nz
|
|||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Audio/DebugOff.hpp>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
#if defined(NAZARA_AUDIO_OPENAL) || defined(NAZARA_AUDIO_BUILD)
|
||||
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/Audio/Config.hpp>
|
||||
#include <Nazara/Audio/Export.hpp>
|
||||
#include <Nazara/Audio/OpenAL.hpp>
|
||||
#include <string>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
|
|
@ -9,8 +9,8 @@
|
|||
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/Audio/AudioDevice.hpp>
|
||||
#include <Nazara/Audio/Config.hpp>
|
||||
#include <Nazara/Audio/Enums.hpp>
|
||||
#include <Nazara/Audio/Export.hpp>
|
||||
#include <Nazara/Core/ObjectLibrary.hpp>
|
||||
#include <Nazara/Core/Resource.hpp>
|
||||
#include <Nazara/Core/ResourceLoader.hpp>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#include <Nazara/Audio/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
|
@ -18,8 +17,6 @@ namespace Nz
|
|||
/*!
|
||||
* \brief Gets the format of the sound buffer
|
||||
* \return Enumeration of type AudioFormat (mono, stereo, ...)
|
||||
*
|
||||
* \remark Produces a NazaraError if there is no sound buffer with NAZARA_AUDIO_SAFE defined
|
||||
*/
|
||||
inline AudioFormat SoundBuffer::GetFormat() const
|
||||
{
|
||||
|
|
@ -29,8 +26,6 @@ namespace Nz
|
|||
/*!
|
||||
* \brief Gets the internal raw samples
|
||||
* \return Pointer to raw data
|
||||
*
|
||||
* \remark Produces a NazaraError if there is no sound buffer with NAZARA_AUDIO_SAFE defined
|
||||
*/
|
||||
inline const Int16* SoundBuffer::GetSamples() const
|
||||
{
|
||||
|
|
@ -40,8 +35,6 @@ namespace Nz
|
|||
/*!
|
||||
* \brief Gets the number of samples in the sound buffer
|
||||
* \return Count of samples (number of seconds * sample rate * channel count)
|
||||
*
|
||||
* \remark Produces a NazaraError if there is no sound buffer with NAZARA_AUDIO_SAFE defined
|
||||
*/
|
||||
inline UInt64 SoundBuffer::GetSampleCount() const
|
||||
{
|
||||
|
|
@ -51,8 +44,6 @@ namespace Nz
|
|||
/*!
|
||||
* \brief Gets the rates of sample in the sound buffer
|
||||
* \return Rate of sample in Hertz (Hz)
|
||||
*
|
||||
* \remark Produces a NazaraError if there is no sound buffer with NAZARA_AUDIO_SAFE defined
|
||||
*/
|
||||
inline UInt32 SoundBuffer::GetSampleRate() const
|
||||
{
|
||||
|
|
@ -60,4 +51,3 @@ namespace Nz
|
|||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Audio/DebugOff.hpp>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
|
|
@ -8,8 +8,8 @@
|
|||
#define NAZARA_AUDIO_SOUNDEMITTER_HPP
|
||||
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/Audio/Config.hpp>
|
||||
#include <Nazara/Audio/Enums.hpp>
|
||||
#include <Nazara/Audio/Export.hpp>
|
||||
#include <Nazara/Core/Time.hpp>
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
#include <limits>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#include <Nazara/Audio/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
|
|
@ -16,4 +15,3 @@ namespace Nz
|
|||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Audio/DebugOff.hpp>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// Copyright (C) 2024 Jérôme "SirLynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - Audio module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
// For conditions of distribution and use, see copyright notice in Export.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
|
|
@ -8,8 +8,8 @@
|
|||
#define NAZARA_AUDIO_SOUNDSTREAM_HPP
|
||||
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/Audio/Config.hpp>
|
||||
#include <Nazara/Audio/Enums.hpp>
|
||||
#include <Nazara/Audio/Export.hpp>
|
||||
#include <Nazara/Core/Resource.hpp>
|
||||
#include <Nazara/Core/ResourceLoader.hpp>
|
||||
#include <Nazara/Core/ResourceParameters.hpp>
|
||||
|
|
|
|||
|
|
@ -1,240 +0,0 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_BULLETPHYSICS3D_BULLETCOLLIDER3D_HPP
|
||||
#define NAZARA_BULLETPHYSICS3D_BULLETCOLLIDER3D_HPP
|
||||
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/BulletPhysics3D/Config.hpp>
|
||||
#include <Nazara/BulletPhysics3D/Enums.hpp>
|
||||
#include <Nazara/Core/ObjectLibrary.hpp>
|
||||
#include <Nazara/Math/Box.hpp>
|
||||
#include <Nazara/Math/Plane.hpp>
|
||||
#include <Nazara/Math/Quaternion.hpp>
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
#include <NazaraUtils/Signal.hpp>
|
||||
#include <NazaraUtils/SparsePtr.hpp>
|
||||
#include <memory>
|
||||
|
||||
class btBoxShape;
|
||||
class btCapsuleShape;
|
||||
class btCompoundShape;
|
||||
class btCollisionShape;
|
||||
class btConeShape;
|
||||
class btConvexHullShape;
|
||||
class btCylinderShape;
|
||||
class btEmptyShape;
|
||||
class btSphereShape;
|
||||
class btStaticPlaneShape;
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class PrimitiveList;
|
||||
class StaticMesh;
|
||||
struct Primitive;
|
||||
|
||||
class NAZARA_BULLETPHYSICS3D_API BulletCollider3D
|
||||
{
|
||||
public:
|
||||
BulletCollider3D() = default;
|
||||
BulletCollider3D(const BulletCollider3D&) = delete;
|
||||
BulletCollider3D(BulletCollider3D&&) = delete;
|
||||
virtual ~BulletCollider3D();
|
||||
|
||||
virtual void BuildDebugMesh(std::vector<Vector3f>& vertices, std::vector<UInt16>& indices, const Matrix4f& offsetMatrix = Matrix4f::Identity()) const = 0;
|
||||
|
||||
Boxf ComputeAABB(const Vector3f& translation, const Quaternionf& rotation, const Vector3f& scale) const;
|
||||
virtual Boxf ComputeAABB(const Matrix4f& offsetMatrix = Matrix4f::Identity(), const Vector3f& scale = Vector3f::Unit()) const;
|
||||
virtual void ComputeInertia(float mass, Vector3f* inertia) const;
|
||||
|
||||
virtual std::shared_ptr<StaticMesh> GenerateDebugMesh() const;
|
||||
|
||||
virtual btCollisionShape* GetShape() const = 0;
|
||||
virtual BulletColliderType3D GetType() const = 0;
|
||||
|
||||
BulletCollider3D& operator=(const BulletCollider3D&) = delete;
|
||||
BulletCollider3D& operator=(BulletCollider3D&&) = delete;
|
||||
|
||||
static std::shared_ptr<BulletCollider3D> Build(const PrimitiveList& list);
|
||||
|
||||
private:
|
||||
static std::shared_ptr<BulletCollider3D> CreateGeomFromPrimitive(const Primitive& primitive);
|
||||
};
|
||||
|
||||
class NAZARA_BULLETPHYSICS3D_API BulletBoxCollider3D final : public BulletCollider3D
|
||||
{
|
||||
public:
|
||||
BulletBoxCollider3D(const Vector3f& lengths);
|
||||
~BulletBoxCollider3D();
|
||||
|
||||
void BuildDebugMesh(std::vector<Vector3f>& vertices, std::vector<UInt16>& indices, const Matrix4f& offsetMatrix) const override;
|
||||
|
||||
Vector3f GetLengths() const;
|
||||
btCollisionShape* GetShape() const override;
|
||||
BulletColliderType3D GetType() const override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<btBoxShape> m_shape;
|
||||
Vector3f m_lengths;
|
||||
};
|
||||
|
||||
class NAZARA_BULLETPHYSICS3D_API BulletCapsuleCollider3D final : public BulletCollider3D
|
||||
{
|
||||
public:
|
||||
BulletCapsuleCollider3D(float length, float radius);
|
||||
~BulletCapsuleCollider3D();
|
||||
|
||||
void BuildDebugMesh(std::vector<Vector3f>& vertices, std::vector<UInt16>& indices, const Matrix4f& offsetMatrix) const override;
|
||||
|
||||
float GetLength() const;
|
||||
float GetRadius() const;
|
||||
btCollisionShape* GetShape() const override;
|
||||
BulletColliderType3D GetType() const override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<btCapsuleShape> m_shape;
|
||||
float m_length;
|
||||
float m_radius;
|
||||
};
|
||||
|
||||
class NAZARA_BULLETPHYSICS3D_API BulletCompoundCollider3D final : public BulletCollider3D
|
||||
{
|
||||
public:
|
||||
struct ChildCollider;
|
||||
|
||||
BulletCompoundCollider3D(std::vector<ChildCollider> childs);
|
||||
~BulletCompoundCollider3D();
|
||||
|
||||
void BuildDebugMesh(std::vector<Vector3f>& vertices, std::vector<UInt16>& indices, const Matrix4f& offsetMatrix) const override;
|
||||
|
||||
const std::vector<ChildCollider>& GetGeoms() const;
|
||||
btCollisionShape* GetShape() const override;
|
||||
BulletColliderType3D GetType() const override;
|
||||
|
||||
struct ChildCollider
|
||||
{
|
||||
std::shared_ptr<BulletCollider3D> collider;
|
||||
Matrix4f offsetMatrix;
|
||||
};
|
||||
|
||||
private:
|
||||
std::unique_ptr<btCompoundShape> m_shape;
|
||||
std::vector<ChildCollider> m_childs;
|
||||
};
|
||||
|
||||
class NAZARA_BULLETPHYSICS3D_API BulletConeCollider3D final : public BulletCollider3D
|
||||
{
|
||||
public:
|
||||
BulletConeCollider3D(float length, float radius);
|
||||
~BulletConeCollider3D();
|
||||
|
||||
void BuildDebugMesh(std::vector<Vector3f>& vertices, std::vector<UInt16>& indices, const Matrix4f& offsetMatrix) const override;
|
||||
|
||||
float GetLength() const;
|
||||
float GetRadius() const;
|
||||
btCollisionShape* GetShape() const override;
|
||||
BulletColliderType3D GetType() const override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<btConeShape> m_shape;
|
||||
float m_length;
|
||||
float m_radius;
|
||||
};
|
||||
|
||||
class NAZARA_BULLETPHYSICS3D_API BulletConvexCollider3D final : public BulletCollider3D
|
||||
{
|
||||
public:
|
||||
BulletConvexCollider3D(SparsePtr<const Vector3f> vertices, unsigned int vertexCount);
|
||||
~BulletConvexCollider3D();
|
||||
|
||||
void BuildDebugMesh(std::vector<Vector3f>& vertices, std::vector<UInt16>& indices, const Matrix4f& offsetMatrix) const override;
|
||||
|
||||
btCollisionShape* GetShape() const override;
|
||||
BulletColliderType3D GetType() const override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<btConvexHullShape> m_shape;
|
||||
};
|
||||
|
||||
class NAZARA_BULLETPHYSICS3D_API BulletCylinderCollider3D final : public BulletCollider3D
|
||||
{
|
||||
public:
|
||||
BulletCylinderCollider3D(float length, float radius);
|
||||
~BulletCylinderCollider3D();
|
||||
|
||||
void BuildDebugMesh(std::vector<Vector3f>& vertices, std::vector<UInt16>& indices, const Matrix4f& offsetMatrix) const override;
|
||||
|
||||
float GetLength() const;
|
||||
float GetRadius() const;
|
||||
btCollisionShape* GetShape() const override;
|
||||
BulletColliderType3D GetType() const override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<btCylinderShape> m_shape;
|
||||
Matrix4f m_matrix;
|
||||
float m_length;
|
||||
float m_radius;
|
||||
};
|
||||
|
||||
class NAZARA_BULLETPHYSICS3D_API BulletNullCollider3D final : public BulletCollider3D
|
||||
{
|
||||
public:
|
||||
BulletNullCollider3D();
|
||||
~BulletNullCollider3D();
|
||||
|
||||
void BuildDebugMesh(std::vector<Vector3f>& vertices, std::vector<UInt16>& indices, const Matrix4f& offsetMatrix) const override;
|
||||
|
||||
void ComputeInertia(float mass, Vector3f* inertia) const override;
|
||||
|
||||
btCollisionShape* GetShape() const override;
|
||||
BulletColliderType3D GetType() const override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<btEmptyShape> m_shape;
|
||||
};
|
||||
|
||||
class NAZARA_BULLETPHYSICS3D_API BulletSphereCollider3D final : public BulletCollider3D
|
||||
{
|
||||
public:
|
||||
BulletSphereCollider3D(float radius);
|
||||
~BulletSphereCollider3D();
|
||||
|
||||
void BuildDebugMesh(std::vector<Vector3f>& vertices, std::vector<UInt16>& indices, const Matrix4f& offsetMatrix) const override;
|
||||
|
||||
float GetRadius() const;
|
||||
btCollisionShape* GetShape() const override;
|
||||
BulletColliderType3D GetType() const override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<btSphereShape> m_shape;
|
||||
Vector3f m_position;
|
||||
float m_radius;
|
||||
};
|
||||
|
||||
class NAZARA_BULLETPHYSICS3D_API BulletStaticPlaneCollider3D final : public BulletCollider3D
|
||||
{
|
||||
public:
|
||||
BulletStaticPlaneCollider3D(const Planef& plane);
|
||||
BulletStaticPlaneCollider3D(const Vector3f& normal, float distance);
|
||||
~BulletStaticPlaneCollider3D();
|
||||
|
||||
void BuildDebugMesh(std::vector<Vector3f>& vertices, std::vector<UInt16>& indices, const Matrix4f& offsetMatrix) const override;
|
||||
|
||||
float GetDistance() const;
|
||||
const Vector3f& GetNormal() const;
|
||||
btCollisionShape* GetShape() const override;
|
||||
BulletColliderType3D GetType() const override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<btStaticPlaneShape> m_shape;
|
||||
Vector3f m_normal;
|
||||
float m_distance;
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/BulletPhysics3D/BulletCollider3D.inl>
|
||||
|
||||
#endif // NAZARA_BULLETPHYSICS3D_BULLETCOLLIDER3D_HPP
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <memory>
|
||||
#include <Nazara/BulletPhysics3D/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
}
|
||||
|
||||
#include <Nazara/BulletPhysics3D/DebugOff.hpp>
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_BULLETPHYSICS3D_BULLETCONSTRAINT3D_HPP
|
||||
#define NAZARA_BULLETPHYSICS3D_BULLETCONSTRAINT3D_HPP
|
||||
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/BulletPhysics3D/BulletPhysWorld3D.hpp>
|
||||
#include <Nazara/BulletPhysics3D/BulletRigidBody3D.hpp>
|
||||
#include <Nazara/BulletPhysics3D/Config.hpp>
|
||||
#include <Nazara/Core/HandledObject.hpp>
|
||||
#include <Nazara/Core/ObjectHandle.hpp>
|
||||
|
||||
class btTypedConstraint;
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class BulletConstraint3D;
|
||||
|
||||
using BulletConstraint3DHandle = ObjectHandle<BulletConstraint3D>;
|
||||
|
||||
class NAZARA_BULLETPHYSICS3D_API BulletConstraint3D : public HandledObject<BulletConstraint3D>
|
||||
{
|
||||
public:
|
||||
BulletConstraint3D(const BulletConstraint3D&) = delete;
|
||||
BulletConstraint3D(BulletConstraint3D&& constraint) noexcept;
|
||||
virtual ~BulletConstraint3D();
|
||||
|
||||
BulletRigidBody3D& GetBodyA();
|
||||
const BulletRigidBody3D& GetBodyA() const;
|
||||
BulletRigidBody3D& GetBodyB();
|
||||
const BulletRigidBody3D& GetBodyB() const;
|
||||
BulletPhysWorld3D& GetWorld();
|
||||
const BulletPhysWorld3D& GetWorld() const;
|
||||
|
||||
inline bool IsBodyCollisionEnabled() const;
|
||||
bool IsSingleBody() const;
|
||||
|
||||
BulletConstraint3D& operator=(const BulletConstraint3D&) = delete;
|
||||
BulletConstraint3D& operator=(BulletConstraint3D&& constraint) noexcept;
|
||||
|
||||
protected:
|
||||
BulletConstraint3D(std::unique_ptr<btTypedConstraint> constraint, bool disableCollisions = false);
|
||||
|
||||
template<typename T> T* GetConstraint();
|
||||
template<typename T> const T* GetConstraint() const;
|
||||
|
||||
private:
|
||||
void Destroy();
|
||||
|
||||
std::unique_ptr<btTypedConstraint> m_constraint;
|
||||
bool m_bodyCollisionEnabled;
|
||||
};
|
||||
|
||||
class NAZARA_BULLETPHYSICS3D_API BulletPivotConstraint3D : public BulletConstraint3D
|
||||
{
|
||||
public:
|
||||
BulletPivotConstraint3D(BulletRigidBody3D& first, const Vector3f& pivot);
|
||||
BulletPivotConstraint3D(BulletRigidBody3D& first, BulletRigidBody3D& second, const Vector3f& pivot, bool disableCollisions = false);
|
||||
BulletPivotConstraint3D(BulletRigidBody3D& first, BulletRigidBody3D& second, const Vector3f& firstAnchor, const Vector3f& secondAnchor, bool disableCollisions = false);
|
||||
~BulletPivotConstraint3D() = default;
|
||||
|
||||
Vector3f GetFirstAnchor() const;
|
||||
Vector3f GetSecondAnchor() const;
|
||||
|
||||
float GetDamping() const;
|
||||
float GetImpulseClamp() const;
|
||||
|
||||
void SetFirstAnchor(const Vector3f& firstAnchor);
|
||||
void SetSecondAnchor(const Vector3f& secondAnchor);
|
||||
|
||||
void SetDamping(float damping);
|
||||
void SetImpulseClamp(float impulseClamp);
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/BulletPhysics3D/BulletConstraint3D.inl>
|
||||
|
||||
#endif // NAZARA_BULLETPHYSICS3D_BULLETCONSTRAINT3D_HPP
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/BulletPhysics3D/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
inline bool BulletConstraint3D::IsBodyCollisionEnabled() const
|
||||
{
|
||||
return m_bodyCollisionEnabled;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T* BulletConstraint3D::GetConstraint()
|
||||
{
|
||||
return SafeCast<T*>(m_constraint.get());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const T* BulletConstraint3D::GetConstraint() const
|
||||
{
|
||||
return SafeCast<const T*>(m_constraint.get());
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/BulletPhysics3D/DebugOff.hpp>
|
||||
|
|
@ -1,77 +0,0 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_BULLETPHYSICS3D_BULLETPHYSWORLD3D_HPP
|
||||
#define NAZARA_BULLETPHYSICS3D_BULLETPHYSWORLD3D_HPP
|
||||
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/BulletPhysics3D/Config.hpp>
|
||||
#include <Nazara/Core/Time.hpp>
|
||||
#include <Nazara/Math/Box.hpp>
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
#include <NazaraUtils/FunctionRef.hpp>
|
||||
#include <NazaraUtils/MovablePtr.hpp>
|
||||
#include <optional>
|
||||
|
||||
class btDynamicsWorld;
|
||||
class btRigidBody;
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class BulletRigidBody3D;
|
||||
|
||||
class NAZARA_BULLETPHYSICS3D_API BulletPhysWorld3D
|
||||
{
|
||||
friend BulletRigidBody3D;
|
||||
|
||||
public:
|
||||
struct RaycastHit;
|
||||
|
||||
BulletPhysWorld3D();
|
||||
BulletPhysWorld3D(const BulletPhysWorld3D&) = delete;
|
||||
BulletPhysWorld3D(BulletPhysWorld3D&& ph) = delete;
|
||||
~BulletPhysWorld3D();
|
||||
|
||||
btDynamicsWorld* GetDynamicsWorld();
|
||||
Vector3f GetGravity() const;
|
||||
std::size_t GetMaxStepCount() const;
|
||||
Time GetStepSize() const;
|
||||
|
||||
bool RaycastQuery(const Vector3f& from, const Vector3f& to, const FunctionRef<std::optional<float>(const RaycastHit& hitInfo)>& callback);
|
||||
bool RaycastQueryFirst(const Vector3f& from, const Vector3f& to, RaycastHit* hitInfo = nullptr);
|
||||
|
||||
void SetGravity(const Vector3f& gravity);
|
||||
void SetMaxStepCount(std::size_t maxStepCount);
|
||||
void SetStepSize(Time stepSize);
|
||||
|
||||
void Step(Time timestep);
|
||||
|
||||
BulletPhysWorld3D& operator=(const BulletPhysWorld3D&) = delete;
|
||||
BulletPhysWorld3D& operator=(BulletPhysWorld3D&&) = delete;
|
||||
|
||||
struct RaycastHit
|
||||
{
|
||||
float fraction;
|
||||
BulletRigidBody3D* hitBody = nullptr;
|
||||
Vector3f hitPosition;
|
||||
Vector3f hitNormal;
|
||||
};
|
||||
|
||||
private:
|
||||
btRigidBody* AddRigidBody(std::size_t& rigidBodyIndex, FunctionRef<void(btRigidBody* body)> constructor);
|
||||
void RemoveRigidBody(btRigidBody* rigidBody, std::size_t rigidBodyIndex);
|
||||
|
||||
struct BulletWorld;
|
||||
|
||||
std::size_t m_maxStepCount;
|
||||
std::unique_ptr<BulletWorld> m_world;
|
||||
Vector3f m_gravity;
|
||||
Time m_stepSize;
|
||||
Time m_timestepAccumulator;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // NAZARA_BULLETPHYSICS3D_BULLETPHYSWORLD3D_HPP
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_BULLETPHYSICS3D_HPP
|
||||
#define NAZARA_BULLETPHYSICS3D_HPP
|
||||
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/BulletPhysics3D/Config.hpp>
|
||||
#include <Nazara/Core/Core.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class NAZARA_BULLETPHYSICS3D_API BulletPhysics3D : public ModuleBase<BulletPhysics3D>
|
||||
{
|
||||
friend ModuleBase;
|
||||
|
||||
public:
|
||||
using Dependencies = TypeList<Core>;
|
||||
|
||||
struct Config {};
|
||||
|
||||
BulletPhysics3D(Config /*config*/);
|
||||
~BulletPhysics3D() = default;
|
||||
|
||||
private:
|
||||
static BulletPhysics3D* s_instance;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // NAZARA_BULLETPHYSICS3D_HPP
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_BULLETPHYSICS3D_BULLETRIGIDBODY3D_HPP
|
||||
#define NAZARA_BULLETPHYSICS3D_BULLETRIGIDBODY3D_HPP
|
||||
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/BulletPhysics3D/BulletCollider3D.hpp>
|
||||
#include <Nazara/BulletPhysics3D/Config.hpp>
|
||||
#include <Nazara/Core/Enums.hpp>
|
||||
#include <Nazara/Math/Matrix4.hpp>
|
||||
#include <Nazara/Math/Quaternion.hpp>
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
#include <NazaraUtils/MovablePtr.hpp>
|
||||
|
||||
class btRigidBody;
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class BulletPhysWorld3D;
|
||||
|
||||
class NAZARA_BULLETPHYSICS3D_API BulletRigidBody3D
|
||||
{
|
||||
public:
|
||||
BulletRigidBody3D(BulletPhysWorld3D* world, const Matrix4f& mat = Matrix4f::Identity());
|
||||
BulletRigidBody3D(BulletPhysWorld3D* world, std::shared_ptr<BulletCollider3D> geom, const Matrix4f& mat = Matrix4f::Identity());
|
||||
BulletRigidBody3D(const BulletRigidBody3D& object) = delete;
|
||||
BulletRigidBody3D(BulletRigidBody3D&& object) noexcept;
|
||||
~BulletRigidBody3D();
|
||||
|
||||
void AddForce(const Vector3f& force, CoordSys coordSys = CoordSys::Global);
|
||||
void AddForce(const Vector3f& force, const Vector3f& point, CoordSys coordSys = CoordSys::Global);
|
||||
void AddTorque(const Vector3f& torque, CoordSys coordSys = CoordSys::Global);
|
||||
|
||||
inline void DisableSleeping();
|
||||
void EnableSleeping(bool enable);
|
||||
|
||||
void FallAsleep();
|
||||
|
||||
Boxf GetAABB() const;
|
||||
float GetAngularDamping() const;
|
||||
Vector3f GetAngularVelocity() const;
|
||||
inline const std::shared_ptr<BulletCollider3D>& GetGeom() const;
|
||||
float GetLinearDamping() const;
|
||||
Vector3f GetLinearVelocity() const;
|
||||
float GetMass() const;
|
||||
Vector3f GetMassCenter(CoordSys coordSys = CoordSys::Local) const;
|
||||
Matrix4f GetMatrix() const;
|
||||
Vector3f GetPosition() const;
|
||||
inline btRigidBody* GetRigidBody() const;
|
||||
Quaternionf GetRotation() const;
|
||||
inline std::size_t GetUniqueIndex() const;
|
||||
inline BulletPhysWorld3D* GetWorld() const;
|
||||
|
||||
bool IsSimulationEnabled() const;
|
||||
bool IsSleeping() const;
|
||||
bool IsSleepingEnabled() const;
|
||||
|
||||
void SetAngularDamping(float angularDamping);
|
||||
void SetAngularVelocity(const Vector3f& angularVelocity);
|
||||
void SetGeom(std::shared_ptr<BulletCollider3D> geom, bool recomputeInertia = true);
|
||||
void SetLinearDamping(float damping);
|
||||
void SetLinearVelocity(const Vector3f& velocity);
|
||||
void SetMass(float mass);
|
||||
void SetMassCenter(const Vector3f& center);
|
||||
void SetPosition(const Vector3f& position);
|
||||
void SetPositionAndRotation(const Vector3f& position, const Quaternionf& rotation);
|
||||
void SetRotation(const Quaternionf& rotation);
|
||||
|
||||
Quaternionf ToLocal(const Quaternionf& worldRotation);
|
||||
Vector3f ToLocal(const Vector3f& worldPosition);
|
||||
Quaternionf ToWorld(const Quaternionf& localRotation);
|
||||
Vector3f ToWorld(const Vector3f& localPosition);
|
||||
|
||||
void WakeUp();
|
||||
|
||||
BulletRigidBody3D& operator=(const BulletRigidBody3D& object) = delete;
|
||||
BulletRigidBody3D& operator=(BulletRigidBody3D&& object) noexcept;
|
||||
|
||||
protected:
|
||||
void Destroy();
|
||||
|
||||
private:
|
||||
std::shared_ptr<BulletCollider3D> m_geom;
|
||||
std::size_t m_bodyPoolIndex;
|
||||
btRigidBody* m_body;
|
||||
BulletPhysWorld3D* m_world;
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/BulletPhysics3D/BulletRigidBody3D.inl>
|
||||
|
||||
#endif // NAZARA_BULLETPHYSICS3D_BULLETRIGIDBODY3D_HPP
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/BulletPhysics3D/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
inline void BulletRigidBody3D::DisableSleeping()
|
||||
{
|
||||
return EnableSleeping(false);
|
||||
}
|
||||
|
||||
inline const std::shared_ptr<BulletCollider3D>& BulletRigidBody3D::GetGeom() const
|
||||
{
|
||||
return m_geom;
|
||||
}
|
||||
|
||||
inline btRigidBody* BulletRigidBody3D::GetRigidBody() const
|
||||
{
|
||||
return m_body;
|
||||
}
|
||||
inline std::size_t BulletRigidBody3D::GetUniqueIndex() const
|
||||
{
|
||||
return m_bodyPoolIndex;
|
||||
}
|
||||
|
||||
inline BulletPhysWorld3D* BulletRigidBody3D::GetWorld() const
|
||||
{
|
||||
return m_world;
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/BulletPhysics3D/DebugOff.hpp>
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_BULLETPHYSICS3D_COMPONENTS_BULLETRIGIDBODY3DCOMPONENT_HPP
|
||||
#define NAZARA_BULLETPHYSICS3D_COMPONENTS_BULLETRIGIDBODY3DCOMPONENT_HPP
|
||||
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/BulletPhysics3D/BulletRigidBody3D.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class NAZARA_BULLETPHYSICS3D_API BulletRigidBody3DComponent : public BulletRigidBody3D
|
||||
{
|
||||
friend class BulletPhysics3DSystem;
|
||||
|
||||
public:
|
||||
using BulletRigidBody3D::BulletRigidBody3D;
|
||||
BulletRigidBody3DComponent(const BulletRigidBody3DComponent&) = default;
|
||||
BulletRigidBody3DComponent(BulletRigidBody3DComponent&&) noexcept = default;
|
||||
~BulletRigidBody3DComponent() = default;
|
||||
|
||||
BulletRigidBody3DComponent& operator=(const BulletRigidBody3DComponent&) = default;
|
||||
BulletRigidBody3DComponent& operator=(BulletRigidBody3DComponent&&) noexcept = default;
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/BulletPhysics3D/Components/BulletRigidBody3DComponent.inl>
|
||||
|
||||
#endif // NAZARA_BULLETPHYSICS3D_COMPONENTS_BULLETRIGIDBODY3DCOMPONENT_HPP
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/BulletPhysics3D/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
}
|
||||
|
||||
#include <Nazara/BulletPhysics3D/DebugOff.hpp>
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
/*
|
||||
Nazara Engine - BulletPhysics3D module
|
||||
|
||||
Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_BULLETPHYSICS3D_CONFIG_HPP
|
||||
#define NAZARA_BULLETPHYSICS3D_CONFIG_HPP
|
||||
|
||||
/// Chaque modification d'un paramètre du module nécessite une recompilation de celui-ci
|
||||
|
||||
// Active les tests de sécurité basés sur le code (Conseillé pour le développement)
|
||||
#define NAZARA_BULLETPHYSICS3D_SAFE 1
|
||||
|
||||
/// Vérification des valeurs et types de certaines constantes
|
||||
#include <Nazara/BulletPhysics3D/ConfigCheck.hpp>
|
||||
|
||||
#if defined(NAZARA_STATIC)
|
||||
#define NAZARA_BULLETPHYSICS3D_API
|
||||
#else
|
||||
#ifdef NAZARA_BULLETPHYSICS3D_BUILD
|
||||
#define NAZARA_BULLETPHYSICS3D_API NAZARA_EXPORT
|
||||
#else
|
||||
#define NAZARA_BULLETPHYSICS3D_API NAZARA_IMPORT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // NAZARA_BULLETPHYSICS3D_CONFIG_HPP
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_BULLETPHYSICS3D_CONFIGCHECK_HPP
|
||||
#define NAZARA_BULLETPHYSICS3D_CONFIGCHECK_HPP
|
||||
|
||||
#endif // NAZARA_BULLETPHYSICS3D_CONFIGCHECK_HPP
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
// no header guards
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
// no header guards
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_BULLETPHYSICS3D_ENUMS_HPP
|
||||
#define NAZARA_BULLETPHYSICS3D_ENUMS_HPP
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
enum class BulletColliderType3D
|
||||
{
|
||||
Box,
|
||||
Capsule,
|
||||
Cone,
|
||||
Compound,
|
||||
ConvexHull,
|
||||
Cylinder,
|
||||
Heightfield,
|
||||
Null,
|
||||
Scene,
|
||||
Sphere,
|
||||
StaticPlane,
|
||||
|
||||
Max = StaticPlane
|
||||
};
|
||||
}
|
||||
|
||||
#endif // NAZARA_BULLETPHYSICS3D_ENUMS_HPP
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_BULLETPHYSICS3D_SYSTEMS_BULLETPHYSICS3DSYSTEM_HPP
|
||||
#define NAZARA_BULLETPHYSICS3D_SYSTEMS_BULLETPHYSICS3DSYSTEM_HPP
|
||||
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/BulletPhysics3D/BulletPhysWorld3D.hpp>
|
||||
#include <Nazara/BulletPhysics3D/Components/BulletRigidBody3DComponent.hpp>
|
||||
#include <Nazara/Core/Clock.hpp>
|
||||
#include <Nazara/Core/Time.hpp>
|
||||
#include <NazaraUtils/TypeList.hpp>
|
||||
#include <entt/entt.hpp>
|
||||
#include <vector>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class NAZARA_BULLETPHYSICS3D_API BulletPhysics3DSystem
|
||||
{
|
||||
public:
|
||||
static constexpr Int64 ExecutionOrder = 0;
|
||||
using Components = TypeList<BulletRigidBody3DComponent, class NodeComponent>;
|
||||
|
||||
struct RaycastHit;
|
||||
|
||||
BulletPhysics3DSystem(entt::registry& registry);
|
||||
BulletPhysics3DSystem(const BulletPhysics3DSystem&) = delete;
|
||||
BulletPhysics3DSystem(BulletPhysics3DSystem&&) = delete;
|
||||
~BulletPhysics3DSystem();
|
||||
|
||||
template<typename... Args> BulletRigidBody3DComponent CreateRigidBody(Args&&... args);
|
||||
|
||||
void Dump();
|
||||
|
||||
inline BulletPhysWorld3D& GetPhysWorld();
|
||||
inline const BulletPhysWorld3D& GetPhysWorld() const;
|
||||
|
||||
bool RaycastQuery(const Vector3f& from, const Vector3f& to, const FunctionRef<std::optional<float>(const RaycastHit& hitInfo)>& callback);
|
||||
bool RaycastQueryFirst(const Vector3f& from, const Vector3f& to, RaycastHit* hitInfo = nullptr);
|
||||
|
||||
void Update(Time elapsedTime);
|
||||
|
||||
BulletPhysics3DSystem& operator=(const BulletPhysics3DSystem&) = delete;
|
||||
BulletPhysics3DSystem& operator=(BulletPhysics3DSystem&&) = delete;
|
||||
|
||||
struct RaycastHit : BulletPhysWorld3D::RaycastHit
|
||||
{
|
||||
entt::handle hitEntity;
|
||||
};
|
||||
|
||||
private:
|
||||
void OnConstruct(entt::registry& registry, entt::entity entity);
|
||||
void OnDestruct(entt::registry& registry, entt::entity entity);
|
||||
|
||||
std::size_t m_activeObjectCount;
|
||||
std::size_t m_stepCount;
|
||||
std::vector<entt::entity> m_physicsEntities;
|
||||
entt::registry& m_registry;
|
||||
entt::observer m_physicsConstructObserver;
|
||||
entt::scoped_connection m_constructConnection;
|
||||
entt::scoped_connection m_destructConnection;
|
||||
BulletPhysWorld3D m_physWorld;
|
||||
Time m_physicsTime;
|
||||
Time m_updateTime;
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/BulletPhysics3D/Systems/BulletPhysics3DSystem.inl>
|
||||
|
||||
#endif // NAZARA_BULLETPHYSICS3D_SYSTEMS_BULLETPHYSICS3DSYSTEM_HPP
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - BulletPhysics3D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/BulletPhysics3D/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
template<typename... Args>
|
||||
BulletRigidBody3DComponent BulletPhysics3DSystem::CreateRigidBody(Args&&... args)
|
||||
{
|
||||
return BulletRigidBody3DComponent(&m_physWorld, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
inline BulletPhysWorld3D& BulletPhysics3DSystem::GetPhysWorld()
|
||||
{
|
||||
return m_physWorld;
|
||||
}
|
||||
|
||||
inline const BulletPhysWorld3D& BulletPhysics3DSystem::GetPhysWorld() const
|
||||
{
|
||||
return m_physWorld;
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/BulletPhysics3D/DebugOff.hpp>
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
// this file was automatically generated and should not be edited
|
||||
|
||||
/*
|
||||
Nazara Engine - Physics2D module
|
||||
|
||||
Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_GLOBAL_CHIPMUNKPHYSICS2D_HPP
|
||||
#define NAZARA_GLOBAL_CHIPMUNKPHYSICS2D_HPP
|
||||
|
||||
#include <Nazara/ChipmunkPhysics2D/ChipmunkArbiter2D.hpp>
|
||||
#include <Nazara/ChipmunkPhysics2D/ChipmunkCollider2D.hpp>
|
||||
#include <Nazara/ChipmunkPhysics2D/ChipmunkConstraint2D.hpp>
|
||||
#include <Nazara/ChipmunkPhysics2D/ChipmunkPhysics2D.hpp>
|
||||
#include <Nazara/ChipmunkPhysics2D/ChipmunkPhysWorld2D.hpp>
|
||||
#include <Nazara/ChipmunkPhysics2D/ChipmunkRigidBody2D.hpp>
|
||||
#include <Nazara/ChipmunkPhysics2D/Config.hpp>
|
||||
#include <Nazara/ChipmunkPhysics2D/Enums.hpp>
|
||||
|
||||
#ifdef NAZARA_ENTT
|
||||
|
||||
#include <Nazara/ChipmunkPhysics2D/Components.hpp>
|
||||
#include <Nazara/ChipmunkPhysics2D/Systems.hpp>
|
||||
|
||||
#endif
|
||||
|
||||
#endif // NAZARA_GLOBAL_CHIPMUNKPHYSICS2D_HPP
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - ChipmunkPhysics2D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <memory>
|
||||
#include <Nazara/ChipmunkPhysics2D/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
inline ChipmunkArbiter2D::ChipmunkArbiter2D(cpArbiter* arbiter) :
|
||||
m_arbiter(arbiter)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/ChipmunkPhysics2D/DebugOff.hpp>
|
||||
|
|
@ -1,196 +0,0 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - ChipmunkPhysics2D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <memory>
|
||||
#include <Nazara/ChipmunkPhysics2D/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
inline ChipmunkCollider2D::ChipmunkCollider2D() :
|
||||
m_categoryMask(0xFFFFFFFF),
|
||||
m_collisionGroup(0),
|
||||
m_collisionMask(0xFFFFFFFF),
|
||||
m_surfaceVelocity(Vector2f::Zero()),
|
||||
m_trigger(false),
|
||||
m_elasticity(0.f),
|
||||
m_friction(0.f),
|
||||
m_collisionId(0)
|
||||
{
|
||||
}
|
||||
|
||||
inline UInt32 ChipmunkCollider2D::GetCategoryMask() const
|
||||
{
|
||||
return m_categoryMask;
|
||||
}
|
||||
|
||||
inline UInt32 ChipmunkCollider2D::GetCollisionGroup() const
|
||||
{
|
||||
return m_collisionGroup;
|
||||
}
|
||||
|
||||
inline unsigned int ChipmunkCollider2D::GetCollisionId() const
|
||||
{
|
||||
return m_collisionId;
|
||||
}
|
||||
|
||||
inline UInt32 ChipmunkCollider2D::GetCollisionMask() const
|
||||
{
|
||||
return m_collisionMask;
|
||||
}
|
||||
|
||||
inline float ChipmunkCollider2D::GetElasticity() const
|
||||
{
|
||||
return m_elasticity;
|
||||
}
|
||||
|
||||
inline float ChipmunkCollider2D::GetFriction() const
|
||||
{
|
||||
return m_friction;
|
||||
}
|
||||
|
||||
inline Vector2f ChipmunkCollider2D::GetSurfaceVelocity() const
|
||||
{
|
||||
return m_surfaceVelocity;
|
||||
}
|
||||
|
||||
inline bool ChipmunkCollider2D::IsTrigger() const
|
||||
{
|
||||
return m_trigger;
|
||||
}
|
||||
|
||||
inline void ChipmunkCollider2D::SetCategoryMask(UInt32 categoryMask)
|
||||
{
|
||||
m_categoryMask = categoryMask;
|
||||
}
|
||||
|
||||
inline void ChipmunkCollider2D::SetCollisionGroup(UInt32 groupId)
|
||||
{
|
||||
m_collisionGroup = groupId;
|
||||
}
|
||||
|
||||
inline void ChipmunkCollider2D::SetCollisionId(unsigned int typeId)
|
||||
{
|
||||
m_collisionId = typeId;
|
||||
}
|
||||
|
||||
inline void ChipmunkCollider2D::SetCollisionMask(UInt32 mask)
|
||||
{
|
||||
m_collisionMask = mask;
|
||||
}
|
||||
|
||||
inline void ChipmunkCollider2D::SetElasticity(float elasticity)
|
||||
{
|
||||
m_elasticity = elasticity;
|
||||
}
|
||||
|
||||
inline void ChipmunkCollider2D::SetFriction(float friction)
|
||||
{
|
||||
m_friction = friction;
|
||||
}
|
||||
|
||||
inline void ChipmunkCollider2D::SetSurfaceVelocity(const Vector2f& surfaceVelocity)
|
||||
{
|
||||
m_surfaceVelocity = surfaceVelocity;
|
||||
}
|
||||
|
||||
inline void ChipmunkCollider2D::SetTrigger(bool trigger)
|
||||
{
|
||||
m_trigger = trigger;
|
||||
}
|
||||
|
||||
inline float ChipmunkBoxCollider2D::GetRadius() const
|
||||
{
|
||||
return m_radius;
|
||||
}
|
||||
|
||||
inline const Rectf& ChipmunkBoxCollider2D::GetRect() const
|
||||
{
|
||||
return m_rect;
|
||||
}
|
||||
|
||||
inline Vector2f ChipmunkBoxCollider2D::GetSize() const
|
||||
{
|
||||
return m_rect.GetLengths();
|
||||
}
|
||||
|
||||
|
||||
inline const Vector2f& ChipmunkCircleCollider2D::GetOffset() const
|
||||
{
|
||||
return m_offset;
|
||||
}
|
||||
|
||||
inline float ChipmunkCircleCollider2D::GetRadius() const
|
||||
{
|
||||
return m_radius;
|
||||
}
|
||||
|
||||
|
||||
inline bool Nz::ChipmunkCompoundCollider2D::DoesOverrideCollisionProperties() const
|
||||
{
|
||||
return m_doesOverrideCollisionProperties;
|
||||
}
|
||||
|
||||
inline const std::vector<std::shared_ptr<ChipmunkCollider2D>>& ChipmunkCompoundCollider2D::GetGeoms() const
|
||||
{
|
||||
return m_geoms;
|
||||
}
|
||||
|
||||
inline void Nz::ChipmunkCompoundCollider2D::OverridesCollisionProperties(bool shouldOverride)
|
||||
{
|
||||
m_doesOverrideCollisionProperties = shouldOverride;
|
||||
}
|
||||
|
||||
|
||||
inline const std::vector<Vector2d>& ChipmunkConvexCollider2D::GetVertices() const
|
||||
{
|
||||
return m_vertices;
|
||||
}
|
||||
|
||||
|
||||
ChipmunkSegmentCollider2D::ChipmunkSegmentCollider2D(const Vector2f& first, const Vector2f& second, float thickness) :
|
||||
ChipmunkSegmentCollider2D(first, first, second, second, thickness)
|
||||
{
|
||||
}
|
||||
|
||||
inline ChipmunkSegmentCollider2D::ChipmunkSegmentCollider2D(const Vector2f& first, const Vector2f& firstNeighbor, const Vector2f& second, const Vector2f& secondNeighbor, float thickness) :
|
||||
m_first(first),
|
||||
m_firstNeighbor(firstNeighbor),
|
||||
m_second(second),
|
||||
m_secondNeighbor(secondNeighbor),
|
||||
m_thickness(thickness)
|
||||
{
|
||||
}
|
||||
|
||||
inline const Vector2f& ChipmunkSegmentCollider2D::GetFirstPoint() const
|
||||
{
|
||||
return m_first;
|
||||
}
|
||||
|
||||
inline const Vector2f& ChipmunkSegmentCollider2D::GetFirstPointNeighbor() const
|
||||
{
|
||||
return m_firstNeighbor;
|
||||
}
|
||||
|
||||
inline float ChipmunkSegmentCollider2D::GetLength() const
|
||||
{
|
||||
return m_first.Distance(m_second);
|
||||
}
|
||||
|
||||
inline const Vector2f& ChipmunkSegmentCollider2D::GetSecondPoint() const
|
||||
{
|
||||
return m_second;
|
||||
}
|
||||
|
||||
inline const Vector2f& ChipmunkSegmentCollider2D::GetSecondPointNeighbor() const
|
||||
{
|
||||
return m_secondNeighbor;
|
||||
}
|
||||
|
||||
inline float ChipmunkSegmentCollider2D::GetThickness() const
|
||||
{
|
||||
return m_thickness;
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/ChipmunkPhysics2D/DebugOff.hpp>
|
||||
|
|
@ -1,238 +0,0 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - ChipmunkPhysics2D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_CHIPMUNKPHYSICS2D_CHIPMUNKCONSTRAINT2D_HPP
|
||||
#define NAZARA_CHIPMUNKPHYSICS2D_CHIPMUNKCONSTRAINT2D_HPP
|
||||
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/ChipmunkPhysics2D/ChipmunkPhysWorld2D.hpp>
|
||||
#include <Nazara/ChipmunkPhysics2D/ChipmunkRigidBody2D.hpp>
|
||||
#include <Nazara/ChipmunkPhysics2D/Config.hpp>
|
||||
#include <Nazara/Core/HandledObject.hpp>
|
||||
#include <Nazara/Core/ObjectHandle.hpp>
|
||||
#include <Nazara/Math/Angle.hpp>
|
||||
#include <NazaraUtils/MovablePtr.hpp>
|
||||
|
||||
struct cpConstraint;
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class ChipmunkConstraint2D;
|
||||
|
||||
using ChipmunkConstraint2DHandle = ObjectHandle<ChipmunkConstraint2D>;
|
||||
|
||||
class NAZARA_CHIPMUNKPHYSICS2D_API ChipmunkConstraint2D : public HandledObject<ChipmunkConstraint2D>
|
||||
{
|
||||
public:
|
||||
ChipmunkConstraint2D(const ChipmunkConstraint2D&) = delete;
|
||||
ChipmunkConstraint2D(ChipmunkConstraint2D&& constraint) noexcept;
|
||||
virtual ~ChipmunkConstraint2D();
|
||||
|
||||
void EnableBodyCollision(bool enable);
|
||||
|
||||
ChipmunkRigidBody2D& GetBodyA();
|
||||
const ChipmunkRigidBody2D& GetBodyA() const;
|
||||
ChipmunkRigidBody2D& GetBodyB();
|
||||
const ChipmunkRigidBody2D& GetBodyB() const;
|
||||
float GetErrorBias() const;
|
||||
float GetLastImpulse() const;
|
||||
float GetMaxBias() const;
|
||||
float GetMaxForce() const;
|
||||
ChipmunkPhysWorld2D& GetWorld();
|
||||
const ChipmunkPhysWorld2D& GetWorld() const;
|
||||
|
||||
bool IsBodyCollisionEnabled() const;
|
||||
bool IsSingleBody() const;
|
||||
|
||||
void SetErrorBias(float bias);
|
||||
void SetMaxBias(float bias);
|
||||
void SetMaxForce(float force);
|
||||
|
||||
ChipmunkConstraint2D& operator=(const ChipmunkConstraint2D&) = delete;
|
||||
ChipmunkConstraint2D& operator=(ChipmunkConstraint2D&& constraint) noexcept;
|
||||
|
||||
protected:
|
||||
ChipmunkConstraint2D(ChipmunkPhysWorld2D* world, cpConstraint* constraint);
|
||||
|
||||
MovablePtr<cpConstraint> m_constraint;
|
||||
|
||||
private:
|
||||
void Destroy();
|
||||
};
|
||||
|
||||
class ChipmunkDampedSpringConstraint2D;
|
||||
|
||||
using ChipmunkDampedSpringConstraint2DHandle = ObjectHandle<ChipmunkDampedSpringConstraint2D>;
|
||||
|
||||
class NAZARA_CHIPMUNKPHYSICS2D_API ChipmunkDampedSpringConstraint2D : public ChipmunkConstraint2D
|
||||
{
|
||||
public:
|
||||
ChipmunkDampedSpringConstraint2D(ChipmunkRigidBody2D& first, ChipmunkRigidBody2D& second, const Vector2f& firstAnchor, const Vector2f& secondAnchor, float restLength, float stiffness, float damping);
|
||||
~ChipmunkDampedSpringConstraint2D() = default;
|
||||
|
||||
float GetDamping() const;
|
||||
Vector2f GetFirstAnchor() const;
|
||||
float GetRestLength() const;
|
||||
Vector2f GetSecondAnchor() const;
|
||||
float GetStiffness() const;
|
||||
|
||||
void SetDamping(float newDamping);
|
||||
void SetFirstAnchor(const Vector2f& firstAnchor);
|
||||
void SetRestLength(float newLength);
|
||||
void SetSecondAnchor(const Vector2f& firstAnchor);
|
||||
void SetStiffness(float newStiffness);
|
||||
};
|
||||
|
||||
class ChipmunkDampedRotarySpringConstraint2D;
|
||||
|
||||
using ChipmunkDampedRotarySpringConstraint2DHandle = ObjectHandle<ChipmunkDampedRotarySpringConstraint2D>;
|
||||
|
||||
class NAZARA_CHIPMUNKPHYSICS2D_API ChipmunkDampedRotarySpringConstraint2D : public ChipmunkConstraint2D
|
||||
{
|
||||
public:
|
||||
ChipmunkDampedRotarySpringConstraint2D(ChipmunkRigidBody2D& first, ChipmunkRigidBody2D& second, const RadianAnglef& restAngle, float stiffness, float damping);
|
||||
~ChipmunkDampedRotarySpringConstraint2D() = default;
|
||||
|
||||
float GetDamping() const;
|
||||
RadianAnglef GetRestAngle() const;
|
||||
float GetStiffness() const;
|
||||
|
||||
void SetDamping(float newDamping);
|
||||
void SetRestAngle(const RadianAnglef& newAngle);
|
||||
void SetStiffness(float newStiffness);
|
||||
};
|
||||
|
||||
class ChipmunkGearConstraint2D;
|
||||
|
||||
using ChipmunkGearConstraint2DHandle = ObjectHandle<ChipmunkGearConstraint2D>;
|
||||
|
||||
class NAZARA_CHIPMUNKPHYSICS2D_API ChipmunkGearConstraint2D : public ChipmunkConstraint2D
|
||||
{
|
||||
public:
|
||||
ChipmunkGearConstraint2D(ChipmunkRigidBody2D& first, ChipmunkRigidBody2D& second, float phase, float ratio);
|
||||
~ChipmunkGearConstraint2D() = default;
|
||||
|
||||
float GetPhase() const;
|
||||
float GetRatio() const;
|
||||
|
||||
void SetPhase(float phase);
|
||||
void SetRatio(float ratio);
|
||||
};
|
||||
|
||||
class ChipmunkMotorConstraint2D;
|
||||
|
||||
using ChipmunkMotorConstraint2DHandle = ObjectHandle<ChipmunkMotorConstraint2D>;
|
||||
|
||||
class NAZARA_CHIPMUNKPHYSICS2D_API ChipmunkMotorConstraint2D : public ChipmunkConstraint2D
|
||||
{
|
||||
public:
|
||||
ChipmunkMotorConstraint2D(ChipmunkRigidBody2D& first, ChipmunkRigidBody2D& second, float rate);
|
||||
~ChipmunkMotorConstraint2D() = default;
|
||||
|
||||
float GetRate() const;
|
||||
void SetRate(float rate);
|
||||
};
|
||||
|
||||
class ChipmunkPinConstraint2D;
|
||||
|
||||
using ChipmunkPinConstraint2DHandle = ObjectHandle<ChipmunkPinConstraint2D>;
|
||||
|
||||
class NAZARA_CHIPMUNKPHYSICS2D_API ChipmunkPinConstraint2D : public ChipmunkConstraint2D
|
||||
{
|
||||
public:
|
||||
ChipmunkPinConstraint2D(ChipmunkRigidBody2D& body, const Vector2f& anchor);
|
||||
ChipmunkPinConstraint2D(ChipmunkRigidBody2D& first, ChipmunkRigidBody2D& second, const Vector2f& firstAnchor, const Vector2f& secondAnchor);
|
||||
~ChipmunkPinConstraint2D() = default;
|
||||
|
||||
float GetDistance() const;
|
||||
Vector2f GetFirstAnchor() const;
|
||||
Vector2f GetSecondAnchor() const;
|
||||
|
||||
void SetDistance(float newDistance);
|
||||
void SetFirstAnchor(const Vector2f& firstAnchor);
|
||||
void SetSecondAnchor(const Vector2f& firstAnchor);
|
||||
};
|
||||
|
||||
class ChipmunkPivotConstraint2D;
|
||||
|
||||
using ChipmunkPivotConstraint2DHandle = ObjectHandle<ChipmunkPivotConstraint2D>;
|
||||
|
||||
class NAZARA_CHIPMUNKPHYSICS2D_API ChipmunkPivotConstraint2D : public ChipmunkConstraint2D
|
||||
{
|
||||
public:
|
||||
ChipmunkPivotConstraint2D(ChipmunkRigidBody2D& body, const Vector2f& anchor);
|
||||
ChipmunkPivotConstraint2D(ChipmunkRigidBody2D& first, ChipmunkRigidBody2D& second, const Vector2f& anchor);
|
||||
ChipmunkPivotConstraint2D(ChipmunkRigidBody2D& first, ChipmunkRigidBody2D& second, const Vector2f& firstAnchor, const Vector2f& secondAnchor);
|
||||
~ChipmunkPivotConstraint2D() = default;
|
||||
|
||||
Vector2f GetFirstAnchor() const;
|
||||
Vector2f GetSecondAnchor() const;
|
||||
|
||||
void SetFirstAnchor(const Vector2f& firstAnchor);
|
||||
void SetSecondAnchor(const Vector2f& firstAnchor);
|
||||
};
|
||||
|
||||
class ChipmunkRatchetConstraint2D;
|
||||
|
||||
using ChipmunkRatchetConstraint2DHandle = ObjectHandle<ChipmunkRatchetConstraint2D>;
|
||||
|
||||
class NAZARA_CHIPMUNKPHYSICS2D_API ChipmunkRatchetConstraint2D : public ChipmunkConstraint2D
|
||||
{
|
||||
public:
|
||||
ChipmunkRatchetConstraint2D(ChipmunkRigidBody2D& first, ChipmunkRigidBody2D& second, float phase, float ratchet);
|
||||
~ChipmunkRatchetConstraint2D() = default;
|
||||
|
||||
RadianAnglef GetAngle() const;
|
||||
float GetPhase() const;
|
||||
float GetRatchet() const;
|
||||
|
||||
void SetAngle(const RadianAnglef& angle);
|
||||
void SetPhase(float phase);
|
||||
void SetRatchet(float ratchet);
|
||||
};
|
||||
|
||||
class ChipmunkRotaryLimitConstraint2D;
|
||||
|
||||
using ChipmunkRotaryLimitConstraint2DHandle = ObjectHandle<ChipmunkRotaryLimitConstraint2D>;
|
||||
|
||||
class NAZARA_CHIPMUNKPHYSICS2D_API ChipmunkRotaryLimitConstraint2D : public ChipmunkConstraint2D
|
||||
{
|
||||
public:
|
||||
ChipmunkRotaryLimitConstraint2D(ChipmunkRigidBody2D& first, ChipmunkRigidBody2D& second, const RadianAnglef& minAngle, const RadianAnglef& maxAngle);
|
||||
~ChipmunkRotaryLimitConstraint2D() = default;
|
||||
|
||||
RadianAnglef GetMaxAngle() const;
|
||||
RadianAnglef GetMinAngle() const;
|
||||
|
||||
void SetMaxAngle(const RadianAnglef& maxAngle);
|
||||
void SetMinAngle(const RadianAnglef& minAngle);
|
||||
};
|
||||
|
||||
class ChipmunkSlideConstraint2D;
|
||||
|
||||
using ChipmunkSlideConstraint2DHandle = ObjectHandle<ChipmunkSlideConstraint2D>;
|
||||
|
||||
class NAZARA_CHIPMUNKPHYSICS2D_API ChipmunkSlideConstraint2D : public ChipmunkConstraint2D
|
||||
{
|
||||
public:
|
||||
ChipmunkSlideConstraint2D(ChipmunkRigidBody2D& first, ChipmunkRigidBody2D& second, const Vector2f& firstAnchor, const Vector2f& secondAnchor, float min, float max);
|
||||
~ChipmunkSlideConstraint2D() = default;
|
||||
|
||||
Vector2f GetFirstAnchor() const;
|
||||
float GetMaxDistance() const;
|
||||
float GetMinDistance() const;
|
||||
Vector2f GetSecondAnchor() const;
|
||||
|
||||
void SetFirstAnchor(const Vector2f& firstAnchor);
|
||||
void SetMaxDistance(float newMaxDistance);
|
||||
void SetMinDistance(float newMinDistance);
|
||||
void SetSecondAnchor(const Vector2f& firstAnchor);
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/ChipmunkPhysics2D/ChipmunkConstraint2D.inl>
|
||||
|
||||
#endif // NAZARA_CHIPMUNKPHYSICS2D_CHIPMUNKCONSTRAINT2D_HPP
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - ChipmunkPhysics2D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <memory>
|
||||
#include <Nazara/ChipmunkPhysics2D/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
}
|
||||
|
||||
#include <Nazara/ChipmunkPhysics2D/DebugOff.hpp>
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - ChipmunkPhysics2D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_CHIPMUNKPHYSICS2D_HPP
|
||||
#define NAZARA_CHIPMUNKPHYSICS2D_HPP
|
||||
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/ChipmunkPhysics2D/Config.hpp>
|
||||
#include <Nazara/Core/Core.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class NAZARA_CHIPMUNKPHYSICS2D_API ChipmunkPhysics2D : public ModuleBase<ChipmunkPhysics2D>
|
||||
{
|
||||
friend ModuleBase;
|
||||
|
||||
public:
|
||||
using Dependencies = TypeList<Core>;
|
||||
|
||||
struct Config {};
|
||||
|
||||
ChipmunkPhysics2D(Config /*config*/);
|
||||
~ChipmunkPhysics2D() = default;
|
||||
|
||||
private:
|
||||
static ChipmunkPhysics2D* s_instance;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // NAZARA_CHIPMUNKPHYSICS2D_HPP
|
||||
|
|
@ -1,99 +0,0 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - ChipmunkPhysics2D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/ChipmunkPhysics2D/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
inline ChipmunkRigidBody2D::ChipmunkRigidBody2D(ChipmunkPhysWorld2D& world, const DynamicSettings& settings)
|
||||
{
|
||||
Create(world, settings);
|
||||
}
|
||||
|
||||
inline ChipmunkRigidBody2D::ChipmunkRigidBody2D(ChipmunkPhysWorld2D& world, const StaticSettings& settings)
|
||||
{
|
||||
Create(world, settings);
|
||||
}
|
||||
|
||||
inline ChipmunkRigidBody2D::~ChipmunkRigidBody2D()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
inline void ChipmunkRigidBody2D::AddForce(const Vector2f& force, CoordSys coordSys)
|
||||
{
|
||||
return AddForce(force, GetMassCenter(coordSys), coordSys);
|
||||
}
|
||||
|
||||
inline void ChipmunkRigidBody2D::AddImpulse(const Vector2f& impulse, CoordSys coordSys)
|
||||
{
|
||||
return AddImpulse(impulse, GetMassCenter(coordSys), coordSys);
|
||||
}
|
||||
|
||||
inline UInt32 ChipmunkRigidBody2D::GetBodyIndex() const
|
||||
{
|
||||
return m_bodyIndex;
|
||||
}
|
||||
|
||||
inline const std::shared_ptr<ChipmunkCollider2D>& ChipmunkRigidBody2D::GetGeom() const
|
||||
{
|
||||
return m_geom;
|
||||
}
|
||||
|
||||
inline cpBody* ChipmunkRigidBody2D::GetHandle() const
|
||||
{
|
||||
return m_handle;
|
||||
}
|
||||
|
||||
inline float ChipmunkRigidBody2D::GetMass() const
|
||||
{
|
||||
return m_mass;
|
||||
}
|
||||
|
||||
inline const Vector2f& ChipmunkRigidBody2D::GetPositionOffset() const
|
||||
{
|
||||
return m_positionOffset;
|
||||
}
|
||||
|
||||
inline std::size_t ChipmunkRigidBody2D::GetShapeIndex(cpShape* shape) const
|
||||
{
|
||||
auto it = std::find(m_shapes.begin(), m_shapes.end(), shape);
|
||||
if (it == m_shapes.end())
|
||||
return InvalidShapeIndex;
|
||||
|
||||
return std::distance(m_shapes.begin(), it);
|
||||
}
|
||||
|
||||
inline std::size_t ChipmunkRigidBody2D::GetShapeCount() const
|
||||
{
|
||||
return m_shapes.size();
|
||||
}
|
||||
|
||||
inline const ChipmunkRigidBody2D::VelocityFunc& ChipmunkRigidBody2D::GetVelocityFunction() const
|
||||
{
|
||||
return m_velocityFunc;
|
||||
}
|
||||
|
||||
inline ChipmunkPhysWorld2D* ChipmunkRigidBody2D::GetWorld() const
|
||||
{
|
||||
return m_world;
|
||||
}
|
||||
|
||||
inline bool ChipmunkRigidBody2D::IsKinematic() const
|
||||
{
|
||||
return m_mass <= 0.f;
|
||||
}
|
||||
|
||||
inline bool ChipmunkRigidBody2D::IsSimulationEnabled() const
|
||||
{
|
||||
return m_isSimulationEnabled;
|
||||
}
|
||||
|
||||
inline bool ChipmunkRigidBody2D::IsStatic() const
|
||||
{
|
||||
return m_isStatic;
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/ChipmunkPhysics2D/DebugOff.hpp>
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - ChipmunkPhysics2D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_CHIPMUNKPHYSICS2D_COMPONENTS_CHIPMUNKRIGIDBODY2DCOMPONENT_HPP
|
||||
#define NAZARA_CHIPMUNKPHYSICS2D_COMPONENTS_CHIPMUNKRIGIDBODY2DCOMPONENT_HPP
|
||||
|
||||
#include <NazaraUtils/Prerequisites.hpp>
|
||||
#include <Nazara/ChipmunkPhysics2D/ChipmunkRigidBody2D.hpp>
|
||||
#include <variant>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class NAZARA_CHIPMUNKPHYSICS2D_API ChipmunkRigidBody2DComponent : public ChipmunkRigidBody2D
|
||||
{
|
||||
friend class ChipmunkPhysics2DSystem;
|
||||
|
||||
public:
|
||||
inline ChipmunkRigidBody2DComponent(const ChipmunkRigidBody2D::DynamicSettings& settings);
|
||||
inline ChipmunkRigidBody2DComponent(const ChipmunkRigidBody2D::StaticSettings& settings);
|
||||
ChipmunkRigidBody2DComponent(const ChipmunkRigidBody2DComponent&) = default;
|
||||
ChipmunkRigidBody2DComponent(ChipmunkRigidBody2DComponent&&) noexcept = default;
|
||||
~ChipmunkRigidBody2DComponent() = default;
|
||||
|
||||
ChipmunkRigidBody2DComponent& operator=(const ChipmunkRigidBody2DComponent&) = default;
|
||||
ChipmunkRigidBody2DComponent& operator=(ChipmunkRigidBody2DComponent&&) noexcept = default;
|
||||
|
||||
private:
|
||||
inline void Construct(ChipmunkPhysWorld2D& world);
|
||||
|
||||
using Setting = std::variant<ChipmunkRigidBody2D::DynamicSettings, ChipmunkRigidBody2D::StaticSettings>;
|
||||
std::unique_ptr<Setting> m_settings;
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/ChipmunkPhysics2D/Components/ChipmunkRigidBody2DComponent.inl>
|
||||
|
||||
#endif // NAZARA_CHIPMUNKPHYSICS2D_COMPONENTS_CHIPMUNKRIGIDBODY2DCOMPONENT_HPP
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - ChipmunkPhysics2D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/ChipmunkPhysics2D/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
inline ChipmunkRigidBody2DComponent::ChipmunkRigidBody2DComponent(const ChipmunkRigidBody2D::DynamicSettings& settings)
|
||||
{
|
||||
m_settings = std::make_unique<Setting>(settings);
|
||||
}
|
||||
|
||||
inline ChipmunkRigidBody2DComponent::ChipmunkRigidBody2DComponent(const ChipmunkRigidBody2D::StaticSettings& settings)
|
||||
{
|
||||
m_settings = std::make_unique<Setting>(settings);
|
||||
}
|
||||
|
||||
inline void ChipmunkRigidBody2DComponent::Construct(ChipmunkPhysWorld2D& world)
|
||||
{
|
||||
assert(m_settings);
|
||||
std::visit([&](auto&& arg)
|
||||
{
|
||||
Create(world, arg);
|
||||
}, *m_settings);
|
||||
m_settings.reset();
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/ChipmunkPhysics2D/DebugOff.hpp>
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
/*
|
||||
Nazara Engine - Physics2D module
|
||||
|
||||
Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_CHIPMUNKPHYSICS2D_CONFIG_HPP
|
||||
#define NAZARA_CHIPMUNKPHYSICS2D_CONFIG_HPP
|
||||
|
||||
/// Chaque modification d'un paramètre du module nécessite une recompilation de celui-ci
|
||||
|
||||
// Active les tests de sécurité basés sur le code (Conseillé pour le développement)
|
||||
#define NAZARA_CHIPMUNKPHYSICS2D_SAFE 1
|
||||
|
||||
/// Vérification des valeurs et types de certaines constantes
|
||||
#include <Nazara/ChipmunkPhysics2D/ConfigCheck.hpp>
|
||||
|
||||
#if defined(NAZARA_STATIC)
|
||||
#define NAZARA_CHIPMUNKPHYSICS2D_API
|
||||
#else
|
||||
#ifdef NAZARA_CHIPMUNKPHYSICS2D_BUILD
|
||||
#define NAZARA_CHIPMUNKPHYSICS2D_API NAZARA_EXPORT
|
||||
#else
|
||||
#define NAZARA_CHIPMUNKPHYSICS2D_API NAZARA_IMPORT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // NAZARA_CHIPMUNKPHYSICS2D_CONFIG_HPP
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
|
||||
// This file is part of the "Nazara Engine - ChipmunkPhysics2D module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_CHIPMUNKPHYSICS2D_CONFIGCHECK_HPP
|
||||
#define NAZARA_CHIPMUNKPHYSICS2D_CONFIGCHECK_HPP
|
||||
|
||||
/// This file is used to check the constant values defined in Config.hpp
|
||||
|
||||
#include <type_traits>
|
||||
#define NazaraCheckTypeAndVal(name, type, op, val, err) static_assert(std::is_ ##type <decltype(name)>::value && name op val, #type err)
|
||||
|
||||
// config checks
|
||||
|
||||
#undef NazaraCheckTypeAndVal
|
||||
|
||||
#endif // NAZARA_CHIPMUNKPHYSICS2D_CONFIGCHECK_HPP
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue