1
0
mirror of https://github.com/libretro/RetroArch synced 2024-07-05 09:48:42 +00:00

(SDK) Move math/matrix code to SDK

This commit is contained in:
twinaphex 2014-10-23 04:48:34 +02:00
parent e786288123
commit 6979b62bdc
10 changed files with 122 additions and 93 deletions

View File

@ -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

View File

@ -18,7 +18,7 @@
#include "../general.h"
#include "fonts/fonts.h"
#include "math/matrix.h"
#include <gfx/math/matrix.h>
#include "gfx_context.h"
#include <gfx/scaler/scaler.h>
#include "fonts/gl_font.h"

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#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

View File

@ -24,7 +24,7 @@
#endif
#include "../gfx_context.h"
#include "../math/matrix.h"
#include <gfx/math/matrix.h>
typedef struct shader_backend
{

View File

@ -21,7 +21,7 @@
#include <compat/posix_string.h>
#include "../state_tracker.h"
#include "../../dynamic.h"
#include "../math/matrix.h"
#include <gfx/math/matrix.h>
#ifdef HAVE_CONFIG_H
#include "../../config.h"

View File

@ -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

View File

@ -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 <http://www.gnu.org/licenses/>.
* 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 <gfx/math/matrix.h>
#include <string.h>
#include <math.h>

View File

@ -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 <http://www.gnu.org/licenses/>.
* 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 <gfx/math/matrix_3x3.h>
#include <math.h>
#include <string.h>

View File

@ -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

View File

@ -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 <http://www.gnu.org/licenses/>.
* 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 <boolean.h>