diff --git a/Makefile.common b/Makefile.common index f830f1e696..02488e35d4 100644 --- a/Makefile.common +++ b/Makefile.common @@ -364,7 +364,7 @@ ifeq ($(HAVE_OPENGL), 1) gfx/context/gfx_null_ctx.o \ gfx/fonts/gl_font.o \ gfx/fonts/gl_raster_font.o \ - gfx/math/matrix.o \ + libretro-sdk/gfx/math/matrix.o \ gfx/state_tracker.o \ libretro-sdk/glsym/rglgen.o @@ -479,7 +479,7 @@ ifeq ($(HAVE_EXYNOS), 1) endif ifeq ($(HAVE_VG), 1) - OBJ += gfx/vg.o gfx/math/matrix_3x3.o + OBJ += gfx/vg.o libretro-sdk/gfx/math/matrix_3x3.o DEFINES += $(VG_CFLAGS) LIBS += $(VG_LIBS) endif diff --git a/gfx/gl_common.h b/gfx/gl_common.h index 5ebf59e34e..75476978d8 100644 --- a/gfx/gl_common.h +++ b/gfx/gl_common.h @@ -18,7 +18,7 @@ #include "../general.h" #include "fonts/fonts.h" -#include "math/matrix.h" +#include #include "gfx_context.h" #include #include "fonts/gl_font.h" diff --git a/gfx/math/matrix.h b/gfx/math/matrix.h deleted file mode 100644 index 6ada38349a..0000000000 --- a/gfx/math/matrix.h +++ /dev/null @@ -1,47 +0,0 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * - * RetroArch is free software: you can redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. - * - * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . - */ - -#ifndef MATH_MATRIX_H__ -#define MATH_MATRIX_H__ - -// Column-major matrix (OpenGL-style). -// Reimplements functionality from FF OpenGL pipeline to be able to work on GLES 2.0 and modern GL variants. -typedef struct math_matrix -{ - float data[16]; -} math_matrix; - -#define MAT_ELEM(mat, r, c) ((mat).data[4 * (c) + (r)]) - -void matrix_identity(math_matrix *mat); -void matrix_transpose(math_matrix *out, const math_matrix *in); - -void matrix_rotate_x(math_matrix *mat, float rad); -void matrix_rotate_y(math_matrix *mat, float rad); -void matrix_rotate_z(math_matrix *mat, float rad); - -void matrix_ortho(math_matrix *mat, - float left, float right, - float bottom, float top, - float znear, float zfar); - -void matrix_multiply(math_matrix *out, const math_matrix *a, const math_matrix *b); - -void matrix_scale(math_matrix *out, float x, float y, float z); -void matrix_translate(math_matrix *out, float x, float y, float z); -void matrix_projection(math_matrix *out, float znear, float zfar); - -#endif - diff --git a/gfx/shader/shader_context.h b/gfx/shader/shader_context.h index 48d3ec8723..0867af51b0 100644 --- a/gfx/shader/shader_context.h +++ b/gfx/shader/shader_context.h @@ -24,7 +24,7 @@ #endif #include "../gfx_context.h" -#include "../math/matrix.h" +#include typedef struct shader_backend { diff --git a/gfx/shader/shader_null.c b/gfx/shader/shader_null.c index d705dbba89..4a2a083237 100644 --- a/gfx/shader/shader_null.c +++ b/gfx/shader/shader_null.c @@ -21,7 +21,7 @@ #include #include "../state_tracker.h" #include "../../dynamic.h" -#include "../math/matrix.h" +#include #ifdef HAVE_CONFIG_H #include "../../config.h" diff --git a/griffin/griffin.c b/griffin/griffin.c index b2ab735e26..5e66ba0cdf 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -173,7 +173,7 @@ VIDEO DRIVER ============================================================ */ #if defined(HAVE_OPENGL) -#include "../gfx/math/matrix.c" +#include "../libretro-sdk/gfx/math/matrix.c" #elif defined(GEKKO) #ifdef HW_RVL #include "../wii/vi_encoder.c" @@ -183,7 +183,7 @@ VIDEO DRIVER #ifdef HAVE_VG #include "../gfx/vg.c" -#include "../gfx/math/matrix_3x3.c" +#include "../libretro-sdk/gfx/math/matrix_3x3.c" #endif #ifdef HAVE_OMAP diff --git a/gfx/math/matrix.c b/libretro-sdk/gfx/math/matrix.c similarity index 67% rename from gfx/math/matrix.c rename to libretro-sdk/gfx/math/matrix.c index ce209e189b..0f02b1d605 100644 --- a/gfx/math/matrix.c +++ b/libretro-sdk/gfx/math/matrix.c @@ -1,19 +1,26 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * - * RetroArch is free software: you can redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. +/* Copyright (C) 2010-2014 The RetroArch team * - * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (matrix.c). + * --------------------------------------------------------------------------------------- * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "matrix.h" +#include #include #include diff --git a/gfx/math/matrix_3x3.c b/libretro-sdk/gfx/math/matrix_3x3.c similarity index 85% rename from gfx/math/matrix_3x3.c rename to libretro-sdk/gfx/math/matrix_3x3.c index 975386e9b0..fdd41d07f0 100644 --- a/gfx/math/matrix_3x3.c +++ b/libretro-sdk/gfx/math/matrix_3x3.c @@ -1,20 +1,26 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2012-2014 - Michael Lelli - * - * RetroArch is free software: you can redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. +/* Copyright (C) 2010-2014 The RetroArch team * - * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (matrix_3x3.c). + * --------------------------------------------------------------------------------------- * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "matrix_3x3.h" +#include #include #include diff --git a/libretro-sdk/include/gfx/math/matrix.h b/libretro-sdk/include/gfx/math/matrix.h new file mode 100644 index 0000000000..ceea1d6760 --- /dev/null +++ b/libretro-sdk/include/gfx/math/matrix.h @@ -0,0 +1,57 @@ +/* Copyright (C) 2010-2014 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (matrix.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __LIBRETRO_SDK_GFX_MATH_MATRIX_H__ +#define __LIBRETRO_SDK_GFX_MATH_MATRIX_H__ + +/* Column-major matrix (OpenGL-style). + * Reimplements functionality from FF OpenGL pipeline to be able + * to work on GLES 2.0 and modern GL variants. + */ + +typedef struct math_matrix +{ + float data[16]; +} math_matrix; + +#define MAT_ELEM(mat, r, c) ((mat).data[4 * (c) + (r)]) + +void matrix_identity(math_matrix *mat); +void matrix_transpose(math_matrix *out, const math_matrix *in); + +void matrix_rotate_x(math_matrix *mat, float rad); +void matrix_rotate_y(math_matrix *mat, float rad); +void matrix_rotate_z(math_matrix *mat, float rad); + +void matrix_ortho(math_matrix *mat, + float left, float right, + float bottom, float top, + float znear, float zfar); + +void matrix_multiply(math_matrix *out, const math_matrix *a, const math_matrix *b); + +void matrix_scale(math_matrix *out, float x, float y, float z); +void matrix_translate(math_matrix *out, float x, float y, float z); +void matrix_projection(math_matrix *out, float znear, float zfar); + +#endif + diff --git a/gfx/math/matrix_3x3.h b/libretro-sdk/include/gfx/math/matrix_3x3.h similarity index 58% rename from gfx/math/matrix_3x3.h rename to libretro-sdk/include/gfx/math/matrix_3x3.h index 6293abbc07..b9a1e6499f 100644 --- a/gfx/math/matrix_3x3.h +++ b/libretro-sdk/include/gfx/math/matrix_3x3.h @@ -1,21 +1,27 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * Copyright (C) 2012-2014 - Michael Lelli - * - * RetroArch is free software: you can redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Found- - * ation, either version 3 of the License, or (at your option) any later version. +/* Copyright (C) 2010-2014 The RetroArch team * - * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (matrix_3x3.h). + * --------------------------------------------------------------------------------------- * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef MATH_MATRIX_3X3_H__ -#define MATH_MATRIX_3X3_H__ +#ifndef __LIBRETRO_SDK_GFX_MATH_MATRIX_3X3_H__ +#define __LIBRETRO_SDK_GFX_MATH_MATRIX_3X3_H__ #include