Compare commits

...

30 Commits

Author SHA1 Message Date
Recep Aslantas
02513b77c1 add version info 2017-05-21 01:31:25 +03:00
Recep Aslantas
fb444203b6 fix inlining exported function 2017-05-21 01:29:10 +03:00
Recep Aslantas
38632b2dd4 Update README.md 2017-05-21 00:34:56 +03:00
Recep Aslantas
1214a566b6 translate and scale make util 2017-05-15 22:27:20 +03:00
Recep Aslantas
41c874aa97 fix linking test lib 2017-04-25 23:56:58 +03:00
Recep Aslantas
38be538342 test: test mat4_mul 2017-04-25 23:27:15 +03:00
Recep Aslantas
4d55510ff0 ignore: ignore test files 2017-04-25 23:25:10 +03:00
Recep Aslantas
e789186889 zero initializer for matrix 2017-04-25 23:22:29 +03:00
Recep Aslantas
24b9992f19 deps: add cmocka as submodule for unit testing 2017-04-22 16:56:16 +03:00
Recep Aslantas
e7f35704ca fix identity quat initialization for C++ / Windows 2017-04-22 15:57:08 +03:00
Recep Aslantas
24ab1ff621 add badges to README 2017-04-22 15:39:08 +03:00
Recep Aslantas
f1b55589ac ci: fix build script for travis ci 2017-04-22 15:29:08 +03:00
Recep Aslantas
ef5a8549e2 add missing file for windows 2017-04-22 15:20:38 +03:00
Recep Aslantas
d5371f10a1 ci: set appveyor image 2017-04-22 15:17:36 +03:00
Recep Aslantas
cab370d1c7 ci: add travis and appveyor 2017-04-22 15:02:12 +03:00
Recep Aslantas
76107064d7 add build instructions for Windows 2017-04-22 14:59:18 +03:00
Recep Aslantas
12ea809e0a enable code analysis for windows 2017-04-22 14:59:18 +03:00
Recep Aslantas
e2fcf80e48 build for windows (dll) 2017-04-22 14:59:18 +03:00
Recep Aslantas
8a34e74b87 Add TODO list to README 2017-04-21 00:38:00 +03:00
Recep Aslantas
33770b9181 add missing docs to vector header 2017-04-15 02:08:43 +03:00
Recep Aslantas
cb6d5c1f7e center point of to vectors 2017-04-15 02:05:06 +03:00
Recep Aslantas
4ffc01655e optimize quat to matrix 2017-04-10 19:52:08 +03:00
Recep Aslantas
25feab7860 use multiplication instead of division for 1 / 2 2017-04-10 18:52:32 +03:00
Recep Aslantas
bf18ca647e distance between two vectors 2017-04-09 21:14:26 +03:00
Recep Aslantas
86c585b9e5 vec-ext: fix vec4 min 2017-03-23 19:34:51 +03:00
Recep Aslantas
d6cae07602 vec-ext: fix vec param type 2017-03-23 19:34:36 +03:00
Recep Aslantas
ba0973054e styles 2017-02-27 16:54:59 +03:00
Recep Aslantas
ec371099bc doc: add documentations to view, projection functions 2017-02-27 16:48:10 +03:00
Recep Aslantas
a3b66f5b4c drop platform (OpenGL) specific codes 2017-02-27 16:30:32 +03:00
Recep Aslantas
4462a84f4a rename _dup (duplicate) to _copy
I think _copy is better and COMMON  name for duplicating/copying
vector, matrices
2017-02-23 09:57:28 +03:00
38 changed files with 1043 additions and 188 deletions

6
.gitignore vendored
View File

@@ -41,10 +41,14 @@ packages/
.anjuta/*
*.anjuta*
config.h.*
config.h
/config.h
stamp*
COPYING
.idea/*
*.VC.db
cscope.*
*-git-ignored-file.*
test/*.trs
test/test_*
*.log
test-*

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "test/lib/cmocka"]
path = test/lib/cmocka
url = git://git.cryptomilk.org/projects/cmocka.git

61
.travis.yml Normal file
View File

@@ -0,0 +1,61 @@
language: c
os:
- linux
- osx
sudo: required
dist: trusty
compiler:
- clang
- gcc
matrix:
fast_finish: true
exclude:
# Skip GCC builds on macOS.
- os: osx
compiler: gcc
include:
# Additional GCC builds for code coverage.
- os: linux
compiler: gcc
env: CODE_COVERAGE=ON
cache:
apt: true
addons:
apt:
packages:
- clang-3.6
- lcov
branches:
only:
- master
before_install:
- pip install --user cpp-coveralls
script:
- sh ./build-deps.sh
- sh ./autogen.sh
- if [[ "$CC" == "gcc" && "$CODE_COVERAGE" == "ON" ]]; then
./configure CFLAGS="-ftest-coverage -fprofile-arcs";
else
./configure;
fi
- make
- make check
after_success:
- if [[ "$CC" == "gcc" && "$CODE_COVERAGE" == "ON" ]]; then
coveralls
--build-root .
--exclude lib
--exclude test
--gcov-options '\-lp'
--verbose;
fi

View File

@@ -1,7 +1,17 @@
# 🎥 OpenGL Mathematics (glm) for `C`
[![Build Status](https://travis-ci.org/recp/cglm.svg?branch=master)](https://travis-ci.org/recp/cglm)
[![Build status](https://ci.appveyor.com/api/projects/status/av7l3gc0yhfex8y4/branch/master?svg=true)](https://ci.appveyor.com/project/recp/cglm/branch/master)
[![Coverage Status](https://coveralls.io/repos/github/recp/cglm/badge.svg?branch=master)](https://coveralls.io/github/recp/cglm?branch=master)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/6a62b37d5f214f178ebef269dc4a6bf1)](https://www.codacy.com/app/recp/cglm?utm_source=github.com&utm_medium=referral&utm_content=recp/cglm&utm_campaign=Badge_Grade)
The original glm library is for C++ only (templates, namespaces, classes...), this library targeted to C99 but currently you can use it for C89 safely by language extensions e.g `__register`
#### Note for previous versions:
- _dup (duplicate) is changed to _copy. For instance `glm_vec_dup -> glm_vec_copy`
- OpenGL related functions are dropped to make this lib platform/third-party independent
- make sure you have latest version and feel free to report bugs, troubles
#### Note for C++ developers:
If you don't aware about original GLM library yet, you may also want to look at:
https://github.com/g-truc/glm
@@ -22,7 +32,7 @@ https://github.com/g-truc/glm
</tbody>
</table>
##Features
## Features
- general purpose matrix operations (mat4, mat3)
- chain matrix multiplication (square only)
- general purpose vector operations (cross, dot, rotate, proj, angle...)
@@ -39,8 +49,8 @@ https://github.com/g-truc/glm
<hr />
You have two option to call a function/operation: inline or library call (link)
Almost all functions are marked inline (always_inline) so compiler probably will inline.
To call pre-compiled version, just use `glmc_` (c stands for 'call') instead of `glm_`.
Almost all functions are marked inline (always_inline) so compiler probably will inline.
To call pre-compiled version, just use `glmc_` (c stands for 'call') instead of `glm_`.
```C
#include <cglm.h> /* for inline */
@@ -76,7 +86,7 @@ glm_mul(T, R, modelMat);
glm_inv_tr(modelMat);
```
##License
## License
MIT. check the LICENSE file
## Build
@@ -84,6 +94,8 @@ MIT. check the LICENSE file
### Unix (Autotools)
```text
$ sh ./build-deps.sh # run only once (dependencies)
$
$ sh autogen.sh
$ ./configure
$ make
@@ -92,11 +104,20 @@ $ [sudo] make install
```
### Windows (MSBuild)
Windows related build files, project files are located in `win` folder,
make sure you are inside `cglm/win` folder.
Code Analysis are enabled, it may take awhile to build
```text
TODO:
```Powershell
$ cd win
$ .\build.bat
```
##How to use
if `msbuild` won't work (because of multi version VS) then try to build with `devenv`:
```Powershell
$ devenv cglm.sln /Build Release
```
## How to use
If you want to use inline versions of funcstions then; include main header
```C
#include <cglm.h>
@@ -126,7 +147,15 @@ glmc_vec_normalize(vec);
```
Function usage and parameters are documented inside related headers.
##Notes
## Notes
- This library uses float types only, does not support Integers, Double... yet
- If headers are not working properly with your compiler, IDE please open an issue, because I'm using GCC and clang to test it maybe sometimes MSVC
**TODO:**
- [ ] Unit tests
- [ ] Unit tests for comparing cglm with glm results
- [x] Add version info
- [ ] Unaligned operations (e.g. `glm_umat4_mul`)
- [ ] Extra documentation
- [ ] ARM Neon Arch

7
appveyor.yml Normal file
View File

@@ -0,0 +1,7 @@
image: Visual Studio 2017
build_script:
- ps: >-
cd win
.\build.bat

30
build-deps.sh Normal file
View File

@@ -0,0 +1,30 @@
#! /bin/sh
#
# Copyright (c), Recep Aslantas.
#
# MIT License (MIT), http://opensource.org/licenses/MIT
# Full license can be found in the LICENSE file
#
# check if deps are pulled
git submodule update --init --recursive
# fix glibtoolize
cd $(dirname "$0")
if [ "$(uname)" = "Darwin" ]; then
libtoolBin=$(which glibtoolize)
libtoolBinDir=$(dirname "${libtoolBin}")
ln -s $libtoolBin "${libtoolBinDir}/libtoolize"
fi
# general deps: gcc make autoconf automake libtool cmake
# test - cmocka
cd ./test/lib/cmocka
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug ..
make -j8
cd ../../../../

View File

@@ -7,7 +7,7 @@
#*****************************************************************************
AC_PREREQ([2.69])
AC_INIT([cglm], [0.1.0], [info@recp.me])
AC_INIT([cglm], [0.2.0], [info@recp.me])
AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects])
AC_CONFIG_MACRO_DIR([m4])

View File

@@ -15,11 +15,11 @@ extern "C" {
CGLM_EXPORT
void
glmc_mat4_udup(mat4 mat, mat4 dest);
glmc_mat4_ucopy(mat4 mat, mat4 dest);
CGLM_EXPORT
void
glmc_mat4_dup(mat4 mat, mat4 dest);
glmc_mat4_copy(mat4 mat, mat4 dest);
CGLM_EXPORT
void

View File

@@ -15,7 +15,7 @@ extern "C" {
CGLM_EXPORT
void
glmc_mat3_dup(mat3 mat, mat3 dest);
glmc_mat3_copy(mat3 mat, mat3 dest);
CGLM_EXPORT
void

View File

@@ -15,15 +15,15 @@ extern "C" {
CGLM_EXPORT
void
glmc_vec_dup(vec3 a, vec3 dest);
glmc_vec_copy(vec3 a, vec3 dest);
CGLM_EXPORT
void
glmc_vec4_dup3(vec4 a, vec3 dest);
glmc_vec4_copy3(vec4 a, vec3 dest);
CGLM_EXPORT
void
glmc_vec4_dup(vec4 v, vec4 dest);
glmc_vec4_copy(vec4 v, vec4 dest);
CGLM_EXPORT
float
@@ -117,6 +117,18 @@ CGLM_EXPORT
void
glmc_vec_proj(vec3 a, vec3 b, vec3 dest);
CGLM_INLINE
void
glmc_vec_center(vec3 v1, vec3 v2, vec3 dest);
CGLM_EXPORT
float
glmc_vec_distance(vec3 v1, vec3 v2);
CGLM_EXPORT
float
glmc_vec4_distance(vec4 v1, vec4 v2);
#ifdef __cplusplus
}
#endif

View File

@@ -87,7 +87,7 @@ glm_inv_tr(mat4 mat) {
/* translate */
glm_mat3_mulv(r, mat[3], t);
glm_vec_flipsign(t);
glm_vec_dup(t, mat[3]);
glm_vec_copy(t, mat[3]);
#endif
}

View File

@@ -121,6 +121,13 @@ glm_translate_z(mat4 m, float to) {
#endif
}
CGLM_INLINE
void
glm_translate_make(mat4 m, vec3 v) {
mat4 t = GLM_MAT4_IDENTITY_INIT;
glm_translate_to(t, v, m);
}
/* scale */
CGLM_INLINE
@@ -130,7 +137,14 @@ glm_scale_to(mat4 m, vec3 v, mat4 dest) {
glm_vec4_scale(m[1], v[1], dest[1]);
glm_vec4_scale(m[2], v[2], dest[2]);
glm_vec4_dup(m[3], dest[3]);
glm_vec4_copy(m[3], dest[3]);
}
CGLM_INLINE
void
glm_scale_make(mat4 m, vec3 v) {
mat4 t = GLM_MAT4_IDENTITY_INIT;
glm_scale_to(t, v, m);
}
CGLM_INLINE
@@ -267,9 +281,9 @@ glm_rotate_ndc(mat4 m, float angle, vec3 axis_ndc) {
glm_vec4_scale(m[2], rot[2][2], tmp[0]);
glm_vec4_add(tmp[3], tmp[0], tmp[3]);
glm_vec4_dup(tmp[1], m[0]);
glm_vec4_dup(tmp[2], m[1]);
glm_vec4_dup(tmp[3], m[2]);
glm_vec4_copy(tmp[1], m[0]);
glm_vec4_copy(tmp[2], m[1]);
glm_vec4_copy(tmp[3], m[2]);
}
CGLM_INLINE
@@ -325,10 +339,10 @@ glm_decompose_rs(mat4 m, mat4 r, vec3 s) {
vec4 t = {0.0f, 0.0f, 0.0f, 1.0f};
vec3 v;
glm_vec4_dup(m[0], r[0]);
glm_vec4_dup(m[1], r[1]);
glm_vec4_dup(m[2], r[2]);
glm_vec4_dup(t, r[3]);
glm_vec4_copy(m[0], r[0]);
glm_vec4_copy(m[1], r[1]);
glm_vec4_copy(m[2], r[2]);
glm_vec4_copy(t, r[3]);
s[0] = glm_vec_norm(m[0]);
s[1] = glm_vec_norm(m[1]);
@@ -359,7 +373,7 @@ glm_decompose_rs(mat4 m, mat4 r, vec3 s) {
CGLM_INLINE
void
glm_decompose(mat4 m, vec4 t, mat4 r, vec3 s) {
glm_vec4_dup(m[3], t);
glm_vec4_copy(m[3], t);
glm_decompose_rs(m, r, s);
}

View File

@@ -9,8 +9,18 @@
#define cglm_vcam_h
#include "cglm-common.h"
#include "cglm-platform.h"
/*!
* @brief set up perspective peprojection matrix
*
* @param[in] left viewport.left
* @param[in] right viewport.right
* @param[in] bottom viewport.bottom
* @param[in] top viewport.top
* @param[in] nearVal near clipping plane
* @param[in] farVal far clipping plane
* @param[out] dest result matrix
*/
CGLM_INLINE
void
glm_frustum(float left,
@@ -19,7 +29,7 @@ glm_frustum(float left,
float top,
float nearVal,
float farVal,
mat4 dest) {
mat4 dest) {
float rl, tb, fn;
glm__memzero(float, dest, sizeof(mat4));
@@ -37,6 +47,17 @@ glm_frustum(float left,
dest[3][2] = -2.0f * farVal * nearVal * fn;
}
/*!
* @brief set up orthographic projection matrix
*
* @param[in] left viewport.left
* @param[in] right viewport.right
* @param[in] bottom viewport.bottom
* @param[in] top viewport.top
* @param[in] nearVal near clipping plane
* @param[in] farVal far clipping plane
* @param[out] dest result matrix
*/
CGLM_INLINE
void
glm_ortho(float left,
@@ -45,7 +66,7 @@ glm_ortho(float left,
float top,
float nearVal,
float farVal,
mat4 dest) {
mat4 dest) {
float rl, tb, fn;
glm__memzero(float, dest, sizeof(mat4));
@@ -63,69 +84,84 @@ glm_ortho(float left,
dest[3][3] = 1.0f;
}
/*!
* @brief set up unit orthographic projection matrix
*
* @param[in] aspect aspect ration ( width / height )
* @param[out] dest result matrix
*/
CGLM_INLINE
void
glm_ortho_default(mat4 dest) {
int32_t rect[4];
float aspectRatio;
glm_platfom_get_viewport_rect(rect);
aspectRatio = (float)rect[2]/rect[3];
if (rect[2] >= rect[3]) {
glm_ortho(-1.0f * aspectRatio,
1.0f * aspectRatio,
glm_ortho_default(float aspect,
mat4 dest) {
if (aspect >= 1.0f) {
glm_ortho(-1.0f * aspect,
1.0f * aspect,
-1.0f,
1.0f,
-100.0f,
100.0f,
dest);
} else {
glm_ortho(-1.0f,
1.0f,
-1.0f / aspectRatio,
1.0f / aspectRatio,
-100.0f,
100.0f,
dest);
return;
}
glm_ortho(-1.0f,
1.0f,
-1.0f / aspect,
1.0f / aspect,
-100.0f,
100.0f,
dest);
}
/*!
* @brief set up orthographic projection matrix with given CUBE size
*
* @param[in] aspect aspect ratio ( width / height )
* @param[in] size cube size
* @param[out] dest result matrix
*/
CGLM_INLINE
void
glm_ortho_default_s(float size, mat4 dest) {
int32_t rect[4];
float aspectRatio;
glm_platfom_get_viewport_rect(rect);
aspectRatio = (float)rect[2]/rect[3];
if (rect[2] >= rect[3]) {
glm_ortho(-size * aspectRatio,
size * aspectRatio,
glm_ortho_default_s(float aspect,
float size,
mat4 dest) {
if (aspect >= 1.0f) {
glm_ortho(-size * aspect,
size * aspect,
-size,
size,
-size - 100.0f,
size + 100.0f,
dest);
} else {
glm_ortho(-size,
size,
-size / aspectRatio,
size / aspectRatio,
-size - 100.0f,
size + 100.0f,
dest);
return;
}
glm_ortho(-size,
size,
-size / aspect,
size / aspect,
-size - 100.0f,
size + 100.0f,
dest);
}
/*!
* @brief set up perspective projection matrix
*
* @param[in] fovy field of view angle
* @param[in] aspect aspect ratio ( width / height )
* @param[in] nearVal near clipping plane
* @param[in] farVal far clipping planes
* @param[out] dest result matrix
*/
CGLM_INLINE
void
glm_perspective(float fovy,
float aspect,
float nearVal,
float farVal,
mat4 dest) {
mat4 dest) {
float f, fn;
glm__memzero(float, dest, sizeof(mat4));
@@ -140,31 +176,50 @@ glm_perspective(float fovy,
dest[3][2] = 2 * nearVal * farVal * fn;
}
/*!
* @brief set up perspective projection matrix with default near/far
* and angle values
*
* @param[in] aspect aspect ratio ( width / height )
* @param[out] dest result matrix
*/
CGLM_INLINE
void
glm_perspective_default(mat4 dest) {
int32_t rect[4];
glm_platfom_get_viewport_rect(rect);
glm_perspective_default(float aspect,
mat4 dest) {
glm_perspective((float)CGLM_PI_4,
(float)rect[2]/rect[3],
aspect,
0.01f,
100.0f,
dest);
}
/*!
* @brief resize perspective matrix by aspect ratio ( width / height )
* this very make easy to resize proj matrix when window, viewport
* reized
*
* @param[in] aspect aspect ratio ( width / height )
* @param[in, out] proj perspective projection matrix
*/
CGLM_INLINE
void
glm_perspective_resize(mat4 proj) {
int32_t rect[4];
glm_perspective_resize(float aspect,
mat4 proj) {
if (proj[0][0] == 0)
return;
glm_platfom_get_viewport_rect(rect);
proj[0][0] = (float)proj[1][1] * rect[3] / rect[2];
proj[0][0] = proj[1][1] / aspect;
}
/*!
* @brief set up view matrix
*
* @param[in] eye eye vector
* @param[in] center center vector
* @param[in] up up vector
* @param[out] dest result matrix
*/
CGLM_INLINE
void
glm_lookat(vec3 eye,

View File

@@ -64,7 +64,7 @@ glm_euler_angles(mat4 m, vec3 dest) {
path = (fabsf(a[0][0]) + fabsf(a[0][1]) + fabsf(a[0][2])) >=
(fabsf(a[1][0]) + fabsf(a[1][1]) + fabsf(a[1][2]));
glm_vec_dup(a[path], dest);
glm_vec_copy(a[path], dest);
} else {
dest[0] = atan2f(m[1][0], m[2][0]);
dest[1] = CGLM_PI_2;

View File

@@ -24,8 +24,14 @@
{0.0f, 0.0f, 1.0f, 0.0f}, \
{0.0f, 0.0f, 0.0f, 1.0f}}
#define GLM_MAT4_ZERO_INIT {{0.0f, 0.0f, 0.0f, 0.0f}, \
{0.0f, 0.0f, 0.0f, 0.0f}, \
{0.0f, 0.0f, 0.0f, 0.0f}, \
{0.0f, 0.0f, 0.0f, 0.0f}}
/* for C only */
#define GLM_MAT4_IDENTITY (mat4)GLM_MAT4_IDENTITY_INIT
#define GLM_MAT4_ZERO (mat4)GLM_MAT4_ZERO_INIT
/*!
* @brief copy all members of [mat] to [dest]
@@ -38,7 +44,7 @@
*/
CGLM_INLINE
void
glm_mat4_udup(mat4 mat, mat4 dest) {
glm_mat4_ucopy(mat4 mat, mat4 dest) {
glm__memcpy(float, dest, mat, sizeof(mat4));
}
@@ -50,7 +56,7 @@ glm_mat4_udup(mat4 mat, mat4 dest) {
*/
CGLM_INLINE
void
glm_mat4_dup(mat4 mat, mat4 dest) {
glm_mat4_copy(mat4 mat, mat4 dest) {
#ifdef __AVX__
_mm256_store_ps(dest[0], _mm256_load_ps(mat[0]));
_mm256_store_ps(dest[2], _mm256_load_ps(mat[2]));
@@ -60,7 +66,7 @@ glm_mat4_dup(mat4 mat, mat4 dest) {
_mm_store_ps(dest[2], _mm_load_ps(mat[2]));
_mm_store_ps(dest[3], _mm_load_ps(mat[3]));
#else
glm_mat4_udup(mat, dest);
glm_mat4_ucopy(mat, dest);
#endif
}
@@ -242,7 +248,7 @@ glm_mat4_mulv(mat4 m, vec4 v, vec4 dest) {
res[1] = m[0][1] * v[0] + m[1][1] * v[1] + m[2][1] * v[2] + m[3][1] * v[3];
res[2] = m[0][2] * v[0] + m[1][2] * v[1] + m[2][2] * v[2] + m[3][2] * v[3];
res[3] = m[0][3] * v[0] + m[1][3] * v[1] + m[2][3] * v[2] + m[3][3] * v[3];
glm_vec4_dup(res, dest);
glm_vec4_copy(res, dest);
#endif
}
@@ -260,7 +266,7 @@ glm_mat4_mulv3(mat4 m, vec3 v, vec3 dest) {
res[0] = m[0][0] * v[0] + m[1][0] * v[1] + m[2][0] * v[2];
res[1] = m[0][1] * v[0] + m[1][1] * v[1] + m[2][1] * v[2];
res[2] = m[0][2] * v[0] + m[1][2] * v[1] + m[2][2] * v[2];
glm_vec_dup(res, dest);
glm_vec_copy(res, dest);
}
/*!
@@ -477,9 +483,9 @@ CGLM_INLINE
void
glm_mat4_swap_col(mat4 mat, int col1, int col2) {
vec4 tmp;
glm_vec4_dup(mat[col1], tmp);
glm_vec4_dup(mat[col2], mat[col1]);
glm_vec4_dup(tmp, mat[col2]);
glm_vec4_copy(mat[col1], tmp);
glm_vec4_copy(mat[col2], mat[col1]);
glm_vec4_copy(tmp, mat[col2]);
}
/*!

View File

@@ -14,9 +14,14 @@
#define GLM_MAT3_IDENTITY_INIT {{1.0f, 0.0f, 0.0f}, \
{0.0f, 1.0f, 0.0f}, \
{0.0f, 0.0f, 1.0f}}
#define GLM_MAT3_ZERO_INIT {{0.0f, 0.0f, 0.0f}, \
{0.0f, 0.0f, 0.0f}, \
{0.0f, 0.0f, 0.0f}}
/* for C only */
#define GLM_MAT3_IDENTITY (mat3)GLM_MAT3_IDENTITY_INIT
#define GLM_MAT3_ZERO (mat3)GLM_MAT3_ZERO_INIT
/*!
* @brief copy all members of [mat] to [dest]
@@ -26,7 +31,7 @@
*/
CGLM_INLINE
void
glm_mat3_dup(mat3 mat, mat3 dest) {
glm_mat3_copy(mat3 mat, mat3 dest) {
glm__memcpy(float, dest, mat, sizeof(mat3));
}
@@ -217,9 +222,9 @@ CGLM_INLINE
void
glm_mat3_swap_col(mat3 mat, int col1, int col2) {
vec3 tmp;
glm_vec_dup(mat[col1], tmp);
glm_vec_dup(mat[col2], mat[col1]);
glm_vec_dup(tmp, mat[col2]);
glm_vec_copy(mat[col1], tmp);
glm_vec_copy(mat[col2], mat[col1]);
glm_vec_copy(tmp, mat[col2]);
}
/*!

View File

@@ -1,20 +0,0 @@
/*
* Copyright (c), Recep Aslantas.
*
* MIT License (MIT), http://opensource.org/licenses/MIT
* Full license can be found in the LICENSE file
*/
#ifndef cglm_mat_opengl_h
#define cglm_mat_opengl_h
#include "cglm-common.h"
#include "cglm-platform.h"
CGLM_INLINE
void
glm_uniform(int32_t location, mat4 m) {
glm_platform_uniform_mat4fv(location, m[0]);
}
#endif /* cglm_mat_opengl_h */

View File

@@ -1,45 +0,0 @@
/*
* Copyright (c), Recep Aslantas.
*
* MIT License (MIT), http://opensource.org/licenses/MIT
* Full license can be found in the LICENSE file
*/
#ifndef cglm_platform_h
#define cglm_platform_h
#include "cglm-common.h"
#ifdef __APPLE__
# include <OpenGL/gl3.h>
#else
# ifdef _WIN32
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# endif
# include <GL/gl.h>
#endif
#ifdef _WIN32
extern
void
glUniformMatrix4fv(GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value);
#endif
CGLM_INLINE
void
glm_platform_uniform_mat4fv(int32_t location,
const float *value) {
glUniformMatrix4fv(location, 1, GL_FALSE, value);
}
CGLM_INLINE
void
glm_platfom_get_viewport_rect(int32_t *rect) {
glGetIntegerv(GL_VIEWPORT, rect);
}
#endif /* cglm_platform_h */

View File

@@ -19,7 +19,8 @@
CGLM_INLINE
void
glm_quat_identity(versor q) {
glm_vec4_dup(GLM_QUAT_IDENTITY, q);
versor v = GLM_QUAT_IDENTITY_INIT;
glm_vec4_copy(v, q);
}
CGLM_INLINE
@@ -31,7 +32,7 @@ glm_quat(versor q,
float z) {
float a, c, s;
a = angle / 2.0f;
a = angle * 0.5f;
c = cosf(a);
s = sinf(a);
@@ -48,7 +49,7 @@ glm_quatv(versor q,
vec3 v) {
float a, c, s;
a = angle / 2.0f;
a = angle * 0.5f;
c = cosf(a);
s = sinf(a);
@@ -99,23 +100,33 @@ CGLM_INLINE
void
glm_quat_mat4(versor q, mat4 dest) {
float w, x, y, z;
float xx, yy, zz;
float xy, yz, xz;
float wx, wy, wz;
w = q[0];
x = q[1];
y = q[2];
z = q[3];
dest[0][0] = 1.0f - 2.0f * (y * y + z * z);
dest[0][1] = 2.0f * (x * y + w * z);
dest[0][2] = 2.0f * (x * z - w * y);
dest[0][3] = 0.0f;
dest[1][0] = 2.0f * (x * y - w * z);
dest[1][1] = 1.0f - 2.0f * (x * x + z * z);
dest[1][2] = 2.0f * (y * z + w * x);
xx = 2.0f * x * x; xy = 2.0f * x * y; wx = 2.0f * w * x;
yy = 2.0f * y * y; yz = 2.0f * y * z; wy = 2.0f * w * y;
zz = 2.0f * z * z; xz = 2.0f * x * z; wz = 2.0f * w * z;
dest[0][0] = 1.0f - yy - zz;
dest[1][1] = 1.0f - xx - zz;
dest[2][2] = 1.0f - xx - yy;
dest[0][1] = xy + wz;
dest[1][2] = yz + wx;
dest[2][0] = xz + wy;
dest[1][0] = xy - wz;
dest[2][1] = yz - wx;
dest[0][2] = xz - wy;
dest[1][3] = 0.0f;
dest[2][0] = 2.0f * (x * z + w * y);
dest[2][1] = 2.0f * (y * z - w * x);
dest[2][2] = 1.0f - 2.0f * (x * x + y * y);
dest[0][3] = 0.0f;
dest[2][3] = 0.0f;
dest[3][0] = 0.0f;
dest[3][1] = 0.0f;

View File

@@ -45,4 +45,10 @@ glm_make_deg(float *rad) {
*rad = *rad * 180.0f / CGLM_PI;
}
CGLM_INLINE
float
glm_pow2(float x) {
return x * x;
}
#endif /* cglm_util_h */

View File

@@ -59,7 +59,7 @@ glm_vec_broadcast(float val, vec3 d) {
CGLM_INLINE
void
glm_vec4_broadcast(float val, vec3 d) {
glm_vec4_broadcast(float val, vec4 d) {
#if defined( __SSE__ ) || defined( __SSE2__ )
_mm_store_ps(d, _mm_set1_ps(val));
#else
@@ -148,7 +148,7 @@ float
glm_vec4_min(vec4 v) {
float min;
min = glm_vec_max(v);
min = glm_vec_min(v);
if (v[3] < min)
min = v[3];

View File

@@ -16,6 +16,7 @@
#include "cglm-common.h"
#include "cglm-vec-ext.h"
#include "arch/simd/cglm-intrin.h"
#include "cglm-util.h"
/*!
* @brief copy all members of [a] to [dest]
@@ -25,7 +26,7 @@
*/
CGLM_INLINE
void
glm_vec_dup(vec3 a, vec3 dest) {
glm_vec_copy(vec3 a, vec3 dest) {
dest[0] = a[0];
dest[1] = a[1];
dest[2] = a[2];
@@ -39,7 +40,7 @@ glm_vec_dup(vec3 a, vec3 dest) {
*/
CGLM_INLINE
void
glm_vec4_dup3(vec4 a, vec3 dest) {
glm_vec4_copy3(vec4 a, vec3 dest) {
dest[0] = a[0];
dest[1] = a[1];
dest[2] = a[2];
@@ -53,7 +54,7 @@ glm_vec4_dup3(vec4 a, vec3 dest) {
*/
CGLM_INLINE
void
glm_vec4_dup(vec4 v, vec4 dest) {
glm_vec4_copy(vec4 v, vec4 dest) {
#if defined( __SSE__ ) || defined( __SSE2__ )
_mm_store_ps(dest, _mm_load_ps(v));
#else
@@ -475,7 +476,7 @@ glm_vec_rotate_m4(mat4 m, vec3 v, vec3 dest) {
res[1] = x[1] * v[0] + y[1] * v[1] + z[1] * v[2];
res[2] = x[2] * v[0] + y[2] * v[1] + z[2] * v[2];
glm_vec_dup(res, dest);
glm_vec_copy(res, dest);
}
/*!
@@ -493,4 +494,49 @@ glm_vec_proj(vec3 a, vec3 b, vec3 dest) {
dest);
}
/**
* @brief find center point of two vector
*
* @param[in] v1
* @param[in] v2
* @param[out] dest center point
*/
CGLM_INLINE
void
glm_vec_center(vec3 v1, vec3 v2, vec3 dest) {
glm_vec_add(v1, v2, dest);
glm_vec_scale(dest, 0.5f, dest);
}
/**
* @brief distance between two vectors
*
* @param[in] v1
* @param[in] v2
* @return returns distance
*/
CGLM_INLINE
float
glm_vec_distance(vec3 v1, vec3 v2) {
return sqrtf(glm_pow2(v2[0] - v1[0])
+ glm_pow2(v2[1] - v1[1])
+ glm_pow2(v2[2] - v1[2]));
}
/**
* @brief distance between two vectors
*
* @param[in] v1
* @param[in] v2
* @return returns distance
*/
CGLM_INLINE
float
glm_vec4_distance(vec4 v1, vec4 v2) {
return sqrtf(glm_pow2(v2[0] - v1[0])
+ glm_pow2(v2[1] - v1[1])
+ glm_pow2(v2[2] - v1[2])
+ glm_pow2(v2[3] - v1[3]));
}
#endif /* cglm_vec_h */

15
include/cglm-version.h Normal file
View File

@@ -0,0 +1,15 @@
/*
* Copyright (c), Recep Aslantas.
*
* MIT License (MIT), http://opensource.org/licenses/MIT
* Full license can be found in the LICENSE file
*/
#ifndef cglm_version_h
#define cglm_version_h
#define CGLM_VERSION_MAJOR 0
#define CGLM_VERSION_MINOR 2
#define CGLM_VERSION_PATCH 0
#endif /* cglm_version_h */

View File

@@ -18,7 +18,22 @@ AM_CFLAGS = -Wall \
lib_LTLIBRARIES = libcglm.la
libcglm_la_LDFLAGS = -no-undefined -version-info 0:1:0
nobase_include_HEADERS = include/cglm.h \
checkLDFLAGS = -L./.libs \
-L./test/lib/cmocka/build/src \
-lcmocka \
-lm \
-lcglm
checkCFLAGS = -I./test/lib/cmocka/include \
-I./include
check_PROGRAMS = test/test_mat4
TESTS = $(check_PROGRAMS)
test_test_mat4_LDFLAGS = $(checkLDFLAGS)
test_test_mat4_CFLAGS = $(checkCFLAGS)
nobase_include_HEADERS = include/cglm-version.h \
include/cglm.h \
include/cglm-call.h \
include/cglm-cam.h \
include/cglm-io.h \
@@ -32,8 +47,6 @@ nobase_include_HEADERS = include/cglm.h \
include/cglm-quat.h \
include/cglm-mat.h \
include/cglm-affine-mat.h \
include/cglm-platform.h \
include/cglm-opengl.h \
include/arch/simd/cglm-mat-simd-avx.h \
include/arch/simd/cglm-affine-mat-avx.h \
include/arch/simd/cglm-quat-simd.h \
@@ -59,3 +72,8 @@ libcglm_la_SOURCES=\
src/cglm-vec.c \
src/cglm-mat3.c \
src/cglm-mat.c
test_test_mat4_SOURCES=test/src/test_mat4.c
all-local:
sh ./post-build.sh

19
post-build.sh Normal file
View File

@@ -0,0 +1,19 @@
#! /bin/sh
#
# Copyright (c), Recep Aslantas.
#
# MIT License (MIT), http://opensource.org/licenses/MIT
# Full license can be found in the LICENSE file
#
cd $(dirname "$0")
mkdir -p .libs
if [ "$(uname)" = "Darwin" ]; then
ln -sf $(pwd)/test/lib/cmocka/build/src/libcmocka.0.dylib \
.libs/libcmocka.0.dylib;
else
ln -sf $(pwd)/test/lib/cmocka/build/src/libcmocka.so.0 \
.libs/libcmocka.so.0;
fi

View File

@@ -9,14 +9,14 @@
CGLM_EXPORT
void
glmc_mat4_udup(mat4 mat, mat4 dest) {
glm_mat4_dup(mat, dest);
glmc_mat4_ucopy(mat4 mat, mat4 dest) {
glm_mat4_copy(mat, dest);
}
CGLM_EXPORT
void
glmc_mat4_dup(mat4 mat, mat4 dest) {
glm_mat4_dup(mat, dest);
glmc_mat4_copy(mat4 mat, mat4 dest) {
glm_mat4_copy(mat, dest);
}
CGLM_EXPORT

View File

@@ -9,8 +9,8 @@
CGLM_EXPORT
void
glmc_mat3_dup(mat3 mat, mat3 dest) {
glm_mat3_dup(mat, dest);
glmc_mat3_copy(mat3 mat, mat3 dest) {
glm_mat3_copy(mat, dest);
}
CGLM_EXPORT

View File

@@ -9,20 +9,20 @@
CGLM_EXPORT
void
glmc_vec_dup(vec3 a, vec3 dest) {
glm_vec_dup(a, dest);
glmc_vec_copy(vec3 a, vec3 dest) {
glm_vec_copy(a, dest);
}
CGLM_EXPORT
void
glmc_vec4_dup3(vec4 a, vec3 dest) {
glm_vec4_dup3(a, dest);
glmc_vec4_copy3(vec4 a, vec3 dest) {
glm_vec4_copy3(a, dest);
}
CGLM_EXPORT
void
glmc_vec4_dup(vec4 v, vec4 dest) {
glm_vec4_dup(v, dest);
glmc_vec4_copy(vec4 v, vec4 dest) {
glm_vec4_copy(v, dest);
}
CGLM_EXPORT
@@ -162,3 +162,21 @@ void
glmc_vec_proj(vec3 a, vec3 b, vec3 dest) {
glm_vec_proj(a, b, dest);
}
CGLM_EXPORT
void
glmc_vec_center(vec3 v1, vec3 v2, vec3 dest) {
glm_vec_center(v1, v2, dest);
}
CGLM_EXPORT
float
glmc_vec_distance(vec3 v1, vec3 v2) {
return glm_vec_distance(v1, v2);
}
CGLM_EXPORT
float
glmc_vec4_distance(vec4 v1, vec4 v2) {
return glm_vec4_distance(v1, v2);
}

22
src/config.h Normal file
View File

@@ -0,0 +1,22 @@
/*
* Copyright (c), Recep Aslantas.
*
* MIT License (MIT), http://opensource.org/licenses/MIT
* Full license can be found in the LICENSE file
*/
#ifndef cglm__config__h_
#define cglm__config__h_
#if defined(_WIN32) || defined(WIN32)
/* Exclude rarely-used stuff from Windows headers */
# define WIN32_LEAN_AND_MEAN
# include <SDKDDKVer.h>
/* Windows Header Files: */
# include <windows.h>
#endif
#endif /* cglm__config__h_ */

23
src/dllmain.c Normal file
View File

@@ -0,0 +1,23 @@
/*
* Copyright (c), Recep Aslantas.
*
* MIT License (MIT), http://opensource.org/licenses/MIT
* Full license can be found in the LICENSE file
*/
#include "config.h"
BOOL
APIENTRY
DllMain(HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved) {
switch (ul_reason_for_call) {
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}

1
test/lib/cmocka Submodule

Submodule test/lib/cmocka added at 5f61d2f188

40
test/src/test_common.h Normal file
View File

@@ -0,0 +1,40 @@
/*
* Copyright (c), Recep Aslantas.
*
* MIT License (MIT), http://opensource.org/licenses/MIT
* Full license can be found in the LICENSE file
*/
#ifndef test_common_h
#define test_common_h
#include <stdarg.h>
#include <stdint.h>
#include <stddef.h>
#include <setjmp.h>
#include <cmocka.h>
#include <time.h>
#include <cglm.h>
#include <cglm-call.h>
#define precision 0.00001f
static
void
test_rand_mat4(mat4 dest);
static
void
test_rand_mat4(mat4 dest) {
int i, j;
srand((unsigned int)time(NULL));
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++) {
dest[i][j] = drand48();
}
}
}
#endif /* test_common_h */

77
test/src/test_mat4.c Normal file
View File

@@ -0,0 +1,77 @@
/*
* Copyright (c), Recep Aslantas.
*
* MIT License (MIT), http://opensource.org/licenses/MIT
* Full license can be found in the LICENSE file
*/
#include <time.h>
#include <stdlib.h>
#include <math.h>
#include <float.h>
#include "test_common.h"
#define m 4
#define n 4
void
test_mat4_mul(void **state) {
mat4 m1 = GLM_MAT4_IDENTITY_INIT;
mat4 m2 = GLM_MAT4_IDENTITY_INIT;
mat4 m3;
mat4 m4 = GLM_MAT4_ZERO_INIT;
int i, j, k;
/* test identity matrix multiplication */
glm_mat4_mul(m1, m2, m3);
for (i = 0; i < m; i++) {
for (j = 0; j < n; j++) {
if (i == j)
assert_true(m3[i][j] == 1.0f);
else
assert_true(m3[i][j] == 0.0f);
}
}
/* test random matrices */
/* random matrices */
test_rand_mat4(m1);
test_rand_mat4(m2);
glm_mat4_mul(m1, m2, m3);
for (i = 0; i < m; i++) {
for (j = 0; j < n; j++) {
for (k = 0; k < m; k++)
/* column-major */
m4[i][j] += m1[k][j] * m2[i][k];
}
}
for (i = 0; i < m; i++) {
for (j = 0; j < n; j++) {
for (k = 0; k < m; k++)
assert_true(fabsf(m3[i][j] - m4[i][j]) <= FLT_EPSILON);
}
}
/* test pre compiled */
glmc_mat4_mul(m1, m2, m3);
for (i = 0; i < m; i++) {
for (j = 0; j < n; j++) {
for (k = 0; k < m; k++)
assert_true(fabsf(m3[i][j] - m4[i][j]) <= FLT_EPSILON);
}
}
}
int
main(int argc, const char * argv[]) {
const struct CMUnitTest tests[] = {
cmocka_unit_test(test_mat4_mul)
};
return cmocka_run_group_tests(tests,
NULL,
NULL);
}

4
win/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
!cglm.sln
!cglm.vcxproj
!cglm.vcxproj.filters
!packages.config

1
win/build.bat Normal file
View File

@@ -0,0 +1 @@
msbuild cglm.vcxproj /p:Configuration=Release

28
win/cglm.sln Normal file
View File

@@ -0,0 +1,28 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26403.7
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cglm", "cglm.vcxproj", "{CA8BCAF9-CD25-4133-8F62-3D1449B5D2FC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CA8BCAF9-CD25-4133-8F62-3D1449B5D2FC}.Debug|x64.ActiveCfg = Debug|x64
{CA8BCAF9-CD25-4133-8F62-3D1449B5D2FC}.Debug|x64.Build.0 = Debug|x64
{CA8BCAF9-CD25-4133-8F62-3D1449B5D2FC}.Debug|x86.ActiveCfg = Debug|Win32
{CA8BCAF9-CD25-4133-8F62-3D1449B5D2FC}.Debug|x86.Build.0 = Debug|Win32
{CA8BCAF9-CD25-4133-8F62-3D1449B5D2FC}.Release|x64.ActiveCfg = Release|x64
{CA8BCAF9-CD25-4133-8F62-3D1449B5D2FC}.Release|x64.Build.0 = Release|x64
{CA8BCAF9-CD25-4133-8F62-3D1449B5D2FC}.Release|x86.ActiveCfg = Release|Win32
{CA8BCAF9-CD25-4133-8F62-3D1449B5D2FC}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

212
win/cglm.vcxproj Normal file
View File

@@ -0,0 +1,212 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{CA8BCAF9-CD25-4133-8F62-3D1449B5D2FC}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>cglm</RootNamespace>
<WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<CodeAnalysisRuleSet>NativeRecommendedRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<CodeAnalysisRuleSet>NativeRecommendedRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<CodeAnalysisRuleSet>NativeRecommendedRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<CodeAnalysisRuleSet>NativeRecommendedRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;CGLM_EXPORTS;CGLM_DLL;%(PreprocessorDefinitions);CGLM_DLL</PreprocessorDefinitions>
<DebugInformationFormat>None</DebugInformationFormat>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<PrecompiledHeaderFile />
<CompileAs>CompileAsC</CompileAs>
<WholeProgramOptimization>true</WholeProgramOptimization>
<EnablePREfast>true</EnablePREfast>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;CGLM_EXPORTS;CGLM_DLL;%(PreprocessorDefinitions);CGLM_DLL</PreprocessorDefinitions>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<IntrinsicFunctions>true</IntrinsicFunctions>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PrecompiledHeaderFile />
<CompileAs>CompileAsC</CompileAs>
<DebugInformationFormat>None</DebugInformationFormat>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<EnablePREfast>true</EnablePREfast>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;CGLM_EXPORTS;CGLM_DLL;%(PreprocessorDefinitions);CGLM_DLL</PreprocessorDefinitions>
<DebugInformationFormat>None</DebugInformationFormat>
<PrecompiledHeaderFile />
<CompileAs>CompileAsC</CompileAs>
<EnablePREfast>true</EnablePREfast>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;CGLM_EXPORTS;CGLM_DLL;%(PreprocessorDefinitions);CGLM_DLL</PreprocessorDefinitions>
<DebugInformationFormat>None</DebugInformationFormat>
<PrecompiledHeaderFile />
<CompileAs>CompileAsC</CompileAs>
<EnablePREfast>true</EnablePREfast>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\include\arch\simd\cglm-affine-mat-avx.h" />
<ClInclude Include="..\include\arch\simd\cglm-affine-mat-sse2.h" />
<ClInclude Include="..\include\arch\simd\cglm-intrin.h" />
<ClInclude Include="..\include\arch\simd\cglm-mat-simd-avx.h" />
<ClInclude Include="..\include\arch\simd\cglm-mat-simd-sse2.h" />
<ClInclude Include="..\include\arch\simd\cglm-mat3-simd-sse2.h" />
<ClInclude Include="..\include\arch\simd\cglm-quat-simd.h" />
<ClInclude Include="..\include\call\cglmc-affine.h" />
<ClInclude Include="..\include\call\cglmc-cam.h" />
<ClInclude Include="..\include\call\cglmc-euler.h" />
<ClInclude Include="..\include\call\cglmc-io.h" />
<ClInclude Include="..\include\call\cglmc-mat.h" />
<ClInclude Include="..\include\call\cglmc-mat3.h" />
<ClInclude Include="..\include\call\cglmc-quat.h" />
<ClInclude Include="..\include\call\cglmc-vec.h" />
<ClInclude Include="..\include\cglm-affine-mat.h" />
<ClInclude Include="..\include\cglm-affine.h" />
<ClInclude Include="..\include\cglm-call.h" />
<ClInclude Include="..\include\cglm-cam.h" />
<ClInclude Include="..\include\cglm-common.h" />
<ClInclude Include="..\include\cglm-euler.h" />
<ClInclude Include="..\include\cglm-io.h" />
<ClInclude Include="..\include\cglm-mat.h" />
<ClInclude Include="..\include\cglm-mat3.h" />
<ClInclude Include="..\include\cglm-quat.h" />
<ClInclude Include="..\include\cglm-types.h" />
<ClInclude Include="..\include\cglm-util.h" />
<ClInclude Include="..\include\cglm-vec-ext.h" />
<ClInclude Include="..\include\cglm-vec.h" />
<ClInclude Include="..\include\cglm.h" />
<ClInclude Include="..\src\config.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\cglm-cam.c" />
<ClCompile Include="..\src\cglm-euler.c" />
<ClCompile Include="..\src\cglm-io.c" />
<ClCompile Include="..\src\cglm-mat.c" />
<ClCompile Include="..\src\cglm-mat3.c" />
<ClCompile Include="..\src\cglm-quat.c" />
<ClCompile Include="..\src\cglm-vec.c" />
<ClCompile Include="..\src\clgm-affine.c" />
<ClCompile Include="..\src\dllmain.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

153
win/cglm.vcxproj.filters Normal file
View File

@@ -0,0 +1,153 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="src">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="include">
<UniqueIdentifier>{f46634e5-c098-41a0-afb3-45afb6a53593}</UniqueIdentifier>
</Filter>
<Filter Include="include\call">
<UniqueIdentifier>{496b3b53-1258-4efa-87b2-4280ea82f87e}</UniqueIdentifier>
</Filter>
<Filter Include="include\arch">
<UniqueIdentifier>{28919415-29bd-4edd-8ab1-1ec9a16e46f0}</UniqueIdentifier>
</Filter>
<Filter Include="include\arch\simd">
<UniqueIdentifier>{792cb1a9-bdc8-4f00-bfde-067750b0ab41}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\include\cglm.h">
<Filter>include</Filter>
</ClInclude>
<ClInclude Include="..\include\cglm-affine.h">
<Filter>include</Filter>
</ClInclude>
<ClInclude Include="..\include\cglm-affine-mat.h">
<Filter>include</Filter>
</ClInclude>
<ClInclude Include="..\include\cglm-call.h">
<Filter>include</Filter>
</ClInclude>
<ClInclude Include="..\include\cglm-cam.h">
<Filter>include</Filter>
</ClInclude>
<ClInclude Include="..\include\cglm-common.h">
<Filter>include</Filter>
</ClInclude>
<ClInclude Include="..\include\cglm-euler.h">
<Filter>include</Filter>
</ClInclude>
<ClInclude Include="..\include\cglm-io.h">
<Filter>include</Filter>
</ClInclude>
<ClInclude Include="..\include\cglm-mat.h">
<Filter>include</Filter>
</ClInclude>
<ClInclude Include="..\include\cglm-mat3.h">
<Filter>include</Filter>
</ClInclude>
<ClInclude Include="..\include\cglm-quat.h">
<Filter>include</Filter>
</ClInclude>
<ClInclude Include="..\include\cglm-types.h">
<Filter>include</Filter>
</ClInclude>
<ClInclude Include="..\include\cglm-util.h">
<Filter>include</Filter>
</ClInclude>
<ClInclude Include="..\include\cglm-vec.h">
<Filter>include</Filter>
</ClInclude>
<ClInclude Include="..\include\cglm-vec-ext.h">
<Filter>include</Filter>
</ClInclude>
<ClInclude Include="..\include\call\cglmc-affine.h">
<Filter>include\call</Filter>
</ClInclude>
<ClInclude Include="..\include\call\cglmc-cam.h">
<Filter>include\call</Filter>
</ClInclude>
<ClInclude Include="..\include\call\cglmc-euler.h">
<Filter>include\call</Filter>
</ClInclude>
<ClInclude Include="..\include\call\cglmc-io.h">
<Filter>include\call</Filter>
</ClInclude>
<ClInclude Include="..\include\call\cglmc-mat.h">
<Filter>include\call</Filter>
</ClInclude>
<ClInclude Include="..\include\call\cglmc-mat3.h">
<Filter>include\call</Filter>
</ClInclude>
<ClInclude Include="..\include\call\cglmc-quat.h">
<Filter>include\call</Filter>
</ClInclude>
<ClInclude Include="..\include\call\cglmc-vec.h">
<Filter>include\call</Filter>
</ClInclude>
<ClInclude Include="..\include\arch\simd\cglm-affine-mat-avx.h">
<Filter>include\arch\simd</Filter>
</ClInclude>
<ClInclude Include="..\include\arch\simd\cglm-affine-mat-sse2.h">
<Filter>include\arch\simd</Filter>
</ClInclude>
<ClInclude Include="..\include\arch\simd\cglm-intrin.h">
<Filter>include\arch\simd</Filter>
</ClInclude>
<ClInclude Include="..\include\arch\simd\cglm-mat3-simd-sse2.h">
<Filter>include\arch\simd</Filter>
</ClInclude>
<ClInclude Include="..\include\arch\simd\cglm-mat-simd-avx.h">
<Filter>include\arch\simd</Filter>
</ClInclude>
<ClInclude Include="..\include\arch\simd\cglm-mat-simd-sse2.h">
<Filter>include\arch\simd</Filter>
</ClInclude>
<ClInclude Include="..\include\arch\simd\cglm-quat-simd.h">
<Filter>include\arch\simd</Filter>
</ClInclude>
<ClInclude Include="..\src\config.h">
<Filter>src</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\cglm-cam.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\src\cglm-euler.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\src\cglm-io.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\src\cglm-mat.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\src\cglm-mat3.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\src\cglm-quat.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\src\cglm-vec.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\src\clgm-affine.c">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\src\dllmain.c">
<Filter>src</Filter>
</ClCompile>
</ItemGroup>
</Project>