Skip to content

Commit

Permalink
Add precision=double support.
Browse files Browse the repository at this point in the history
  • Loading branch information
fire committed Nov 2, 2023
1 parent 3836276 commit 18e2b78
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 52 deletions.
165 changes: 114 additions & 51 deletions .github/workflows/build-addons.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,57 +24,119 @@ jobs:
fail-fast: false
matrix:
include:
- identifier: windows-debug
os: windows-latest
name: 🏁 Windows Debug
target: template_debug
platform: windows
arch: x86_64
toolset: msvc
platform_version: 2022
- identifier: windows-release
os: windows-latest
name: 🏁 Windows Release
target: template_release
platform: windows
arch: x86_64
toolset: msvc
platform_version: 2022
- identifier: macos-debug
os: macos-latest
name: 🍎 macOS (universal) Debug
target: template_debug
platform: macos
arch: universal
toolset: clang
platform_version: 11
- identifier: macos-release
os: macos-latest
name: 🍎 macOS (universal) Release
target: template_release
platform: macos
arch: universal
toolset: clang
platform_version: 11
- identifier: linux-debug
os: ubuntu-latest
name: 🐧 Linux Debug
runner: ubuntu-22.04
target: template_debug
platform: linux
arch: x86_64
toolset: gcc
platform_version: 20.04
- identifier: linux-release
os: ubuntu-latest
name: 🐧 Linux Release
runner: ubuntu-22.04
target: template_release
platform: linux
arch: x86_64
toolset: gcc
platform_version: 20.04

- identifier: windows-debug-single
os: windows-latest
name: 🏁 Windows Debug (Single Precision)
target: template_debug
platform: windows
arch: x86_64
toolset: msvc
platform_version: 2022
precision: single
- identifier: windows-debug-double
os: windows-latest
name: 🏁 Windows Debug (Double Precision)
target: template_debug
platform: windows
arch: x86_64
toolset: msvc
platform_version: 2022
precision: double
- identifier: windows-release-single
os: windows-latest
name: 🏁 Windows Release (Single Precision)
target: template_release
platform: windows
arch: x86_64
toolset: msvc
platform_version: 2022
precision: single
- identifier: windows-release-double
os: windows-latest
name: 🏁 Windows Release (Double Precision)
target: template_release
platform: windows
arch: x86_64
toolset: msvc
platform_version: 2022
precision: double
- identifier: macos-debug-single
os: macos-latest
name: 🍎 macOS (universal) Debug (Single Precision)
target: template_debug
platform: macos
arch: universal
toolset: clang
platform_version: 11
precision: single
- identifier: macos-debug-double
os: macos-latest
name: 🍎 macOS (universal) Debug (Double Precision)
target: template_debug
platform: macos
arch: universal
toolset: clang
platform_version: 11
precision: double
- identifier: macos-release-single
os: macos-latest
name: 🍎 macOS (universal) Release (Single Precision)
target: template_release
platform: macos
arch: universal
toolset: clang
platform_version: 11
precision: single
- identifier: macos-release-double
os: macos-latest
name: 🍎 macOS (universal) Release (Double Precision)
target: template_release
platform: macos
arch: universal
toolset: clang
platform_version: 11
precision: double
- identifier: linux-debug-single
os: ubuntu-latest
name: 🐧 Linux Debug (Single Precision)
runner: ubuntu-22.04
target: template_debug
platform: linux
arch: x86_64
toolset: gcc
platform_version: 20.04
precision: single
- identifier: linux-debug-double
os: ubuntu-latest
name: 🐧 Linux Debug (Double Precision)
runner: ubuntu-22.04
target: template_debug
platform: linux
arch: x86_64
toolset: gcc
platform_version: 20.04
precision: double
- identifier: linux-release-single
os: ubuntu-latest
name: 🐧 Linux Release (Single Precision)
runner: ubuntu-22.04
target: template_release
platform: linux
arch: x86_64
toolset: gcc
platform_version: 20.04
precision: single
- identifier: linux-release-double
os: ubuntu-latest
name: 🐧 Linux Release (Double Precision)
runner: ubuntu-22.04
target: template_release
platform: linux
arch: x86_64
toolset: gcc
platform_version: 20.04
precision: double

steps:

- name: Checkout project
Expand Down Expand Up @@ -150,6 +212,7 @@ jobs:
arch=${{ matrix.arch }}
Boost_INCLUDE_DIR=${{steps.install-boost.outputs.BOOST_ROOT}}/include/
Boost_LIBRARY_DIRS=${{steps.install-boost.outputs.BOOST_ROOT}}/lib
precision=${{ matrix.precision }}
env:
BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}

Expand Down
4 changes: 4 additions & 0 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ env = SConscript("godot-cpp/SConstruct",'env')
opts = Variables([], ARGUMENTS)
opts.Add("Boost_INCLUDE_DIR", "boost library include path", "")
opts.Add("Boost_LIBRARY_DIRS", "boost library library path", "")
opts.Add("precision", "floating point precision", "single")

opts.Update(env)
boost_path = Dir(env['Boost_INCLUDE_DIR'])

env["precision"] = env['precision']

# Add Included files.
env.Append(CPPPATH=["src/","thirdparty/",boost_path])

Expand Down
2 changes: 1 addition & 1 deletion src/CritSpringDamper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ struct CritDampSpring : public RefCounted
}
else
{
float halfangle = acosf(clampf(q.w, -1.0f, 1.0f));
real_t halfangle = acosf(clampf(q.w, real_t(-1.0), real_t(1.0)));
return halfangle * (Vector3(q.x, q.y, q.z) / length);
}
}
Expand Down

0 comments on commit 18e2b78

Please sign in to comment.