mirror of
https://github.com/libretro/RetroArch
synced 2025-04-09 21:45:45 +00:00
(SDK) Move math/matrix code to SDK
This commit is contained in:
parent
e786288123
commit
6979b62bdc
@ -364,7 +364,7 @@ ifeq ($(HAVE_OPENGL), 1)
|
|||||||
gfx/context/gfx_null_ctx.o \
|
gfx/context/gfx_null_ctx.o \
|
||||||
gfx/fonts/gl_font.o \
|
gfx/fonts/gl_font.o \
|
||||||
gfx/fonts/gl_raster_font.o \
|
gfx/fonts/gl_raster_font.o \
|
||||||
gfx/math/matrix.o \
|
libretro-sdk/gfx/math/matrix.o \
|
||||||
gfx/state_tracker.o \
|
gfx/state_tracker.o \
|
||||||
libretro-sdk/glsym/rglgen.o
|
libretro-sdk/glsym/rglgen.o
|
||||||
|
|
||||||
@ -479,7 +479,7 @@ ifeq ($(HAVE_EXYNOS), 1)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(HAVE_VG), 1)
|
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)
|
DEFINES += $(VG_CFLAGS)
|
||||||
LIBS += $(VG_LIBS)
|
LIBS += $(VG_LIBS)
|
||||||
endif
|
endif
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#include "../general.h"
|
#include "../general.h"
|
||||||
#include "fonts/fonts.h"
|
#include "fonts/fonts.h"
|
||||||
#include "math/matrix.h"
|
#include <gfx/math/matrix.h>
|
||||||
#include "gfx_context.h"
|
#include "gfx_context.h"
|
||||||
#include <gfx/scaler/scaler.h>
|
#include <gfx/scaler/scaler.h>
|
||||||
#include "fonts/gl_font.h"
|
#include "fonts/gl_font.h"
|
||||||
|
@ -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
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "../gfx_context.h"
|
#include "../gfx_context.h"
|
||||||
#include "../math/matrix.h"
|
#include <gfx/math/matrix.h>
|
||||||
|
|
||||||
typedef struct shader_backend
|
typedef struct shader_backend
|
||||||
{
|
{
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include <compat/posix_string.h>
|
#include <compat/posix_string.h>
|
||||||
#include "../state_tracker.h"
|
#include "../state_tracker.h"
|
||||||
#include "../../dynamic.h"
|
#include "../../dynamic.h"
|
||||||
#include "../math/matrix.h"
|
#include <gfx/math/matrix.h>
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "../../config.h"
|
#include "../../config.h"
|
||||||
|
@ -173,7 +173,7 @@ VIDEO DRIVER
|
|||||||
============================================================ */
|
============================================================ */
|
||||||
|
|
||||||
#if defined(HAVE_OPENGL)
|
#if defined(HAVE_OPENGL)
|
||||||
#include "../gfx/math/matrix.c"
|
#include "../libretro-sdk/gfx/math/matrix.c"
|
||||||
#elif defined(GEKKO)
|
#elif defined(GEKKO)
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
#include "../wii/vi_encoder.c"
|
#include "../wii/vi_encoder.c"
|
||||||
@ -183,7 +183,7 @@ VIDEO DRIVER
|
|||||||
|
|
||||||
#ifdef HAVE_VG
|
#ifdef HAVE_VG
|
||||||
#include "../gfx/vg.c"
|
#include "../gfx/vg.c"
|
||||||
#include "../gfx/math/matrix_3x3.c"
|
#include "../libretro-sdk/gfx/math/matrix_3x3.c"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_OMAP
|
#ifdef HAVE_OMAP
|
||||||
|
@ -1,19 +1,26 @@
|
|||||||
/* RetroArch - A frontend for libretro.
|
/* Copyright (C) 2010-2014 The RetroArch team
|
||||||
* 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-
|
* The following license statement only applies to this file (matrix.c).
|
||||||
* 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;
|
* Permission is hereby granted, free of charge,
|
||||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
||||||
* PURPOSE. See the GNU General Public License for more details.
|
* 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:
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
* If not, see <http://www.gnu.org/licenses/>.
|
*
|
||||||
|
* 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 <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
@ -1,20 +1,26 @@
|
|||||||
/* RetroArch - A frontend for libretro.
|
/* Copyright (C) 2010-2014 The RetroArch team
|
||||||
* 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-
|
* The following license statement only applies to this file (matrix_3x3.c).
|
||||||
* 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;
|
* Permission is hereby granted, free of charge,
|
||||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
||||||
* PURPOSE. See the GNU General Public License for more details.
|
* 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:
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
* If not, see <http://www.gnu.org/licenses/>.
|
*
|
||||||
|
* 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 <math.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
57
libretro-sdk/include/gfx/math/matrix.h
Normal file
57
libretro-sdk/include/gfx/math/matrix.h
Normal 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
|
||||||
|
|
@ -1,21 +1,27 @@
|
|||||||
/* RetroArch - A frontend for libretro.
|
/* Copyright (C) 2010-2014 The RetroArch team
|
||||||
* 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-
|
* The following license statement only applies to this file (matrix_3x3.h).
|
||||||
* 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;
|
* Permission is hereby granted, free of charge,
|
||||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
||||||
* PURPOSE. See the GNU General Public License for more details.
|
* 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:
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
* If not, see <http://www.gnu.org/licenses/>.
|
*
|
||||||
|
* 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__
|
#ifndef __LIBRETRO_SDK_GFX_MATH_MATRIX_3X3_H__
|
||||||
#define MATH_MATRIX_3X3_H__
|
#define __LIBRETRO_SDK_GFX_MATH_MATRIX_3X3_H__
|
||||||
|
|
||||||
#include <boolean.h>
|
#include <boolean.h>
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user