mirror of
https://github.com/g-truc/glm.git
synced 2024-11-26 10:14:35 +00:00
Merge branch 'master' of github.com:g-truc/glm
This commit is contained in:
commit
9dca1667fe
@ -49,6 +49,10 @@ matrix:
|
|||||||
- image: Visual Studio 2019
|
- image: Visual Studio 2019
|
||||||
platform: x64
|
platform: x64
|
||||||
|
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
|
||||||
before_build:
|
before_build:
|
||||||
- ps: |
|
- ps: |
|
||||||
mkdir build
|
mkdir build
|
||||||
|
275
.travis.yml
275
.travis.yml
@ -1,24 +1,12 @@
|
|||||||
language: cpp
|
language: cpp
|
||||||
|
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
- stable
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: osx
|
|
||||||
osx_image: xcode7.3
|
|
||||||
script:
|
|
||||||
- cmake --version
|
|
||||||
- mkdir ./build_unknown_release
|
|
||||||
- cd ./build_unknown_release
|
|
||||||
- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_BUILD_TYPE=Release -DGLM_TEST_ENABLE=ON -DGLM_DISABLE_AUTO_DETECTION=ON ..
|
|
||||||
- cmake --build .
|
|
||||||
- ctest --verbose
|
|
||||||
- cd $TRAVIS_BUILD_DIR
|
|
||||||
- mkdir ./build_test_cmake
|
|
||||||
- cd ./build_test_cmake
|
|
||||||
- cmake -DCMAKE_CXX_COMPILER=$COMPILER $TRAVIS_BUILD_DIR/test/cmake/ -Dglm_DIR=$TRAVIS_BUILD_DIR/cmake/glm/
|
|
||||||
- cmake --build .
|
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="INFO=C++unknown-release"
|
|
||||||
|
|
||||||
- os: osx
|
- os: osx
|
||||||
osx_image: xcode7.3
|
osx_image: xcode7.3
|
||||||
script:
|
script:
|
||||||
@ -88,142 +76,109 @@ matrix:
|
|||||||
- MATRIX_EVAL="INFO=C++11-sse2-release"
|
- MATRIX_EVAL="INFO=C++11-sse2-release"
|
||||||
|
|
||||||
- os: osx
|
- os: osx
|
||||||
osx_image: xcode8
|
osx_image: xcode10.3
|
||||||
script:
|
script:
|
||||||
- cmake --version
|
- cmake --version
|
||||||
- mkdir ./build_pure_14_release
|
- mkdir ./build_pure_14_release
|
||||||
- cd ./build_pure_14_release
|
- cd ./build_pure_14_release
|
||||||
- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_BUILD_TYPE=Release -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_14=ON -DGLM_TEST_FORCE_PURE=ON ..
|
- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_BUILD_TYPE=Release -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_14=ON -DGLM_TEST_FORCE_PURE=ON ..
|
||||||
- cmake --build . --parallel
|
- cmake --build . --parallel 4
|
||||||
- ctest --parallel 4 --output-on-failure
|
- ctest --parallel 4 --output-on-failure
|
||||||
- cd $TRAVIS_BUILD_DIR
|
- cd $TRAVIS_BUILD_DIR
|
||||||
- mkdir ./build_test_cmake
|
- mkdir ./build_test_cmake
|
||||||
- cd ./build_test_cmake
|
- cd ./build_test_cmake
|
||||||
- cmake -DCMAKE_CXX_COMPILER=$COMPILER $TRAVIS_BUILD_DIR/test/cmake/ -Dglm_DIR=$TRAVIS_BUILD_DIR/cmake/glm/
|
- cmake -DCMAKE_CXX_COMPILER=$COMPILER $TRAVIS_BUILD_DIR/test/cmake/ -Dglm_DIR=$TRAVIS_BUILD_DIR/cmake/glm/
|
||||||
- cmake --build . --parallel
|
- cmake --parallel 4 --build .
|
||||||
env:
|
env:
|
||||||
- MATRIX_EVAL="INFO=C++14-pure-release"
|
- MATRIX_EVAL="INFO=C++14-pure-release"
|
||||||
|
|
||||||
- os: osx
|
- os: osx
|
||||||
osx_image: xcode8
|
osx_image: xcode10.3
|
||||||
script:
|
script:
|
||||||
- cmake --version
|
- cmake --version
|
||||||
- mkdir ./build_sse3_14_release
|
- mkdir ./build_sse3_14_release
|
||||||
- cd ./build_sse3_14_release
|
- cd ./build_sse3_14_release
|
||||||
- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_BUILD_TYPE=Release -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_14=ON -DGLM_TEST_ENABLE_LANG_EXTENSIONS=ON -DGLM_TEST_ENABLE_SIMD_SSE3=ON ..
|
- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_BUILD_TYPE=Release -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_14=ON -DGLM_TEST_ENABLE_LANG_EXTENSIONS=ON -DGLM_TEST_ENABLE_SIMD_SSE3=ON ..
|
||||||
- cmake --build . --parallel
|
- cmake --build . --parallel 4
|
||||||
- ctest --parallel 4 --output-on-failure
|
- ctest --parallel 4 --output-on-failure
|
||||||
- cd $TRAVIS_BUILD_DIR
|
- cd $TRAVIS_BUILD_DIR
|
||||||
- mkdir ./build_test_cmake
|
- mkdir ./build_test_cmake
|
||||||
- cd ./build_test_cmake
|
- cd ./build_test_cmake
|
||||||
- cmake -DCMAKE_CXX_COMPILER=$COMPILER $TRAVIS_BUILD_DIR/test/cmake/ -Dglm_DIR=$TRAVIS_BUILD_DIR/cmake/glm/
|
- cmake -DCMAKE_CXX_COMPILER=$COMPILER $TRAVIS_BUILD_DIR/test/cmake/ -Dglm_DIR=$TRAVIS_BUILD_DIR/cmake/glm/
|
||||||
- cmake --build . --parallel
|
- cmake --build . --parallel 4
|
||||||
env:
|
env:
|
||||||
- MATRIX_EVAL="INFO=C++14-sse3-release"
|
- MATRIX_EVAL="INFO=C++14-sse3-release"
|
||||||
|
|
||||||
- os: osx
|
- os: osx
|
||||||
osx_image: xcode8
|
osx_image: xcode10.3
|
||||||
script:
|
|
||||||
- cmake --version
|
|
||||||
- mkdir ./build_avx_14_release
|
|
||||||
- cd ./build_avx_14_release
|
|
||||||
- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_BUILD_TYPE=Release -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_14=ON -DGLM_TEST_ENABLE_LANG_EXTENSIONS=ON -DGLM_TEST_ENABLE_SIMD_AVX=ON ..
|
|
||||||
- cmake --build . --parallel
|
|
||||||
- ctest --parallel 4 --output-on-failure
|
|
||||||
- cd $TRAVIS_BUILD_DIR
|
|
||||||
- mkdir ./build_test_cmake
|
|
||||||
- cd ./build_test_cmake
|
|
||||||
- cmake -DCMAKE_CXX_COMPILER=$COMPILER $TRAVIS_BUILD_DIR/test/cmake/ -Dglm_DIR=$TRAVIS_BUILD_DIR/cmake/glm/
|
|
||||||
- cmake --build . --parallel
|
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="INFO=C++14-avx-release"
|
|
||||||
|
|
||||||
- os: osx
|
|
||||||
osx_image: xcode8
|
|
||||||
script:
|
script:
|
||||||
- cmake --version
|
- cmake --version
|
||||||
- mkdir ./build_avx_14_debug
|
- mkdir ./build_avx_14_debug
|
||||||
- cd ./build_avx_14_debug
|
- cd ./build_avx_14_debug
|
||||||
- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_BUILD_TYPE=Debug -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_14=ON -DGLM_TEST_ENABLE_LANG_EXTENSIONS=ON -DGLM_TEST_ENABLE_SIMD_AVX=ON ..
|
- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_BUILD_TYPE=Debug -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_14=ON -DGLM_TEST_ENABLE_LANG_EXTENSIONS=ON -DGLM_TEST_ENABLE_SIMD_AVX=ON ..
|
||||||
- cmake --build . --parallel
|
- cmake --build . --parallel 4
|
||||||
- ctest --parallel 4 --output-on-failure
|
- ctest --parallel 4 --output-on-failure
|
||||||
- cd $TRAVIS_BUILD_DIR
|
- cd $TRAVIS_BUILD_DIR
|
||||||
- mkdir ./build_test_cmake
|
- mkdir ./build_test_cmake
|
||||||
- cd ./build_test_cmake
|
- cd ./build_test_cmake
|
||||||
- cmake -DCMAKE_CXX_COMPILER=$COMPILER $TRAVIS_BUILD_DIR/test/cmake/ -Dglm_DIR=$TRAVIS_BUILD_DIR/cmake/glm/
|
- cmake -DCMAKE_CXX_COMPILER=$COMPILER $TRAVIS_BUILD_DIR/test/cmake/ -Dglm_DIR=$TRAVIS_BUILD_DIR/cmake/glm/
|
||||||
- cmake --build . --parallel
|
- cmake --build . --parallel 4
|
||||||
env:
|
env:
|
||||||
- MATRIX_EVAL="INFO=C++14-avx-debug"
|
- MATRIX_EVAL="INFO=C++14-avx-debug"
|
||||||
|
|
||||||
- os: osx
|
- os: osx
|
||||||
osx_image: xcode11
|
osx_image: xcode12.2
|
||||||
script:
|
script:
|
||||||
- cmake --version
|
- cmake --version
|
||||||
- mkdir ./build_pure_17_release
|
- mkdir ./build_pure_17_release
|
||||||
- cd ./build_pure_17_release
|
- cd ./build_pure_17_release
|
||||||
- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_BUILD_TYPE=Release -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_17=ON -DGLM_TEST_FORCE_PURE=ON ..
|
- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_BUILD_TYPE=Release -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_17=ON -DGLM_TEST_FORCE_PURE=ON ..
|
||||||
- cmake --build . --parallel
|
- cmake --build . --parallel 4
|
||||||
- ctest --parallel 4 --output-on-failure
|
- ctest --parallel 4 --output-on-failure
|
||||||
- cd $TRAVIS_BUILD_DIR
|
- cd $TRAVIS_BUILD_DIR
|
||||||
- mkdir ./build_test_cmake
|
- mkdir ./build_test_cmake
|
||||||
- cd ./build_test_cmake
|
- cd ./build_test_cmake
|
||||||
- cmake -DCMAKE_CXX_COMPILER=$COMPILER $TRAVIS_BUILD_DIR/test/cmake/ -Dglm_DIR=$TRAVIS_BUILD_DIR/cmake/glm/
|
- cmake -DCMAKE_CXX_COMPILER=$COMPILER $TRAVIS_BUILD_DIR/test/cmake/ -Dglm_DIR=$TRAVIS_BUILD_DIR/cmake/glm/
|
||||||
- cmake --build . --parallel
|
- cmake --build . --parallel 4
|
||||||
env:
|
env:
|
||||||
- MATRIX_EVAL="INFO=C++17-pure-release"
|
- MATRIX_EVAL="INFO=C++17-pure-release"
|
||||||
|
|
||||||
- os: osx
|
- os: osx
|
||||||
osx_image: xcode11
|
osx_image: xcode12.2
|
||||||
script:
|
script:
|
||||||
- cmake --version
|
- cmake --version
|
||||||
- mkdir ./build_pure_17_debug
|
- mkdir ./build_pure_17_debug
|
||||||
- cd ./build_pure_17_debug
|
- cd ./build_pure_17_debug
|
||||||
- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_BUILD_TYPE=Debug -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_17=ON -DGLM_TEST_FORCE_PURE=ON ..
|
- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_BUILD_TYPE=Debug -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_17=ON -DGLM_TEST_FORCE_PURE=ON ..
|
||||||
- cmake --build . --parallel
|
- cmake --build . --parallel 4
|
||||||
- ctest --parallel 4 --output-on-failure
|
- ctest --parallel 4 --output-on-failure
|
||||||
- cd $TRAVIS_BUILD_DIR
|
- cd $TRAVIS_BUILD_DIR
|
||||||
- mkdir ./build_test_cmake
|
- mkdir ./build_test_cmake
|
||||||
- cd ./build_test_cmake
|
- cd ./build_test_cmake
|
||||||
- cmake -DCMAKE_CXX_COMPILER=$COMPILER $TRAVIS_BUILD_DIR/test/cmake/ -Dglm_DIR=$TRAVIS_BUILD_DIR/cmake/glm/
|
- cmake -DCMAKE_CXX_COMPILER=$COMPILER $TRAVIS_BUILD_DIR/test/cmake/ -Dglm_DIR=$TRAVIS_BUILD_DIR/cmake/glm/
|
||||||
- cmake --build . --parallel
|
- cmake --build . --parallel 4
|
||||||
env:
|
env:
|
||||||
- MATRIX_EVAL="INFO=C++17-pure-debug"
|
- MATRIX_EVAL="INFO=C++17-pure-debug"
|
||||||
|
|
||||||
- os: osx
|
- os: osx
|
||||||
osx_image: xcode11
|
osx_image: xcode12.2
|
||||||
script:
|
|
||||||
- cmake --version
|
|
||||||
- mkdir ./build_avx_17_release
|
|
||||||
- cd ./build_avx_17_release
|
|
||||||
- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_BUILD_TYPE=Release -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_17=ON -DGLM_TEST_ENABLE_LANG_EXTENSIONS=ON -DGLM_TEST_ENABLE_SIMD_AVX=ON ..
|
|
||||||
- cmake --build . --parallel
|
|
||||||
- ctest --parallel 4 --output-on-failure
|
|
||||||
- cd $TRAVIS_BUILD_DIR
|
|
||||||
- mkdir ./build_test_cmake
|
|
||||||
- cd ./build_test_cmake
|
|
||||||
- cmake -DCMAKE_CXX_COMPILER=$COMPILER $TRAVIS_BUILD_DIR/test/cmake/ -Dglm_DIR=$TRAVIS_BUILD_DIR/cmake/glm/
|
|
||||||
- cmake --build . --parallel
|
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="INFO=C++17-avx-release"
|
|
||||||
|
|
||||||
- os: osx
|
|
||||||
osx_image: xcode11
|
|
||||||
script:
|
script:
|
||||||
- cmake --version
|
- cmake --version
|
||||||
- mkdir ./build_avx_17_debug
|
- mkdir ./build_avx_17_debug
|
||||||
- cd ./build_avx_17_debug
|
- cd ./build_avx_17_debug
|
||||||
- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_BUILD_TYPE=Debug -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_17=ON -DGLM_TEST_ENABLE_LANG_EXTENSIONS=ON -DGLM_TEST_ENABLE_SIMD_AVX=ON ..
|
- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_BUILD_TYPE=Debug -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_17=ON -DGLM_TEST_ENABLE_LANG_EXTENSIONS=ON -DGLM_TEST_ENABLE_SIMD_AVX=ON ..
|
||||||
- cmake --build . --parallel
|
- cmake --build . --parallel 4
|
||||||
- ctest --parallel 4 --output-on-failure
|
- ctest --parallel 4 --output-on-failure
|
||||||
- cd $TRAVIS_BUILD_DIR
|
- cd $TRAVIS_BUILD_DIR
|
||||||
- mkdir ./build_test_cmake
|
- mkdir ./build_test_cmake
|
||||||
- cd ./build_test_cmake
|
- cd ./build_test_cmake
|
||||||
- cmake -DCMAKE_CXX_COMPILER=$COMPILER $TRAVIS_BUILD_DIR/test/cmake/ -Dglm_DIR=$TRAVIS_BUILD_DIR/cmake/glm/
|
- cmake -DCMAKE_CXX_COMPILER=$COMPILER $TRAVIS_BUILD_DIR/test/cmake/ -Dglm_DIR=$TRAVIS_BUILD_DIR/cmake/glm/
|
||||||
- cmake --build . --parallel
|
- cmake --build . --parallel 4
|
||||||
env:
|
env:
|
||||||
- MATRIX_EVAL="INFO=C++17-avx-debug"
|
- MATRIX_EVAL="INFO=C++17-avx-debug"
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
|
dist: Xenial
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
@ -246,6 +201,7 @@ matrix:
|
|||||||
- cmake --build . --parallel
|
- cmake --build . --parallel
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
|
dist: Xenial
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
@ -268,6 +224,7 @@ matrix:
|
|||||||
- cmake --build . --parallel
|
- cmake --build . --parallel
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
|
dist: Xenial
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
@ -290,28 +247,7 @@ matrix:
|
|||||||
- cmake --build . --parallel
|
- cmake --build . --parallel
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
addons:
|
dist: Xenial
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
packages:
|
|
||||||
- g++-5
|
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="CC=gcc-5 && CXX=g++-5 && INFO=C++11-pure-release"
|
|
||||||
script:
|
|
||||||
- cmake --version
|
|
||||||
- mkdir ./build_pure_11_release
|
|
||||||
- cd ./build_pure_11_release
|
|
||||||
- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_BUILD_TYPE=Release -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_11=ON -DGLM_TEST_FORCE_PURE=ON ..
|
|
||||||
- cmake --build . --parallel
|
|
||||||
- ctest --parallel 4 --output-on-failure
|
|
||||||
- cd $TRAVIS_BUILD_DIR
|
|
||||||
- mkdir ./build_test_cmake
|
|
||||||
- cd ./build_test_cmake
|
|
||||||
- cmake -DCMAKE_CXX_COMPILER=$COMPILER $TRAVIS_BUILD_DIR/test/cmake/ -Dglm_DIR=$TRAVIS_BUILD_DIR/cmake/glm/
|
|
||||||
- cmake --build . --parallel
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
@ -334,6 +270,7 @@ matrix:
|
|||||||
- cmake --build . --parallel
|
- cmake --build . --parallel
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
|
dist: Xenial
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
@ -356,6 +293,7 @@ matrix:
|
|||||||
- cmake --build . --parallel
|
- cmake --build . --parallel
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
|
dist: Xenial
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
@ -378,28 +316,7 @@ matrix:
|
|||||||
- cmake --build . --parallel
|
- cmake --build . --parallel
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
addons:
|
dist: bionic
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
packages:
|
|
||||||
- g++-6
|
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="CC=gcc-6 && CXX=g++-6 && INFO=C++14-pure-release"
|
|
||||||
script:
|
|
||||||
- cmake --version
|
|
||||||
- mkdir ./build_pure_14_release
|
|
||||||
- cd ./build_pure_14_release
|
|
||||||
- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_BUILD_TYPE=Release -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_14=ON -DGLM_TEST_FORCE_PURE=ON ..
|
|
||||||
- cmake --build . --parallel
|
|
||||||
- ctest --parallel 4 --output-on-failure
|
|
||||||
- cd $TRAVIS_BUILD_DIR
|
|
||||||
- mkdir ./build_test_cmake
|
|
||||||
- cd ./build_test_cmake
|
|
||||||
- cmake -DCMAKE_CXX_COMPILER=$COMPILER $TRAVIS_BUILD_DIR/test/cmake/ -Dglm_DIR=$TRAVIS_BUILD_DIR/cmake/glm/
|
|
||||||
- cmake --build . --parallel
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
@ -422,6 +339,7 @@ matrix:
|
|||||||
- cmake --build . --parallel
|
- cmake --build . --parallel
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
|
dist: bionic
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
@ -444,28 +362,7 @@ matrix:
|
|||||||
- cmake --build . --parallel
|
- cmake --build . --parallel
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
addons:
|
dist: bionic
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
packages:
|
|
||||||
- g++-6
|
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="CC=gcc-6 && CXX=g++-6 && INFO=C++14-sse3-release"
|
|
||||||
script:
|
|
||||||
- cmake --version
|
|
||||||
- mkdir ./build_sse3_ms_release
|
|
||||||
- cd ./build_sse3_ms_release
|
|
||||||
- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_BUILD_TYPE=Release -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_14=ON -DGLM_TEST_ENABLE_LANG_EXTENSIONS=ON -DGLM_TEST_ENABLE_SIMD_SSE3=ON ..
|
|
||||||
- cmake --build . --parallel
|
|
||||||
- ctest --parallel 4 --output-on-failure
|
|
||||||
- cd $TRAVIS_BUILD_DIR
|
|
||||||
- mkdir ./build_test_cmake
|
|
||||||
- cd ./build_test_cmake
|
|
||||||
- cmake -DCMAKE_CXX_COMPILER=$COMPILER $TRAVIS_BUILD_DIR/test/cmake/ -Dglm_DIR=$TRAVIS_BUILD_DIR/cmake/glm/
|
|
||||||
- cmake --build . --parallel
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
@ -488,6 +385,7 @@ matrix:
|
|||||||
- cmake --build . --parallel
|
- cmake --build . --parallel
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
|
dist: bionic
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
@ -510,6 +408,7 @@ matrix:
|
|||||||
- cmake --build . --parallel
|
- cmake --build . --parallel
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
|
dist: bionic
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
@ -517,12 +416,12 @@ matrix:
|
|||||||
packages:
|
packages:
|
||||||
- g++-7
|
- g++-7
|
||||||
env:
|
env:
|
||||||
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7 && INFO=C++17-sse3-release"
|
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7 && INFO=C++17-sse3-debug"
|
||||||
script:
|
script:
|
||||||
- cmake --version
|
- cmake --version
|
||||||
- mkdir ./build_sse3_17_release
|
- mkdir ./build_sse3_17_debug
|
||||||
- cd ./build_sse3_17_release
|
- cd ./build_sse3_17_debug
|
||||||
- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_BUILD_TYPE=Release -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_17=ON -DGLM_TEST_ENABLE_LANG_EXTENSIONS=ON -DGLM_TEST_ENABLE_SIMD_SSE3=ON ..
|
- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_BUILD_TYPE=Debug -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_17=ON -DGLM_TEST_ENABLE_LANG_EXTENSIONS=ON -DGLM_TEST_ENABLE_SIMD_SSE3=ON ..
|
||||||
- cmake -E time cmake --build . --parallel
|
- cmake -E time cmake --build . --parallel
|
||||||
- ctest --parallel 4 --output-on-failure
|
- ctest --parallel 4 --output-on-failure
|
||||||
- cd $TRAVIS_BUILD_DIR
|
- cd $TRAVIS_BUILD_DIR
|
||||||
@ -532,6 +431,7 @@ matrix:
|
|||||||
- cmake --build . --parallel
|
- cmake --build . --parallel
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
|
dist: bionic
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
@ -539,57 +439,12 @@ matrix:
|
|||||||
packages:
|
packages:
|
||||||
- g++-7
|
- g++-7
|
||||||
env:
|
env:
|
||||||
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7 && INFO=C++17-avx-release"
|
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7 && INFO=C++17-avx2-debug"
|
||||||
script:
|
script:
|
||||||
- cmake --version
|
- cmake --version
|
||||||
- mkdir ./build_avx_17_release
|
- mkdir ./build_avx2_17_debug
|
||||||
- cd ./build_avx_17_release
|
- cd ./build_avx2_17_debug
|
||||||
- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_BUILD_TYPE=Release -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_17=ON -DGLM_TEST_ENABLE_LANG_EXTENSIONS=ON -DGLM_TEST_ENABLE_SIMD_AVX=ON ..
|
- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_BUILD_TYPE=Debug -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_17=ON -DGLM_TEST_ENABLE_LANG_EXTENSIONS=ON -DGLM_TEST_ENABLE_SIMD_AVX2=ON ..
|
||||||
- cmake -E time cmake --build . --parallel
|
|
||||||
- ctest --parallel 4 --output-on-failure
|
|
||||||
- cd $TRAVIS_BUILD_DIR
|
|
||||||
- mkdir ./build_test_cmake
|
|
||||||
- cd ./build_test_cmake
|
|
||||||
- cmake -DCMAKE_CXX_COMPILER=$COMPILER $TRAVIS_BUILD_DIR/test/cmake/ -Dglm_DIR=$TRAVIS_BUILD_DIR/cmake/glm/
|
|
||||||
- cmake --build . --parallel
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
packages:
|
|
||||||
- g++-7
|
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7 && INFO=C++17-avx2-release"
|
|
||||||
script:
|
|
||||||
- cmake --version
|
|
||||||
- mkdir ./build_avx2_17_release
|
|
||||||
- cd ./build_avx2_17_release
|
|
||||||
- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_BUILD_TYPE=Release -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_17=ON -DGLM_TEST_ENABLE_LANG_EXTENSIONS=ON -DGLM_TEST_ENABLE_SIMD_AVX2=ON ..
|
|
||||||
- cmake -E time cmake --build . --parallel
|
|
||||||
- ctest --parallel 4 --output-on-failure
|
|
||||||
- cd $TRAVIS_BUILD_DIR
|
|
||||||
- mkdir ./build_test_cmake
|
|
||||||
- cd ./build_test_cmake
|
|
||||||
- cmake -DCMAKE_CXX_COMPILER=$COMPILER $TRAVIS_BUILD_DIR/test/cmake/ -Dglm_DIR=$TRAVIS_BUILD_DIR/cmake/glm/
|
|
||||||
- cmake --build . --parallel
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
- llvm-toolchain-precise-3.6
|
|
||||||
packages:
|
|
||||||
- clang-3.6
|
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="CC=clang-3.6 && CXX=clang++-3.6 && INFO=C++14-pure-release"
|
|
||||||
script:
|
|
||||||
- cmake --version
|
|
||||||
- mkdir ./build_pure_14_release
|
|
||||||
- cd ./build_pure_14_release
|
|
||||||
- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_BUILD_TYPE=Release -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_14=ON -DGLM_TEST_FORCE_PURE=ON ..
|
|
||||||
- cmake -E time cmake --build . --parallel
|
- cmake -E time cmake --build . --parallel
|
||||||
- ctest --parallel 4 --output-on-failure
|
- ctest --parallel 4 --output-on-failure
|
||||||
- cd $TRAVIS_BUILD_DIR
|
- cd $TRAVIS_BUILD_DIR
|
||||||
@ -599,6 +454,7 @@ matrix:
|
|||||||
- cmake --build . --parallel
|
- cmake --build . --parallel
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
|
dist: Xenial
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
@ -622,6 +478,7 @@ matrix:
|
|||||||
- cmake --build . --parallel
|
- cmake --build . --parallel
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
|
dist: Xenial
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
@ -645,24 +502,7 @@ matrix:
|
|||||||
- cmake --build . --parallel
|
- cmake --build . --parallel
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
dist: bionic
|
dist: focal
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="CC=clang && CXX=clang++ && INFO=C++17-pure-release"
|
|
||||||
script:
|
|
||||||
- cmake --version
|
|
||||||
- mkdir ./build_pure_17_release
|
|
||||||
- cd ./build_pure_17_release
|
|
||||||
- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_BUILD_TYPE=Release -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_17=ON -DGLM_TEST_FORCE_PURE=ON ..
|
|
||||||
- cmake -E time cmake --build . --parallel
|
|
||||||
- ctest --parallel 4 --output-on-failure
|
|
||||||
- cd $TRAVIS_BUILD_DIR
|
|
||||||
- mkdir ./build_test_cmake
|
|
||||||
- cd ./build_test_cmake
|
|
||||||
- cmake -DCMAKE_CXX_COMPILER=$COMPILER $TRAVIS_BUILD_DIR/test/cmake/ -Dglm_DIR=$TRAVIS_BUILD_DIR/cmake/glm/
|
|
||||||
- cmake --build . --parallel
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
dist: bionic
|
|
||||||
env:
|
env:
|
||||||
- MATRIX_EVAL="CC=clang && CXX=clang++ && INFO=C++17-pure-debug"
|
- MATRIX_EVAL="CC=clang && CXX=clang++ && INFO=C++17-pure-debug"
|
||||||
script:
|
script:
|
||||||
@ -679,24 +519,7 @@ matrix:
|
|||||||
- cmake --build . --parallel
|
- cmake --build . --parallel
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
dist: bionic
|
dist: focal
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="CC=clang && CXX=clang++ && INFO=C++17-sse3-release
|
|
||||||
script:
|
|
||||||
- cmake --version
|
|
||||||
- mkdir ./build_sse3_17_release
|
|
||||||
- cd ./build_sse3_17_release
|
|
||||||
- cmake -DCMAKE_CXX_COMPILER=$COMPILER -DCMAKE_BUILD_TYPE=Release -DGLM_TEST_ENABLE=ON -DGLM_TEST_ENABLE_CXX_17=ON -DGLM_TEST_ENABLE_LANG_EXTENSIONS=ON -DGLM_TEST_ENABLE_SIMD_SSE3=ON ..
|
|
||||||
- cmake -E time cmake --build . --parallel
|
|
||||||
- ctest --parallel 4 --output-on-failure
|
|
||||||
- cd $TRAVIS_BUILD_DIR
|
|
||||||
- mkdir ./build_test_cmake
|
|
||||||
- cd ./build_test_cmake
|
|
||||||
- cmake -DCMAKE_CXX_COMPILER=$COMPILER $TRAVIS_BUILD_DIR/test/cmake/ -Dglm_DIR=$TRAVIS_BUILD_DIR/cmake/glm/
|
|
||||||
- cmake --build . --parallel
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
dist: bionic
|
|
||||||
env:
|
env:
|
||||||
- MATRIX_EVAL="CC=clang && CXX=clang++ && INFO=C++17-sse3-debug"
|
- MATRIX_EVAL="CC=clang && CXX=clang++ && INFO=C++17-sse3-debug"
|
||||||
script:
|
script:
|
||||||
@ -713,7 +536,7 @@ matrix:
|
|||||||
- cmake --build . --parallel
|
- cmake --build . --parallel
|
||||||
|
|
||||||
- os: linux
|
- os: linux
|
||||||
dist: bionic
|
dist: focal
|
||||||
env:
|
env:
|
||||||
- MATRIX_EVAL="CC=clang && CXX=clang++ && INFO=C++17-ssse3-release"
|
- MATRIX_EVAL="CC=clang && CXX=clang++ && INFO=C++17-ssse3-release"
|
||||||
script:
|
script:
|
||||||
|
@ -16,6 +16,38 @@ namespace detail
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<length_t C, length_t R, typename T, qualifier Q, bool IsFloat, bool Aligned>
|
||||||
|
struct compute_matrixCompMult_type {
|
||||||
|
GLM_FUNC_QUALIFIER static mat<C, R, T, Q> call(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y)
|
||||||
|
{
|
||||||
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE,
|
||||||
|
"'matrixCompMult' only accept floating-point inputs, include <glm/ext/matrix_integer.hpp> to discard this restriction.");
|
||||||
|
return detail::compute_matrixCompMult<C, R, T, Q, detail::is_aligned<Q>::value>::call(x, y);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<length_t DA, length_t DB, typename T, qualifier Q>
|
||||||
|
struct compute_outerProduct {
|
||||||
|
GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait<DA, DB, T, Q>::type call(vec<DA, T, Q> const& c, vec<DB, T, Q> const& r)
|
||||||
|
{
|
||||||
|
typename detail::outerProduct_trait<DA, DB, T, Q>::type m;
|
||||||
|
for(length_t i = 0; i < m.length(); ++i)
|
||||||
|
m[i] = c * r[i];
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<length_t DA, length_t DB, typename T, qualifier Q, bool IsFloat>
|
||||||
|
struct compute_outerProduct_type {
|
||||||
|
GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait<DA, DB, T, Q>::type call(vec<DA, T, Q> const& c, vec<DB, T, Q> const& r)
|
||||||
|
{
|
||||||
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE,
|
||||||
|
"'outerProduct' only accept floating-point inputs, include <glm/ext/matrix_integer.hpp> to discard this restriction.");
|
||||||
|
|
||||||
|
return detail::compute_outerProduct<DA, DB, T, Q>::call(c, r);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
template<length_t C, length_t R, typename T, qualifier Q, bool Aligned>
|
template<length_t C, length_t R, typename T, qualifier Q, bool Aligned>
|
||||||
struct compute_transpose{};
|
struct compute_transpose{};
|
||||||
|
|
||||||
@ -195,6 +227,16 @@ namespace detail
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<length_t C, length_t R, typename T, qualifier Q, bool IsFloat, bool Aligned>
|
||||||
|
struct compute_transpose_type {
|
||||||
|
GLM_FUNC_QUALIFIER static mat<R, C, T, Q> call(mat<C, R, T, Q> const& m)
|
||||||
|
{
|
||||||
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE,
|
||||||
|
"'transpose' only accept floating-point inputs, include <glm/ext/matrix_integer.hpp> to discard this restriction.");
|
||||||
|
return detail::compute_transpose<C, R, T, Q, detail::is_aligned<Q>::value>::call(m);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
template<length_t C, length_t R, typename T, qualifier Q, bool Aligned>
|
template<length_t C, length_t R, typename T, qualifier Q, bool Aligned>
|
||||||
struct compute_determinant{};
|
struct compute_determinant{};
|
||||||
|
|
||||||
@ -243,6 +285,17 @@ namespace detail
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<length_t C, length_t R, typename T, qualifier Q, bool IsFloat, bool Aligned>
|
||||||
|
struct compute_determinant_type{
|
||||||
|
|
||||||
|
GLM_FUNC_QUALIFIER static T call(mat<C, R, T, Q> const& m)
|
||||||
|
{
|
||||||
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE,
|
||||||
|
"'determinant' only accept floating-point inputs, include <glm/ext/matrix_integer.hpp> to discard this restriction.");
|
||||||
|
return detail::compute_determinant<C, R, T, Q, detail::is_aligned<Q>::value>::call(m);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
template<length_t C, length_t R, typename T, qualifier Q, bool Aligned>
|
template<length_t C, length_t R, typename T, qualifier Q, bool Aligned>
|
||||||
struct compute_inverse{};
|
struct compute_inverse{};
|
||||||
|
|
||||||
@ -355,33 +408,25 @@ namespace detail
|
|||||||
template<length_t C, length_t R, typename T, qualifier Q>
|
template<length_t C, length_t R, typename T, qualifier Q>
|
||||||
GLM_FUNC_QUALIFIER mat<C, R, T, Q> matrixCompMult(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y)
|
GLM_FUNC_QUALIFIER mat<C, R, T, Q> matrixCompMult(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'matrixCompMult' only accept floating-point inputs");
|
return detail::compute_matrixCompMult_type<C, R, T, Q, std::numeric_limits<T>::is_iec559, detail::is_aligned<Q>::value>::call(x, y);
|
||||||
return detail::compute_matrixCompMult<C, R, T, Q, detail::is_aligned<Q>::value>::call(x, y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<length_t DA, length_t DB, typename T, qualifier Q>
|
template<length_t DA, length_t DB, typename T, qualifier Q>
|
||||||
GLM_FUNC_QUALIFIER typename detail::outerProduct_trait<DA, DB, T, Q>::type outerProduct(vec<DA, T, Q> const& c, vec<DB, T, Q> const& r)
|
GLM_FUNC_QUALIFIER typename detail::outerProduct_trait<DA, DB, T, Q>::type outerProduct(vec<DA, T, Q> const& c, vec<DB, T, Q> const& r)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'outerProduct' only accept floating-point inputs");
|
return detail::compute_outerProduct_type<DA, DB, T, Q, std::numeric_limits<T>::is_iec559>::call(c, r);
|
||||||
|
|
||||||
typename detail::outerProduct_trait<DA, DB, T, Q>::type m;
|
|
||||||
for(length_t i = 0; i < m.length(); ++i)
|
|
||||||
m[i] = c * r[i];
|
|
||||||
return m;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<length_t C, length_t R, typename T, qualifier Q>
|
template<length_t C, length_t R, typename T, qualifier Q>
|
||||||
GLM_FUNC_QUALIFIER typename mat<C, R, T, Q>::transpose_type transpose(mat<C, R, T, Q> const& m)
|
GLM_FUNC_QUALIFIER typename mat<C, R, T, Q>::transpose_type transpose(mat<C, R, T, Q> const& m)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'transpose' only accept floating-point inputs");
|
return detail::compute_transpose_type<C, R, T, Q, std::numeric_limits<T>::is_iec559, detail::is_aligned<Q>::value>::call(m);
|
||||||
return detail::compute_transpose<C, R, T, Q, detail::is_aligned<Q>::value>::call(m);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<length_t C, length_t R, typename T, qualifier Q>
|
template<length_t C, length_t R, typename T, qualifier Q>
|
||||||
GLM_FUNC_QUALIFIER T determinant(mat<C, R, T, Q> const& m)
|
GLM_FUNC_QUALIFIER T determinant(mat<C, R, T, Q> const& m)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'determinant' only accept floating-point inputs");
|
return detail::compute_determinant_type<C, R, T, Q, std::numeric_limits<T>::is_iec559, detail::is_aligned<Q>::value>::call(m);
|
||||||
return detail::compute_determinant<C, R, T, Q, detail::is_aligned<Q>::value>::call(m);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<length_t C, length_t R, typename T, qualifier Q>
|
template<length_t C, length_t R, typename T, qualifier Q>
|
||||||
|
91
glm/ext/matrix_integer.hpp
Normal file
91
glm/ext/matrix_integer.hpp
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
/// @ref ext_matrix_integer
|
||||||
|
/// @file glm/ext/matrix_integer.hpp
|
||||||
|
///
|
||||||
|
/// @defgroup ext_matrix_integer GLM_EXT_matrix_integer
|
||||||
|
/// @ingroup ext
|
||||||
|
///
|
||||||
|
/// Defines functions that generate common transformation matrices.
|
||||||
|
///
|
||||||
|
/// The matrices generated by this extension use standard OpenGL fixed-function
|
||||||
|
/// conventions. For example, the lookAt function generates a transform from world
|
||||||
|
/// space into the specific eye space that the projective matrix functions
|
||||||
|
/// (perspective, ortho, etc) are designed to expect. The OpenGL compatibility
|
||||||
|
/// specifications defines the particular layout of this eye space.
|
||||||
|
///
|
||||||
|
/// Include <glm/ext/matrix_integer.hpp> to use the features of this extension.
|
||||||
|
///
|
||||||
|
/// @see ext_matrix_projection
|
||||||
|
/// @see ext_matrix_clip_space
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// Dependencies
|
||||||
|
#include "../gtc/constants.hpp"
|
||||||
|
#include "../geometric.hpp"
|
||||||
|
#include "../trigonometric.hpp"
|
||||||
|
#include "../matrix.hpp"
|
||||||
|
|
||||||
|
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
|
||||||
|
# pragma message("GLM: GLM_EXT_matrix_integer extension included")
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace glm
|
||||||
|
{
|
||||||
|
/// @addtogroup ext_matrix_integer
|
||||||
|
/// @{
|
||||||
|
|
||||||
|
/// Multiply matrix x by matrix y component-wise, i.e.,
|
||||||
|
/// result[i][j] is the scalar product of x[i][j] and y[i][j].
|
||||||
|
///
|
||||||
|
/// @tparam C Integer between 1 and 4 included that qualify the number a column
|
||||||
|
/// @tparam R Integer between 1 and 4 included that qualify the number a row
|
||||||
|
/// @tparam T Floating-point or signed integer scalar types
|
||||||
|
/// @tparam Q Value from qualifier enum
|
||||||
|
///
|
||||||
|
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/matrixCompMult.xml">GLSL matrixCompMult man page</a>
|
||||||
|
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
|
||||||
|
template<length_t C, length_t R, typename T, qualifier Q>
|
||||||
|
GLM_FUNC_DECL mat<C, R, T, Q> matrixCompMult(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y);
|
||||||
|
|
||||||
|
/// Treats the first parameter c as a column vector
|
||||||
|
/// and the second parameter r as a row vector
|
||||||
|
/// and does a linear algebraic matrix multiply c * r.
|
||||||
|
///
|
||||||
|
/// @tparam C Integer between 1 and 4 included that qualify the number a column
|
||||||
|
/// @tparam R Integer between 1 and 4 included that qualify the number a row
|
||||||
|
/// @tparam T Floating-point or signed integer scalar types
|
||||||
|
/// @tparam Q Value from qualifier enum
|
||||||
|
///
|
||||||
|
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/outerProduct.xml">GLSL outerProduct man page</a>
|
||||||
|
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
|
||||||
|
template<length_t C, length_t R, typename T, qualifier Q>
|
||||||
|
GLM_FUNC_DECL typename detail::outerProduct_trait<C, R, T, Q>::type outerProduct(vec<C, T, Q> const& c, vec<R, T, Q> const& r);
|
||||||
|
|
||||||
|
/// Returns the transposed matrix of x
|
||||||
|
///
|
||||||
|
/// @tparam C Integer between 1 and 4 included that qualify the number a column
|
||||||
|
/// @tparam R Integer between 1 and 4 included that qualify the number a row
|
||||||
|
/// @tparam T Floating-point or signed integer scalar types
|
||||||
|
/// @tparam Q Value from qualifier enum
|
||||||
|
///
|
||||||
|
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/transpose.xml">GLSL transpose man page</a>
|
||||||
|
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
|
||||||
|
template<length_t C, length_t R, typename T, qualifier Q>
|
||||||
|
GLM_FUNC_DECL typename mat<C, R, T, Q>::transpose_type transpose(mat<C, R, T, Q> const& x);
|
||||||
|
|
||||||
|
/// Return the determinant of a squared matrix.
|
||||||
|
///
|
||||||
|
/// @tparam C Integer between 1 and 4 included that qualify the number a column
|
||||||
|
/// @tparam R Integer between 1 and 4 included that qualify the number a row
|
||||||
|
/// @tparam T Floating-point or signed integer scalar types
|
||||||
|
/// @tparam Q Value from qualifier enum
|
||||||
|
///
|
||||||
|
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/determinant.xml">GLSL determinant man page</a>
|
||||||
|
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
|
||||||
|
template<length_t C, length_t R, typename T, qualifier Q>
|
||||||
|
GLM_FUNC_DECL T determinant(mat<C, R, T, Q> const& m);
|
||||||
|
|
||||||
|
/// @}
|
||||||
|
}//namespace glm
|
||||||
|
|
||||||
|
#include "matrix_integer.inl"
|
38
glm/ext/matrix_integer.inl
Normal file
38
glm/ext/matrix_integer.inl
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
namespace glm{
|
||||||
|
namespace detail
|
||||||
|
{
|
||||||
|
template<length_t C, length_t R, typename T, qualifier Q, bool Aligned>
|
||||||
|
struct compute_matrixCompMult_type<C, R, T, Q, false, Aligned> {
|
||||||
|
GLM_FUNC_QUALIFIER static mat<C, R, T, Q> call(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y)
|
||||||
|
{
|
||||||
|
return detail::compute_matrixCompMult<C, R, T, Q, detail::is_aligned<Q>::value>::call(x, y);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<length_t DA, length_t DB, typename T, qualifier Q>
|
||||||
|
struct compute_outerProduct_type<DA, DB, T, Q, false> {
|
||||||
|
GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait<DA, DB, T, Q>::type call(vec<DA, T, Q> const& c, vec<DB, T, Q> const& r)
|
||||||
|
{
|
||||||
|
return detail::compute_outerProduct<DA, DB, T, Q>::call(c, r);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<length_t C, length_t R, typename T, qualifier Q, bool Aligned>
|
||||||
|
struct compute_transpose_type<C, R, T, Q, false, Aligned>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static mat<R, C, T, Q> call(mat<C, R, T, Q> const& m)
|
||||||
|
{
|
||||||
|
return detail::compute_transpose<C, R, T, Q, detail::is_aligned<Q>::value>::call(m);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<length_t C, length_t R, typename T, qualifier Q, bool Aligned>
|
||||||
|
struct compute_determinant_type<C, R, T, Q, false, Aligned>{
|
||||||
|
|
||||||
|
GLM_FUNC_QUALIFIER static T call(mat<C, R, T, Q> const& m)
|
||||||
|
{
|
||||||
|
return detail::compute_determinant<C, R, T, Q, detail::is_aligned<Q>::value>::call(m);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}//namespace detail
|
||||||
|
}//namespace glm
|
@ -10,7 +10,10 @@ namespace glm
|
|||||||
template<length_t C, length_t R, typename T, qualifier Q>
|
template<length_t C, length_t R, typename T, qualifier Q>
|
||||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<C, bool, Q> equal(mat<C, R, T, Q> const& a, mat<C, R, T, Q> const& b)
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<C, bool, Q> equal(mat<C, R, T, Q> const& a, mat<C, R, T, Q> const& b)
|
||||||
{
|
{
|
||||||
return equal(a, b, static_cast<T>(0));
|
vec<C, bool, Q> Result(true);
|
||||||
|
for(length_t i = 0; i < C; ++i)
|
||||||
|
Result[i] = all(equal(a[i], b[i]));
|
||||||
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<length_t C, length_t R, typename T, qualifier Q>
|
template<length_t C, length_t R, typename T, qualifier Q>
|
||||||
@ -29,15 +32,18 @@ namespace glm
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<length_t C, length_t R, typename T, qualifier Q>
|
template<length_t C, length_t R, typename T, qualifier Q>
|
||||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<C, bool, Q> notEqual(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y)
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<C, bool, Q> notEqual(mat<C, R, T, Q> const& a, mat<C, R, T, Q> const& b)
|
||||||
{
|
{
|
||||||
return notEqual(x, y, static_cast<T>(0));
|
vec<C, bool, Q> Result(true);
|
||||||
|
for(length_t i = 0; i < C; ++i)
|
||||||
|
Result[i] = any(notEqual(a[i], b[i]));
|
||||||
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<length_t C, length_t R, typename T, qualifier Q>
|
template<length_t C, length_t R, typename T, qualifier Q>
|
||||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<C, bool, Q> notEqual(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y, T Epsilon)
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<C, bool, Q> notEqual(mat<C, R, T, Q> const& a, mat<C, R, T, Q> const& b, T Epsilon)
|
||||||
{
|
{
|
||||||
return notEqual(x, y, vec<C, T, Q>(Epsilon));
|
return notEqual(a, b, vec<C, T, Q>(Epsilon));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<length_t C, length_t R, typename T, qualifier Q>
|
template<length_t C, length_t R, typename T, qualifier Q>
|
||||||
@ -65,9 +71,9 @@ namespace glm
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<length_t C, length_t R, typename T, qualifier Q>
|
template<length_t C, length_t R, typename T, qualifier Q>
|
||||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<C, bool, Q> notEqual(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y, int MaxULPs)
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<C, bool, Q> notEqual(mat<C, R, T, Q> const& a, mat<C, R, T, Q> const& b, int MaxULPs)
|
||||||
{
|
{
|
||||||
return notEqual(x, y, vec<C, int, Q>(MaxULPs));
|
return notEqual(a, b, vec<C, int, Q>(MaxULPs));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<length_t C, length_t R, typename T, qualifier Q>
|
template<length_t C, length_t R, typename T, qualifier Q>
|
||||||
|
@ -97,7 +97,7 @@ namespace detail
|
|||||||
///
|
///
|
||||||
/// @tparam C Integer between 1 and 4 included that qualify the number a column
|
/// @tparam C Integer between 1 and 4 included that qualify the number a column
|
||||||
/// @tparam R Integer between 1 and 4 included that qualify the number a row
|
/// @tparam R Integer between 1 and 4 included that qualify the number a row
|
||||||
/// @tparam T Floating-point or signed integer scalar types
|
/// @tparam T Floating-point scalar types
|
||||||
/// @tparam Q Value from qualifier enum
|
/// @tparam Q Value from qualifier enum
|
||||||
///
|
///
|
||||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/matrixCompMult.xml">GLSL matrixCompMult man page</a>
|
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/matrixCompMult.xml">GLSL matrixCompMult man page</a>
|
||||||
@ -111,7 +111,7 @@ namespace detail
|
|||||||
///
|
///
|
||||||
/// @tparam C Integer between 1 and 4 included that qualify the number a column
|
/// @tparam C Integer between 1 and 4 included that qualify the number a column
|
||||||
/// @tparam R Integer between 1 and 4 included that qualify the number a row
|
/// @tparam R Integer between 1 and 4 included that qualify the number a row
|
||||||
/// @tparam T Floating-point or signed integer scalar types
|
/// @tparam T Floating-point scalar types
|
||||||
/// @tparam Q Value from qualifier enum
|
/// @tparam Q Value from qualifier enum
|
||||||
///
|
///
|
||||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/outerProduct.xml">GLSL outerProduct man page</a>
|
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/outerProduct.xml">GLSL outerProduct man page</a>
|
||||||
@ -123,7 +123,7 @@ namespace detail
|
|||||||
///
|
///
|
||||||
/// @tparam C Integer between 1 and 4 included that qualify the number a column
|
/// @tparam C Integer between 1 and 4 included that qualify the number a column
|
||||||
/// @tparam R Integer between 1 and 4 included that qualify the number a row
|
/// @tparam R Integer between 1 and 4 included that qualify the number a row
|
||||||
/// @tparam T Floating-point or signed integer scalar types
|
/// @tparam T Floating-point scalar types
|
||||||
/// @tparam Q Value from qualifier enum
|
/// @tparam Q Value from qualifier enum
|
||||||
///
|
///
|
||||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/transpose.xml">GLSL transpose man page</a>
|
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/transpose.xml">GLSL transpose man page</a>
|
||||||
@ -135,7 +135,7 @@ namespace detail
|
|||||||
///
|
///
|
||||||
/// @tparam C Integer between 1 and 4 included that qualify the number a column
|
/// @tparam C Integer between 1 and 4 included that qualify the number a column
|
||||||
/// @tparam R Integer between 1 and 4 included that qualify the number a row
|
/// @tparam R Integer between 1 and 4 included that qualify the number a row
|
||||||
/// @tparam T Floating-point or signed integer scalar types
|
/// @tparam T Floating-point scalar types
|
||||||
/// @tparam Q Value from qualifier enum
|
/// @tparam Q Value from qualifier enum
|
||||||
///
|
///
|
||||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/determinant.xml">GLSL determinant man page</a>
|
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/determinant.xml">GLSL determinant man page</a>
|
||||||
@ -147,7 +147,7 @@ namespace detail
|
|||||||
///
|
///
|
||||||
/// @tparam C Integer between 1 and 4 included that qualify the number a column
|
/// @tparam C Integer between 1 and 4 included that qualify the number a column
|
||||||
/// @tparam R Integer between 1 and 4 included that qualify the number a row
|
/// @tparam R Integer between 1 and 4 included that qualify the number a row
|
||||||
/// @tparam T Floating-point or signed integer scalar types
|
/// @tparam T Floating-point scalar types
|
||||||
/// @tparam Q Value from qualifier enum
|
/// @tparam Q Value from qualifier enum
|
||||||
///
|
///
|
||||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inverse.xml">GLSL inverse man page</a>
|
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inverse.xml">GLSL inverse man page</a>
|
||||||
|
@ -58,6 +58,7 @@ glm::mat4 camera(float Translate, glm::vec2 const& Rotate)
|
|||||||
- Added *GLM_EXT_scalar_reciprocal* with tests
|
- Added *GLM_EXT_scalar_reciprocal* with tests
|
||||||
- Added *GLM_EXT_vector_reciprocal* with tests
|
- Added *GLM_EXT_vector_reciprocal* with tests
|
||||||
- Added `glm::iround` and `glm::uround` to *GLM_EXT_scalar_common* and *GLM_EXT_vector_common*
|
- Added `glm::iround` and `glm::uround` to *GLM_EXT_scalar_common* and *GLM_EXT_vector_common*
|
||||||
|
- Added *GLM_EXT_matrix_integer* with tests
|
||||||
|
|
||||||
#### Improvements:
|
#### Improvements:
|
||||||
- Added `constexpr` qualifier for `cross` product #1040
|
- Added `constexpr` qualifier for `cross` product #1040
|
||||||
|
@ -1,8 +1,15 @@
|
|||||||
#include <glm/matrix.hpp>
|
#include <glm/ext/matrix_relational.hpp>
|
||||||
#include <glm/gtc/matrix_transform.hpp>
|
#include <glm/ext/matrix_transform.hpp>
|
||||||
#include <glm/gtc/ulp.hpp>
|
#include <glm/ext/scalar_constants.hpp>
|
||||||
#include <glm/gtc/epsilon.hpp>
|
#include <glm/mat2x2.hpp>
|
||||||
#include <glm/gtc/constants.hpp>
|
#include <glm/mat2x3.hpp>
|
||||||
|
#include <glm/mat2x4.hpp>
|
||||||
|
#include <glm/mat3x2.hpp>
|
||||||
|
#include <glm/mat3x3.hpp>
|
||||||
|
#include <glm/mat3x4.hpp>
|
||||||
|
#include <glm/mat4x2.hpp>
|
||||||
|
#include <glm/mat4x3.hpp>
|
||||||
|
#include <glm/mat4x4.hpp>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
@ -17,72 +24,63 @@ int test_matrixCompMult()
|
|||||||
mat2 m(0, 1, 2, 3);
|
mat2 m(0, 1, 2, 3);
|
||||||
mat2 n = matrixCompMult(m, m);
|
mat2 n = matrixCompMult(m, m);
|
||||||
mat2 expected = mat2(0, 1, 4, 9);
|
mat2 expected = mat2(0, 1, 4, 9);
|
||||||
for (length_t l = 0; l < m.length(); ++l)
|
Error += all(equal(n, expected, epsilon<float>())) ? 0 : 1;
|
||||||
Error += all(epsilonEqual(n[l], expected[l], epsilon<float>())) ? 0 : 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
mat2x3 m(0, 1, 2, 3, 4, 5);
|
mat2x3 m(0, 1, 2, 3, 4, 5);
|
||||||
mat2x3 n = matrixCompMult(m, m);
|
mat2x3 n = matrixCompMult(m, m);
|
||||||
mat2x3 expected = mat2x3(0, 1, 4, 9, 16, 25);
|
mat2x3 expected = mat2x3(0, 1, 4, 9, 16, 25);
|
||||||
for (length_t l = 0; l < m.length(); ++l)
|
Error += all(equal(n, expected, epsilon<float>())) ? 0 : 1;
|
||||||
Error += all(epsilonEqual(n[l], expected[l], epsilon<float>())) ? 0 : 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
mat2x4 m(0, 1, 2, 3, 4, 5, 6, 7);
|
mat2x4 m(0, 1, 2, 3, 4, 5, 6, 7);
|
||||||
mat2x4 n = matrixCompMult(m, m);
|
mat2x4 n = matrixCompMult(m, m);
|
||||||
mat2x4 expected = mat2x4(0, 1, 4, 9, 16, 25, 36, 49);
|
mat2x4 expected = mat2x4(0, 1, 4, 9, 16, 25, 36, 49);
|
||||||
for (length_t l = 0; l < m.length(); ++l)
|
Error += all(equal(n, expected, epsilon<float>())) ? 0 : 1;
|
||||||
Error += all(epsilonEqual(n[l], expected[l], epsilon<float>())) ? 0 : 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
mat3 m(0, 1, 2, 3, 4, 5, 6, 7, 8);
|
mat3 m(0, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||||
mat3 n = matrixCompMult(m, m);
|
mat3 n = matrixCompMult(m, m);
|
||||||
mat3 expected = mat3(0, 1, 4, 9, 16, 25, 36, 49, 64);
|
mat3 expected = mat3(0, 1, 4, 9, 16, 25, 36, 49, 64);
|
||||||
for (length_t l = 0; l < m.length(); ++l)
|
Error += all(equal(n, expected, epsilon<float>())) ? 0 : 1;
|
||||||
Error += all(epsilonEqual(n[l], expected[l], epsilon<float>())) ? 0 : 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
mat3x2 m(0, 1, 2, 3, 4, 5);
|
mat3x2 m(0, 1, 2, 3, 4, 5);
|
||||||
mat3x2 n = matrixCompMult(m, m);
|
mat3x2 n = matrixCompMult(m, m);
|
||||||
mat3x2 expected = mat3x2(0, 1, 4, 9, 16, 25);
|
mat3x2 expected = mat3x2(0, 1, 4, 9, 16, 25);
|
||||||
for (length_t l = 0; l < m.length(); ++l)
|
Error += all(equal(n, expected, epsilon<float>())) ? 0 : 1;
|
||||||
Error += all(epsilonEqual(n[l], expected[l], epsilon<float>())) ? 0 : 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
mat3x4 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
|
mat3x4 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
|
||||||
mat3x4 n = matrixCompMult(m, m);
|
mat3x4 n = matrixCompMult(m, m);
|
||||||
mat3x4 expected = mat3x4(0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121);
|
mat3x4 expected = mat3x4(0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121);
|
||||||
for (length_t l = 0; l < m.length(); ++l)
|
Error += all(equal(n, expected, epsilon<float>())) ? 0 : 1;
|
||||||
Error += all(epsilonEqual(n[l], expected[l], epsilon<float>())) ? 0 : 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
mat4 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
|
mat4 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
|
||||||
mat4 n = matrixCompMult(m, m);
|
mat4 n = matrixCompMult(m, m);
|
||||||
mat4 expected = mat4(0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225);
|
mat4 expected = mat4(0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225);
|
||||||
for (length_t l = 0; l < m.length(); ++l)
|
Error += all(equal(n, expected, epsilon<float>())) ? 0 : 1;
|
||||||
Error += all(epsilonEqual(n[l], expected[l], epsilon<float>())) ? 0 : 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
mat4x2 m(0, 1, 2, 3, 4, 5, 6, 7);
|
mat4x2 m(0, 1, 2, 3, 4, 5, 6, 7);
|
||||||
mat4x2 n = matrixCompMult(m, m);
|
mat4x2 n = matrixCompMult(m, m);
|
||||||
mat4x2 expected = mat4x2(0, 1, 4, 9, 16, 25, 36, 49);
|
mat4x2 expected = mat4x2(0, 1, 4, 9, 16, 25, 36, 49);
|
||||||
for (length_t l = 0; l < m.length(); ++l)
|
Error += all(equal(n, expected, epsilon<float>())) ? 0 : 1;
|
||||||
Error += all(epsilonEqual(n[l], expected[l], epsilon<float>())) ? 0 : 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
mat4x3 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
|
mat4x3 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
|
||||||
mat4x3 n = matrixCompMult(m, m);
|
mat4x3 n = matrixCompMult(m, m);
|
||||||
mat4x3 expected = mat4x3(0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121);
|
mat4x3 expected = mat4x3(0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121);
|
||||||
for (length_t l = 0; l < m.length(); ++l)
|
Error += all(equal(n, expected, epsilon<float>())) ? 0 : 1;
|
||||||
Error += all(epsilonEqual(n[l], expected[l], epsilon<float>())) ? 0 : 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Error;
|
return Error;
|
||||||
@ -114,72 +112,63 @@ int test_transpose()
|
|||||||
mat2 const m(0, 1, 2, 3);
|
mat2 const m(0, 1, 2, 3);
|
||||||
mat2 const t = transpose(m);
|
mat2 const t = transpose(m);
|
||||||
mat2 const expected = mat2(0, 2, 1, 3);
|
mat2 const expected = mat2(0, 2, 1, 3);
|
||||||
for (length_t l = 0; l < expected.length(); ++l)
|
Error += all(equal(t, expected, epsilon<float>())) ? 0 : 1;
|
||||||
Error += all(epsilonEqual(t[l], expected[l], epsilon<float>())) ? 0 : 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
mat2x3 m(0, 1, 2, 3, 4, 5);
|
mat2x3 m(0, 1, 2, 3, 4, 5);
|
||||||
mat3x2 t = transpose(m);
|
mat3x2 t = transpose(m);
|
||||||
mat3x2 const expected = mat3x2(0, 3, 1, 4, 2, 5);
|
mat3x2 const expected = mat3x2(0, 3, 1, 4, 2, 5);
|
||||||
for (length_t l = 0; l < expected.length(); ++l)
|
Error += all(equal(t, expected, epsilon<float>())) ? 0 : 1;
|
||||||
Error += all(epsilonEqual(t[l], expected[l], epsilon<float>())) ? 0 : 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
mat2x4 m(0, 1, 2, 3, 4, 5, 6, 7);
|
mat2x4 m(0, 1, 2, 3, 4, 5, 6, 7);
|
||||||
mat4x2 t = transpose(m);
|
mat4x2 t = transpose(m);
|
||||||
mat4x2 const expected = mat4x2(0, 4, 1, 5, 2, 6, 3, 7);
|
mat4x2 const expected = mat4x2(0, 4, 1, 5, 2, 6, 3, 7);
|
||||||
for (length_t l = 0; l < expected.length(); ++l)
|
Error += all(equal(t, expected, epsilon<float>())) ? 0 : 1;
|
||||||
Error += all(epsilonEqual(t[l], expected[l], epsilon<float>())) ? 0 : 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
mat3 m(0, 1, 2, 3, 4, 5, 6, 7, 8);
|
mat3 m(0, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||||
mat3 t = transpose(m);
|
mat3 t = transpose(m);
|
||||||
mat3 const expected = mat3(0, 3, 6, 1, 4, 7, 2, 5, 8);
|
mat3 const expected = mat3(0, 3, 6, 1, 4, 7, 2, 5, 8);
|
||||||
for (length_t l = 0; l < expected.length(); ++l)
|
Error += all(equal(t, expected, epsilon<float>())) ? 0 : 1;
|
||||||
Error += all(epsilonEqual(t[l], expected[l], epsilon<float>())) ? 0 : 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
mat3x2 m(0, 1, 2, 3, 4, 5);
|
mat3x2 m(0, 1, 2, 3, 4, 5);
|
||||||
mat2x3 t = transpose(m);
|
mat2x3 t = transpose(m);
|
||||||
mat2x3 const expected = mat2x3(0, 2, 4, 1, 3, 5);
|
mat2x3 const expected = mat2x3(0, 2, 4, 1, 3, 5);
|
||||||
for (length_t l = 0; l < expected.length(); ++l)
|
Error += all(equal(t, expected, epsilon<float>())) ? 0 : 1;
|
||||||
Error += all(epsilonEqual(t[l], expected[l], epsilon<float>())) ? 0 : 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
mat3x4 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
|
mat3x4 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
|
||||||
mat4x3 t = transpose(m);
|
mat4x3 t = transpose(m);
|
||||||
mat4x3 const expected = mat4x3(0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11);
|
mat4x3 const expected = mat4x3(0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11);
|
||||||
for (length_t l = 0; l < expected.length(); ++l)
|
Error += all(equal(t, expected, epsilon<float>())) ? 0 : 1;
|
||||||
Error += all(epsilonEqual(t[l], expected[l], epsilon<float>())) ? 0 : 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
mat4 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
|
mat4 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
|
||||||
mat4 t = transpose(m);
|
mat4 t = transpose(m);
|
||||||
mat4 const expected = mat4(0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15);
|
mat4 const expected = mat4(0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15);
|
||||||
for (length_t l = 0; l < expected.length(); ++l)
|
Error += all(equal(t, expected, epsilon<float>())) ? 0 : 1;
|
||||||
Error += all(epsilonEqual(t[l], expected[l], epsilon<float>())) ? 0 : 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
mat4x2 m(0, 1, 2, 3, 4, 5, 6, 7);
|
mat4x2 m(0, 1, 2, 3, 4, 5, 6, 7);
|
||||||
mat2x4 t = transpose(m);
|
mat2x4 t = transpose(m);
|
||||||
mat2x4 const expected = mat2x4(0, 2, 4, 6, 1, 3, 5, 7);
|
mat2x4 const expected = mat2x4(0, 2, 4, 6, 1, 3, 5, 7);
|
||||||
for (length_t l = 0; l < expected.length(); ++l)
|
Error += all(equal(t, expected, epsilon<float>())) ? 0 : 1;
|
||||||
Error += all(epsilonEqual(t[l], expected[l], epsilon<float>())) ? 0 : 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
mat4x3 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
|
mat4x3 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
|
||||||
mat3x4 t = transpose(m);
|
mat3x4 t = transpose(m);
|
||||||
mat3x4 const expected = mat3x4(0, 3, 6, 9, 1, 4, 7, 10, 2, 5, 8, 11);
|
mat3x4 const expected = mat3x4(0, 3, 6, 9, 1, 4, 7, 10, 2, 5, 8, 11);
|
||||||
for (length_t l = 0; l < expected.length(); ++l)
|
Error += all(equal(t, expected, epsilon<float>())) ? 0 : 1;
|
||||||
Error += all(epsilonEqual(t[l], expected[l], epsilon<float>())) ? 0 : 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Error;
|
return Error;
|
||||||
@ -205,8 +194,7 @@ int test_inverse()
|
|||||||
glm::mat4x4 B4x4 = inverse(A4x4);
|
glm::mat4x4 B4x4 = inverse(A4x4);
|
||||||
glm::mat4x4 I4x4 = A4x4 * B4x4;
|
glm::mat4x4 I4x4 = A4x4 * B4x4;
|
||||||
glm::mat4x4 Identity(1);
|
glm::mat4x4 Identity(1);
|
||||||
for (length_t l = 0; l < Identity.length(); ++l)
|
Error += all(equal(I4x4, Identity, epsilon<float>())) ? 0 : 1;
|
||||||
Error += all(epsilonEqual(I4x4[l], Identity[l], epsilon<float>())) ? 0 : 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -217,8 +205,7 @@ int test_inverse()
|
|||||||
glm::mat3x3 B3x3 = glm::inverse(A3x3);
|
glm::mat3x3 B3x3 = glm::inverse(A3x3);
|
||||||
glm::mat3x3 I3x3 = A3x3 * B3x3;
|
glm::mat3x3 I3x3 = A3x3 * B3x3;
|
||||||
glm::mat3x3 Identity(1);
|
glm::mat3x3 Identity(1);
|
||||||
for (length_t l = 0; l < Identity.length(); ++l)
|
Error += all(equal(I3x3, Identity, epsilon<float>())) ? 0 : 1;
|
||||||
Error += all(epsilonEqual(I3x3[l], Identity[l], epsilon<float>())) ? 0 : 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -228,8 +215,7 @@ int test_inverse()
|
|||||||
glm::mat2x2 B2x2 = glm::inverse(A2x2);
|
glm::mat2x2 B2x2 = glm::inverse(A2x2);
|
||||||
glm::mat2x2 I2x2 = A2x2 * B2x2;
|
glm::mat2x2 I2x2 = A2x2 * B2x2;
|
||||||
glm::mat2x2 Identity(1);
|
glm::mat2x2 Identity(1);
|
||||||
for (length_t l = 0; l < Identity.length(); ++l)
|
Error += all(equal(I2x2, Identity, epsilon<float>())) ? 0 : 1;
|
||||||
Error += all(epsilonEqual(I2x2[l], Identity[l], epsilon<float>())) ? 0 : 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Error;
|
return Error;
|
||||||
@ -249,10 +235,7 @@ int test_inverse_simd()
|
|||||||
glm::mat4x4 const B4x4 = glm::inverse(A4x4);
|
glm::mat4x4 const B4x4 = glm::inverse(A4x4);
|
||||||
glm::mat4x4 const I4x4 = A4x4 * B4x4;
|
glm::mat4x4 const I4x4 = A4x4 * B4x4;
|
||||||
|
|
||||||
Error += glm::all(glm::epsilonEqual(I4x4[0], Identity[0], 0.001f)) ? 0 : 1;
|
Error += glm::all(glm::equal(I4x4, Identity, 0.001f)) ? 0 : 1;
|
||||||
Error += glm::all(glm::epsilonEqual(I4x4[1], Identity[1], 0.001f)) ? 0 : 1;
|
|
||||||
Error += glm::all(glm::epsilonEqual(I4x4[2], Identity[2], 0.001f)) ? 0 : 1;
|
|
||||||
Error += glm::all(glm::epsilonEqual(I4x4[3], Identity[3], 0.001f)) ? 0 : 1;
|
|
||||||
|
|
||||||
return Error;
|
return Error;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
glmCreateTestGTC(ext_matrix_relational)
|
glmCreateTestGTC(ext_matrix_relational)
|
||||||
glmCreateTestGTC(ext_matrix_transform)
|
glmCreateTestGTC(ext_matrix_transform)
|
||||||
glmCreateTestGTC(ext_matrix_common)
|
glmCreateTestGTC(ext_matrix_common)
|
||||||
|
glmCreateTestGTC(ext_matrix_integer)
|
||||||
glmCreateTestGTC(ext_matrix_int2x2_sized)
|
glmCreateTestGTC(ext_matrix_int2x2_sized)
|
||||||
glmCreateTestGTC(ext_matrix_int2x3_sized)
|
glmCreateTestGTC(ext_matrix_int2x3_sized)
|
||||||
glmCreateTestGTC(ext_matrix_int2x4_sized)
|
glmCreateTestGTC(ext_matrix_int2x4_sized)
|
||||||
|
237
test/ext/ext_matrix_integer.cpp
Normal file
237
test/ext/ext_matrix_integer.cpp
Normal file
@ -0,0 +1,237 @@
|
|||||||
|
#include <glm/ext/matrix_relational.hpp>
|
||||||
|
#include <glm/ext/matrix_integer.hpp>
|
||||||
|
#include <glm/ext/matrix_int2x2.hpp>
|
||||||
|
#include <glm/ext/matrix_int2x3.hpp>
|
||||||
|
#include <glm/ext/matrix_int2x4.hpp>
|
||||||
|
#include <glm/ext/matrix_int3x2.hpp>
|
||||||
|
#include <glm/ext/matrix_int3x3.hpp>
|
||||||
|
#include <glm/ext/matrix_int3x4.hpp>
|
||||||
|
#include <glm/ext/matrix_int4x2.hpp>
|
||||||
|
#include <glm/ext/matrix_int4x3.hpp>
|
||||||
|
#include <glm/ext/matrix_int4x4.hpp>
|
||||||
|
|
||||||
|
using namespace glm;
|
||||||
|
|
||||||
|
int test_matrixCompMult()
|
||||||
|
{
|
||||||
|
int Error = 0;
|
||||||
|
|
||||||
|
{
|
||||||
|
imat2 m(0, 1, 2, 3);
|
||||||
|
imat2 n = matrixCompMult(m, m);
|
||||||
|
imat2 expected = imat2(0, 1, 4, 9);
|
||||||
|
Error += all(equal(n, expected)) ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
imat2x3 m(0, 1, 2, 3, 4, 5);
|
||||||
|
imat2x3 n = matrixCompMult(m, m);
|
||||||
|
imat2x3 expected = imat2x3(0, 1, 4, 9, 16, 25);
|
||||||
|
Error += all(equal(n, expected)) ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
imat2x4 m(0, 1, 2, 3, 4, 5, 6, 7);
|
||||||
|
imat2x4 n = matrixCompMult(m, m);
|
||||||
|
imat2x4 expected = imat2x4(0, 1, 4, 9, 16, 25, 36, 49);
|
||||||
|
Error += all(equal(n, expected)) ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
imat3 m(0, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||||
|
imat3 n = matrixCompMult(m, m);
|
||||||
|
imat3 expected = imat3(0, 1, 4, 9, 16, 25, 36, 49, 64);
|
||||||
|
Error += all(equal(n, expected)) ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
imat3x2 m(0, 1, 2, 3, 4, 5);
|
||||||
|
imat3x2 n = matrixCompMult(m, m);
|
||||||
|
imat3x2 expected = imat3x2(0, 1, 4, 9, 16, 25);
|
||||||
|
Error += all(equal(n, expected)) ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
imat3x4 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
|
||||||
|
imat3x4 n = matrixCompMult(m, m);
|
||||||
|
imat3x4 expected = imat3x4(0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121);
|
||||||
|
Error += all(equal(n, expected)) ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
imat4 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
|
||||||
|
imat4 n = matrixCompMult(m, m);
|
||||||
|
imat4 expected = imat4(0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225);
|
||||||
|
Error += all(equal(n, expected)) ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
imat4x2 m(0, 1, 2, 3, 4, 5, 6, 7);
|
||||||
|
imat4x2 n = matrixCompMult(m, m);
|
||||||
|
imat4x2 expected = imat4x2(0, 1, 4, 9, 16, 25, 36, 49);
|
||||||
|
Error += all(equal(n, expected)) ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
imat4x3 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
|
||||||
|
imat4x3 n = matrixCompMult(m, m);
|
||||||
|
imat4x3 expected = imat4x3(0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121);
|
||||||
|
Error += all(equal(n, expected)) ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Error;
|
||||||
|
}
|
||||||
|
|
||||||
|
int test_outerProduct()
|
||||||
|
{
|
||||||
|
int Error = 0;
|
||||||
|
|
||||||
|
{
|
||||||
|
glm::imat2x2 const m = glm::outerProduct(glm::ivec2(1), glm::ivec2(1));
|
||||||
|
Error += all(equal(m, glm::imat2x2(1, 1, 1, 1))) ? 0 : 1;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
glm::imat2x3 const m = glm::outerProduct(glm::ivec3(1), glm::ivec2(1));
|
||||||
|
Error += all(equal(m, glm::imat2x3(1, 1, 1, 1, 1, 1))) ? 0 : 1;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
glm::imat2x4 const m = glm::outerProduct(glm::ivec4(1), glm::ivec2(1));
|
||||||
|
Error += all(equal(m, glm::imat2x4(1, 1, 1, 1, 1, 1, 1, 1))) ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
glm::imat3x2 const m = glm::outerProduct(glm::ivec2(1), glm::ivec3(1));
|
||||||
|
Error += all(equal(m, glm::imat3x2(1, 1, 1, 1, 1, 1))) ? 0 : 1;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
glm::imat3x3 const m = glm::outerProduct(glm::ivec3(1), glm::ivec3(1));
|
||||||
|
Error += all(equal(m, glm::imat3x3(1, 1, 1, 1, 1, 1, 1, 1, 1))) ? 0 : 1;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
glm::imat3x4 const m = glm::outerProduct(glm::ivec4(1), glm::ivec3(1));
|
||||||
|
Error += all(equal(m, glm::imat3x4(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1))) ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
glm::imat4x2 const m = glm::outerProduct(glm::ivec2(1), glm::ivec4(1));
|
||||||
|
Error += all(equal(m, glm::imat4x2(1, 1, 1, 1, 1, 1, 1, 1))) ? 0 : 1;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
glm::imat4x3 const m = glm::outerProduct(glm::ivec3(1), glm::ivec4(1));
|
||||||
|
Error += all(equal(m, glm::imat4x3(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1))) ? 0 : 1;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
glm::imat4x4 const m = glm::outerProduct(glm::ivec4(1), glm::ivec4(1));
|
||||||
|
Error += all(equal(m, glm::imat4x4(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1))) ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Error;
|
||||||
|
}
|
||||||
|
|
||||||
|
int test_transpose()
|
||||||
|
{
|
||||||
|
int Error = 0;
|
||||||
|
|
||||||
|
{
|
||||||
|
imat2 const m(0, 1, 2, 3);
|
||||||
|
imat2 const t = transpose(m);
|
||||||
|
imat2 const expected = imat2(0, 2, 1, 3);
|
||||||
|
Error += all(equal(t, expected)) ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
imat2x3 m(0, 1, 2, 3, 4, 5);
|
||||||
|
imat3x2 t = transpose(m);
|
||||||
|
imat3x2 const expected = imat3x2(0, 3, 1, 4, 2, 5);
|
||||||
|
Error += all(equal(t, expected)) ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
imat2x4 m(0, 1, 2, 3, 4, 5, 6, 7);
|
||||||
|
imat4x2 t = transpose(m);
|
||||||
|
imat4x2 const expected = imat4x2(0, 4, 1, 5, 2, 6, 3, 7);
|
||||||
|
Error += all(equal(t, expected)) ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
imat3 m(0, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||||
|
imat3 t = transpose(m);
|
||||||
|
imat3 const expected = imat3(0, 3, 6, 1, 4, 7, 2, 5, 8);
|
||||||
|
Error += all(equal(t, expected)) ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
imat3x2 m(0, 1, 2, 3, 4, 5);
|
||||||
|
imat2x3 t = transpose(m);
|
||||||
|
imat2x3 const expected = imat2x3(0, 2, 4, 1, 3, 5);
|
||||||
|
Error += all(equal(t, expected)) ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
imat3x4 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
|
||||||
|
imat4x3 t = transpose(m);
|
||||||
|
imat4x3 const expected = imat4x3(0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11);
|
||||||
|
Error += all(equal(t, expected)) ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
imat4 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
|
||||||
|
imat4 t = transpose(m);
|
||||||
|
imat4 const expected = imat4(0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15);
|
||||||
|
Error += all(equal(t, expected)) ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
imat4x2 m(0, 1, 2, 3, 4, 5, 6, 7);
|
||||||
|
imat2x4 t = transpose(m);
|
||||||
|
imat2x4 const expected = imat2x4(0, 2, 4, 6, 1, 3, 5, 7);
|
||||||
|
Error += all(equal(t, expected)) ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
imat4x3 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
|
||||||
|
imat3x4 t = transpose(m);
|
||||||
|
imat3x4 const expected = imat3x4(0, 3, 6, 9, 1, 4, 7, 10, 2, 5, 8, 11);
|
||||||
|
Error += all(equal(t, expected)) ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Error;
|
||||||
|
}
|
||||||
|
|
||||||
|
int test_determinant()
|
||||||
|
{
|
||||||
|
int Error = 0;
|
||||||
|
|
||||||
|
{
|
||||||
|
imat2 const m(1, 1, 1, 1);
|
||||||
|
int const t = determinant(m);
|
||||||
|
Error += t == 0 ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
imat3 m(1, 1, 1, 1, 1, 1, 1, 1, 1);
|
||||||
|
int t = determinant(m);
|
||||||
|
Error += t == 0 ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
imat4 m(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
|
||||||
|
int t = determinant(m);
|
||||||
|
Error += t == 0 ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Error;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
int Error = 0;
|
||||||
|
|
||||||
|
Error += test_matrixCompMult();
|
||||||
|
Error += test_outerProduct();
|
||||||
|
Error += test_transpose();
|
||||||
|
Error += test_determinant();
|
||||||
|
|
||||||
|
return Error;
|
||||||
|
}
|
@ -118,8 +118,8 @@ static int test_acsch()
|
|||||||
{
|
{
|
||||||
int Error = 0;
|
int Error = 0;
|
||||||
|
|
||||||
Error += glm::acsch(0.0001) > 10000.0 ? 0 : 1;
|
Error += glm::acsch(0.01) > 1.0 ? 0 : 1;
|
||||||
Error += glm::acsch(-0.0001) < -10000.0 ? 0 : 1;
|
Error += glm::acsch(-0.01) < -1.0 ? 0 : 1;
|
||||||
|
|
||||||
Error += glm::equal(glm::acsch(100.0), 0.0, 0.01) ? 0 : 1;
|
Error += glm::equal(glm::acsch(100.0), 0.0, 0.01) ? 0 : 1;
|
||||||
Error += glm::equal(glm::acsch(-100.0), 0.0, 0.01) ? 0 : 1;
|
Error += glm::equal(glm::acsch(-100.0), 0.0, 0.01) ? 0 : 1;
|
||||||
|
@ -130,8 +130,11 @@ static int test_acsch()
|
|||||||
{
|
{
|
||||||
int Error = 0;
|
int Error = 0;
|
||||||
|
|
||||||
Error += glm::acsch(glm::dvec1(0.0001)).x > 10000.0 ? 0 : 1;
|
glm::dvec1 const a(glm::acsch(glm::dvec1(0.01)));
|
||||||
Error += glm::acsch(glm::dvec1(-0.0001)).x < -10000.0 ? 0 : 1;
|
Error += a.x > 1.0 ? 0 : 1;
|
||||||
|
|
||||||
|
glm::dvec1 const b(glm::acsch(glm::dvec1(-0.01)));
|
||||||
|
Error += b.x < -1.0 ? 0 : 1;
|
||||||
|
|
||||||
Error += glm::all(glm::equal(glm::acsch(glm::dvec1(100.0)), glm::dvec1(0.0), 0.01)) ? 0 : 1;
|
Error += glm::all(glm::equal(glm::acsch(glm::dvec1(100.0)), glm::dvec1(0.0), 0.01)) ? 0 : 1;
|
||||||
Error += glm::all(glm::equal(glm::acsch(glm::dvec1(-100.0)), glm::dvec1(0.0), 0.01)) ? 0 : 1;
|
Error += glm::all(glm::equal(glm::acsch(glm::dvec1(-100.0)), glm::dvec1(0.0), 0.01)) ? 0 : 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user