[Video] Update headers
This commit is contained in:
parent
894706a379
commit
b50c8b1fdd
|
@ -1,42 +1,16 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "Gfx_1.3.h"
|
||||
extern "C" {
|
||||
#ifndef NOSSE
|
||||
|
|
|
@ -1,54 +1,28 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
void calc_light (VERTEX *v);
|
||||
void calc_linear (VERTEX *v);
|
||||
void calc_sphere (VERTEX *v);
|
||||
|
||||
void math_init();
|
||||
|
||||
typedef void (*MULMATRIX)(float m1[4][4],float m2[4][4],float r[4][4]);
|
||||
typedef void(*MULMATRIX)(float m1[4][4], float m2[4][4], float r[4][4]);
|
||||
extern MULMATRIX MulMatrices;
|
||||
typedef void (*TRANSFORMVECTOR)(float *src,float *dst,float mat[4][4]);
|
||||
typedef void(*TRANSFORMVECTOR)(float *src, float *dst, float mat[4][4]);
|
||||
extern TRANSFORMVECTOR TransformVector;
|
||||
extern TRANSFORMVECTOR InverseTransformVector;
|
||||
typedef float (*DOTPRODUCT)(register float *v1, register float *v2);
|
||||
typedef float(*DOTPRODUCT)(register float *v1, register float *v2);
|
||||
extern DOTPRODUCT DotProduct;
|
||||
typedef void (*NORMALIZEVECTOR)(float *v);
|
||||
typedef void(*NORMALIZEVECTOR)(float *v);
|
||||
extern NORMALIZEVECTOR NormalizeVector;
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#ifdef ANDROID
|
||||
#include <jni.h>
|
||||
|
|
|
@ -1,48 +1,16 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// CRC32 calculation functions
|
||||
//
|
||||
// Created by Gonetz, 2004
|
||||
//
|
||||
//****************************************************************
|
||||
//*
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#define CRC32_POLYNOMIAL 0x04C11DB7
|
||||
|
||||
unsigned int CRCTable[256];
|
||||
|
|
|
@ -1,47 +1,16 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// CRC32 calculation functions
|
||||
//
|
||||
// Created by Gonetz, 2004
|
||||
//
|
||||
//****************************************************************
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
void CRC_BuildTable();
|
||||
|
||||
|
|
|
@ -1,42 +1,16 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include <string.h>
|
||||
#include "Gfx_1.3.h"
|
||||
#include "Util.h"
|
||||
|
|
|
@ -1,41 +1,16 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#ifndef COMBINE_H
|
||||
#define COMBINE_H
|
||||
|
||||
|
|
|
@ -1,49 +1,16 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators (tested mostly with Project64)
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 dialogs
|
||||
// Created by Gonetz, 2008
|
||||
//
|
||||
//****************************************************************
|
||||
|
||||
// -*- C++ -*- generated by wxGlade 0.6.3 on Tue Oct 07 22:39:28 2008
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "Gfx_1.3.h"
|
||||
#include "DepthBufferRender.h"
|
||||
#include "Config.h"
|
||||
|
|
|
@ -1,46 +1,16 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators (tested mostly with Project64)
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 dialogs
|
||||
// Created by Gonetz, 2008
|
||||
//
|
||||
//****************************************************************
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#ifdef _WIN32
|
||||
|
|
|
@ -1,42 +1,16 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
|
|
|
@ -1,40 +1,14 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
|
||||
void output (float x, float y, int scale, const char *fmt, ...);
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
void output(float x, float y, int scale, const char *fmt, ...);
|
||||
|
|
|
@ -1,50 +1,16 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// Software rendering into N64 depth buffer
|
||||
// Idea and N64 depth value format by Orkin
|
||||
// Polygon rasterization algorithm is taken from FATMAP2 engine by Mats Byggmastar, mri@penti.sit.fi
|
||||
//
|
||||
// Created by Gonetz, Dec 2004
|
||||
//
|
||||
//****************************************************************
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "Gfx_1.3.h"
|
||||
#include "rdp.h"
|
||||
#include "DepthBufferRender.h"
|
||||
|
@ -53,33 +19,33 @@ uint16_t * zLUT = 0;
|
|||
|
||||
void ZLUT_init()
|
||||
{
|
||||
if (zLUT)
|
||||
return;
|
||||
zLUT = new uint16_t[0x40000];
|
||||
for(int i=0; i<0x40000; i++)
|
||||
{
|
||||
uint32_t exponent = 0;
|
||||
uint32_t testbit = 1 << 17;
|
||||
while((i & testbit) && (exponent < 7))
|
||||
if (zLUT)
|
||||
return;
|
||||
zLUT = new uint16_t[0x40000];
|
||||
for (int i = 0; i < 0x40000; i++)
|
||||
{
|
||||
exponent++;
|
||||
testbit = 1 << (17 - exponent);
|
||||
uint32_t exponent = 0;
|
||||
uint32_t testbit = 1 << 17;
|
||||
while ((i & testbit) && (exponent < 7))
|
||||
{
|
||||
exponent++;
|
||||
testbit = 1 << (17 - exponent);
|
||||
}
|
||||
|
||||
uint32_t mantissa = (i >> (6 - (6 < exponent ? 6 : exponent))) & 0x7ff;
|
||||
zLUT[i] = (uint16_t)(((exponent << 11) | mantissa) << 2);
|
||||
}
|
||||
|
||||
uint32_t mantissa = (i >> (6 - (6 < exponent ? 6 : exponent))) & 0x7ff;
|
||||
zLUT[i] = (uint16_t)(((exponent << 11) | mantissa) << 2);
|
||||
}
|
||||
}
|
||||
|
||||
void ZLUT_release()
|
||||
{
|
||||
delete[] zLUT;
|
||||
zLUT = 0;
|
||||
delete[] zLUT;
|
||||
zLUT = 0;
|
||||
}
|
||||
|
||||
static vertexi * max_vtx; // Max y vertex (ending vertex)
|
||||
static vertexi * start_vtx, * end_vtx; // First and last vertex in array
|
||||
static vertexi * right_vtx, * left_vtx; // Current right and left vertex
|
||||
static vertexi * start_vtx, *end_vtx; // First and last vertex in array
|
||||
static vertexi * right_vtx, *left_vtx; // Current right and left vertex
|
||||
|
||||
static int right_height, left_height;
|
||||
static int right_x, right_dxdy, left_x, left_dxdy;
|
||||
|
@ -103,210 +69,208 @@ __inline int idiv16(int x, int y) // (x << 16) / y
|
|||
|
||||
__inline int iceil(int x)
|
||||
{
|
||||
x += 0xffff;
|
||||
return (x >> 16);
|
||||
x += 0xffff;
|
||||
return (x >> 16);
|
||||
}
|
||||
|
||||
static void RightSection(void)
|
||||
{
|
||||
// Walk backwards trough the vertex array
|
||||
|
||||
vertexi * v2, * v1 = right_vtx;
|
||||
if(right_vtx > start_vtx) v2 = right_vtx-1;
|
||||
else v2 = end_vtx; // Wrap to end of array
|
||||
right_vtx = v2;
|
||||
|
||||
// v1 = top vertex
|
||||
// v2 = bottom vertex
|
||||
|
||||
// Calculate number of scanlines in this section
|
||||
|
||||
right_height = iceil(v2->y) - iceil(v1->y);
|
||||
if(right_height <= 0) return;
|
||||
|
||||
// Guard against possible div overflows
|
||||
|
||||
if(right_height > 1) {
|
||||
// OK, no worries, we have a section that is at least
|
||||
// one pixel high. Calculate slope as usual.
|
||||
|
||||
int height = v2->y - v1->y;
|
||||
right_dxdy = idiv16(v2->x - v1->x, height);
|
||||
}
|
||||
else {
|
||||
// Height is less or equal to one pixel.
|
||||
// Calculate slope = width * 1/height
|
||||
// using 18:14 bit precision to avoid overflows.
|
||||
|
||||
int inv_height = (0x10000 << 14) / (v2->y - v1->y);
|
||||
right_dxdy = imul14(v2->x - v1->x, inv_height);
|
||||
}
|
||||
|
||||
// Prestep initial values
|
||||
|
||||
int prestep = (iceil(v1->y) << 16) - v1->y;
|
||||
right_x = v1->x + imul16(prestep, right_dxdy);
|
||||
// Walk backwards trough the vertex array
|
||||
|
||||
vertexi * v2, *v1 = right_vtx;
|
||||
if (right_vtx > start_vtx) v2 = right_vtx - 1;
|
||||
else v2 = end_vtx; // Wrap to end of array
|
||||
right_vtx = v2;
|
||||
|
||||
// v1 = top vertex
|
||||
// v2 = bottom vertex
|
||||
|
||||
// Calculate number of scanlines in this section
|
||||
|
||||
right_height = iceil(v2->y) - iceil(v1->y);
|
||||
if (right_height <= 0) return;
|
||||
|
||||
// Guard against possible div overflows
|
||||
|
||||
if (right_height > 1) {
|
||||
// OK, no worries, we have a section that is at least
|
||||
// one pixel high. Calculate slope as usual.
|
||||
|
||||
int height = v2->y - v1->y;
|
||||
right_dxdy = idiv16(v2->x - v1->x, height);
|
||||
}
|
||||
else {
|
||||
// Height is less or equal to one pixel.
|
||||
// Calculate slope = width * 1/height
|
||||
// using 18:14 bit precision to avoid overflows.
|
||||
|
||||
int inv_height = (0x10000 << 14) / (v2->y - v1->y);
|
||||
right_dxdy = imul14(v2->x - v1->x, inv_height);
|
||||
}
|
||||
|
||||
// Prestep initial values
|
||||
|
||||
int prestep = (iceil(v1->y) << 16) - v1->y;
|
||||
right_x = v1->x + imul16(prestep, right_dxdy);
|
||||
}
|
||||
|
||||
static void LeftSection(void)
|
||||
{
|
||||
// Walk forward trough the vertex array
|
||||
|
||||
vertexi * v2, * v1 = left_vtx;
|
||||
if(left_vtx < end_vtx) v2 = left_vtx+1;
|
||||
else v2 = start_vtx; // Wrap to start of array
|
||||
left_vtx = v2;
|
||||
|
||||
// v1 = top vertex
|
||||
// v2 = bottom vertex
|
||||
|
||||
// Calculate number of scanlines in this section
|
||||
|
||||
left_height = iceil(v2->y) - iceil(v1->y);
|
||||
if(left_height <= 0) return;
|
||||
|
||||
// Guard against possible div overflows
|
||||
|
||||
if(left_height > 1) {
|
||||
// OK, no worries, we have a section that is at least
|
||||
// one pixel high. Calculate slope as usual.
|
||||
|
||||
int height = v2->y - v1->y;
|
||||
left_dxdy = idiv16(v2->x - v1->x, height);
|
||||
left_dzdy = idiv16(v2->z - v1->z, height);
|
||||
}
|
||||
else {
|
||||
// Height is less or equal to one pixel.
|
||||
// Calculate slope = width * 1/height
|
||||
// using 18:14 bit precision to avoid overflows.
|
||||
|
||||
int inv_height = (0x10000 << 14) / (v2->y - v1->y);
|
||||
left_dxdy = imul14(v2->x - v1->x, inv_height);
|
||||
left_dzdy = imul14(v2->z - v1->z, inv_height);
|
||||
}
|
||||
|
||||
// Prestep initial values
|
||||
|
||||
int prestep = (iceil(v1->y) << 16) - v1->y;
|
||||
left_x = v1->x + imul16(prestep, left_dxdy);
|
||||
left_z = v1->z + imul16(prestep, left_dzdy);
|
||||
}
|
||||
// Walk forward trough the vertex array
|
||||
|
||||
vertexi * v2, *v1 = left_vtx;
|
||||
if (left_vtx < end_vtx) v2 = left_vtx + 1;
|
||||
else v2 = start_vtx; // Wrap to start of array
|
||||
left_vtx = v2;
|
||||
|
||||
// v1 = top vertex
|
||||
// v2 = bottom vertex
|
||||
|
||||
// Calculate number of scanlines in this section
|
||||
|
||||
left_height = iceil(v2->y) - iceil(v1->y);
|
||||
if (left_height <= 0) return;
|
||||
|
||||
// Guard against possible div overflows
|
||||
|
||||
if (left_height > 1) {
|
||||
// OK, no worries, we have a section that is at least
|
||||
// one pixel high. Calculate slope as usual.
|
||||
|
||||
int height = v2->y - v1->y;
|
||||
left_dxdy = idiv16(v2->x - v1->x, height);
|
||||
left_dzdy = idiv16(v2->z - v1->z, height);
|
||||
}
|
||||
else {
|
||||
// Height is less or equal to one pixel.
|
||||
// Calculate slope = width * 1/height
|
||||
// using 18:14 bit precision to avoid overflows.
|
||||
|
||||
int inv_height = (0x10000 << 14) / (v2->y - v1->y);
|
||||
left_dxdy = imul14(v2->x - v1->x, inv_height);
|
||||
left_dzdy = imul14(v2->z - v1->z, inv_height);
|
||||
}
|
||||
|
||||
// Prestep initial values
|
||||
|
||||
int prestep = (iceil(v1->y) << 16) - v1->y;
|
||||
left_x = v1->x + imul16(prestep, left_dxdy);
|
||||
left_z = v1->z + imul16(prestep, left_dzdy);
|
||||
}
|
||||
|
||||
void Rasterize(vertexi * vtx, int vertices, int dzdx)
|
||||
{
|
||||
start_vtx = vtx; // First vertex in array
|
||||
|
||||
// Search trough the vtx array to find min y, max y
|
||||
// and the location of these structures.
|
||||
|
||||
vertexi * min_vtx = vtx;
|
||||
max_vtx = vtx;
|
||||
|
||||
int min_y = vtx->y;
|
||||
int max_y = vtx->y;
|
||||
|
||||
vtx++;
|
||||
|
||||
for(int n=1; n<vertices; n++) {
|
||||
if(vtx->y < min_y) {
|
||||
min_y = vtx->y;
|
||||
min_vtx = vtx;
|
||||
start_vtx = vtx; // First vertex in array
|
||||
|
||||
// Search trough the vtx array to find min y, max y
|
||||
// and the location of these structures.
|
||||
|
||||
vertexi * min_vtx = vtx;
|
||||
max_vtx = vtx;
|
||||
|
||||
int min_y = vtx->y;
|
||||
int max_y = vtx->y;
|
||||
|
||||
vtx++;
|
||||
|
||||
for (int n = 1; n < vertices; n++) {
|
||||
if (vtx->y < min_y) {
|
||||
min_y = vtx->y;
|
||||
min_vtx = vtx;
|
||||
}
|
||||
else
|
||||
if (vtx->y > max_y) {
|
||||
max_y = vtx->y;
|
||||
max_vtx = vtx;
|
||||
}
|
||||
vtx++;
|
||||
}
|
||||
else
|
||||
if(vtx->y > max_y) {
|
||||
max_y = vtx->y;
|
||||
max_vtx = vtx;
|
||||
}
|
||||
vtx++;
|
||||
}
|
||||
|
||||
// OK, now we know where in the array we should start and
|
||||
// where to end while scanning the edges of the polygon
|
||||
|
||||
left_vtx = min_vtx; // Left side starting vertex
|
||||
right_vtx = min_vtx; // Right side starting vertex
|
||||
end_vtx = vtx-1; // Last vertex in array
|
||||
|
||||
// Search for the first usable right section
|
||||
|
||||
do {
|
||||
if(right_vtx == max_vtx) return;
|
||||
RightSection();
|
||||
} while(right_height <= 0);
|
||||
|
||||
// Search for the first usable left section
|
||||
|
||||
do {
|
||||
if(left_vtx == max_vtx) return;
|
||||
LeftSection();
|
||||
} while(left_height <= 0);
|
||||
|
||||
uint16_t * destptr = (uint16_t*)(gfx.RDRAM+rdp.zimg);
|
||||
int y1 = iceil(min_y);
|
||||
if (y1 >= (int)rdp.scissor_o.lr_y) return;
|
||||
int shift;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
int x1 = iceil(left_x);
|
||||
if (x1 < (int)rdp.scissor_o.ul_x)
|
||||
x1 = rdp.scissor_o.ul_x;
|
||||
int width = iceil(right_x) - x1;
|
||||
if (x1+width >= (int)rdp.scissor_o.lr_x)
|
||||
width = rdp.scissor_o.lr_x - x1 - 1;
|
||||
|
||||
if(width > 0 && y1 >= (int)rdp.scissor_o.ul_y) {
|
||||
|
||||
// Prestep initial z
|
||||
|
||||
int prestep = (x1 << 16) - left_x;
|
||||
int z = left_z + imul16(prestep, dzdx);
|
||||
|
||||
shift = x1 + y1*rdp.zi_width;
|
||||
//draw to depth buffer
|
||||
int trueZ;
|
||||
int idx;
|
||||
uint16_t encodedZ;
|
||||
for (int x = 0; x < width; x++)
|
||||
{
|
||||
trueZ = z/8192;
|
||||
if (trueZ < 0) trueZ = 0;
|
||||
else if (trueZ > 0x3FFFF) trueZ = 0x3FFFF;
|
||||
encodedZ = zLUT[trueZ];
|
||||
idx = (shift+x)^1;
|
||||
if(encodedZ < destptr[idx])
|
||||
destptr[idx] = encodedZ;
|
||||
z += dzdx;
|
||||
}
|
||||
}
|
||||
|
||||
//destptr += rdp.zi_width;
|
||||
y1++;
|
||||
if (y1 >= (int)rdp.scissor_o.lr_y) return;
|
||||
|
||||
// Scan the right side
|
||||
|
||||
if(--right_height <= 0) { // End of this section?
|
||||
do {
|
||||
if(right_vtx == max_vtx) return;
|
||||
|
||||
// OK, now we know where in the array we should start and
|
||||
// where to end while scanning the edges of the polygon
|
||||
|
||||
left_vtx = min_vtx; // Left side starting vertex
|
||||
right_vtx = min_vtx; // Right side starting vertex
|
||||
end_vtx = vtx - 1; // Last vertex in array
|
||||
|
||||
// Search for the first usable right section
|
||||
|
||||
do {
|
||||
if (right_vtx == max_vtx) return;
|
||||
RightSection();
|
||||
} while(right_height <= 0);
|
||||
}
|
||||
else
|
||||
right_x += right_dxdy;
|
||||
|
||||
// Scan the left side
|
||||
|
||||
if(--left_height <= 0) { // End of this section?
|
||||
do {
|
||||
if(left_vtx == max_vtx) return;
|
||||
} while (right_height <= 0);
|
||||
|
||||
// Search for the first usable left section
|
||||
|
||||
do {
|
||||
if (left_vtx == max_vtx) return;
|
||||
LeftSection();
|
||||
} while(left_height <= 0);
|
||||
} while (left_height <= 0);
|
||||
|
||||
uint16_t * destptr = (uint16_t*)(gfx.RDRAM + rdp.zimg);
|
||||
int y1 = iceil(min_y);
|
||||
if (y1 >= (int)rdp.scissor_o.lr_y) return;
|
||||
int shift;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
int x1 = iceil(left_x);
|
||||
if (x1 < (int)rdp.scissor_o.ul_x)
|
||||
x1 = rdp.scissor_o.ul_x;
|
||||
int width = iceil(right_x) - x1;
|
||||
if (x1 + width >= (int)rdp.scissor_o.lr_x)
|
||||
width = rdp.scissor_o.lr_x - x1 - 1;
|
||||
|
||||
if (width > 0 && y1 >= (int)rdp.scissor_o.ul_y) {
|
||||
// Prestep initial z
|
||||
|
||||
int prestep = (x1 << 16) - left_x;
|
||||
int z = left_z + imul16(prestep, dzdx);
|
||||
|
||||
shift = x1 + y1*rdp.zi_width;
|
||||
//draw to depth buffer
|
||||
int trueZ;
|
||||
int idx;
|
||||
uint16_t encodedZ;
|
||||
for (int x = 0; x < width; x++)
|
||||
{
|
||||
trueZ = z / 8192;
|
||||
if (trueZ < 0) trueZ = 0;
|
||||
else if (trueZ > 0x3FFFF) trueZ = 0x3FFFF;
|
||||
encodedZ = zLUT[trueZ];
|
||||
idx = (shift + x) ^ 1;
|
||||
if (encodedZ < destptr[idx])
|
||||
destptr[idx] = encodedZ;
|
||||
z += dzdx;
|
||||
}
|
||||
}
|
||||
|
||||
//destptr += rdp.zi_width;
|
||||
y1++;
|
||||
if (y1 >= (int)rdp.scissor_o.lr_y) return;
|
||||
|
||||
// Scan the right side
|
||||
|
||||
if (--right_height <= 0) { // End of this section?
|
||||
do {
|
||||
if (right_vtx == max_vtx) return;
|
||||
RightSection();
|
||||
} while (right_height <= 0);
|
||||
}
|
||||
else
|
||||
right_x += right_dxdy;
|
||||
|
||||
// Scan the left side
|
||||
|
||||
if (--left_height <= 0) { // End of this section?
|
||||
do {
|
||||
if (left_vtx == max_vtx) return;
|
||||
LeftSection();
|
||||
} while (left_height <= 0);
|
||||
}
|
||||
else {
|
||||
left_x += left_dxdy;
|
||||
left_z += left_dzdy;
|
||||
}
|
||||
}
|
||||
else {
|
||||
left_x += left_dxdy;
|
||||
left_z += left_dzdy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,53 +1,22 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// Software rendering to N64 depth buffer
|
||||
// Created by Gonetz, Dec 2004
|
||||
//
|
||||
//****************************************************************
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#ifndef DEPTH_BUFFER_RENDER_H
|
||||
#define DEPTH_BUFFER_RENDER_H
|
||||
|
||||
struct vertexi
|
||||
{
|
||||
int x,y; // Screen position in 16:16 bit fixed point
|
||||
int x, y; // Screen position in 16:16 bit fixed point
|
||||
int z; // z value in 16:16 bit fixed point
|
||||
};
|
||||
|
||||
|
|
|
@ -1,26 +1,15 @@
|
|||
/*
|
||||
* Texture Filtering
|
||||
* Version: 1.0
|
||||
*
|
||||
* Copyright (C) 2007 Hiroshi Morii All Rights Reserved.
|
||||
* Email koolsmoky(at)users.sourceforge.net
|
||||
* Web http://www.3dfxzone.it/koolsmoky
|
||||
*
|
||||
* this 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 Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* this 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 GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2007 Hiroshi Morii *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include <memory.h>
|
||||
#include <stdlib.h>
|
||||
#include "Ext_TxFilter.h"
|
||||
|
|
|
@ -1,25 +1,15 @@
|
|||
/*
|
||||
* Texture Filtering
|
||||
* Version: 1.0
|
||||
*
|
||||
* Copyright (C) 2007 Hiroshi Morii All Rights Reserved.
|
||||
* Email koolsmoky(at)users.sourceforge.net
|
||||
* Web http://www.3dfxzone.it/koolsmoky
|
||||
*
|
||||
* this 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 Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* this 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 GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2007 Hiroshi Morii *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __EXT_TXFILTER_H__
|
||||
#define __EXT_TXFILTER_H__
|
||||
|
|
|
@ -1,47 +1,16 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// Draw N64 frame buffer to screen.
|
||||
// Created by Gonetz, 2007
|
||||
//
|
||||
//****************************************************************
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "Gfx_1.3.h"
|
||||
#include "FBtoScreen.h"
|
||||
#include "TexCache.h"
|
||||
|
|
|
@ -1,60 +1,30 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// Render N64 frame buffer to screen
|
||||
// Created by Gonetz, 2007
|
||||
//
|
||||
//****************************************************************
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#ifndef FBtoSCREEN_H
|
||||
#define FBtoSCREEN_H
|
||||
|
||||
typedef struct
|
||||
typedef struct
|
||||
{
|
||||
uint32_t addr; //color image address
|
||||
uint32_t size;
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
uint32_t ul_x;
|
||||
uint32_t ul_y;
|
||||
uint32_t lr_x;
|
||||
uint32_t lr_y;
|
||||
uint32_t opaque;
|
||||
uint32_t addr; //color image address
|
||||
uint32_t size;
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
uint32_t ul_x;
|
||||
uint32_t ul_y;
|
||||
uint32_t lr_x;
|
||||
uint32_t lr_y;
|
||||
uint32_t opaque;
|
||||
} FB_TO_SCREEN_INFO;
|
||||
|
||||
bool DrawFrameBufferToScreen(FB_TO_SCREEN_INFO & fb_info);
|
||||
|
|
|
@ -1,67 +1,17 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
|
||||
/**********************************************************************************
|
||||
Common gfx plugin spec, version #1.3 maintained by zilmar (zilmar@emulation64.com)
|
||||
|
||||
All questions or suggestions should go through the mailing list.
|
||||
http://www.egroups.com/group/Plugin64-Dev
|
||||
***********************************************************************************
|
||||
|
||||
Notes:
|
||||
------
|
||||
|
||||
Setting the approprate bits in the MI_INTR_REG and calling CheckInterrupts which
|
||||
are both passed to the DLL in InitiateGFX will generate an Interrupt from with in
|
||||
the plugin.
|
||||
|
||||
The Setting of the RSP flags and generating an SP interrupt should not be done in
|
||||
the plugin
|
||||
|
||||
**********************************************************************************/
|
||||
|
||||
// THIS FILE IS A PRECOMPILED HEADER TO DECREASE BUILD TIME. INCLUDE ALL STANDARD
|
||||
// .H FILES HERE
|
||||
|
||||
#ifndef _GFX_H_INCLUDED__
|
||||
#define _GFX_H_INCLUDED__
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
#include "winlnxdefs.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -533,4 +483,3 @@ extern "C" {
|
|||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
#endif //_GFX_H_INCLUDED__
|
||||
|
|
|
@ -1,42 +1,16 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include <string.h>
|
||||
#include <Common/StdString.h>
|
||||
#include "Gfx_1.3.h"
|
||||
|
|
|
@ -1,41 +1,16 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include <Common/stdtypes.h>
|
||||
#include <string.h>
|
||||
typedef uint32_t uint32_t;
|
||||
|
|
|
@ -1,46 +1,16 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// Created by Gonetz, 2007
|
||||
//
|
||||
//****************************************************************
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include <string.h>
|
||||
|
||||
static inline void mirror32bS(uint8_t *tex, uint8_t *start, int width, int height, int mask, int line, int full, int count)
|
||||
|
|
|
@ -1,41 +1,16 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
//****************************************************************
|
||||
// 8-bit Horizontal Mirror
|
||||
|
|
|
@ -1,23 +1,16 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else // _WIN32
|
||||
|
|
|
@ -1,22 +1,16 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
|
|
@ -1,22 +1,16 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#define SAVE_CBUFFER
|
||||
|
||||
|
|
|
@ -1,23 +1,16 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else // _WIN32
|
||||
|
|
|
@ -1,22 +1,16 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include <GLES2/gl2.h>
|
||||
#include "glitchmain.h"
|
||||
|
||||
|
|
|
@ -1,3 +1,16 @@
|
|||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
#include <GLES2/gl2.h>
|
||||
#include <GLES2/gl2ext.h>
|
||||
|
|
|
@ -1,3 +1,16 @@
|
|||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else // _WIN32
|
||||
|
|
|
@ -1,3 +1,16 @@
|
|||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include <stdio.h>
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
|
|
|
@ -1,3 +1,16 @@
|
|||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#define SAVE_CBUFFER
|
||||
|
||||
#ifdef _WIN32
|
||||
|
|
|
@ -1,3 +1,16 @@
|
|||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else // _WIN32
|
||||
|
|
|
@ -1,5 +1,17 @@
|
|||
#ifndef MAIN_H
|
||||
#define MAIN_H
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#ifndef _WIN32
|
||||
//#define VPDEBUG
|
||||
|
@ -260,4 +272,3 @@ FX_ENTRY void FX_CALL
|
|||
|
||||
void CHECK_FRAMEBUFFER_STATUS(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64 - A Nintendo 64 emulator. *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include <Common/StdString.h>
|
||||
#include <Settings/Settings.h>
|
||||
#include <Project64-video/trace.h>
|
||||
|
|
|
@ -1,10 +1,20 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
class CSettings
|
||||
{
|
||||
public:
|
||||
CSettings();
|
||||
CSettings();
|
||||
|
||||
//Frame buffer emulation options
|
||||
enum fb_bits_t
|
||||
|
@ -27,37 +37,37 @@ public:
|
|||
|
||||
enum hacks_t
|
||||
{
|
||||
hack_ASB = (1<<0), //All-Star Baseball games
|
||||
hack_Banjo2 = (1<<1), //Banjo Tooie
|
||||
hack_BAR = (1<<2), //Beetle Adventure Racing
|
||||
hack_Chopper = (1<<3), //Chopper Attack
|
||||
hack_Diddy = (1<<4), //diddy kong racing
|
||||
hack_Fifa98 = (1<<5), //FIFA - Road to World Cup 98
|
||||
hack_Fzero = (1<<6), //F-Zero
|
||||
hack_GoldenEye = (1<<7), //Golden Eye
|
||||
hack_Hyperbike = (1<<8), //Top Gear Hyper Bike
|
||||
hack_ISS64 = (1<<9), //International Superstar Soccer 64
|
||||
hack_KI = (1<<10), //Killer Instinct
|
||||
hack_Knockout = (1<<11), //Knockout Kings 2000
|
||||
hack_Lego = (1<<12), //LEGO Racers
|
||||
hack_MK64 = (1<<13), //Mario Kart
|
||||
hack_Megaman = (1<<14), //Megaman64
|
||||
hack_Makers = (1<<15), //Mischief-makers
|
||||
hack_WCWnitro = (1<<16), //WCW Nitro
|
||||
hack_Ogre64 = (1<<17), //Ogre Battle 64
|
||||
hack_Pilotwings = (1<<18), //Pilotwings
|
||||
hack_PMario = (1<<19), //Paper Mario
|
||||
hack_PPL = (1<<20), //pokemon puzzle league requires many special fixes
|
||||
hack_RE2 = (1<<21), //Resident Evil 2
|
||||
hack_Starcraft = (1<<22), //StarCraft64
|
||||
hack_Supercross = (1<<23), //Supercross 2000
|
||||
hack_TGR = (1<<24), //Top Gear Rally
|
||||
hack_TGR2 = (1<<25), //Top Gear Rally 2
|
||||
hack_Tonic = (1<<26), //tonic trouble
|
||||
hack_Winback = (1<<27), //WinBack - Covert Operations
|
||||
hack_Yoshi = (1<<28), //Yoshi Story
|
||||
hack_Zelda = (1<<29), //zeldas hacks
|
||||
hack_OoT = (1<<30), //zelda OoT hacks
|
||||
hack_ASB = (1 << 0), //All-Star Baseball games
|
||||
hack_Banjo2 = (1 << 1), //Banjo Tooie
|
||||
hack_BAR = (1 << 2), //Beetle Adventure Racing
|
||||
hack_Chopper = (1 << 3), //Chopper Attack
|
||||
hack_Diddy = (1 << 4), //diddy kong racing
|
||||
hack_Fifa98 = (1 << 5), //FIFA - Road to World Cup 98
|
||||
hack_Fzero = (1 << 6), //F-Zero
|
||||
hack_GoldenEye = (1 << 7), //Golden Eye
|
||||
hack_Hyperbike = (1 << 8), //Top Gear Hyper Bike
|
||||
hack_ISS64 = (1 << 9), //International Superstar Soccer 64
|
||||
hack_KI = (1 << 10), //Killer Instinct
|
||||
hack_Knockout = (1 << 11), //Knockout Kings 2000
|
||||
hack_Lego = (1 << 12), //LEGO Racers
|
||||
hack_MK64 = (1 << 13), //Mario Kart
|
||||
hack_Megaman = (1 << 14), //Megaman64
|
||||
hack_Makers = (1 << 15), //Mischief-makers
|
||||
hack_WCWnitro = (1 << 16), //WCW Nitro
|
||||
hack_Ogre64 = (1 << 17), //Ogre Battle 64
|
||||
hack_Pilotwings = (1 << 18), //Pilotwings
|
||||
hack_PMario = (1 << 19), //Paper Mario
|
||||
hack_PPL = (1 << 20), //pokemon puzzle league requires many special fixes
|
||||
hack_RE2 = (1 << 21), //Resident Evil 2
|
||||
hack_Starcraft = (1 << 22), //StarCraft64
|
||||
hack_Supercross = (1 << 23), //Supercross 2000
|
||||
hack_TGR = (1 << 24), //Top Gear Rally
|
||||
hack_TGR2 = (1 << 25), //Top Gear Rally 2
|
||||
hack_Tonic = (1 << 26), //tonic trouble
|
||||
hack_Winback = (1 << 27), //WinBack - Covert Operations
|
||||
hack_Yoshi = (1 << 28), //Yoshi Story
|
||||
hack_Zelda = (1 << 29), //zeldas hacks
|
||||
hack_OoT = (1 << 30), //zelda OoT hacks
|
||||
};
|
||||
|
||||
enum AspectMode_t
|
||||
|
@ -117,7 +127,7 @@ public:
|
|||
HiResPackFormat_None = 0,
|
||||
HiResPackFormat_Riceformat = 0x00020000,
|
||||
};
|
||||
|
||||
|
||||
enum SwapMode_t
|
||||
{
|
||||
SwapMode_Old = 0,
|
||||
|
@ -172,7 +182,7 @@ public:
|
|||
|
||||
inline bool fb_emulation_enabled(void) const { return ((m_frame_buffer&fb_emulation) != 0); }
|
||||
inline bool fb_ref_enabled(void) const { return ((m_frame_buffer&fb_ref) != 0); }
|
||||
inline bool fb_hwfbe_enabled(void) const { return ((m_frame_buffer&(fb_emulation |fb_hwfbe)) == (fb_emulation | fb_hwfbe)); }
|
||||
inline bool fb_hwfbe_enabled(void) const { return ((m_frame_buffer&(fb_emulation | fb_hwfbe)) == (fb_emulation | fb_hwfbe)); }
|
||||
inline bool fb_hwfbe_set(void) const { return ((m_frame_buffer&fb_hwfbe) != 0); }
|
||||
inline bool fb_depth_render_enabled(void) const { return ((m_frame_buffer&fb_depth_render) != 0); }
|
||||
inline bool fb_get_info_enabled(void) const { return ((m_frame_buffer&fb_get_info) != 0); }
|
||||
|
@ -199,7 +209,7 @@ public:
|
|||
inline ScreenRotate_t rotate(void) const { return m_rotate; }
|
||||
inline Filtering_t filtering(void) const { return m_filtering; }
|
||||
|
||||
inline bool fog (void) const { return m_fog; }
|
||||
inline bool fog(void) const { return m_fog; }
|
||||
inline bool buff_clear(void) const { return m_buff_clear; }
|
||||
inline SwapMode_t swapmode(void) const { return m_swapmode; }
|
||||
inline PixelLevelOfDetail_t lodmode(void) const { return m_lodmode; }
|
||||
|
@ -255,9 +265,9 @@ public:
|
|||
inline bool zmode_compare_less(void) const { return m_zmode_compare_less; } //force GR_CMP_LESS for zmode=0 (opaque)and zmode=1 (interpenetrating)
|
||||
inline bool old_style_adither(void) const { return m_old_style_adither; } //apply alpha dither regardless of alpha_dither_mode
|
||||
inline bool n64_z_scale(void) const { return m_n64_z_scale; } //scale vertex z value before writing to depth buffer, as N64 does.
|
||||
|
||||
|
||||
inline bool hacks(hacks_t hack) const { return (m_hacks & hack) == hack; } //Special game hacks
|
||||
|
||||
|
||||
//wrapper settings
|
||||
#ifndef ANDROID
|
||||
inline uint32_t FullScreenRes(void) const { return m_FullScreenRes; }
|
||||
|
@ -288,7 +298,7 @@ public:
|
|||
void SetGhqHirsF16bpp(bool value);
|
||||
void SetGhqHirsDump(bool value);
|
||||
void SetGhqEnhtNobg(bool value);
|
||||
void SetGhqEnhtCmpr(bool value);
|
||||
void SetGhqEnhtCmpr(bool value);
|
||||
void SetGhqHirsAltcrc(bool value);
|
||||
void SetGhqHirsCmpr(bool value);
|
||||
void SetGhqHirsGz(bool value);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project 64 - A Nintendo 64 emulator. *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2012 Project64. All rights reserved. *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
|
|
|
@ -1,47 +1,16 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// Hardware frame buffer emulation
|
||||
// Dec 2003 created by Gonetz
|
||||
//
|
||||
//****************************************************************
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include <string.h>
|
||||
#include "Gfx_1.3.h"
|
||||
#include "TexBuffer.h"
|
||||
|
|
|
@ -1,47 +1,16 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// Hardware frame buffer emulation
|
||||
// Dec 2003 created by Gonetz
|
||||
//
|
||||
//****************************************************************
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#ifndef TEXBUFFER_H
|
||||
#define TEXBUFFER_H
|
||||
|
||||
|
|
|
@ -1,41 +1,16 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "Gfx_1.3.h"
|
||||
|
||||
#include "TexCache.h"
|
||||
|
|
|
@ -1,42 +1,16 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#ifndef TEXCACHE_H
|
||||
#define TEXCACHE_H
|
||||
|
||||
|
|
|
@ -1,42 +1,16 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
static inline void texConv_ARGB1555_ARGB4444(uint8_t *src, uint8_t *dst, int size)
|
||||
{
|
||||
uint32_t *v3;
|
||||
|
|
|
@ -1,41 +1,16 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#include "TexLoad4b.h"
|
||||
#include "TexLoad8b.h"
|
||||
|
|
|
@ -1,41 +1,16 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
static inline void load16bRGBA(uint8_t *src, uint8_t *dst, int wid_64, int height, int line, int ext)
|
||||
{
|
||||
|
|
|
@ -1,41 +1,16 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
//****************************************************************
|
||||
// Size: 2, Format: 0
|
||||
|
|
|
@ -1,41 +1,16 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
static inline void load4bCI(uint8_t *src, uint8_t *dst, int wid_64, int height, uint16_t line, int ext, uint16_t *pal)
|
||||
{
|
||||
|
|
|
@ -1,41 +1,16 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
static inline void load8bCI(uint8_t *src, uint8_t *dst, int wid_64, int height, int line, int ext, uint16_t *pal)
|
||||
{
|
||||
|
|
|
@ -1,42 +1,16 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
static void mod_tex_inter_color_using_factor(uint16_t *dst, int size, uint32_t color, uint32_t factor)
|
||||
{
|
||||
float percent = factor / 255.0f;
|
||||
|
|
|
@ -1,42 +1,16 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
static void mod_tex_inter_color_using_factor_CI(uint32_t color, uint32_t factor)
|
||||
{
|
||||
float percent = factor / 255.0f;
|
||||
|
@ -171,7 +145,7 @@ static void mod_tex_sub_col_mul_fac_add_tex_CI(uint32_t color, uint32_t factor)
|
|||
cg = (uint8_t)((color >> 16) & 0xFF);
|
||||
cb = (uint8_t)((color >> 8) & 0xFF);
|
||||
|
||||
for (int i = 0; i<256; i++)
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
col = rdp.pal_8[i];
|
||||
a = (uint8_t)(col & 0x0001);;
|
||||
|
@ -290,7 +264,7 @@ static void mod_tex_sub_col_mul_fac_CI(uint32_t color, uint32_t factor)
|
|||
cg = (uint8_t)((color >> 16) & 0xFF);
|
||||
cb = (uint8_t)((color >> 8) & 0xFF);
|
||||
|
||||
for (int i = 0; i<256; i++)
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
col = rdp.pal_8[i];
|
||||
a = (uint8_t)(col & 0x0001);
|
||||
|
|
|
@ -1,58 +1,18 @@
|
|||
/*
|
||||
* Texture Filtering
|
||||
* Version: 1.0
|
||||
*
|
||||
* Copyright (C) 2007 Hiroshi Morii All Rights Reserved.
|
||||
* Email koolsmoky(at)users.sourceforge.net
|
||||
* Web http://www.3dfxzone.it/koolsmoky
|
||||
*
|
||||
* this 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 Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* this 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 GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __EXT_TXFILTER_H__
|
||||
#define __EXT_TXFILTER_H__
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#define TXHMODULE HMODULE
|
||||
#define DLOPEN(a) LoadLibraryW(a)
|
||||
#define DLCLOSE(a) FreeLibrary(a)
|
||||
#define DLSYM(a, b) GetProcAddress(a, b)
|
||||
#define GETCWD(a, b) GetCurrentDirectoryW(a, b)
|
||||
#define CHDIR(a) SetCurrentDirectoryW(a)
|
||||
#else
|
||||
#include <iostream>
|
||||
#include <dlfcn.h>
|
||||
#define MAX_PATH 4095
|
||||
#define TXHMODULE void*
|
||||
#define DLOPEN(a) dlopen(a, RTLD_LAZY|RTLD_GLOBAL)
|
||||
#define DLCLOSE(a) dlclose(a)
|
||||
#define DLSYM(a, b) dlsym(a, b)
|
||||
#define GETCWD(a, b) getcwd(b, a)
|
||||
#define CHDIR(a) chdir(a)
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
typedef __int64 int64;
|
||||
typedef unsigned __int64 uint64;
|
||||
typedef unsigned char boolean;
|
||||
#else
|
||||
typedef long long int64;
|
||||
typedef unsigned long long uint64;
|
||||
typedef unsigned char boolean;
|
||||
#endif
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2007 Hiroshi Morii *
|
||||
* Copyright (C) 2003 Rice1964 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
#include <Common/stdtypes.h>
|
||||
|
||||
#define NO_OPTIONS 0x00000000
|
||||
|
||||
|
@ -104,44 +64,21 @@ typedef unsigned char boolean;
|
|||
#define LET_TEXARTISTS_FLY 0x40000000 /* a little freedom for texture artists */
|
||||
#define DUMP_TEX 0x80000000
|
||||
|
||||
#ifndef __GLIDE_H__ /* GLIDE3 */
|
||||
/* from 3Dfx Interactive Inc. glide.h */
|
||||
#define GR_TEXFMT_ALPHA_8 0x2
|
||||
#define GR_TEXFMT_INTENSITY_8 0x3
|
||||
|
||||
#define GR_TEXFMT_ALPHA_INTENSITY_44 0x4
|
||||
#define GR_TEXFMT_P_8 0x5
|
||||
|
||||
#define GR_TEXFMT_RGB_565 0xa
|
||||
#define GR_TEXFMT_ARGB_1555 0xb
|
||||
#define GR_TEXFMT_ARGB_4444 0xc
|
||||
#define GR_TEXFMT_ALPHA_INTENSITY_88 0xd
|
||||
|
||||
/* from 3Dfx Interactive Inc. g3ext.h */
|
||||
#define GR_TEXFMT_ARGB_CMP_FXT1 0x11
|
||||
|
||||
#define GR_TEXFMT_ARGB_8888 0x12
|
||||
|
||||
#define GR_TEXFMT_ARGB_CMP_DXT1 0x16
|
||||
#define GR_TEXFMT_ARGB_CMP_DXT3 0x18
|
||||
#define GR_TEXFMT_ARGB_CMP_DXT5 0x1A
|
||||
#endif /* GLIDE3 */
|
||||
|
||||
struct GHQTexInfo {
|
||||
unsigned char *data;
|
||||
int width;
|
||||
int height;
|
||||
unsigned short format;
|
||||
unsigned char *data;
|
||||
int width;
|
||||
int height;
|
||||
unsigned short format;
|
||||
|
||||
int smallLodLog2;
|
||||
int largeLodLog2;
|
||||
int aspectRatioLog2;
|
||||
int smallLodLog2;
|
||||
int largeLodLog2;
|
||||
int aspectRatioLog2;
|
||||
|
||||
int tiles;
|
||||
int untiled_width;
|
||||
int untiled_height;
|
||||
int tiles;
|
||||
int untiled_width;
|
||||
int untiled_height;
|
||||
|
||||
unsigned char is_hires_tex;
|
||||
unsigned char is_hires_tex;
|
||||
};
|
||||
|
||||
/* Callback to display hires texture info.
|
||||
|
@ -159,54 +96,53 @@ struct GHQTexInfo {
|
|||
* printf(buf);
|
||||
* }
|
||||
*/
|
||||
|
||||
#define INFO_BUF 4095
|
||||
typedef void (*dispInfoFuncExt)(const char *format, ...);
|
||||
typedef void(*dispInfoFuncExt)(const char *format, ...);
|
||||
|
||||
#ifndef TXFILTER_DLL
|
||||
boolean ext_ghq_init(int maxwidth, /* maximum texture width supported by hardware */
|
||||
int maxheight,/* maximum texture height supported by hardware */
|
||||
int maxbpp, /* maximum texture bpp supported by hardware */
|
||||
int options, /* options */
|
||||
int cachesize,/* cache textures to system memory */
|
||||
const char *path, /* plugin directory. must be smaller than MAX_PATH */
|
||||
const char *ident, /* name of ROM. must be no longer than 64 in character. */
|
||||
dispInfoFuncExt callback /* callback function to display info */
|
||||
);
|
||||
bool ext_ghq_init(int maxwidth, /* maximum texture width supported by hardware */
|
||||
int maxheight,/* maximum texture height supported by hardware */
|
||||
int maxbpp, /* maximum texture bpp supported by hardware */
|
||||
int options, /* options */
|
||||
int cachesize,/* cache textures to system memory */
|
||||
const char *path, /* plugin directory. must be smaller than MAX_PATH */
|
||||
const char *ident, /* name of ROM. must be no longer than 64 in character. */
|
||||
dispInfoFuncExt callback /* callback function to display info */
|
||||
);
|
||||
|
||||
void ext_ghq_shutdown(void);
|
||||
|
||||
boolean ext_ghq_txfilter(unsigned char *src, /* input texture */
|
||||
int srcwidth, /* width of input texture */
|
||||
int srcheight, /* height of input texture */
|
||||
unsigned short srcformat, /* format of input texture */
|
||||
uint64 g64crc, /* glide64 crc */
|
||||
GHQTexInfo *info /* output */
|
||||
);
|
||||
bool ext_ghq_txfilter(unsigned char *src, /* input texture */
|
||||
int srcwidth, /* width of input texture */
|
||||
int srcheight, /* height of input texture */
|
||||
unsigned short srcformat, /* format of input texture */
|
||||
uint64_t g64crc, /* glide64 crc */
|
||||
GHQTexInfo *info /* output */
|
||||
);
|
||||
|
||||
boolean ext_ghq_hirestex(uint64 g64crc, /* glide64 crc */
|
||||
uint64 r_crc64, /* checksum hi:palette low:texture */
|
||||
unsigned short *palette, /* palette for CI textures */
|
||||
GHQTexInfo *info /* output */
|
||||
);
|
||||
bool ext_ghq_hirestex(uint64_t g64crc, /* glide64 crc */
|
||||
uint64_t r_crc64, /* checksum hi:palette low:texture */
|
||||
unsigned short *palette, /* palette for CI textures */
|
||||
GHQTexInfo *info /* output */
|
||||
);
|
||||
|
||||
uint64 ext_ghq_checksum(unsigned char *src, /* input texture */
|
||||
int width, /* width of texture */
|
||||
int height, /* height of texture */
|
||||
int size, /* type of texture pixel */
|
||||
int rowStride, /* row stride in bytes */
|
||||
unsigned char *palette /* palette */
|
||||
);
|
||||
uint64_t ext_ghq_checksum(unsigned char *src, /* input texture */
|
||||
int width, /* width of texture */
|
||||
int height, /* height of texture */
|
||||
int size, /* type of texture pixel */
|
||||
int rowStride, /* row stride in bytes */
|
||||
unsigned char *palette /* palette */
|
||||
);
|
||||
|
||||
boolean ext_ghq_dmptx(unsigned char *src, /* input texture (must be in 3Dfx Glide format) */
|
||||
int width, /* width of texture */
|
||||
int height, /* height of texture */
|
||||
int rowStridePixel, /* row stride of input texture in pixels */
|
||||
unsigned short gfmt, /* glide format of input texture */
|
||||
unsigned short n64fmt,/* N64 format hi:format low:size */
|
||||
uint64 r_crc64 /* checksum hi:palette low:texture */
|
||||
);
|
||||
bool ext_ghq_dmptx(unsigned char *src, /* input texture (must be in 3Dfx Glide format) */
|
||||
int width, /* width of texture */
|
||||
int height, /* height of texture */
|
||||
int rowStridePixel, /* row stride of input texture in pixels */
|
||||
unsigned short gfmt, /* glide format of input texture */
|
||||
unsigned short n64fmt,/* N64 format hi:format low:size */
|
||||
uint64_t r_crc64 /* checksum hi:palette low:texture */
|
||||
);
|
||||
|
||||
boolean ext_ghq_reloadhirestex();
|
||||
bool ext_ghq_reloadhirestex();
|
||||
#endif /* TXFILTER_DLL */
|
||||
|
||||
#endif /* __EXT_TXFILTER_H__ */
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,26 +1,16 @@
|
|||
/*
|
||||
* Texture Filtering
|
||||
* Version: 1.0
|
||||
*
|
||||
* Copyright (C) 2007 Hiroshi Morii All Rights Reserved.
|
||||
* Email koolsmoky(at)users.sourceforge.net
|
||||
* Web http://www.3dfxzone.it/koolsmoky
|
||||
*
|
||||
* this 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 Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* this 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 GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2007 Hiroshi Morii *
|
||||
* Copyright (C) 2003 Rice1964 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __TEXTUREFILTERS_H__
|
||||
#define __TEXTUREFILTERS_H__
|
||||
|
@ -33,7 +23,7 @@
|
|||
|
||||
#include "TxInternal.h"
|
||||
|
||||
/* enhancers */
|
||||
/* enhancers */
|
||||
void hq4x_8888(unsigned char * pIn, unsigned char * pOut, int Xres, int Yres, int SrcPPL, int BpL);
|
||||
|
||||
void hq2x_32(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height);
|
||||
|
@ -58,7 +48,7 @@ void filter_8888(uint32 *src, uint32 srcwidth, uint32 srcheight, uint32 *dest, u
|
|||
void hq4x_init(void);
|
||||
void hq4x_4444(unsigned char * pIn, unsigned char * pOut, int Xres, int Yres, int SrcPPL, int BpL);
|
||||
void hq4x_1555(unsigned char * pIn, unsigned char * pOut, int Xres, int Yres, int SrcPPL, int BpL);
|
||||
void hq4x_565 (unsigned char * pIn, unsigned char * pOut, int Xres, int Yres, int SrcPPL, int BpL);
|
||||
void hq4x_565(unsigned char * pIn, unsigned char * pOut, int Xres, int Yres, int SrcPPL, int BpL);
|
||||
|
||||
void hq2x_16(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height);
|
||||
void hq2xS_16(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height);
|
||||
|
@ -68,8 +58,8 @@ void lq2xS_16(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, in
|
|||
|
||||
void Super2xSaI_4444(uint16 *srcPtr, uint16 *destPtr, uint32 width, uint32 height, uint32 pitch);
|
||||
void Super2xSaI_1555(uint16 *srcPtr, uint16 *destPtr, uint32 width, uint32 height, uint32 pitch);
|
||||
void Super2xSaI_565 (uint16 *srcPtr, uint16 *destPtr, uint32 width, uint32 height, uint32 pitch);
|
||||
void Super2xSaI_8 (uint8 *srcPtr, uint8 *destPtr, uint32 width, uint32 height, uint32 pitch);
|
||||
void Super2xSaI_565(uint16 *srcPtr, uint16 *destPtr, uint32 width, uint32 height, uint32 pitch);
|
||||
void Super2xSaI_8(uint8 *srcPtr, uint8 *destPtr, uint32 width, uint32 height, uint32 pitch);
|
||||
|
||||
void Texture2x_16(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height);
|
||||
|
||||
|
|
|
@ -1,28 +1,16 @@
|
|||
/*
|
||||
* Texture Filtering
|
||||
* Version: 1.0
|
||||
*
|
||||
* Copyright (C) 2007 Hiroshi Morii All Rights Reserved.
|
||||
* Email koolsmoky(at)users.sourceforge.net
|
||||
* Web http://www.3dfxzone.it/koolsmoky
|
||||
*
|
||||
* this 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 Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* this 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 GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/* Based on Derek Liauw Kie Fa and Rice1964 Super2xSaI code */
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2007 Hiroshi Morii *
|
||||
* Copyright (C) 2003 Rice1964 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "TextureFilters.h"
|
||||
|
||||
#define GET_RESULT(A, B, C, D) ((A != C || A != D) - (B != C || B != D))
|
||||
|
@ -36,14 +24,14 @@ void Super2xSaI_8888(uint32 *srcPtr, uint32 *destPtr, uint32 width, uint32 heigh
|
|||
#define SAI_INTERPOLATE SAI_INTERPOLATE_8888
|
||||
#define SAI_Q_INTERPOLATE SAI_Q_INTERPOLATE_8888
|
||||
|
||||
uint32 destWidth = width << 1;
|
||||
|
||||
uint32 color4, color5, color6;
|
||||
uint32 color1, color2, color3;
|
||||
uint32 colorA0, colorA1, colorA2, colorA3;
|
||||
uint32 colorB0, colorB1, colorB2, colorB3;
|
||||
uint32 colorS1, colorS2;
|
||||
uint32 product1a, product1b, product2a, product2b;
|
||||
uint32 destWidth = width << 1;
|
||||
|
||||
uint32 color4, color5, color6;
|
||||
uint32 color1, color2, color3;
|
||||
uint32 colorA0, colorA1, colorA2, colorA3;
|
||||
uint32 colorB0, colorB1, colorB2, colorB3;
|
||||
uint32 colorS1, colorS2;
|
||||
uint32 product1a, product1b, product2a, product2b;
|
||||
|
||||
#include "TextureFilters_2xsai.h"
|
||||
|
||||
|
@ -61,15 +49,15 @@ void Super2xSaI_4444(uint16 *srcPtr, uint16 *destPtr, uint32 width, uint32 heigh
|
|||
#define SAI_INTERPOLATE SAI_INTERPOLATE_4444
|
||||
#define SAI_Q_INTERPOLATE SAI_Q_INTERPOLATE_4444
|
||||
|
||||
uint32 destWidth = width << 1;
|
||||
uint32 destHeight = height << 1;
|
||||
uint32 destWidth = width << 1;
|
||||
uint32 destHeight = height << 1;
|
||||
|
||||
uint16 color4, color5, color6;
|
||||
uint16 color1, color2, color3;
|
||||
uint16 colorA0, colorA1, colorA2, colorA3;
|
||||
uint16 colorB0, colorB1, colorB2, colorB3;
|
||||
uint16 colorS1, colorS2;
|
||||
uint16 product1a, product1b, product2a, product2b;
|
||||
uint16 color4, color5, color6;
|
||||
uint16 color1, color2, color3;
|
||||
uint16 colorA0, colorA1, colorA2, colorA3;
|
||||
uint16 colorB0, colorB1, colorB2, colorB3;
|
||||
uint16 colorS1, colorS2;
|
||||
uint16 product1a, product1b, product2a, product2b;
|
||||
|
||||
#include "TextureFilters_2xsai.h"
|
||||
|
||||
|
@ -86,15 +74,15 @@ void Super2xSaI_1555(uint16 *srcPtr, uint16 *destPtr, uint32 width, uint32 heigh
|
|||
#define SAI_INTERPOLATE SAI_INTERPOLATE_1555
|
||||
#define SAI_Q_INTERPOLATE SAI_Q_INTERPOLATE_1555
|
||||
|
||||
uint32 destWidth = width << 1;
|
||||
uint32 destHeight = height << 1;
|
||||
uint32 destWidth = width << 1;
|
||||
uint32 destHeight = height << 1;
|
||||
|
||||
uint16 color4, color5, color6;
|
||||
uint16 color1, color2, color3;
|
||||
uint16 colorA0, colorA1, colorA2, colorA3;
|
||||
uint16 colorB0, colorB1, colorB2, colorB3;
|
||||
uint16 colorS1, colorS2;
|
||||
uint16 product1a, product1b, product2a, product2b;
|
||||
uint16 color4, color5, color6;
|
||||
uint16 color1, color2, color3;
|
||||
uint16 colorA0, colorA1, colorA2, colorA3;
|
||||
uint16 colorB0, colorB1, colorB2, colorB3;
|
||||
uint16 colorS1, colorS2;
|
||||
uint16 product1a, product1b, product2a, product2b;
|
||||
|
||||
#include "TextureFilters_2xsai.h"
|
||||
|
||||
|
@ -111,15 +99,15 @@ void Super2xSaI_565(uint16 *srcPtr, uint16 *destPtr, uint32 width, uint32 height
|
|||
#define SAI_INTERPOLATE SAI_INTERPOLATE_565
|
||||
#define SAI_Q_INTERPOLATE SAI_Q_INTERPOLATE_565
|
||||
|
||||
uint32 destWidth = width << 1;
|
||||
uint32 destHeight = height << 1;
|
||||
uint32 destWidth = width << 1;
|
||||
uint32 destHeight = height << 1;
|
||||
|
||||
uint16 color4, color5, color6;
|
||||
uint16 color1, color2, color3;
|
||||
uint16 colorA0, colorA1, colorA2, colorA3;
|
||||
uint16 colorB0, colorB1, colorB2, colorB3;
|
||||
uint16 colorS1, colorS2;
|
||||
uint16 product1a, product1b, product2a, product2b;
|
||||
uint16 color4, color5, color6;
|
||||
uint16 color1, color2, color3;
|
||||
uint16 colorA0, colorA1, colorA2, colorA3;
|
||||
uint16 colorB0, colorB1, colorB2, colorB3;
|
||||
uint16 colorS1, colorS2;
|
||||
uint16 product1a, product1b, product2a, product2b;
|
||||
|
||||
#include "TextureFilters_2xsai.h"
|
||||
|
||||
|
@ -136,19 +124,19 @@ void Super2xSaI_8(uint8 *srcPtr, uint8 *destPtr, uint32 width, uint32 height, ui
|
|||
#define SAI_INTERPOLATE SAI_INTERPOLATE_8
|
||||
#define SAI_Q_INTERPOLATE SAI_Q_INTERPOLATE_8
|
||||
|
||||
uint32 destWidth = width << 1;
|
||||
uint32 destHeight = height << 1;
|
||||
uint32 destWidth = width << 1;
|
||||
uint32 destHeight = height << 1;
|
||||
|
||||
uint8 color4, color5, color6;
|
||||
uint8 color1, color2, color3;
|
||||
uint8 colorA0, colorA1, colorA2, colorA3;
|
||||
uint8 colorB0, colorB1, colorB2, colorB3;
|
||||
uint8 colorS1, colorS2;
|
||||
uint8 product1a, product1b, product2a, product2b;
|
||||
uint8 color4, color5, color6;
|
||||
uint8 color1, color2, color3;
|
||||
uint8 colorA0, colorA1, colorA2, colorA3;
|
||||
uint8 colorB0, colorB1, colorB2, colorB3;
|
||||
uint8 colorS1, colorS2;
|
||||
uint8 product1a, product1b, product2a, product2b;
|
||||
|
||||
#include "TextureFilters_2xsai.h"
|
||||
|
||||
#undef SAI_INTERPOLATE
|
||||
#undef SAI_Q_INTERPOLATE
|
||||
}
|
||||
#endif /* !_16BPP_HACK */
|
||||
#endif /* !_16BPP_HACK */
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,28 +1,16 @@
|
|||
/*
|
||||
* Texture Filtering
|
||||
* Version: 1.0
|
||||
*
|
||||
* Copyright (C) 2007 Hiroshi Morii All Rights Reserved.
|
||||
* Email koolsmoky(at)users.sourceforge.net
|
||||
* Web http://www.3dfxzone.it/koolsmoky
|
||||
*
|
||||
* this 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 Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* this 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 GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/* Based on Maxim Stepin and Rice1964 hq4x code */
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2007 Hiroshi Morii *
|
||||
* Copyright (C) 2003 Rice1964 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include "TextureFilters.h"
|
||||
|
@ -51,92 +39,92 @@ static uint32 RGB444toYUV[4096];
|
|||
|
||||
static uint32 RGB555toYUV(uint32 val)
|
||||
{
|
||||
uint32 r, g, b, Y, u, v;
|
||||
uint32 r, g, b, Y, u, v;
|
||||
|
||||
r = (val & 0x7C00) >> 7;
|
||||
g = (val & 0x03E0) >> 2;
|
||||
b = (val & 0x001F) << 3;
|
||||
r |= r >> 5;
|
||||
g |= g >> 5;
|
||||
b |= b >> 5;
|
||||
r = (val & 0x7C00) >> 7;
|
||||
g = (val & 0x03E0) >> 2;
|
||||
b = (val & 0x001F) << 3;
|
||||
r |= r >> 5;
|
||||
g |= g >> 5;
|
||||
b |= b >> 5;
|
||||
|
||||
Y = (r + g + b) >> 2;
|
||||
u = 128 + ((r - b) >> 2);
|
||||
v = 128 + ((2*g - r - b)>>3);
|
||||
Y = (r + g + b) >> 2;
|
||||
u = 128 + ((r - b) >> 2);
|
||||
v = 128 + ((2 * g - r - b) >> 3);
|
||||
|
||||
return ((Y << 16) | (u << 8) | v);
|
||||
return ((Y << 16) | (u << 8) | v);
|
||||
}
|
||||
|
||||
static uint32 RGB565toYUV(uint32 val)
|
||||
{
|
||||
uint32 r, g, b, Y, u, v;
|
||||
uint32 r, g, b, Y, u, v;
|
||||
|
||||
r = (val & 0xF800) >> 8;
|
||||
g = (val & 0x07E0) >> 3;
|
||||
b = (val & 0x001F) << 3;
|
||||
r |= r >> 5;
|
||||
g |= g >> 6;
|
||||
b |= b >> 5;
|
||||
r = (val & 0xF800) >> 8;
|
||||
g = (val & 0x07E0) >> 3;
|
||||
b = (val & 0x001F) << 3;
|
||||
r |= r >> 5;
|
||||
g |= g >> 6;
|
||||
b |= b >> 5;
|
||||
|
||||
Y = (r + g + b) >> 2;
|
||||
u = 128 + ((r - b) >> 2);
|
||||
v = 128 + ((2*g - r - b)>>3);
|
||||
Y = (r + g + b) >> 2;
|
||||
u = 128 + ((r - b) >> 2);
|
||||
v = 128 + ((2 * g - r - b) >> 3);
|
||||
|
||||
return ((Y << 16) | (u << 8) | v);
|
||||
return ((Y << 16) | (u << 8) | v);
|
||||
}
|
||||
#endif /* !_16BPP_HACK */
|
||||
|
||||
static uint32 RGB888toYUV(uint32 val)
|
||||
{
|
||||
#if 0
|
||||
uint32 Yuv;
|
||||
uint32 Yuv;
|
||||
|
||||
__asm {
|
||||
mov eax, dword ptr [val];
|
||||
mov ebx, eax;
|
||||
mov ecx, eax;
|
||||
and ebx, 0x000000ff; // b
|
||||
and eax, 0x00ff0000; // r
|
||||
and ecx, 0x0000ff00; // g
|
||||
shl ebx, 14;
|
||||
shr eax, 2;
|
||||
shl ecx, 6;
|
||||
mov edx, ebx;
|
||||
add edx, eax;
|
||||
add edx, ecx;
|
||||
and edx, 0xffff0000;
|
||||
__asm {
|
||||
mov eax, dword ptr[val];
|
||||
mov ebx, eax;
|
||||
mov ecx, eax;
|
||||
and ebx, 0x000000ff; // b
|
||||
and eax, 0x00ff0000; // r
|
||||
and ecx, 0x0000ff00; // g
|
||||
shl ebx, 14;
|
||||
shr eax, 2;
|
||||
shl ecx, 6;
|
||||
mov edx, ebx;
|
||||
add edx, eax;
|
||||
add edx, ecx;
|
||||
and edx, 0xffff0000;
|
||||
|
||||
sub eax, ebx;
|
||||
add eax, 0x00800000;
|
||||
shr eax, 8;
|
||||
or edx, eax;
|
||||
sub eax, 0x00800000;
|
||||
and edx, 0xffffff00;
|
||||
sub eax, ebx;
|
||||
add eax, 0x00800000;
|
||||
shr eax, 8;
|
||||
or edx, eax;
|
||||
sub eax, 0x00800000;
|
||||
and edx, 0xffffff00;
|
||||
|
||||
add ecx, 0x00800000;
|
||||
shr ecx, 5;
|
||||
shr ebx, 7;
|
||||
add eax, ebx;
|
||||
sub ecx, eax;
|
||||
shr ecx, 11;
|
||||
or edx, ecx;
|
||||
add ecx, 0x00800000;
|
||||
shr ecx, 5;
|
||||
shr ebx, 7;
|
||||
add eax, ebx;
|
||||
sub ecx, eax;
|
||||
shr ecx, 11;
|
||||
or edx, ecx;
|
||||
|
||||
mov dword ptr [Yuv], edx;
|
||||
}
|
||||
mov dword ptr[Yuv], edx;
|
||||
}
|
||||
|
||||
return Yuv;
|
||||
return Yuv;
|
||||
#else
|
||||
uint32 r, g, b, Y, u, v;
|
||||
uint32 r, g, b, Y, u, v;
|
||||
|
||||
r = (val & 0x00ff0000) >> 16;
|
||||
g = (val & 0x0000ff00) >> 8;
|
||||
b = val & 0x000000ff;
|
||||
r = (val & 0x00ff0000) >> 16;
|
||||
g = (val & 0x0000ff00) >> 8;
|
||||
b = val & 0x000000ff;
|
||||
|
||||
Y = (r + g + b) >> 2;
|
||||
u = (0x00000200 + r - b) >> 2;
|
||||
v = (0x00000400 + (g << 1) - r - b) >> 3;
|
||||
Y = (r + g + b) >> 2;
|
||||
u = (0x00000200 + r - b) >> 2;
|
||||
v = (0x00000400 + (g << 1) - r - b) >> 3;
|
||||
|
||||
return ((Y << 16) | (u << 8) | v);
|
||||
return ((Y << 16) | (u << 8) | v);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -423,88 +411,90 @@ void hq4x_4444(unsigned char * pIn, unsigned char * pOut, int Xres, int Yres, in
|
|||
#define BPP2 4
|
||||
#define BPP3 6
|
||||
|
||||
int i, j, k;
|
||||
int prevline, nextline;
|
||||
uint16 w[10];
|
||||
uint16 c[10];
|
||||
int i, j, k;
|
||||
int prevline, nextline;
|
||||
uint16 w[10];
|
||||
uint16 c[10];
|
||||
|
||||
int pattern;
|
||||
int flag;
|
||||
int pattern;
|
||||
int flag;
|
||||
|
||||
int YUV1, YUV2;
|
||||
int YUV1, YUV2;
|
||||
|
||||
// +----+----+----+
|
||||
// | | | |
|
||||
// | w1 | w2 | w3 |
|
||||
// +----+----+----+
|
||||
// | | | |
|
||||
// | w4 | w5 | w6 |
|
||||
// +----+----+----+
|
||||
// | | | |
|
||||
// | w7 | w8 | w9 |
|
||||
// +----+----+----+
|
||||
// +----+----+----+
|
||||
// | | | |
|
||||
// | w1 | w2 | w3 |
|
||||
// +----+----+----+
|
||||
// | | | |
|
||||
// | w4 | w5 | w6 |
|
||||
// +----+----+----+
|
||||
// | | | |
|
||||
// | w7 | w8 | w9 |
|
||||
// +----+----+----+
|
||||
|
||||
for (j = 0; j < Yres; j++) {
|
||||
if (j>0) prevline = -SrcPPL*2; else prevline = 0;
|
||||
if (j<Yres-1) nextline = SrcPPL*2; else nextline = 0;
|
||||
for (j = 0; j < Yres; j++) {
|
||||
if (j > 0) prevline = -SrcPPL * 2; else prevline = 0;
|
||||
if (j < Yres - 1) nextline = SrcPPL * 2; else nextline = 0;
|
||||
|
||||
for (i=0; i<Xres; i++) {
|
||||
w[2] = *((uint16*)(pIn + prevline));
|
||||
w[5] = *((uint16*)pIn);
|
||||
w[8] = *((uint16*)(pIn + nextline));
|
||||
for (i = 0; i < Xres; i++) {
|
||||
w[2] = *((uint16*)(pIn + prevline));
|
||||
w[5] = *((uint16*)pIn);
|
||||
w[8] = *((uint16*)(pIn + nextline));
|
||||
|
||||
if (i>0) {
|
||||
w[1] = *((uint16*)(pIn + prevline - 2));
|
||||
w[4] = *((uint16*)(pIn - 2));
|
||||
w[7] = *((uint16*)(pIn + nextline - 2));
|
||||
} else {
|
||||
w[1] = w[2];
|
||||
w[4] = w[5];
|
||||
w[7] = w[8];
|
||||
}
|
||||
if (i > 0) {
|
||||
w[1] = *((uint16*)(pIn + prevline - 2));
|
||||
w[4] = *((uint16*)(pIn - 2));
|
||||
w[7] = *((uint16*)(pIn + nextline - 2));
|
||||
}
|
||||
else {
|
||||
w[1] = w[2];
|
||||
w[4] = w[5];
|
||||
w[7] = w[8];
|
||||
}
|
||||
|
||||
if (i<Xres-1) {
|
||||
w[3] = *((uint16*)(pIn + prevline + 2));
|
||||
w[6] = *((uint16*)(pIn + 2));
|
||||
w[9] = *((uint16*)(pIn + nextline + 2));
|
||||
} else {
|
||||
w[3] = w[2];
|
||||
w[6] = w[5];
|
||||
w[9] = w[8];
|
||||
}
|
||||
if (i < Xres - 1) {
|
||||
w[3] = *((uint16*)(pIn + prevline + 2));
|
||||
w[6] = *((uint16*)(pIn + 2));
|
||||
w[9] = *((uint16*)(pIn + nextline + 2));
|
||||
}
|
||||
else {
|
||||
w[3] = w[2];
|
||||
w[6] = w[5];
|
||||
w[9] = w[8];
|
||||
}
|
||||
|
||||
pattern = 0;
|
||||
flag = 1;
|
||||
pattern = 0;
|
||||
flag = 1;
|
||||
|
||||
YUV1 = RGB444toYUV(w[5]);
|
||||
YUV1 = RGB444toYUV(w[5]);
|
||||
|
||||
for (k=1; k<=9; k++) {
|
||||
if (k==5) continue;
|
||||
for (k = 1; k <= 9; k++) {
|
||||
if (k == 5) continue;
|
||||
|
||||
if ( w[k] != w[5] ) {
|
||||
YUV2 = RGB444toYUV(w[k]);
|
||||
if ( ( abs((YUV1 & Ymask) - (YUV2 & Ymask)) > trY ) ||
|
||||
( abs((YUV1 & Umask) - (YUV2 & Umask)) > trU ) ||
|
||||
( abs((YUV1 & Vmask) - (YUV2 & Vmask)) > trV ) )
|
||||
pattern |= flag;
|
||||
}
|
||||
flag <<= 1;
|
||||
}
|
||||
if (w[k] != w[5]) {
|
||||
YUV2 = RGB444toYUV(w[k]);
|
||||
if ((abs((YUV1 & Ymask) - (YUV2 & Ymask)) > trY) ||
|
||||
(abs((YUV1 & Umask) - (YUV2 & Umask)) > trU) ||
|
||||
(abs((YUV1 & Vmask) - (YUV2 & Vmask)) > trV))
|
||||
pattern |= flag;
|
||||
}
|
||||
flag <<= 1;
|
||||
}
|
||||
|
||||
for (k=1; k<=9; k++)
|
||||
c[k] = w[k];
|
||||
for (k = 1; k <= 9; k++)
|
||||
c[k] = w[k];
|
||||
|
||||
#include "TextureFilters_hq4x.h"
|
||||
|
||||
pIn+=2;
|
||||
pOut+=8;
|
||||
pIn += 2;
|
||||
pOut += 8;
|
||||
}
|
||||
pIn += 2 * (SrcPPL - Xres);
|
||||
pOut += 8 * (SrcPPL - Xres);
|
||||
pOut += BpL;
|
||||
pOut += BpL;
|
||||
pOut += BpL;
|
||||
}
|
||||
pIn += 2*(SrcPPL-Xres);
|
||||
pOut+= 8*(SrcPPL-Xres);
|
||||
pOut+=BpL;
|
||||
pOut+=BpL;
|
||||
pOut+=BpL;
|
||||
}
|
||||
|
||||
#undef BPP
|
||||
#undef BPP2
|
||||
|
@ -535,88 +525,90 @@ void hq4x_1555(unsigned char * pIn, unsigned char * pOut, int Xres, int Yres, in
|
|||
#define BPP2 4
|
||||
#define BPP3 6
|
||||
|
||||
int i, j, k;
|
||||
int prevline, nextline;
|
||||
uint16 w[10];
|
||||
uint16 c[10];
|
||||
int i, j, k;
|
||||
int prevline, nextline;
|
||||
uint16 w[10];
|
||||
uint16 c[10];
|
||||
|
||||
int pattern;
|
||||
int flag;
|
||||
int pattern;
|
||||
int flag;
|
||||
|
||||
int YUV1, YUV2;
|
||||
int YUV1, YUV2;
|
||||
|
||||
// +----+----+----+
|
||||
// | | | |
|
||||
// | w1 | w2 | w3 |
|
||||
// +----+----+----+
|
||||
// | | | |
|
||||
// | w4 | w5 | w6 |
|
||||
// +----+----+----+
|
||||
// | | | |
|
||||
// | w7 | w8 | w9 |
|
||||
// +----+----+----+
|
||||
// +----+----+----+
|
||||
// | | | |
|
||||
// | w1 | w2 | w3 |
|
||||
// +----+----+----+
|
||||
// | | | |
|
||||
// | w4 | w5 | w6 |
|
||||
// +----+----+----+
|
||||
// | | | |
|
||||
// | w7 | w8 | w9 |
|
||||
// +----+----+----+
|
||||
|
||||
for (j = 0; j < Yres; j++) {
|
||||
if (j>0) prevline = -SrcPPL*2; else prevline = 0;
|
||||
if (j<Yres-1) nextline = SrcPPL*2; else nextline = 0;
|
||||
for (j = 0; j < Yres; j++) {
|
||||
if (j > 0) prevline = -SrcPPL * 2; else prevline = 0;
|
||||
if (j < Yres - 1) nextline = SrcPPL * 2; else nextline = 0;
|
||||
|
||||
for (i=0; i<Xres; i++) {
|
||||
w[2] = *((uint16*)(pIn + prevline));
|
||||
w[5] = *((uint16*)pIn);
|
||||
w[8] = *((uint16*)(pIn + nextline));
|
||||
for (i = 0; i < Xres; i++) {
|
||||
w[2] = *((uint16*)(pIn + prevline));
|
||||
w[5] = *((uint16*)pIn);
|
||||
w[8] = *((uint16*)(pIn + nextline));
|
||||
|
||||
if (i>0) {
|
||||
w[1] = *((uint16*)(pIn + prevline - 2));
|
||||
w[4] = *((uint16*)(pIn - 2));
|
||||
w[7] = *((uint16*)(pIn + nextline - 2));
|
||||
} else {
|
||||
w[1] = w[2];
|
||||
w[4] = w[5];
|
||||
w[7] = w[8];
|
||||
}
|
||||
if (i > 0) {
|
||||
w[1] = *((uint16*)(pIn + prevline - 2));
|
||||
w[4] = *((uint16*)(pIn - 2));
|
||||
w[7] = *((uint16*)(pIn + nextline - 2));
|
||||
}
|
||||
else {
|
||||
w[1] = w[2];
|
||||
w[4] = w[5];
|
||||
w[7] = w[8];
|
||||
}
|
||||
|
||||
if (i<Xres-1) {
|
||||
w[3] = *((uint16*)(pIn + prevline + 2));
|
||||
w[6] = *((uint16*)(pIn + 2));
|
||||
w[9] = *((uint16*)(pIn + nextline + 2));
|
||||
} else {
|
||||
w[3] = w[2];
|
||||
w[6] = w[5];
|
||||
w[9] = w[8];
|
||||
}
|
||||
if (i < Xres - 1) {
|
||||
w[3] = *((uint16*)(pIn + prevline + 2));
|
||||
w[6] = *((uint16*)(pIn + 2));
|
||||
w[9] = *((uint16*)(pIn + nextline + 2));
|
||||
}
|
||||
else {
|
||||
w[3] = w[2];
|
||||
w[6] = w[5];
|
||||
w[9] = w[8];
|
||||
}
|
||||
|
||||
pattern = 0;
|
||||
flag = 1;
|
||||
pattern = 0;
|
||||
flag = 1;
|
||||
|
||||
YUV1 = RGB555toYUV(w[5]);
|
||||
YUV1 = RGB555toYUV(w[5]);
|
||||
|
||||
for (k=1; k<=9; k++) {
|
||||
if (k==5) continue;
|
||||
for (k = 1; k <= 9; k++) {
|
||||
if (k == 5) continue;
|
||||
|
||||
if ( w[k] != w[5] ) {
|
||||
YUV2 = RGB555toYUV(w[k]);
|
||||
if ( ( abs((YUV1 & Ymask) - (YUV2 & Ymask)) > trY ) ||
|
||||
( abs((YUV1 & Umask) - (YUV2 & Umask)) > trU ) ||
|
||||
( abs((YUV1 & Vmask) - (YUV2 & Vmask)) > trV ) )
|
||||
pattern |= flag;
|
||||
}
|
||||
flag <<= 1;
|
||||
}
|
||||
if (w[k] != w[5]) {
|
||||
YUV2 = RGB555toYUV(w[k]);
|
||||
if ((abs((YUV1 & Ymask) - (YUV2 & Ymask)) > trY) ||
|
||||
(abs((YUV1 & Umask) - (YUV2 & Umask)) > trU) ||
|
||||
(abs((YUV1 & Vmask) - (YUV2 & Vmask)) > trV))
|
||||
pattern |= flag;
|
||||
}
|
||||
flag <<= 1;
|
||||
}
|
||||
|
||||
for (k=1; k<=9; k++)
|
||||
c[k] = w[k];
|
||||
for (k = 1; k <= 9; k++)
|
||||
c[k] = w[k];
|
||||
|
||||
#include "TextureFilters_hq4x.h"
|
||||
|
||||
pIn+=2;
|
||||
pOut+=8;
|
||||
pIn += 2;
|
||||
pOut += 8;
|
||||
}
|
||||
pIn += 2 * (SrcPPL - Xres);
|
||||
pOut += 8 * (SrcPPL - Xres);
|
||||
pOut += BpL;
|
||||
pOut += BpL;
|
||||
pOut += BpL;
|
||||
}
|
||||
pIn += 2*(SrcPPL-Xres);
|
||||
pOut+= 8*(SrcPPL-Xres);
|
||||
pOut+=BpL;
|
||||
pOut+=BpL;
|
||||
pOut+=BpL;
|
||||
}
|
||||
|
||||
#undef BPP
|
||||
#undef BPP2
|
||||
|
@ -647,88 +639,90 @@ void hq4x_565(unsigned char * pIn, unsigned char * pOut, int Xres, int Yres, int
|
|||
#define BPP2 4
|
||||
#define BPP3 6
|
||||
|
||||
int i, j, k;
|
||||
int prevline, nextline;
|
||||
uint16 w[10];
|
||||
uint16 c[10];
|
||||
int i, j, k;
|
||||
int prevline, nextline;
|
||||
uint16 w[10];
|
||||
uint16 c[10];
|
||||
|
||||
int pattern;
|
||||
int flag;
|
||||
int pattern;
|
||||
int flag;
|
||||
|
||||
int YUV1, YUV2;
|
||||
int YUV1, YUV2;
|
||||
|
||||
// +----+----+----+
|
||||
// | | | |
|
||||
// | w1 | w2 | w3 |
|
||||
// +----+----+----+
|
||||
// | | | |
|
||||
// | w4 | w5 | w6 |
|
||||
// +----+----+----+
|
||||
// | | | |
|
||||
// | w7 | w8 | w9 |
|
||||
// +----+----+----+
|
||||
// +----+----+----+
|
||||
// | | | |
|
||||
// | w1 | w2 | w3 |
|
||||
// +----+----+----+
|
||||
// | | | |
|
||||
// | w4 | w5 | w6 |
|
||||
// +----+----+----+
|
||||
// | | | |
|
||||
// | w7 | w8 | w9 |
|
||||
// +----+----+----+
|
||||
|
||||
for (j = 0; j < Yres; j++) {
|
||||
if (j>0) prevline = -SrcPPL*2; else prevline = 0;
|
||||
if (j<Yres-1) nextline = SrcPPL*2; else nextline = 0;
|
||||
for (j = 0; j < Yres; j++) {
|
||||
if (j > 0) prevline = -SrcPPL * 2; else prevline = 0;
|
||||
if (j < Yres - 1) nextline = SrcPPL * 2; else nextline = 0;
|
||||
|
||||
for (i=0; i<Xres; i++) {
|
||||
w[2] = *((uint16*)(pIn + prevline));
|
||||
w[5] = *((uint16*)pIn);
|
||||
w[8] = *((uint16*)(pIn + nextline));
|
||||
for (i = 0; i < Xres; i++) {
|
||||
w[2] = *((uint16*)(pIn + prevline));
|
||||
w[5] = *((uint16*)pIn);
|
||||
w[8] = *((uint16*)(pIn + nextline));
|
||||
|
||||
if (i>0) {
|
||||
w[1] = *((uint16*)(pIn + prevline - 2));
|
||||
w[4] = *((uint16*)(pIn - 2));
|
||||
w[7] = *((uint16*)(pIn + nextline - 2));
|
||||
} else {
|
||||
w[1] = w[2];
|
||||
w[4] = w[5];
|
||||
w[7] = w[8];
|
||||
}
|
||||
if (i > 0) {
|
||||
w[1] = *((uint16*)(pIn + prevline - 2));
|
||||
w[4] = *((uint16*)(pIn - 2));
|
||||
w[7] = *((uint16*)(pIn + nextline - 2));
|
||||
}
|
||||
else {
|
||||
w[1] = w[2];
|
||||
w[4] = w[5];
|
||||
w[7] = w[8];
|
||||
}
|
||||
|
||||
if (i<Xres-1) {
|
||||
w[3] = *((uint16*)(pIn + prevline + 2));
|
||||
w[6] = *((uint16*)(pIn + 2));
|
||||
w[9] = *((uint16*)(pIn + nextline + 2));
|
||||
} else {
|
||||
w[3] = w[2];
|
||||
w[6] = w[5];
|
||||
w[9] = w[8];
|
||||
}
|
||||
if (i < Xres - 1) {
|
||||
w[3] = *((uint16*)(pIn + prevline + 2));
|
||||
w[6] = *((uint16*)(pIn + 2));
|
||||
w[9] = *((uint16*)(pIn + nextline + 2));
|
||||
}
|
||||
else {
|
||||
w[3] = w[2];
|
||||
w[6] = w[5];
|
||||
w[9] = w[8];
|
||||
}
|
||||
|
||||
pattern = 0;
|
||||
flag = 1;
|
||||
pattern = 0;
|
||||
flag = 1;
|
||||
|
||||
YUV1 = RGB565toYUV(w[5]);
|
||||
YUV1 = RGB565toYUV(w[5]);
|
||||
|
||||
for (k=1; k<=9; k++) {
|
||||
if (k==5) continue;
|
||||
for (k = 1; k <= 9; k++) {
|
||||
if (k == 5) continue;
|
||||
|
||||
if ( w[k] != w[5] ) {
|
||||
YUV2 = RGB565toYUV(w[k]);
|
||||
if ( ( abs((YUV1 & Ymask) - (YUV2 & Ymask)) > trY ) ||
|
||||
( abs((YUV1 & Umask) - (YUV2 & Umask)) > trU ) ||
|
||||
( abs((YUV1 & Vmask) - (YUV2 & Vmask)) > trV ) )
|
||||
pattern |= flag;
|
||||
}
|
||||
flag <<= 1;
|
||||
}
|
||||
if (w[k] != w[5]) {
|
||||
YUV2 = RGB565toYUV(w[k]);
|
||||
if ((abs((YUV1 & Ymask) - (YUV2 & Ymask)) > trY) ||
|
||||
(abs((YUV1 & Umask) - (YUV2 & Umask)) > trU) ||
|
||||
(abs((YUV1 & Vmask) - (YUV2 & Vmask)) > trV))
|
||||
pattern |= flag;
|
||||
}
|
||||
flag <<= 1;
|
||||
}
|
||||
|
||||
for (k=1; k<=9; k++)
|
||||
c[k] = w[k];
|
||||
for (k = 1; k <= 9; k++)
|
||||
c[k] = w[k];
|
||||
|
||||
#include "TextureFilters_hq4x.h"
|
||||
|
||||
pIn+=2;
|
||||
pOut+=8;
|
||||
pIn += 2;
|
||||
pOut += 8;
|
||||
}
|
||||
pIn += 2 * (SrcPPL - Xres);
|
||||
pOut += 8 * (SrcPPL - Xres);
|
||||
pOut += BpL;
|
||||
pOut += BpL;
|
||||
pOut += BpL;
|
||||
}
|
||||
pIn += 2*(SrcPPL-Xres);
|
||||
pOut+= 8*(SrcPPL-Xres);
|
||||
pOut+=BpL;
|
||||
pOut+=BpL;
|
||||
pOut+=BpL;
|
||||
}
|
||||
|
||||
#undef BPP
|
||||
#undef BPP2
|
||||
|
@ -760,89 +754,91 @@ void hq4x_8888(unsigned char * pIn, unsigned char * pOut, int Xres, int Yres, in
|
|||
#define BPP2 8
|
||||
#define BPP3 12
|
||||
|
||||
int i, j, k;
|
||||
int prevline, nextline;
|
||||
uint32 w[10];
|
||||
uint32 c[10];
|
||||
int i, j, k;
|
||||
int prevline, nextline;
|
||||
uint32 w[10];
|
||||
uint32 c[10];
|
||||
|
||||
int pattern;
|
||||
int flag;
|
||||
int pattern;
|
||||
int flag;
|
||||
|
||||
int YUV1, YUV2;
|
||||
int YUV1, YUV2;
|
||||
|
||||
// +----+----+----+
|
||||
// | | | |
|
||||
// | w1 | w2 | w3 |
|
||||
// +----+----+----+
|
||||
// | | | |
|
||||
// | w4 | w5 | w6 |
|
||||
// +----+----+----+
|
||||
// | | | |
|
||||
// | w7 | w8 | w9 |
|
||||
// +----+----+----+
|
||||
// +----+----+----+
|
||||
// | | | |
|
||||
// | w1 | w2 | w3 |
|
||||
// +----+----+----+
|
||||
// | | | |
|
||||
// | w4 | w5 | w6 |
|
||||
// +----+----+----+
|
||||
// | | | |
|
||||
// | w7 | w8 | w9 |
|
||||
// +----+----+----+
|
||||
|
||||
for (j = 0; j < Yres; j++) {
|
||||
if (j>0) prevline = -SrcPPL*4; else prevline = 0;
|
||||
if (j<Yres-1) nextline = SrcPPL*4; else nextline = 0;
|
||||
for (j = 0; j < Yres; j++) {
|
||||
if (j > 0) prevline = -SrcPPL * 4; else prevline = 0;
|
||||
if (j < Yres - 1) nextline = SrcPPL * 4; else nextline = 0;
|
||||
|
||||
for (i=0; i<Xres; i++) {
|
||||
w[2] = *((uint32*)(pIn + prevline));
|
||||
w[5] = *((uint32*)pIn);
|
||||
w[8] = *((uint32*)(pIn + nextline));
|
||||
for (i = 0; i < Xres; i++) {
|
||||
w[2] = *((uint32*)(pIn + prevline));
|
||||
w[5] = *((uint32*)pIn);
|
||||
w[8] = *((uint32*)(pIn + nextline));
|
||||
|
||||
if (i>0) {
|
||||
w[1] = *((uint32*)(pIn + prevline - 4));
|
||||
w[4] = *((uint32*)(pIn - 4));
|
||||
w[7] = *((uint32*)(pIn + nextline - 4));
|
||||
} else {
|
||||
w[1] = w[2];
|
||||
w[4] = w[5];
|
||||
w[7] = w[8];
|
||||
}
|
||||
if (i > 0) {
|
||||
w[1] = *((uint32*)(pIn + prevline - 4));
|
||||
w[4] = *((uint32*)(pIn - 4));
|
||||
w[7] = *((uint32*)(pIn + nextline - 4));
|
||||
}
|
||||
else {
|
||||
w[1] = w[2];
|
||||
w[4] = w[5];
|
||||
w[7] = w[8];
|
||||
}
|
||||
|
||||
if (i<Xres-1) {
|
||||
w[3] = *((uint32*)(pIn + prevline + 4));
|
||||
w[6] = *((uint32*)(pIn + 4));
|
||||
w[9] = *((uint32*)(pIn + nextline + 4));
|
||||
} else {
|
||||
w[3] = w[2];
|
||||
w[6] = w[5];
|
||||
w[9] = w[8];
|
||||
}
|
||||
if (i < Xres - 1) {
|
||||
w[3] = *((uint32*)(pIn + prevline + 4));
|
||||
w[6] = *((uint32*)(pIn + 4));
|
||||
w[9] = *((uint32*)(pIn + nextline + 4));
|
||||
}
|
||||
else {
|
||||
w[3] = w[2];
|
||||
w[6] = w[5];
|
||||
w[9] = w[8];
|
||||
}
|
||||
|
||||
pattern = 0;
|
||||
flag = 1;
|
||||
pattern = 0;
|
||||
flag = 1;
|
||||
|
||||
YUV1 = RGB888toYUV(w[5]);
|
||||
YUV1 = RGB888toYUV(w[5]);
|
||||
|
||||
for (k=1; k<=9; k++) {
|
||||
if (k==5) continue;
|
||||
for (k = 1; k <= 9; k++) {
|
||||
if (k == 5) continue;
|
||||
|
||||
if ( w[k] != w[5] ) {
|
||||
YUV2 = RGB888toYUV(w[k]);
|
||||
if ( ( abs((YUV1 & Ymask) - (YUV2 & Ymask)) > trY ) ||
|
||||
( abs((YUV1 & Umask) - (YUV2 & Umask)) > trU ) ||
|
||||
( abs((YUV1 & Vmask) - (YUV2 & Vmask)) > trV ) )
|
||||
pattern |= flag;
|
||||
}
|
||||
flag <<= 1;
|
||||
}
|
||||
if (w[k] != w[5]) {
|
||||
YUV2 = RGB888toYUV(w[k]);
|
||||
if ((abs((YUV1 & Ymask) - (YUV2 & Ymask)) > trY) ||
|
||||
(abs((YUV1 & Umask) - (YUV2 & Umask)) > trU) ||
|
||||
(abs((YUV1 & Vmask) - (YUV2 & Vmask)) > trV))
|
||||
pattern |= flag;
|
||||
}
|
||||
flag <<= 1;
|
||||
}
|
||||
|
||||
for (k=1; k<=9; k++)
|
||||
c[k] = w[k];
|
||||
for (k = 1; k <= 9; k++)
|
||||
c[k] = w[k];
|
||||
|
||||
#include "TextureFilters_hq4x.h"
|
||||
|
||||
pIn+=4;
|
||||
pOut+=16;
|
||||
}
|
||||
pIn += 4;
|
||||
pOut += 16;
|
||||
}
|
||||
|
||||
pIn += 4*(SrcPPL-Xres);
|
||||
pOut+= 16*(SrcPPL-Xres);
|
||||
pOut+=BpL;
|
||||
pOut+=BpL;
|
||||
pOut+=BpL;
|
||||
}
|
||||
pIn += 4 * (SrcPPL - Xres);
|
||||
pOut += 16 * (SrcPPL - Xres);
|
||||
pOut += BpL;
|
||||
pOut += BpL;
|
||||
pOut += BpL;
|
||||
}
|
||||
|
||||
#undef BPP
|
||||
#undef BPP2
|
||||
|
@ -861,32 +857,32 @@ void hq4x_8888(unsigned char * pIn, unsigned char * pOut, int Xres, int Yres, in
|
|||
#if !_16BPP_HACK
|
||||
void hq4x_init(void)
|
||||
{
|
||||
static int done = 0;
|
||||
int r, g, b, Y, u, v, i, j, k;
|
||||
static int done = 0;
|
||||
int r, g, b, Y, u, v, i, j, k;
|
||||
|
||||
if (done ) return;
|
||||
if (done) return;
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
for (j = 0; j < 16; j++) {
|
||||
for (k = 0; k < 16; k++) {
|
||||
r = (i << 4) | i;
|
||||
g = (j << 4) | j;
|
||||
b = (k << 4) | k;
|
||||
for (i = 0; i < 16; i++) {
|
||||
for (j = 0; j < 16; j++) {
|
||||
for (k = 0; k < 16; k++) {
|
||||
r = (i << 4) | i;
|
||||
g = (j << 4) | j;
|
||||
b = (k << 4) | k;
|
||||
|
||||
/* Microsoft's RGB888->YUV conversion */
|
||||
/*Y = ((( 66 * r + 129 * g + 25 * b + 128) >> 8) + 16) & 0xFF;
|
||||
u = ((( -38 * r - 74 * g + 112 * b + 128) >> 8) + 128) & 0xFF;
|
||||
v = ((( 112 * r - 94 * g - 18 * b + 128) >> 8) + 128) & 0xFF;*/
|
||||
/* Microsoft's RGB888->YUV conversion */
|
||||
/*Y = ((( 66 * r + 129 * g + 25 * b + 128) >> 8) + 16) & 0xFF;
|
||||
u = ((( -38 * r - 74 * g + 112 * b + 128) >> 8) + 128) & 0xFF;
|
||||
v = ((( 112 * r - 94 * g - 18 * b + 128) >> 8) + 128) & 0xFF;*/
|
||||
|
||||
Y = (r + g + b) >> 2;
|
||||
u = 128 + ((r - b) >> 2);
|
||||
v = 128 + ((-r + 2*g -b)>>3);
|
||||
Y = (r + g + b) >> 2;
|
||||
u = 128 + ((r - b) >> 2);
|
||||
v = 128 + ((-r + 2 * g - b) >> 3);
|
||||
|
||||
RGB444toYUV[(i << 8) | (j << 4) | k] = (Y << 16) | (u << 8) | v;
|
||||
}
|
||||
RGB444toYUV[(i << 8) | (j << 4) | k] = (Y << 16) | (u << 8) | v;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
done = 1;
|
||||
done = 1;
|
||||
}
|
||||
#endif /* !_16BPP_HACK */
|
||||
#endif /* !_16BPP_HACK */
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,25 +1,16 @@
|
|||
/*
|
||||
* Texture Filtering
|
||||
* Version: 1.0
|
||||
*
|
||||
* Copyright (C) 2007 Hiroshi Morii All Rights Reserved.
|
||||
* Email koolsmoky(at)users.sourceforge.net
|
||||
* Web http://www.3dfxzone.it/koolsmoky
|
||||
*
|
||||
* this 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 Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* this 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 GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2007 Hiroshi Morii *
|
||||
* Copyright (C) 2003 Rice1964 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef WIN32
|
||||
#pragma warning(disable: 4786)
|
||||
|
@ -33,6 +24,7 @@
|
|||
#include <zlib/zlib.h>
|
||||
#include <Common/path.h>
|
||||
#include <Common/StdString.h>
|
||||
#include <Project64-video/Renderer/types.h>
|
||||
|
||||
TxCache::~TxCache()
|
||||
{
|
||||
|
@ -82,8 +74,8 @@ TxCache::TxCache(int options, int cachesize, const char *path, const char *ident
|
|||
}
|
||||
}
|
||||
|
||||
boolean
|
||||
TxCache::add(uint64 checksum, GHQTexInfo *info, int dataSize)
|
||||
bool
|
||||
TxCache::add(uint64_t checksum, GHQTexInfo *info, int dataSize)
|
||||
{
|
||||
/* NOTE: dataSize must be provided if info->data is zlib compressed. */
|
||||
|
||||
|
@ -112,7 +104,7 @@ TxCache::add(uint64 checksum, GHQTexInfo *info, int dataSize)
|
|||
{
|
||||
DBG_INFO(80, "zlib compressed: %.02fkb->%.02fkb\n", (float)dataSize / 1000, (float)destLen / 1000);
|
||||
dataSize = destLen;
|
||||
format |= GR_TEXFMT_GZ;
|
||||
format |= GFX_TEXFMT_GZ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -124,11 +116,11 @@ TxCache::add(uint64 checksum, GHQTexInfo *info, int dataSize)
|
|||
if ((_totalSize > _cacheSize) && !_cachelist.empty())
|
||||
{
|
||||
/* _cachelist is arranged so that frequently used textures are in the back */
|
||||
std::list<uint64>::iterator itList = _cachelist.begin();
|
||||
std::list<uint64_t>::iterator itList = _cachelist.begin();
|
||||
while (itList != _cachelist.end())
|
||||
{
|
||||
/* find it in _cache */
|
||||
std::map<uint64, TXCACHE*>::iterator itMap = _cache.find(*itList);
|
||||
std::map<uint64_t, TXCACHE*>::iterator itMap = _cache.find(*itList);
|
||||
if (itMap != _cache.end())
|
||||
{
|
||||
/* yep we have it. remove it. */
|
||||
|
@ -176,7 +168,7 @@ TxCache::add(uint64 checksum, GHQTexInfo *info, int dataSize)
|
|||
txCache->it = --(_cachelist.end());
|
||||
}
|
||||
/* _cache[checksum] = txCache; */
|
||||
_cache.insert(std::map<uint64, TXCACHE*>::value_type(checksum, txCache));
|
||||
_cache.insert(std::map<uint64_t, TXCACHE*>::value_type(checksum, txCache));
|
||||
|
||||
#ifdef DEBUG
|
||||
DBG_INFO(80, "[%5d] added!! crc:%08X %08X %d x %d gfmt:%x total:%.02fmb\n",
|
||||
|
@ -213,13 +205,13 @@ TxCache::add(uint64 checksum, GHQTexInfo *info, int dataSize)
|
|||
return 0;
|
||||
}
|
||||
|
||||
boolean
|
||||
TxCache::get(uint64 checksum, GHQTexInfo *info)
|
||||
bool
|
||||
TxCache::get(uint64_t checksum, GHQTexInfo *info)
|
||||
{
|
||||
if (!checksum || _cache.empty()) return 0;
|
||||
|
||||
/* find a match in cache */
|
||||
std::map<uint64, TXCACHE*>::iterator itMap = _cache.find(checksum);
|
||||
std::map<uint64_t, TXCACHE*>::iterator itMap = _cache.find(checksum);
|
||||
if (itMap != _cache.end())
|
||||
{
|
||||
/* yep, we've got it. */
|
||||
|
@ -234,7 +226,7 @@ TxCache::get(uint64 checksum, GHQTexInfo *info)
|
|||
}
|
||||
|
||||
/* zlib decompress it */
|
||||
if (info->format & GR_TEXFMT_GZ)
|
||||
if (info->format & GFX_TEXFMT_GZ)
|
||||
{
|
||||
uLongf destLen = _gzdestLen;
|
||||
uint8 *dest = (_gzdest0 == info->data) ? _gzdest1 : _gzdest0;
|
||||
|
@ -244,7 +236,7 @@ TxCache::get(uint64 checksum, GHQTexInfo *info)
|
|||
return 0;
|
||||
}
|
||||
info->data = dest;
|
||||
info->format &= ~GR_TEXFMT_GZ;
|
||||
info->format &= ~GFX_TEXFMT_GZ;
|
||||
DBG_INFO(80, "zlib decompressed: %.02fkb->%.02fkb\n", (float)(((*itMap).second)->size) / 1000, (float)destLen / 1000);
|
||||
}
|
||||
return 1;
|
||||
|
@ -252,7 +244,7 @@ TxCache::get(uint64 checksum, GHQTexInfo *info)
|
|||
return 0;
|
||||
}
|
||||
|
||||
boolean TxCache::save(const char *path, const char *filename, int config)
|
||||
bool TxCache::save(const char *path, const char *filename, int config)
|
||||
{
|
||||
if (!_cache.empty())
|
||||
{
|
||||
|
@ -265,7 +257,7 @@ boolean TxCache::save(const char *path, const char *filename, int config)
|
|||
/* write header to determine config match */
|
||||
gzwrite(gzfp, &config, 4);
|
||||
|
||||
std::map<uint64, TXCACHE*>::iterator itMap = _cache.begin();
|
||||
std::map<uint64_t, TXCACHE*>::iterator itMap = _cache.begin();
|
||||
while (itMap != _cache.end())
|
||||
{
|
||||
uint8 *dest = (*itMap).second->info.data;
|
||||
|
@ -277,17 +269,17 @@ boolean TxCache::save(const char *path, const char *filename, int config)
|
|||
* texture data in a zlib compressed state. if the GZ_TEXCACHE or GZ_HIRESTEXCACHE
|
||||
* option is toggled, the cache will need to be rebuilt.
|
||||
*/
|
||||
/*if (format & GR_TEXFMT_GZ) {
|
||||
dest = _gzdest0;
|
||||
destLen = _gzdestLen;
|
||||
if (dest && destLen) {
|
||||
if (uncompress(dest, &destLen, (*itMap).second->info.data, (*itMap).second->size) != Z_OK) {
|
||||
dest = NULL;
|
||||
destLen = 0;
|
||||
}
|
||||
format &= ~GR_TEXFMT_GZ;
|
||||
}
|
||||
}*/
|
||||
/*if (format & GFX_TEXFMT_GZ) {
|
||||
dest = _gzdest0;
|
||||
destLen = _gzdestLen;
|
||||
if (dest && destLen) {
|
||||
if (uncompress(dest, &destLen, (*itMap).second->info.data, (*itMap).second->size) != Z_OK) {
|
||||
dest = NULL;
|
||||
destLen = 0;
|
||||
}
|
||||
format &= ~GFX_TEXFMT_GZ;
|
||||
}
|
||||
}*/
|
||||
|
||||
if (dest && destLen)
|
||||
{
|
||||
|
@ -325,7 +317,7 @@ boolean TxCache::save(const char *path, const char *filename, int config)
|
|||
return _cache.empty();
|
||||
}
|
||||
|
||||
boolean TxCache::load(const char *path, const char *filename, int config)
|
||||
bool TxCache::load(const char *path, const char *filename, int config)
|
||||
{
|
||||
/* find it on disk */
|
||||
CPath cbuf(path, filename);
|
||||
|
@ -336,7 +328,7 @@ boolean TxCache::load(const char *path, const char *filename, int config)
|
|||
{
|
||||
/* yep, we have it. load it into memory cache. */
|
||||
int dataSize;
|
||||
uint64 checksum;
|
||||
uint64_t checksum;
|
||||
GHQTexInfo tmpInfo;
|
||||
int tmpconfig;
|
||||
/* read header to determine config match */
|
||||
|
@ -372,7 +364,7 @@ boolean TxCache::load(const char *path, const char *filename, int config)
|
|||
gzread(gzfp, tmpInfo.data, dataSize);
|
||||
|
||||
/* add to memory cache */
|
||||
add(checksum, &tmpInfo, (tmpInfo.format & GR_TEXFMT_GZ) ? dataSize : 0);
|
||||
add(checksum, &tmpInfo, (tmpInfo.format & GFX_TEXFMT_GZ) ? dataSize : 0);
|
||||
|
||||
free(tmpInfo.data);
|
||||
}
|
||||
|
@ -391,11 +383,11 @@ boolean TxCache::load(const char *path, const char *filename, int config)
|
|||
return !_cache.empty();
|
||||
}
|
||||
|
||||
boolean TxCache::del(uint64 checksum)
|
||||
bool TxCache::del(uint64_t checksum)
|
||||
{
|
||||
if (!checksum || _cache.empty()) return 0;
|
||||
|
||||
std::map<uint64, TXCACHE*>::iterator itMap = _cache.find(checksum);
|
||||
std::map<uint64_t, TXCACHE*>::iterator itMap = _cache.find(checksum);
|
||||
if (itMap != _cache.end())
|
||||
{
|
||||
/* for texture cache (not hi-res cache) */
|
||||
|
@ -415,9 +407,9 @@ boolean TxCache::del(uint64 checksum)
|
|||
return 0;
|
||||
}
|
||||
|
||||
boolean TxCache::is_cached(uint64 checksum)
|
||||
bool TxCache::is_cached(uint64_t checksum)
|
||||
{
|
||||
std::map<uint64, TXCACHE*>::iterator itMap = _cache.find(checksum);
|
||||
std::map<uint64_t, TXCACHE*>::iterator itMap = _cache.find(checksum);
|
||||
if (itMap != _cache.end()) return 1;
|
||||
|
||||
return 0;
|
||||
|
@ -427,7 +419,7 @@ void TxCache::clear()
|
|||
{
|
||||
if (!_cache.empty())
|
||||
{
|
||||
std::map<uint64, TXCACHE*>::iterator itMap = _cache.begin();
|
||||
std::map<uint64_t, TXCACHE*>::iterator itMap = _cache.begin();
|
||||
while (itMap != _cache.end())
|
||||
{
|
||||
free((*itMap).second->info.data);
|
||||
|
|
|
@ -1,25 +1,16 @@
|
|||
/*
|
||||
* Texture Filtering
|
||||
* Version: 1.0
|
||||
*
|
||||
* Copyright (C) 2007 Hiroshi Morii All Rights Reserved.
|
||||
* Email koolsmoky(at)users.sourceforge.net
|
||||
* Web http://www.3dfxzone.it/koolsmoky
|
||||
*
|
||||
* this 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 Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* this 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 GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2007 Hiroshi Morii *
|
||||
* Copyright (C) 2003 Rice1964 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __TXCACHE_H__
|
||||
#define __TXCACHE_H__
|
||||
|
@ -33,37 +24,37 @@
|
|||
class TxCache
|
||||
{
|
||||
private:
|
||||
std::list<uint64> _cachelist;
|
||||
uint8 *_gzdest0;
|
||||
uint8 *_gzdest1;
|
||||
uint32 _gzdestLen;
|
||||
std::list<uint64_t> _cachelist;
|
||||
uint8 *_gzdest0;
|
||||
uint8 *_gzdest1;
|
||||
uint32 _gzdestLen;
|
||||
protected:
|
||||
int _options;
|
||||
std::string _ident;
|
||||
std::string _path;
|
||||
dispInfoFuncExt _callback;
|
||||
TxUtil *_txUtil;
|
||||
struct TXCACHE {
|
||||
int size;
|
||||
GHQTexInfo info;
|
||||
std::list<uint64>::iterator it;
|
||||
};
|
||||
int _totalSize;
|
||||
int _cacheSize;
|
||||
std::map<uint64, TXCACHE*> _cache;
|
||||
boolean save(const char *path, const char *filename, const int config);
|
||||
boolean load(const char *path, const char *filename, const int config);
|
||||
boolean del(uint64 checksum); /* checksum hi:palette low:texture */
|
||||
boolean is_cached(uint64 checksum); /* checksum hi:palette low:texture */
|
||||
void clear();
|
||||
int _options;
|
||||
std::string _ident;
|
||||
std::string _path;
|
||||
dispInfoFuncExt _callback;
|
||||
TxUtil *_txUtil;
|
||||
struct TXCACHE {
|
||||
int size;
|
||||
GHQTexInfo info;
|
||||
std::list<uint64_t>::iterator it;
|
||||
};
|
||||
int _totalSize;
|
||||
int _cacheSize;
|
||||
std::map<uint64_t, TXCACHE*> _cache;
|
||||
bool save(const char *path, const char *filename, const int config);
|
||||
bool load(const char *path, const char *filename, const int config);
|
||||
bool del(uint64_t checksum); /* checksum hi:palette low:texture */
|
||||
bool is_cached(uint64_t checksum); /* checksum hi:palette low:texture */
|
||||
void clear();
|
||||
public:
|
||||
~TxCache();
|
||||
TxCache(int options, int cachesize, const char *path, const char *ident,
|
||||
dispInfoFuncExt callback);
|
||||
boolean add(uint64 checksum, /* checksum hi:palette low:texture */
|
||||
GHQTexInfo *info, int dataSize = 0);
|
||||
boolean get(uint64 checksum, /* checksum hi:palette low:texture */
|
||||
GHQTexInfo *info);
|
||||
~TxCache();
|
||||
TxCache(int options, int cachesize, const char *path, const char *ident,
|
||||
dispInfoFuncExt callback);
|
||||
bool add(uint64_t checksum, /* checksum hi:palette low:texture */
|
||||
GHQTexInfo *info, int dataSize = 0);
|
||||
bool get(uint64_t checksum, /* checksum hi:palette low:texture */
|
||||
GHQTexInfo *info);
|
||||
};
|
||||
|
||||
#endif /* __TXCACHE_H__ */
|
||||
|
|
|
@ -1,26 +1,16 @@
|
|||
/*
|
||||
* Texture Filtering
|
||||
* Version: 1.0
|
||||
*
|
||||
* Copyright (C) 2007 Hiroshi Morii All Rights Reserved.
|
||||
* Email koolsmoky(at)users.sourceforge.net
|
||||
* Web http://www.3dfxzone.it/koolsmoky
|
||||
*
|
||||
* this 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 Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* this 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 GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2007 Hiroshi Morii *
|
||||
* Copyright (C) 2003 Rice1964 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#define DBG_LEVEL 80
|
||||
|
||||
#include "TxDbg.h"
|
||||
|
@ -49,7 +39,7 @@ TxDbg::TxDbg()
|
|||
|
||||
TxDbg::~TxDbg()
|
||||
{
|
||||
if (_dbgfile)
|
||||
if (_dbgfile)
|
||||
{
|
||||
fclose(_dbgfile);
|
||||
_dbgfile = 0;
|
||||
|
|
|
@ -1,25 +1,16 @@
|
|||
/*
|
||||
* Texture Filtering
|
||||
* Version: 1.0
|
||||
*
|
||||
* Copyright (C) 2007 Hiroshi Morii All Rights Reserved.
|
||||
* Email koolsmoky(at)users.sourceforge.net
|
||||
* Web http://www.3dfxzone.it/koolsmoky
|
||||
*
|
||||
* this 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 Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* this 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 GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2007 Hiroshi Morii *
|
||||
* Copyright (C) 2003 Rice1964 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __TXDBG_H__
|
||||
#define __TXDBG_H__
|
||||
|
@ -30,16 +21,16 @@
|
|||
class TxDbg
|
||||
{
|
||||
private:
|
||||
FILE* _dbgfile;
|
||||
int _level;
|
||||
TxDbg();
|
||||
FILE* _dbgfile;
|
||||
int _level;
|
||||
TxDbg();
|
||||
public:
|
||||
static TxDbg* getInstance() {
|
||||
static TxDbg txDbg;
|
||||
return &txDbg;
|
||||
}
|
||||
~TxDbg();
|
||||
void output(const int level, const char *format, ...);
|
||||
static TxDbg* getInstance() {
|
||||
static TxDbg txDbg;
|
||||
return &txDbg;
|
||||
}
|
||||
~TxDbg();
|
||||
void output(const int level, const char *format, ...);
|
||||
};
|
||||
|
||||
#ifdef DEBUG
|
||||
|
|
|
@ -1,32 +1,23 @@
|
|||
/*
|
||||
* Texture Filtering
|
||||
* Version: 1.0
|
||||
*
|
||||
* Copyright (C) 2007 Hiroshi Morii All Rights Reserved.
|
||||
* Email koolsmoky(at)users.sourceforge.net
|
||||
* Web http://www.3dfxzone.it/koolsmoky
|
||||
*
|
||||
* this 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 Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* this 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 GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2007 Hiroshi Morii *
|
||||
* Copyright (C) 2003 Rice1964 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#ifdef _WIN32
|
||||
#pragma warning(disable: 4786)
|
||||
#endif
|
||||
|
||||
#include <Common/path.h>
|
||||
#include <Common/StdString.h>
|
||||
#include <Project64-video/Renderer/types.h>
|
||||
#include "TxFilter.h"
|
||||
#include "TextureFilters.h"
|
||||
#include "TxDbg.h"
|
||||
|
@ -173,8 +164,8 @@ TxFilter::TxFilter(int maxwidth, int maxheight, int maxbpp, int options,
|
|||
_initialized = 1;
|
||||
}
|
||||
|
||||
boolean
|
||||
TxFilter::filter(uint8 *src, int srcwidth, int srcheight, uint16 srcformat, uint64 g64crc, GHQTexInfo *info)
|
||||
bool
|
||||
TxFilter::filter(uint8 *src, int srcwidth, int srcheight, uint16 srcformat, uint64_t g64crc, GHQTexInfo *info)
|
||||
{
|
||||
uint8 *texture = src;
|
||||
uint8 *tmptex = _tex1;
|
||||
|
@ -187,7 +178,7 @@ TxFilter::filter(uint8 *src, int srcwidth, int srcheight, uint16 srcformat, uint
|
|||
if (_cacheSize) {
|
||||
/* calculate checksum of source texture */
|
||||
if (!g64crc)
|
||||
g64crc = (uint64)(_txUtil->checksumTx(texture, srcwidth, srcheight, srcformat));
|
||||
g64crc = (uint64_t)(_txUtil->checksumTx(texture, srcwidth, srcheight, srcformat));
|
||||
|
||||
DBG_INFO(80, "filter: crc:%08X %08X %d x %d gfmt:%x\n",
|
||||
(uint32)(g64crc >> 32), (uint32)(g64crc & 0xffffffff), srcwidth, srcheight, srcformat);
|
||||
|
@ -208,25 +199,25 @@ TxFilter::filter(uint8 *src, int srcwidth, int srcheight, uint16 srcformat, uint
|
|||
*/
|
||||
if ((srcwidth >= 4 && srcheight >= 4) &&
|
||||
((_options & (FILTER_MASK | ENHANCEMENT_MASK | COMPRESSION_MASK)) ||
|
||||
(srcformat == GR_TEXFMT_ARGB_8888 && (_maxbpp < 32 || _options & FORCE16BPP_TEX)))) {
|
||||
(srcformat == GFX_TEXFMT_ARGB_8888 && (_maxbpp < 32 || _options & FORCE16BPP_TEX)))) {
|
||||
#if !_16BPP_HACK
|
||||
/* convert textures to a format that the compressor accepts (ARGB8888) */
|
||||
if (_options & COMPRESSION_MASK) {
|
||||
#endif
|
||||
if (srcformat != GR_TEXFMT_ARGB_8888) {
|
||||
if (!_txQuantize->quantize(texture, tmptex, srcwidth, srcheight, srcformat, GR_TEXFMT_ARGB_8888)) {
|
||||
if (srcformat != GFX_TEXFMT_ARGB_8888) {
|
||||
if (!_txQuantize->quantize(texture, tmptex, srcwidth, srcheight, srcformat, GFX_TEXFMT_ARGB_8888)) {
|
||||
DBG_INFO(80, "Error: unsupported format! gfmt:%x\n", srcformat);
|
||||
return 0;
|
||||
}
|
||||
texture = tmptex;
|
||||
destformat = GR_TEXFMT_ARGB_8888;
|
||||
destformat = GFX_TEXFMT_ARGB_8888;
|
||||
}
|
||||
#if !_16BPP_HACK
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (destformat) {
|
||||
case GR_TEXFMT_ARGB_8888:
|
||||
case GFX_TEXFMT_ARGB_8888:
|
||||
|
||||
/*
|
||||
* prepare texture enhancements (x2, x4 scalers)
|
||||
|
@ -293,8 +284,8 @@ TxFilter::filter(uint8 *src, int srcwidth, int srcheight, uint16 srcformat, uint
|
|||
/*
|
||||
* texture compression
|
||||
*/
|
||||
/* ignored if we only have texture compression option on.
|
||||
* only done when texture enhancer is used. see constructor. */
|
||||
/* ignored if we only have texture compression option on.
|
||||
* only done when texture enhancer is used. see constructor. */
|
||||
if ((_options & COMPRESSION_MASK) &&
|
||||
(srcwidth >= 64 && srcheight >= 64) /* Texture compression is not suitable for low pixel coarse detail
|
||||
* textures. The assumption here is that textures larger than 64x64
|
||||
|
@ -304,16 +295,16 @@ TxFilter::filter(uint8 *src, int srcwidth, int srcheight, uint16 srcformat, uint
|
|||
* reasonable if decisions are made based on fourier-transform
|
||||
* spectrum or RMS error.
|
||||
*/
|
||||
) {
|
||||
) {
|
||||
int compressionType = _options & COMPRESSION_MASK;
|
||||
int tmpwidth, tmpheight;
|
||||
uint16 tmpformat;
|
||||
/* XXX: textures that use 8bit alpha channel look bad with the current
|
||||
* fxt1 library, so we substitute it with dxtn for now. afaik all gfx
|
||||
* cards that support fxt1 also support dxtn. (3dfx and Intel) */
|
||||
if ((destformat == GR_TEXFMT_ALPHA_INTENSITY_88) ||
|
||||
(destformat == GR_TEXFMT_ARGB_8888) ||
|
||||
(destformat == GR_TEXFMT_ALPHA_8)) {
|
||||
if ((destformat == GFX_TEXFMT_ALPHA_INTENSITY_88) ||
|
||||
(destformat == GFX_TEXFMT_ARGB_8888) ||
|
||||
(destformat == GFX_TEXFMT_ALPHA_8)) {
|
||||
compressionType = S3TC_COMPRESSION;
|
||||
}
|
||||
tmptex = (texture == _tex1) ? _tex2 : _tex1;
|
||||
|
@ -331,11 +322,11 @@ TxFilter::filter(uint8 *src, int srcwidth, int srcheight, uint16 srcformat, uint
|
|||
/*
|
||||
* texture (re)conversions
|
||||
*/
|
||||
if (destformat == GR_TEXFMT_ARGB_8888) {
|
||||
if (srcformat == GR_TEXFMT_ARGB_8888 && (_maxbpp < 32 || _options & FORCE16BPP_TEX)) srcformat = GR_TEXFMT_ARGB_4444;
|
||||
if (srcformat != GR_TEXFMT_ARGB_8888) {
|
||||
if (destformat == GFX_TEXFMT_ARGB_8888) {
|
||||
if (srcformat == GFX_TEXFMT_ARGB_8888 && (_maxbpp < 32 || _options & FORCE16BPP_TEX)) srcformat = GFX_TEXFMT_ARGB_4444;
|
||||
if (srcformat != GFX_TEXFMT_ARGB_8888) {
|
||||
tmptex = (texture == _tex1) ? _tex2 : _tex1;
|
||||
if (!_txQuantize->quantize(texture, tmptex, srcwidth, srcheight, GR_TEXFMT_ARGB_8888, srcformat)) {
|
||||
if (!_txQuantize->quantize(texture, tmptex, srcwidth, srcheight, GFX_TEXFMT_ARGB_8888, srcformat)) {
|
||||
DBG_INFO(80, "Error: unsupported format! gfmt:%x\n", srcformat);
|
||||
return 0;
|
||||
}
|
||||
|
@ -346,7 +337,7 @@ TxFilter::filter(uint8 *src, int srcwidth, int srcheight, uint16 srcformat, uint
|
|||
|
||||
break;
|
||||
#if !_16BPP_HACK
|
||||
case GR_TEXFMT_ARGB_4444:
|
||||
case GFX_TEXFMT_ARGB_4444:
|
||||
|
||||
int scale_shift = 0;
|
||||
tmptex = (texture == _tex1) ? _tex2 : _tex1;
|
||||
|
@ -374,25 +365,25 @@ TxFilter::filter(uint8 *src, int srcwidth, int srcheight, uint16 srcformat, uint
|
|||
}
|
||||
break;
|
||||
case LQ2X_ENHANCEMENT:
|
||||
if (srcwidth <= (_maxwidth >> 1) && srcheight <= (_maxheight >> 1)) {
|
||||
if (srcwidth <= (_maxwidth >> 1) && srcheight <= (_maxheight >> 1)) {
|
||||
lq2x_16((uint8*)texture, srcwidth * 2, (uint8*)tmptex, srcwidth * 2 * 2, srcwidth, srcheight);
|
||||
scale_shift = 1;
|
||||
}
|
||||
break;
|
||||
case LQ2XS_ENHANCEMENT:
|
||||
if (srcwidth <= (_maxwidth >> 1) && srcheight <= (_maxheight >> 1)) {
|
||||
if (srcwidth <= (_maxwidth >> 1) && srcheight <= (_maxheight >> 1)) {
|
||||
lq2xS_16((uint8*)texture, srcwidth * 2, (uint8*)tmptex, srcwidth * 2 * 2, srcwidth, srcheight);
|
||||
scale_shift = 1;
|
||||
}
|
||||
break;
|
||||
case X2SAI_ENHANCEMENT:
|
||||
if (srcwidth <= (_maxwidth >> 1) && srcheight <= (_maxheight >> 1)) {
|
||||
if (srcwidth <= (_maxwidth >> 1) && srcheight <= (_maxheight >> 1)) {
|
||||
Super2xSaI_4444((uint16*)texture, (uint16*)tmptex, srcwidth, srcheight, srcwidth);
|
||||
scale_shift = 1;
|
||||
}
|
||||
break;
|
||||
case X2_ENHANCEMENT:
|
||||
if (srcwidth <= (_maxwidth >> 1) && srcheight <= (_maxheight >> 1)) {
|
||||
if (srcwidth <= (_maxwidth >> 1) && srcheight <= (_maxheight >> 1)) {
|
||||
Texture2x_16((uint8*)texture, srcwidth * 2, (uint8*)tmptex, srcwidth * 2 * 2, srcwidth, srcheight);
|
||||
scale_shift = 1;
|
||||
}
|
||||
|
@ -407,18 +398,19 @@ TxFilter::filter(uint8 *src, int srcwidth, int srcheight, uint16 srcformat, uint
|
|||
tmptex = (texture == _tex1) ? _tex2 : _tex1;
|
||||
SmoothFilter_4444((uint16*)texture, srcwidth, srcheight, (uint16*)tmptex, (_options & SMOOTH_FILTER_MASK));
|
||||
texture = tmptex;
|
||||
} else if (_options & SHARP_FILTER_MASK) {
|
||||
}
|
||||
else if (_options & SHARP_FILTER_MASK) {
|
||||
tmptex = (texture == _tex1) ? _tex2 : _tex1;
|
||||
SharpFilter_4444((uint16*)texture, srcwidth, srcheight, (uint16*)tmptex, (_options & SHARP_FILTER_MASK));
|
||||
texture = tmptex;
|
||||
}
|
||||
|
||||
break;
|
||||
case GR_TEXFMT_ARGB_1555:
|
||||
case GFX_TEXFMT_ARGB_1555:
|
||||
break;
|
||||
case GR_TEXFMT_RGB_565:
|
||||
case GFX_TEXFMT_RGB_565:
|
||||
break;
|
||||
case GR_TEXFMT_ALPHA_8:
|
||||
case GFX_TEXFMT_ALPHA_8:
|
||||
break;
|
||||
#endif /* _16BPP_HACK */
|
||||
}
|
||||
|
@ -442,8 +434,8 @@ TxFilter::filter(uint8 *src, int srcwidth, int srcheight, uint16 srcformat, uint
|
|||
return 1;
|
||||
}
|
||||
|
||||
boolean
|
||||
TxFilter::hirestex(uint64 g64crc, uint64 r_crc64, uint16 *palette, GHQTexInfo *info)
|
||||
bool
|
||||
TxFilter::hirestex(uint64_t g64crc, uint64_t r_crc64, uint16 *palette, GHQTexInfo *info)
|
||||
{
|
||||
/* NOTE: Rice CRC32 sometimes return the same value for different textures.
|
||||
* As a workaround, Glide64 CRC32 is used for the key for NON-hires
|
||||
|
@ -501,8 +493,8 @@ TxFilter::hirestex(uint64 g64crc, uint64 r_crc64, uint16 *palette, GHQTexInfo *i
|
|||
* NOTE: the pre-converted palette from Glide64 is in RGBA5551 format.
|
||||
* A comp comes before RGB comp.
|
||||
*/
|
||||
if (palette && info->format == GR_TEXFMT_P_8) {
|
||||
DBG_INFO(80, "found GR_TEXFMT_P_8 format. Need conversion!!\n");
|
||||
if (palette && info->format == GFX_TEXFMT_P_8) {
|
||||
DBG_INFO(80, "found GFX_TEXFMT_P_8 format. Need conversion!!\n");
|
||||
|
||||
int width = info->width;
|
||||
int height = info->height;
|
||||
|
@ -514,31 +506,31 @@ TxFilter::hirestex(uint64 g64crc, uint64 r_crc64, uint16 *palette, GHQTexInfo *i
|
|||
/* use palette and convert to 16bit format */
|
||||
_txQuantize->P8_16BPP((uint32*)texture, (uint32*)tmptex, info->width, info->height, (uint32*)palette);
|
||||
texture = tmptex;
|
||||
format = GR_TEXFMT_ARGB_1555;
|
||||
format = GFX_TEXFMT_ARGB_1555;
|
||||
|
||||
#if 1
|
||||
/* XXX: compressed if memory cache compression is ON */
|
||||
if (_options & COMPRESSION_MASK) {
|
||||
tmptex = (texture == _tex1) ? _tex2 : _tex1;
|
||||
if (_txQuantize->quantize(texture, tmptex, info->width, info->height, format, GR_TEXFMT_ARGB_8888)) {
|
||||
if (_txQuantize->quantize(texture, tmptex, info->width, info->height, format, GFX_TEXFMT_ARGB_8888)) {
|
||||
texture = tmptex;
|
||||
format = GR_TEXFMT_ARGB_8888;
|
||||
format = GFX_TEXFMT_ARGB_8888;
|
||||
}
|
||||
if (format == GR_TEXFMT_ARGB_8888) {
|
||||
if (format == GFX_TEXFMT_ARGB_8888) {
|
||||
tmptex = (texture == _tex1) ? _tex2 : _tex1;
|
||||
if (_txQuantize->compress(texture, tmptex,
|
||||
info->width, info->height, GR_TEXFMT_ARGB_1555,
|
||||
info->width, info->height, GFX_TEXFMT_ARGB_1555,
|
||||
&width, &height, &format,
|
||||
_options & COMPRESSION_MASK)) {
|
||||
texture = tmptex;
|
||||
}
|
||||
else {
|
||||
/*if (!_txQuantize->quantize(texture, tmptex, info->width, info->height, GR_TEXFMT_ARGB_8888, GR_TEXFMT_ARGB_1555)) {
|
||||
/*if (!_txQuantize->quantize(texture, tmptex, info->width, info->height, GFX_TEXFMT_ARGB_8888, GFX_TEXFMT_ARGB_1555)) {
|
||||
DBG_INFO(80, "Error: unsupported format! gfmt:%x\n", format);
|
||||
return 0;
|
||||
}*/
|
||||
texture = tmptex;
|
||||
format = GR_TEXFMT_ARGB_1555;
|
||||
format = GFX_TEXFMT_ARGB_1555;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -557,7 +549,7 @@ TxFilter::hirestex(uint64 g64crc, uint64 r_crc64, uint16 *palette, GHQTexInfo *i
|
|||
/* XXX: add to hires texture cache!!! */
|
||||
_txHiResCache->add(r_crc64, info);
|
||||
|
||||
DBG_INFO(80, "GR_TEXFMT_P_8 loaded as gfmt:%x!\n", format);
|
||||
DBG_INFO(80, "GFX_TEXFMT_P_8 loaded as gfmt:%x!\n", format);
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -580,7 +572,7 @@ TxFilter::hirestex(uint64 g64crc, uint64 r_crc64, uint16 *palette, GHQTexInfo *i
|
|||
return 0;
|
||||
}
|
||||
|
||||
uint64
|
||||
uint64_t
|
||||
TxFilter::checksum64(uint8 *src, int width, int height, int size, int rowStride, uint8 *palette)
|
||||
{
|
||||
if (_options & (HIRESTEXTURES_MASK | DUMP_TEX))
|
||||
|
@ -590,8 +582,8 @@ TxFilter::checksum64(uint8 *src, int width, int height, int size, int rowStride,
|
|||
return 0;
|
||||
}
|
||||
|
||||
boolean
|
||||
TxFilter::dmptx(uint8 *src, int width, int height, int rowStridePixel, uint16 gfmt, uint16 n64fmt, uint64 r_crc64)
|
||||
bool
|
||||
TxFilter::dmptx(uint8 *src, int width, int height, int rowStridePixel, uint16 gfmt, uint16 n64fmt, uint64_t r_crc64)
|
||||
{
|
||||
if (!_initialized)
|
||||
{
|
||||
|
@ -605,7 +597,7 @@ TxFilter::dmptx(uint8 *src, int width, int height, int rowStridePixel, uint16 gf
|
|||
DBG_INFO(80, "hirestex: r_crc64:%08X %08X\n",
|
||||
(uint32)(r_crc64 >> 32), (uint32)(r_crc64 & 0xffffffff));
|
||||
|
||||
if (!_txQuantize->quantize(src, _tex1, rowStridePixel, height, (gfmt & 0x00ff), GR_TEXFMT_ARGB_8888))
|
||||
if (!_txQuantize->quantize(src, _tex1, rowStridePixel, height, (gfmt & 0x00ff), GFX_TEXFMT_ARGB_8888))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -657,7 +649,7 @@ TxFilter::dmptx(uint8 *src, int width, int height, int rowStridePixel, uint16 gf
|
|||
return 0;
|
||||
}
|
||||
|
||||
boolean TxFilter::reloadhirestex()
|
||||
bool TxFilter::reloadhirestex()
|
||||
{
|
||||
DBG_INFO(80, "Reload hires textures from texture pack.\n");
|
||||
|
||||
|
|
|
@ -1,25 +1,16 @@
|
|||
/*
|
||||
* Texture Filtering
|
||||
* Version: 1.0
|
||||
*
|
||||
* Copyright (C) 2007 Hiroshi Morii All Rights Reserved.
|
||||
* Email koolsmoky(at)users.sourceforge.net
|
||||
* Web http://www.3dfxzone.it/koolsmoky
|
||||
*
|
||||
* this 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 Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* this 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 GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2007 Hiroshi Morii *
|
||||
* Copyright (C) 2003 Rice1964 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __TXFILTER_H__
|
||||
#define __TXFILTER_H__
|
||||
|
@ -35,47 +26,47 @@
|
|||
class TxFilter
|
||||
{
|
||||
private:
|
||||
int _numcore;
|
||||
int _numcore;
|
||||
|
||||
uint8 *_tex1;
|
||||
uint8 *_tex2;
|
||||
int _maxwidth;
|
||||
int _maxheight;
|
||||
int _maxbpp;
|
||||
int _options;
|
||||
int _cacheSize;
|
||||
std::string _ident;
|
||||
std::string _path;
|
||||
TxQuantize *_txQuantize;
|
||||
TxTexCache *_txTexCache;
|
||||
TxHiResCache *_txHiResCache;
|
||||
TxUtil *_txUtil;
|
||||
TxImage *_txImage;
|
||||
boolean _initialized;
|
||||
void clear();
|
||||
uint8 *_tex1;
|
||||
uint8 *_tex2;
|
||||
int _maxwidth;
|
||||
int _maxheight;
|
||||
int _maxbpp;
|
||||
int _options;
|
||||
int _cacheSize;
|
||||
std::string _ident;
|
||||
std::string _path;
|
||||
TxQuantize *_txQuantize;
|
||||
TxTexCache *_txTexCache;
|
||||
TxHiResCache *_txHiResCache;
|
||||
TxUtil *_txUtil;
|
||||
TxImage *_txImage;
|
||||
bool _initialized;
|
||||
void clear();
|
||||
public:
|
||||
~TxFilter();
|
||||
TxFilter(int maxwidth,
|
||||
int maxheight,
|
||||
int maxbpp,
|
||||
int options,
|
||||
int cachesize,
|
||||
const char *path,
|
||||
const char *ident,
|
||||
dispInfoFuncExt callback);
|
||||
boolean filter(uint8 *src,
|
||||
int srcwidth,
|
||||
int srcheight,
|
||||
uint16 srcformat,
|
||||
uint64 g64crc, /* glide64 crc, 64bit for future use */
|
||||
GHQTexInfo *info);
|
||||
boolean hirestex(uint64 g64crc, /* glide64 crc, 64bit for future use */
|
||||
uint64 r_crc64, /* checksum hi:palette low:texture */
|
||||
uint16 *palette,
|
||||
GHQTexInfo *info);
|
||||
uint64 checksum64(uint8 *src, int width, int height, int size, int rowStride, uint8 *palette);
|
||||
boolean dmptx(uint8 *src, int width, int height, int rowStridePixel, uint16 gfmt, uint16 n64fmt, uint64 r_crc64);
|
||||
boolean reloadhirestex();
|
||||
~TxFilter();
|
||||
TxFilter(int maxwidth,
|
||||
int maxheight,
|
||||
int maxbpp,
|
||||
int options,
|
||||
int cachesize,
|
||||
const char *path,
|
||||
const char *ident,
|
||||
dispInfoFuncExt callback);
|
||||
bool filter(uint8 *src,
|
||||
int srcwidth,
|
||||
int srcheight,
|
||||
uint16 srcformat,
|
||||
uint64_t g64crc, /* glide64 crc, 64bit for future use */
|
||||
GHQTexInfo *info);
|
||||
bool hirestex(uint64_t g64crc, /* glide64 crc, 64bit for future use */
|
||||
uint64_t r_crc64, /* checksum hi:palette low:texture */
|
||||
uint16 *palette,
|
||||
GHQTexInfo *info);
|
||||
uint64_t checksum64(uint8 *src, int width, int height, int size, int rowStride, uint8 *palette);
|
||||
bool dmptx(uint8 *src, int width, int height, int rowStridePixel, uint16 gfmt, uint16 n64fmt, uint64_t r_crc64);
|
||||
bool reloadhirestex();
|
||||
};
|
||||
|
||||
#endif /* __TXFILTER_H__ */
|
||||
|
|
|
@ -1,25 +1,16 @@
|
|||
/*
|
||||
* Texture Filtering
|
||||
* Version: 1.0
|
||||
*
|
||||
* Copyright (C) 2007 Hiroshi Morii All Rights Reserved.
|
||||
* Email koolsmoky(at)users.sourceforge.net
|
||||
* Web http://www.3dfxzone.it/koolsmoky
|
||||
*
|
||||
* this 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 Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* this 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 GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2007 Hiroshi Morii *
|
||||
* Copyright (C) 2003 Rice1964 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef WIN32
|
||||
#pragma warning(disable: 4786)
|
||||
|
@ -30,76 +21,76 @@
|
|||
TxFilter *txFilter = NULL;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
TAPI boolean TAPIENTRY
|
||||
txfilter_init(int maxwidth, int maxheight, int maxbpp, int options, int cachesize,
|
||||
const char *path, const char * ident,
|
||||
dispInfoFuncExt callback)
|
||||
{
|
||||
if (txFilter) return 0;
|
||||
TAPI bool TAPIENTRY
|
||||
txfilter_init(int maxwidth, int maxheight, int maxbpp, int options, int cachesize,
|
||||
const char *path, const char * ident,
|
||||
dispInfoFuncExt callback)
|
||||
{
|
||||
if (txFilter) return 0;
|
||||
|
||||
txFilter = new TxFilter(maxwidth, maxheight, maxbpp, options, cachesize,
|
||||
path, ident, callback);
|
||||
txFilter = new TxFilter(maxwidth, maxheight, maxbpp, options, cachesize,
|
||||
path, ident, callback);
|
||||
|
||||
return (txFilter ? 1 : 0);
|
||||
}
|
||||
return (txFilter ? 1 : 0);
|
||||
}
|
||||
|
||||
void txfilter_shutdown(void)
|
||||
{
|
||||
if (txFilter) delete txFilter;
|
||||
void txfilter_shutdown(void)
|
||||
{
|
||||
if (txFilter) delete txFilter;
|
||||
|
||||
txFilter = NULL;
|
||||
}
|
||||
txFilter = NULL;
|
||||
}
|
||||
|
||||
TAPI boolean TAPIENTRY
|
||||
txfilter(uint8 *src, int srcwidth, int srcheight, uint16 srcformat,
|
||||
uint64 g64crc, GHQTexInfo *info)
|
||||
{
|
||||
if (txFilter)
|
||||
return txFilter->filter(src, srcwidth, srcheight, srcformat,
|
||||
g64crc, info);
|
||||
TAPI bool TAPIENTRY
|
||||
txfilter(uint8 *src, int srcwidth, int srcheight, uint16 srcformat,
|
||||
uint64_t g64crc, GHQTexInfo *info)
|
||||
{
|
||||
if (txFilter)
|
||||
return txFilter->filter(src, srcwidth, srcheight, srcformat,
|
||||
g64crc, info);
|
||||
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
TAPI boolean TAPIENTRY
|
||||
txfilter_hirestex(uint64 g64crc, uint64 r_crc64, uint16 *palette, GHQTexInfo *info)
|
||||
{
|
||||
if (txFilter)
|
||||
return txFilter->hirestex(g64crc, r_crc64, palette, info);
|
||||
TAPI bool TAPIENTRY
|
||||
txfilter_hirestex(uint64_t g64crc, uint64_t r_crc64, uint16 *palette, GHQTexInfo *info)
|
||||
{
|
||||
if (txFilter)
|
||||
return txFilter->hirestex(g64crc, r_crc64, palette, info);
|
||||
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
TAPI uint64 TAPIENTRY
|
||||
txfilter_checksum(uint8 *src, int width, int height, int size, int rowStride, uint8 *palette)
|
||||
{
|
||||
if (txFilter)
|
||||
return txFilter->checksum64(src, width, height, size, rowStride, palette);
|
||||
TAPI uint64_t TAPIENTRY
|
||||
txfilter_checksum(uint8 *src, int width, int height, int size, int rowStride, uint8 *palette)
|
||||
{
|
||||
if (txFilter)
|
||||
return txFilter->checksum64(src, width, height, size, rowStride, palette);
|
||||
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
TAPI boolean TAPIENTRY
|
||||
txfilter_dmptx(uint8 *src, int width, int height, int rowStridePixel, uint16 gfmt, uint16 n64fmt, uint64 r_crc64)
|
||||
{
|
||||
if (txFilter)
|
||||
return txFilter->dmptx(src, width, height, rowStridePixel, gfmt, n64fmt, r_crc64);
|
||||
TAPI bool TAPIENTRY
|
||||
txfilter_dmptx(uint8 *src, int width, int height, int rowStridePixel, uint16 gfmt, uint16 n64fmt, uint64_t r_crc64)
|
||||
{
|
||||
if (txFilter)
|
||||
return txFilter->dmptx(src, width, height, rowStridePixel, gfmt, n64fmt, r_crc64);
|
||||
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
TAPI boolean TAPIENTRY
|
||||
txfilter_reloadhirestex()
|
||||
{
|
||||
if (txFilter)
|
||||
return txFilter->reloadhirestex();
|
||||
TAPI bool TAPIENTRY
|
||||
txfilter_reloadhirestex()
|
||||
{
|
||||
if (txFilter)
|
||||
return txFilter->reloadhirestex();
|
||||
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -1,28 +1,17 @@
|
|||
/*
|
||||
* Texture Filtering
|
||||
* Version: 1.0
|
||||
*
|
||||
* Copyright (C) 2007 Hiroshi Morii All Rights Reserved.
|
||||
* Email koolsmoky(at)users.sourceforge.net
|
||||
* Web http://www.3dfxzone.it/koolsmoky
|
||||
*
|
||||
* this 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 Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* this 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 GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/* 2007 Gonetz <gonetz(at)ngs.ru>
|
||||
* Added callback to display hires texture info. */
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2007 Hiroshi Morii *
|
||||
* Copyright (C) 2003 Rice1964 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma warning(disable: 4786)
|
||||
|
@ -32,14 +21,14 @@
|
|||
* (0:disable, 1:enable) */
|
||||
#define DUMP_CACHE 1
|
||||
|
||||
/* handle oversized textures by
|
||||
* 0: minification
|
||||
* 1: Glide64 style tiling
|
||||
*/
|
||||
/* handle oversized textures by
|
||||
* 0: minification
|
||||
* 1: Glide64 style tiling
|
||||
*/
|
||||
#define TEXTURE_TILING 1
|
||||
|
||||
/* use power of 2 texture size
|
||||
* (0:disable, 1:enable, 2:3dfx) */
|
||||
/* use power of 2 texture size
|
||||
* (0:disable, 1:enable, 2:3dfx) */
|
||||
#define POW2_TEXTURES 2
|
||||
|
||||
#if TEXTURE_TILING
|
||||
|
@ -47,13 +36,13 @@
|
|||
#define POW2_TEXTURES 2
|
||||
#endif
|
||||
|
||||
/* hack to reduce texture footprint to achieve
|
||||
* better performace on midrange gfx cards.
|
||||
* (0:disable, 1:enable) */
|
||||
/* hack to reduce texture footprint to achieve
|
||||
* better performace on midrange gfx cards.
|
||||
* (0:disable, 1:enable) */
|
||||
#define REDUCE_TEXTURE_FOOTPRINT 0
|
||||
|
||||
/* use aggressive format assumption for quantization
|
||||
* (0:disable, 1:enable, 2:extreme) */
|
||||
/* use aggressive format assumption for quantization
|
||||
* (0:disable, 1:enable, 2:extreme) */
|
||||
#define AGGRESSIVE_QUANTIZATION 1
|
||||
|
||||
#include "TxHiResCache.h"
|
||||
|
@ -62,6 +51,7 @@
|
|||
#include <string>
|
||||
#include <Common/path.h>
|
||||
#include <Common/StdString.h>
|
||||
#include <Project64-video/Renderer/types.h>
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
@ -88,7 +78,7 @@ TxHiResCache::~TxHiResCache()
|
|||
}
|
||||
|
||||
TxHiResCache::TxHiResCache(int maxwidth, int maxheight, int maxbpp, int options, const char *path, const char *ident, dispInfoFuncExt callback) :
|
||||
TxCache((options & ~GZ_TEXCACHE), 0, path, ident, callback)
|
||||
TxCache((options & ~GZ_TEXCACHE), 0, path, ident, callback)
|
||||
{
|
||||
_txImage = new TxImage();
|
||||
_txQuantize = new TxQuantize();
|
||||
|
@ -129,14 +119,14 @@ TxCache((options & ~GZ_TEXCACHE), 0, path, ident, callback)
|
|||
if (!_haveCache) TxHiResCache::load(0);
|
||||
}
|
||||
|
||||
boolean
|
||||
bool
|
||||
TxHiResCache::empty()
|
||||
{
|
||||
return _cache.empty();
|
||||
}
|
||||
|
||||
boolean
|
||||
TxHiResCache::load(boolean replace) /* 0 : reload, 1 : replace partial */
|
||||
bool
|
||||
TxHiResCache::load(bool replace) /* 0 : reload, 1 : replace partial */
|
||||
{
|
||||
if (!_path.empty() && !_ident.empty())
|
||||
{
|
||||
|
@ -168,7 +158,7 @@ TxHiResCache::load(boolean replace) /* 0 : reload, 1 : replace partial */
|
|||
return 0;
|
||||
}
|
||||
|
||||
boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
||||
bool TxHiResCache::loadHiResTextures(const char * dir_path, bool replace)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
DBG_INFO(80, "-----\n");
|
||||
|
@ -198,12 +188,6 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
{
|
||||
do
|
||||
{
|
||||
if (KBHIT(0x1B))
|
||||
{
|
||||
_abortLoad = 1;
|
||||
if (_callback) (*_callback)("Aborted loading hiresolution texture!\n");
|
||||
INFO(80, "Error: aborted loading hiresolution texture!\n");
|
||||
}
|
||||
if (_abortLoad) break;
|
||||
|
||||
DBG_INFO(80, "-----\n");
|
||||
|
@ -221,7 +205,7 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
/* Rice hi-res textures: begin
|
||||
*/
|
||||
uint32 chksum = 0, fmt = 0, siz = 0, palchksum = 0;
|
||||
char *pfname = NULL, fname[MAX_PATH];
|
||||
char *pfname = NULL, fname[260];
|
||||
std::string ident;
|
||||
FILE *fp = NULL;
|
||||
|
||||
|
@ -240,7 +224,7 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
/* read in Rice's file naming convention */
|
||||
#define CRCFMTSIZ_LEN 13
|
||||
#define PALCRC_LEN 9
|
||||
wcstombs(fname, stdstr(TextureDir.GetNameExtension()).ToUTF16().c_str(), MAX_PATH);
|
||||
wcstombs(fname, stdstr(TextureDir.GetNameExtension()).ToUTF16().c_str(), 260);
|
||||
/* XXX case sensitivity fiasco!
|
||||
* files must use _a, _rgb, _all, _allciByRGBA, _ciByRGBA, _ci
|
||||
* and file extensions must be in lower case letters! */
|
||||
|
@ -294,9 +278,9 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
|
||||
/* check if we already have it in hires texture cache */
|
||||
if (!replace) {
|
||||
uint64 chksum64 = (uint64)palchksum;
|
||||
uint64_t chksum64 = (uint64_t)palchksum;
|
||||
chksum64 <<= 32;
|
||||
chksum64 |= (uint64)chksum;
|
||||
chksum64 |= (uint64_t)chksum;
|
||||
if (TxCache::is_cached(chksum64)) {
|
||||
#if !DEBUG
|
||||
INFO(80, "-----\n");
|
||||
|
@ -382,7 +366,7 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
if (tmptex) {
|
||||
/* check if _rgb.* and _a.* have matching size and format. */
|
||||
if (!tex || width != tmpwidth || height != tmpheight ||
|
||||
format != GR_TEXFMT_ARGB_8888 || tmpformat != GR_TEXFMT_ARGB_8888) {
|
||||
format != GFX_TEXFMT_ARGB_8888 || tmpformat != GFX_TEXFMT_ARGB_8888) {
|
||||
#if !DEBUG
|
||||
INFO(80, "-----\n");
|
||||
INFO(80, "path: %ls\n", stdstr(dir_path).ToUTF16().c_str());
|
||||
|
@ -394,7 +378,7 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
else if (width != tmpwidth || height != tmpheight) {
|
||||
INFO(80, "Error: _rgb.* and _a.* have mismatched width or height!\n");
|
||||
}
|
||||
else if (format != GR_TEXFMT_ARGB_8888 || tmpformat != GR_TEXFMT_ARGB_8888) {
|
||||
else if (format != GFX_TEXFMT_ARGB_8888 || tmpformat != GFX_TEXFMT_ARGB_8888) {
|
||||
INFO(80, "Error: _rgb.* or _a.* not in 32bit color!\n");
|
||||
}
|
||||
if (tex) free(tex);
|
||||
|
@ -421,7 +405,7 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
uint32 texel = ((uint32*)tmptex)[i];
|
||||
uint32 acomp = (((texel >> 16) & 0xff) * 6969 +
|
||||
((texel >> 8) & 0xff) * 23434 +
|
||||
((texel)& 0xff) * 2365) / 32768;
|
||||
((texel) & 0xff) * 2365) / 32768;
|
||||
((uint32*)tex)[i] = (acomp << 24) | (((uint32*)tex)[i] & 0x00ffffff);
|
||||
#endif
|
||||
#if 0
|
||||
|
@ -429,7 +413,7 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
uint32 texel = ((uint32*)tmptex)[i];
|
||||
uint32 acomp = (((texel >> 16) & 0xff) * 299 +
|
||||
((texel >> 8) & 0xff) * 587 +
|
||||
((texel)& 0xff) * 114) / 1000;
|
||||
((texel) & 0xff) * 114) / 1000;
|
||||
((uint32*)tex)[i] = (acomp << 24) | (((uint32*)tex)[i] & 0x00ffffff);
|
||||
#endif
|
||||
}
|
||||
|
@ -457,58 +441,58 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
* read in _all.png, _all.dds, _allciByRGBA.png, _allciByRGBA.dds
|
||||
* _ciByRGBA.png, _ciByRGBA.dds, _ci.bmp
|
||||
*/
|
||||
if (pfname == strstr(fname, "_all.png") ||
|
||||
pfname == strstr(fname, "_all.dds") ||
|
||||
if (pfname == strstr(fname, "_all.png") ||
|
||||
pfname == strstr(fname, "_all.dds") ||
|
||||
#ifdef _WIN32
|
||||
pfname == strstr(fname, "_allcibyrgba.png") ||
|
||||
pfname == strstr(fname, "_allcibyrgba.dds") ||
|
||||
pfname == strstr(fname, "_cibyrgba.png") ||
|
||||
pfname == strstr(fname, "_cibyrgba.dds") ||
|
||||
pfname == strstr(fname, "_allcibyrgba.png") ||
|
||||
pfname == strstr(fname, "_allcibyrgba.dds") ||
|
||||
pfname == strstr(fname, "_cibyrgba.png") ||
|
||||
pfname == strstr(fname, "_cibyrgba.dds") ||
|
||||
#else
|
||||
pfname == strstr(fname, "_allciByRGBA.png") ||
|
||||
pfname == strstr(fname, "_allciByRGBA.dds") ||
|
||||
pfname == strstr(fname, "_ciByRGBA.png") ||
|
||||
pfname == strstr(fname, "_ciByRGBA.dds") ||
|
||||
pfname == strstr(fname, "_allciByRGBA.png") ||
|
||||
pfname == strstr(fname, "_allciByRGBA.dds") ||
|
||||
pfname == strstr(fname, "_ciByRGBA.png") ||
|
||||
pfname == strstr(fname, "_ciByRGBA.dds") ||
|
||||
#endif
|
||||
pfname == strstr(fname, "_ci.bmp")) {
|
||||
CPath TargetFile(dir_path, fname);
|
||||
if ((fp = fopen(TargetFile, "rb")) != NULL) {
|
||||
if (strstr(fname, ".png")) tex = _txImage->readPNG(fp, &width, &height, &format);
|
||||
else if (strstr(fname, ".dds")) tex = _txImage->readDDS(fp, &width, &height, &format);
|
||||
else tex = _txImage->readBMP(fp, &width, &height, &format);
|
||||
fclose(fp);
|
||||
}
|
||||
/* XXX: auto-adjustment of dxt dds textures unsupported for now */
|
||||
if (tex && strstr(fname, ".dds")) {
|
||||
const float aspectratio = (width > height) ? (float)width / (float)height : (float)height / (float)width;
|
||||
if (!(aspectratio == 1.0 ||
|
||||
aspectratio == 2.0 ||
|
||||
aspectratio == 4.0 ||
|
||||
aspectratio == 8.0)) {
|
||||
free(tex);
|
||||
tex = NULL;
|
||||
pfname == strstr(fname, "_ci.bmp")) {
|
||||
CPath TargetFile(dir_path, fname);
|
||||
if ((fp = fopen(TargetFile, "rb")) != NULL) {
|
||||
if (strstr(fname, ".png")) tex = _txImage->readPNG(fp, &width, &height, &format);
|
||||
else if (strstr(fname, ".dds")) tex = _txImage->readDDS(fp, &width, &height, &format);
|
||||
else tex = _txImage->readBMP(fp, &width, &height, &format);
|
||||
fclose(fp);
|
||||
}
|
||||
/* XXX: auto-adjustment of dxt dds textures unsupported for now */
|
||||
if (tex && strstr(fname, ".dds")) {
|
||||
const float aspectratio = (width > height) ? (float)width / (float)height : (float)height / (float)width;
|
||||
if (!(aspectratio == 1.0 ||
|
||||
aspectratio == 2.0 ||
|
||||
aspectratio == 4.0 ||
|
||||
aspectratio == 8.0)) {
|
||||
free(tex);
|
||||
tex = NULL;
|
||||
#if !DEBUG
|
||||
INFO(80, "-----\n");
|
||||
INFO(80, "path: %ls\n", stdstr(dir_path).ToUTF16().c_str());
|
||||
INFO(80, "file: %ls\n", TextureDir.GetNameExtension().ToUTF16().c_str());
|
||||
INFO(80, "-----\n");
|
||||
INFO(80, "path: %ls\n", stdstr(dir_path).ToUTF16().c_str());
|
||||
INFO(80, "file: %ls\n", TextureDir.GetNameExtension().ToUTF16().c_str());
|
||||
#endif
|
||||
INFO(80, "Error: W:H aspect ratio range not 8:1 - 1:8!\n");
|
||||
continue;
|
||||
}
|
||||
if (width != _txReSample->nextPow2(width) ||
|
||||
height != _txReSample->nextPow2(height)) {
|
||||
free(tex);
|
||||
tex = NULL;
|
||||
INFO(80, "Error: W:H aspect ratio range not 8:1 - 1:8!\n");
|
||||
continue;
|
||||
}
|
||||
if (width != _txReSample->nextPow2(width) ||
|
||||
height != _txReSample->nextPow2(height)) {
|
||||
free(tex);
|
||||
tex = NULL;
|
||||
#if !DEBUG
|
||||
INFO(80, "-----\n");
|
||||
INFO(80, "path: %ls\n", stdstr(dir_path).ToUTF16().c_str());
|
||||
INFO(80, "file: %ls\n", TextureDir.GetNameExtension().ToUTF16().c_str());
|
||||
INFO(80, "-----\n");
|
||||
INFO(80, "path: %ls\n", stdstr(dir_path).ToUTF16().c_str());
|
||||
INFO(80, "file: %ls\n", TextureDir.GetNameExtension().ToUTF16().c_str());
|
||||
#endif
|
||||
INFO(80, "Error: not power of 2 size!\n");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
INFO(80, "Error: not power of 2 size!\n");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* if we do not have a texture at this point we are screwed */
|
||||
if (!tex) {
|
||||
|
@ -523,11 +507,11 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
DBG_INFO(80, "read in as %d x %d gfmt:%x\n", tmpwidth, tmpheight, tmpformat);
|
||||
|
||||
/* check if size and format are OK */
|
||||
if (!(format == GR_TEXFMT_ARGB_8888 ||
|
||||
format == GR_TEXFMT_P_8 ||
|
||||
format == GR_TEXFMT_ARGB_CMP_DXT1 ||
|
||||
format == GR_TEXFMT_ARGB_CMP_DXT3 ||
|
||||
format == GR_TEXFMT_ARGB_CMP_DXT5) ||
|
||||
if (!(format == GFX_TEXFMT_ARGB_8888 ||
|
||||
format == GFX_TEXFMT_P_8 ||
|
||||
format == GFX_TEXFMT_ARGB_CMP_DXT1 ||
|
||||
format == GFX_TEXFMT_ARGB_CMP_DXT3 ||
|
||||
format == GFX_TEXFMT_ARGB_CMP_DXT5) ||
|
||||
(width * height) < 4) { /* TxQuantize requirement: width * height must be 4 or larger. */
|
||||
free(tex);
|
||||
tex = NULL;
|
||||
|
@ -541,11 +525,11 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
}
|
||||
|
||||
/* analyze and determine best format to quantize */
|
||||
if (format == GR_TEXFMT_ARGB_8888) {
|
||||
if (format == GFX_TEXFMT_ARGB_8888) {
|
||||
int i;
|
||||
int alphabits = 0;
|
||||
int fullalpha = 0;
|
||||
boolean intensity = 1;
|
||||
bool intensity = 1;
|
||||
|
||||
if (!(_options & LET_TEXARTISTS_FLY)) {
|
||||
/* HACK ALERT! */
|
||||
|
@ -634,7 +618,7 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
if (intensity) {
|
||||
int rcomp = (texel >> 16) & 0xff;
|
||||
int gcomp = (texel >> 8) & 0xff;
|
||||
int bcomp = (texel)& 0xff;
|
||||
int bcomp = (texel) & 0xff;
|
||||
#if AGGRESSIVE_QUANTIZATION
|
||||
if (abs(rcomp - gcomp) > 8 || abs(rcomp - bcomp) > 8 || abs(gcomp - bcomp) > 8) intensity = 0;
|
||||
#else
|
||||
|
@ -649,33 +633,33 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
#if !REDUCE_TEXTURE_FOOTPRINT
|
||||
if (_maxbpp < 32 || _options & (FORCE16BPP_HIRESTEX | COMPRESSION_MASK)) {
|
||||
#endif
|
||||
if (alphabits == 0) destformat = GR_TEXFMT_RGB_565;
|
||||
else if (alphabits == 1) destformat = GR_TEXFMT_ARGB_1555;
|
||||
else destformat = GR_TEXFMT_ARGB_8888;
|
||||
if (alphabits == 0) destformat = GFX_TEXFMT_RGB_565;
|
||||
else if (alphabits == 1) destformat = GFX_TEXFMT_ARGB_1555;
|
||||
else destformat = GFX_TEXFMT_ARGB_8888;
|
||||
#if !REDUCE_TEXTURE_FOOTPRINT
|
||||
}
|
||||
else {
|
||||
destformat = GR_TEXFMT_ARGB_8888;
|
||||
destformat = GFX_TEXFMT_ARGB_8888;
|
||||
}
|
||||
#endif
|
||||
if (fmt == 4 && alphabits == 0) {
|
||||
destformat = GR_TEXFMT_ARGB_8888;
|
||||
destformat = GFX_TEXFMT_ARGB_8888;
|
||||
/* Rice I format; I = (R + G + B) / 3 */
|
||||
for (i = 0; i < height * width; i++) {
|
||||
uint32 texel = ((uint32*)tex)[i];
|
||||
uint32 icomp = (((texel >> 16) & 0xff) +
|
||||
((texel >> 8) & 0xff) +
|
||||
((texel)& 0xff)) / 3;
|
||||
((texel) & 0xff)) / 3;
|
||||
((uint32*)tex)[i] = (icomp << 24) | (texel & 0x00ffffff);
|
||||
}
|
||||
}
|
||||
if (intensity) {
|
||||
if (alphabits == 0) {
|
||||
if (fmt == 4) destformat = GR_TEXFMT_ALPHA_8;
|
||||
else destformat = GR_TEXFMT_INTENSITY_8;
|
||||
if (fmt == 4) destformat = GFX_TEXFMT_ALPHA_8;
|
||||
else destformat = GFX_TEXFMT_INTENSITY_8;
|
||||
}
|
||||
else {
|
||||
destformat = GR_TEXFMT_ALPHA_INTENSITY_88;
|
||||
destformat = GFX_TEXFMT_ALPHA_INTENSITY_88;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -684,8 +668,8 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
/*
|
||||
* Rice hi-res textures: end */
|
||||
|
||||
/* XXX: only ARGB8888 for now. comeback to this later... */
|
||||
if (format == GR_TEXFMT_ARGB_8888) {
|
||||
/* XXX: only ARGB8888 for now. comeback to this later... */
|
||||
if (format == GFX_TEXFMT_ARGB_8888) {
|
||||
#if TEXTURE_TILING
|
||||
|
||||
/* Glide64 style texture tiling */
|
||||
|
@ -695,136 +679,136 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
/* NOTE: we skip this for palette textures that need minification
|
||||
* becasue it will look ugly. */
|
||||
|
||||
/* minification */
|
||||
{
|
||||
int ratio = 1;
|
||||
/* minification */
|
||||
{
|
||||
int ratio = 1;
|
||||
|
||||
/* minification to enable glide64 style texture tiling */
|
||||
/* determine the minification ratio to tile the texture into 256x256 size */
|
||||
if ((_options & TILE_HIRESTEX) && _maxwidth >= 256 && _maxheight >= 256) {
|
||||
DBG_INFO(80, "determine minification ratio to tile\n");
|
||||
tmpwidth = width;
|
||||
tmpheight = height;
|
||||
if (height > 256) {
|
||||
ratio = ((height - 1) >> 8) + 1;
|
||||
tmpwidth = width / ratio;
|
||||
tmpheight = height / ratio;
|
||||
DBG_INFO(80, "height > 256, minification ratio:%d %d x %d -> %d x %d\n",
|
||||
ratio, width, height, tmpwidth, tmpheight);
|
||||
}
|
||||
if (tmpwidth > 256 && (((tmpwidth - 1) >> 8) + 1) * tmpheight > 256) {
|
||||
ratio *= ((((((tmpwidth - 1) >> 8) + 1) * tmpheight) - 1) >> 8) + 1;
|
||||
DBG_INFO(80, "width > 256, minification ratio:%d %d x %d -> %d x %d\n",
|
||||
ratio, width, height, width / ratio, height / ratio);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* normal minification to fit max texture size */
|
||||
if (width > _maxwidth || height > _maxheight) {
|
||||
DBG_INFO(80, "determine minification ratio to fit max texture size\n");
|
||||
tmpwidth = width;
|
||||
tmpheight = height;
|
||||
while (tmpwidth > _maxwidth) {
|
||||
tmpheight >>= 1;
|
||||
tmpwidth >>= 1;
|
||||
ratio <<= 1;
|
||||
}
|
||||
while (tmpheight > _maxheight) {
|
||||
tmpheight >>= 1;
|
||||
tmpwidth >>= 1;
|
||||
ratio <<= 1;
|
||||
}
|
||||
DBG_INFO(80, "minification ratio:%d %d x %d -> %d x %d\n",
|
||||
ratio, width, height, tmpwidth, tmpheight);
|
||||
}
|
||||
}
|
||||
/* minification to enable glide64 style texture tiling */
|
||||
/* determine the minification ratio to tile the texture into 256x256 size */
|
||||
if ((_options & TILE_HIRESTEX) && _maxwidth >= 256 && _maxheight >= 256) {
|
||||
DBG_INFO(80, "determine minification ratio to tile\n");
|
||||
tmpwidth = width;
|
||||
tmpheight = height;
|
||||
if (height > 256) {
|
||||
ratio = ((height - 1) >> 8) + 1;
|
||||
tmpwidth = width / ratio;
|
||||
tmpheight = height / ratio;
|
||||
DBG_INFO(80, "height > 256, minification ratio:%d %d x %d -> %d x %d\n",
|
||||
ratio, width, height, tmpwidth, tmpheight);
|
||||
}
|
||||
if (tmpwidth > 256 && (((tmpwidth - 1) >> 8) + 1) * tmpheight > 256) {
|
||||
ratio *= ((((((tmpwidth - 1) >> 8) + 1) * tmpheight) - 1) >> 8) + 1;
|
||||
DBG_INFO(80, "width > 256, minification ratio:%d %d x %d -> %d x %d\n",
|
||||
ratio, width, height, width / ratio, height / ratio);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* normal minification to fit max texture size */
|
||||
if (width > _maxwidth || height > _maxheight) {
|
||||
DBG_INFO(80, "determine minification ratio to fit max texture size\n");
|
||||
tmpwidth = width;
|
||||
tmpheight = height;
|
||||
while (tmpwidth > _maxwidth) {
|
||||
tmpheight >>= 1;
|
||||
tmpwidth >>= 1;
|
||||
ratio <<= 1;
|
||||
}
|
||||
while (tmpheight > _maxheight) {
|
||||
tmpheight >>= 1;
|
||||
tmpwidth >>= 1;
|
||||
ratio <<= 1;
|
||||
}
|
||||
DBG_INFO(80, "minification ratio:%d %d x %d -> %d x %d\n",
|
||||
ratio, width, height, tmpwidth, tmpheight);
|
||||
}
|
||||
}
|
||||
|
||||
if (ratio > 1) {
|
||||
if (!_txReSample->minify(&tex, &width, &height, ratio)) {
|
||||
free(tex);
|
||||
tex = NULL;
|
||||
DBG_INFO(80, "Error: minification failed!\n");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ratio > 1) {
|
||||
if (!_txReSample->minify(&tex, &width, &height, ratio)) {
|
||||
free(tex);
|
||||
tex = NULL;
|
||||
DBG_INFO(80, "Error: minification failed!\n");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* tiling */
|
||||
if ((_options & TILE_HIRESTEX) && _maxwidth >= 256 && _maxheight >= 256) {
|
||||
boolean usetile = 0;
|
||||
/* tiling */
|
||||
if ((_options & TILE_HIRESTEX) && _maxwidth >= 256 && _maxheight >= 256) {
|
||||
bool usetile = 0;
|
||||
|
||||
/* to tile or not to tile, that is the question */
|
||||
if (width > 256 && height <= 128 && (((width - 1) >> 8) + 1) * height <= 256) {
|
||||
if (width > _maxwidth) usetile = 1;
|
||||
else {
|
||||
/* tile if the tiled texture memory footprint is smaller */
|
||||
int tilewidth = 256;
|
||||
int tileheight = _txReSample->nextPow2((((width - 1) >> 8) + 1) * height);
|
||||
tmpwidth = width;
|
||||
tmpheight = height;
|
||||
/* to tile or not to tile, that is the question */
|
||||
if (width > 256 && height <= 128 && (((width - 1) >> 8) + 1) * height <= 256) {
|
||||
if (width > _maxwidth) usetile = 1;
|
||||
else {
|
||||
/* tile if the tiled texture memory footprint is smaller */
|
||||
int tilewidth = 256;
|
||||
int tileheight = _txReSample->nextPow2((((width - 1) >> 8) + 1) * height);
|
||||
tmpwidth = width;
|
||||
tmpheight = height;
|
||||
|
||||
/* 3dfx Glide3 tmpheight, W:H aspect ratio range (8:1 - 1:8) */
|
||||
if (tilewidth > (tileheight << 3)) tileheight = tilewidth >> 3;
|
||||
/* 3dfx Glide3 tmpheight, W:H aspect ratio range (8:1 - 1:8) */
|
||||
if (tilewidth > (tileheight << 3)) tileheight = tilewidth >> 3;
|
||||
|
||||
/* HACKALERT: see TxReSample::pow2(); */
|
||||
if (tmpwidth > 64) tmpwidth -= 4;
|
||||
else if (tmpwidth > 16) tmpwidth -= 2;
|
||||
else if (tmpwidth > 4) tmpwidth -= 1;
|
||||
/* HACKALERT: see TxReSample::pow2(); */
|
||||
if (tmpwidth > 64) tmpwidth -= 4;
|
||||
else if (tmpwidth > 16) tmpwidth -= 2;
|
||||
else if (tmpwidth > 4) tmpwidth -= 1;
|
||||
|
||||
if (tmpheight > 64) tmpheight -= 4;
|
||||
else if (tmpheight > 16) tmpheight -= 2;
|
||||
else if (tmpheight > 4) tmpheight -= 1;
|
||||
if (tmpheight > 64) tmpheight -= 4;
|
||||
else if (tmpheight > 16) tmpheight -= 2;
|
||||
else if (tmpheight > 4) tmpheight -= 1;
|
||||
|
||||
tmpwidth = _txReSample->nextPow2(tmpwidth);
|
||||
tmpheight = _txReSample->nextPow2(tmpheight);
|
||||
tmpwidth = _txReSample->nextPow2(tmpwidth);
|
||||
tmpheight = _txReSample->nextPow2(tmpheight);
|
||||
|
||||
/* 3dfx Glide3 tmpheight, W:H aspect ratio range (8:1 - 1:8) */
|
||||
if (tmpwidth > tmpheight) {
|
||||
if (tmpwidth > (tmpheight << 3)) tmpheight = tmpwidth >> 3;
|
||||
}
|
||||
else {
|
||||
if (tmpheight > (tmpwidth << 3)) tmpwidth = tmpheight >> 3;
|
||||
}
|
||||
/* 3dfx Glide3 tmpheight, W:H aspect ratio range (8:1 - 1:8) */
|
||||
if (tmpwidth > tmpheight) {
|
||||
if (tmpwidth > (tmpheight << 3)) tmpheight = tmpwidth >> 3;
|
||||
}
|
||||
else {
|
||||
if (tmpheight > (tmpwidth << 3)) tmpwidth = tmpheight >> 3;
|
||||
}
|
||||
|
||||
usetile = (tilewidth * tileheight < tmpwidth * tmpheight);
|
||||
}
|
||||
}
|
||||
usetile = (tilewidth * tileheight < tmpwidth * tmpheight);
|
||||
}
|
||||
}
|
||||
|
||||
/* tile it! do the actual tiling into 256x256 size */
|
||||
if (usetile) {
|
||||
DBG_INFO(80, "Glide64 style texture tiling\n");
|
||||
/* tile it! do the actual tiling into 256x256 size */
|
||||
if (usetile) {
|
||||
DBG_INFO(80, "Glide64 style texture tiling\n");
|
||||
|
||||
int x, y, z, ratio, offset;
|
||||
offset = 0;
|
||||
ratio = ((width - 1) >> 8) + 1;
|
||||
tmptex = (uint8 *)malloc(_txUtil->sizeofTx(256, height * ratio, format));
|
||||
if (tmptex) {
|
||||
for (x = 0; x < ratio; x++) {
|
||||
for (y = 0; y < height; y++) {
|
||||
if (x < ratio - 1) {
|
||||
memcpy(&tmptex[offset << 2], &tex[(x * 256 + y * width) << 2], 256 << 2);
|
||||
}
|
||||
else {
|
||||
for (z = 0; z < width - 256 * (ratio - 1); z++) {
|
||||
((uint32*)tmptex)[offset + z] = ((uint32*)tex)[x * 256 + y * width + z];
|
||||
}
|
||||
for (; z < 256; z++) {
|
||||
((uint32*)tmptex)[offset + z] = ((uint32*)tmptex)[offset + z - 1];
|
||||
}
|
||||
}
|
||||
offset += 256;
|
||||
}
|
||||
}
|
||||
free(tex);
|
||||
tex = tmptex;
|
||||
untiled_width = width;
|
||||
untiled_height = height;
|
||||
width = 256;
|
||||
height *= ratio;
|
||||
DBG_INFO(80, "Tiled: %d x %d -> %d x %d\n", untiled_width, untiled_height, width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
int x, y, z, ratio, offset;
|
||||
offset = 0;
|
||||
ratio = ((width - 1) >> 8) + 1;
|
||||
tmptex = (uint8 *)malloc(_txUtil->sizeofTx(256, height * ratio, format));
|
||||
if (tmptex) {
|
||||
for (x = 0; x < ratio; x++) {
|
||||
for (y = 0; y < height; y++) {
|
||||
if (x < ratio - 1) {
|
||||
memcpy(&tmptex[offset << 2], &tex[(x * 256 + y * width) << 2], 256 << 2);
|
||||
}
|
||||
else {
|
||||
for (z = 0; z < width - 256 * (ratio - 1); z++) {
|
||||
((uint32*)tmptex)[offset + z] = ((uint32*)tex)[x * 256 + y * width + z];
|
||||
}
|
||||
for (; z < 256; z++) {
|
||||
((uint32*)tmptex)[offset + z] = ((uint32*)tmptex)[offset + z - 1];
|
||||
}
|
||||
}
|
||||
offset += 256;
|
||||
}
|
||||
}
|
||||
free(tex);
|
||||
tex = tmptex;
|
||||
untiled_width = width;
|
||||
untiled_height = height;
|
||||
width = 256;
|
||||
height *= ratio;
|
||||
DBG_INFO(80, "Tiled: %d x %d -> %d x %d\n", untiled_width, untiled_height, width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#else /* TEXTURE_TILING */
|
||||
|
||||
|
@ -833,7 +817,8 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
int ratio = 1;
|
||||
if (width / _maxwidth > height / _maxheight) {
|
||||
ratio = (int)ceil((double)width / _maxwidth);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ratio = (int)ceil((double)height / _maxheight);
|
||||
}
|
||||
if (!_txReSample->minify(&tex, &width, &height, ratio)) {
|
||||
|
@ -858,7 +843,7 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
*
|
||||
* NOTE: texture size must be checked before expanding to pow2 size.
|
||||
*/
|
||||
) {
|
||||
) {
|
||||
int dataSize = 0;
|
||||
int compressionType = _options & COMPRESSION_MASK;
|
||||
|
||||
|
@ -880,40 +865,40 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
switch (_options & COMPRESSION_MASK) {
|
||||
case S3TC_COMPRESSION:
|
||||
switch (destformat) {
|
||||
case GR_TEXFMT_ARGB_8888:
|
||||
case GFX_TEXFMT_ARGB_8888:
|
||||
#if GLIDE64_DXTN
|
||||
case GR_TEXFMT_ARGB_1555: /* for ARGB1555 use DXT5 instead of DXT1 */
|
||||
case GFX_TEXFMT_ARGB_1555: /* for ARGB1555 use DXT5 instead of DXT1 */
|
||||
#endif
|
||||
case GR_TEXFMT_ALPHA_INTENSITY_88:
|
||||
case GFX_TEXFMT_ALPHA_INTENSITY_88:
|
||||
dataSize = width * height;
|
||||
break;
|
||||
#if !GLIDE64_DXTN
|
||||
case GR_TEXFMT_ARGB_1555:
|
||||
case GFX_TEXFMT_ARGB_1555:
|
||||
#endif
|
||||
case GR_TEXFMT_RGB_565:
|
||||
case GR_TEXFMT_INTENSITY_8:
|
||||
case GFX_TEXFMT_RGB_565:
|
||||
case GFX_TEXFMT_INTENSITY_8:
|
||||
dataSize = (width * height) >> 1;
|
||||
break;
|
||||
case GR_TEXFMT_ALPHA_8: /* no size benefit with dxtn */
|
||||
case GFX_TEXFMT_ALPHA_8: /* no size benefit with dxtn */
|
||||
;
|
||||
}
|
||||
break;
|
||||
case FXT1_COMPRESSION:
|
||||
switch (destformat) {
|
||||
case GR_TEXFMT_ARGB_1555:
|
||||
case GR_TEXFMT_RGB_565:
|
||||
case GR_TEXFMT_INTENSITY_8:
|
||||
case GFX_TEXFMT_ARGB_1555:
|
||||
case GFX_TEXFMT_RGB_565:
|
||||
case GFX_TEXFMT_INTENSITY_8:
|
||||
dataSize = (width * height) >> 1;
|
||||
break;
|
||||
/* XXX: textures that use 8bit alpha channel look bad with the current
|
||||
* fxt1 library, so we substitute it with dxtn for now. afaik all gfx
|
||||
* cards that support fxt1 also support dxtn. (3dfx and Intel) */
|
||||
case GR_TEXFMT_ALPHA_INTENSITY_88:
|
||||
case GR_TEXFMT_ARGB_8888:
|
||||
case GFX_TEXFMT_ALPHA_INTENSITY_88:
|
||||
case GFX_TEXFMT_ARGB_8888:
|
||||
compressionType = S3TC_COMPRESSION;
|
||||
dataSize = width * height;
|
||||
break;
|
||||
case GR_TEXFMT_ALPHA_8: /* no size benefit with dxtn */
|
||||
case GFX_TEXFMT_ALPHA_8: /* no size benefit with dxtn */
|
||||
;
|
||||
}
|
||||
}
|
||||
|
@ -922,8 +907,8 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
#if 0 /* TEST: dither before compression for better results with gradients */
|
||||
tmptex = (uint8 *)malloc(_txUtil->sizeofTx(width, height, destformat));
|
||||
if (tmptex) {
|
||||
if (_txQuantize->quantize(tex, tmptex, width, height, GR_TEXFMT_ARGB_8888, destformat, 0))
|
||||
_txQuantize->quantize(tmptex, tex, width, height, destformat, GR_TEXFMT_ARGB_8888, 0);
|
||||
if (_txQuantize->quantize(tex, tmptex, width, height, GFX_TEXFMT_ARGB_8888, destformat, 0))
|
||||
_txQuantize->quantize(tmptex, tex, width, height, destformat, GFX_TEXFMT_ARGB_8888, 0);
|
||||
free(tmptex);
|
||||
}
|
||||
#endif
|
||||
|
@ -963,50 +948,50 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
}
|
||||
|
||||
/* quantize */
|
||||
{
|
||||
tmptex = (uint8 *)malloc(_txUtil->sizeofTx(width, height, destformat));
|
||||
if (tmptex) {
|
||||
switch (destformat) {
|
||||
case GR_TEXFMT_ARGB_8888:
|
||||
case GR_TEXFMT_ARGB_4444:
|
||||
{
|
||||
tmptex = (uint8 *)malloc(_txUtil->sizeofTx(width, height, destformat));
|
||||
if (tmptex) {
|
||||
switch (destformat) {
|
||||
case GFX_TEXFMT_ARGB_8888:
|
||||
case GFX_TEXFMT_ARGB_4444:
|
||||
#if !REDUCE_TEXTURE_FOOTPRINT
|
||||
if (_maxbpp < 32 || _options & FORCE16BPP_HIRESTEX)
|
||||
if (_maxbpp < 32 || _options & FORCE16BPP_HIRESTEX)
|
||||
#endif
|
||||
destformat = GR_TEXFMT_ARGB_4444;
|
||||
break;
|
||||
case GR_TEXFMT_ARGB_1555:
|
||||
destformat = GFX_TEXFMT_ARGB_4444;
|
||||
break;
|
||||
case GFX_TEXFMT_ARGB_1555:
|
||||
#if !REDUCE_TEXTURE_FOOTPRINT
|
||||
if (_maxbpp < 32 || _options & FORCE16BPP_HIRESTEX)
|
||||
if (_maxbpp < 32 || _options & FORCE16BPP_HIRESTEX)
|
||||
#endif
|
||||
destformat = GR_TEXFMT_ARGB_1555;
|
||||
break;
|
||||
case GR_TEXFMT_RGB_565:
|
||||
destformat = GFX_TEXFMT_ARGB_1555;
|
||||
break;
|
||||
case GFX_TEXFMT_RGB_565:
|
||||
#if !REDUCE_TEXTURE_FOOTPRINT
|
||||
if (_maxbpp < 32 || _options & FORCE16BPP_HIRESTEX)
|
||||
if (_maxbpp < 32 || _options & FORCE16BPP_HIRESTEX)
|
||||
#endif
|
||||
destformat = GR_TEXFMT_RGB_565;
|
||||
break;
|
||||
case GR_TEXFMT_ALPHA_INTENSITY_88:
|
||||
case GR_TEXFMT_ALPHA_INTENSITY_44:
|
||||
destformat = GFX_TEXFMT_RGB_565;
|
||||
break;
|
||||
case GFX_TEXFMT_ALPHA_INTENSITY_88:
|
||||
case GFX_TEXFMT_ALPHA_INTENSITY_44:
|
||||
#if !REDUCE_TEXTURE_FOOTPRINT
|
||||
destformat = GR_TEXFMT_ALPHA_INTENSITY_88;
|
||||
destformat = GFX_TEXFMT_ALPHA_INTENSITY_88;
|
||||
#else
|
||||
destformat = GR_TEXFMT_ALPHA_INTENSITY_44;
|
||||
destformat = GFX_TEXFMT_ALPHA_INTENSITY_44;
|
||||
#endif
|
||||
break;
|
||||
case GR_TEXFMT_ALPHA_8:
|
||||
destformat = GR_TEXFMT_ALPHA_8; /* yes, this is correct. ALPHA_8 instead of INTENSITY_8 */
|
||||
break;
|
||||
case GR_TEXFMT_INTENSITY_8:
|
||||
destformat = GR_TEXFMT_INTENSITY_8;
|
||||
}
|
||||
if (_txQuantize->quantize(tex, tmptex, width, height, GR_TEXFMT_ARGB_8888, destformat, 0)) {
|
||||
format = destformat;
|
||||
free(tex);
|
||||
tex = tmptex;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GFX_TEXFMT_ALPHA_8:
|
||||
destformat = GFX_TEXFMT_ALPHA_8; /* yes, this is correct. ALPHA_8 instead of INTENSITY_8 */
|
||||
break;
|
||||
case GFX_TEXFMT_INTENSITY_8:
|
||||
destformat = GFX_TEXFMT_INTENSITY_8;
|
||||
}
|
||||
if (_txQuantize->quantize(tex, tmptex, width, height, GFX_TEXFMT_ARGB_8888, destformat, 0)) {
|
||||
format = destformat;
|
||||
free(tex);
|
||||
tex = tmptex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* last minute validations */
|
||||
|
@ -1029,9 +1014,9 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
|
||||
/* load it into hires texture cache. */
|
||||
{
|
||||
uint64 chksum64 = (uint64)palchksum;
|
||||
uint64_t chksum64 = (uint64_t)palchksum;
|
||||
chksum64 <<= 32;
|
||||
chksum64 |= (uint64)chksum;
|
||||
chksum64 |= (uint64_t)chksum;
|
||||
|
||||
GHQTexInfo tmpInfo;
|
||||
memset(&tmpInfo, 0, sizeof(GHQTexInfo));
|
||||
|
@ -1047,7 +1032,8 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
|
||||
#if TEXTURE_TILING
|
||||
/* Glide64 style texture tiling. */
|
||||
if (untiled_width && untiled_height) {
|
||||
if (untiled_width && untiled_height)
|
||||
{
|
||||
tmpInfo.tiles = ((untiled_width - 1) >> 8) + 1;
|
||||
tmpInfo.untiled_width = untiled_width;
|
||||
tmpInfo.untiled_height = untiled_height;
|
||||
|
@ -1055,17 +1041,20 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
#endif
|
||||
|
||||
/* remove redundant in cache */
|
||||
if (replace && TxCache::del(chksum64)) {
|
||||
if (replace && TxCache::del(chksum64))
|
||||
{
|
||||
DBG_INFO(80, "removed duplicate old cache.\n");
|
||||
}
|
||||
|
||||
/* add to cache */
|
||||
if (TxCache::add(chksum64, &tmpInfo)) {
|
||||
if (TxCache::add(chksum64, &tmpInfo))
|
||||
{
|
||||
/* Callback to display hires texture info.
|
||||
* Gonetz <gonetz(at)ngs.ru> */
|
||||
if (_callback) {
|
||||
wchar_t tmpbuf[MAX_PATH];
|
||||
mbstowcs(tmpbuf, fname, MAX_PATH);
|
||||
if (_callback)
|
||||
{
|
||||
wchar_t tmpbuf[260];
|
||||
mbstowcs(tmpbuf, fname, 260);
|
||||
(*_callback)("[%d] total mem:%.2fmb - %ls\n", _cache.size(), (float)_totalSize / 1000000, tmpbuf);
|
||||
}
|
||||
DBG_INFO(80, "texture loaded!\n");
|
||||
|
@ -1076,4 +1065,4 @@ boolean TxHiResCache::loadHiResTextures(const char * dir_path, boolean replace)
|
|||
}
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
}
|
|
@ -1,25 +1,16 @@
|
|||
/*
|
||||
* Texture Filtering
|
||||
* Version: 1.0
|
||||
*
|
||||
* Copyright (C) 2007 Hiroshi Morii All Rights Reserved.
|
||||
* Email koolsmoky(at)users.sourceforge.net
|
||||
* Web http://www.3dfxzone.it/koolsmoky
|
||||
*
|
||||
* this 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 Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* this 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 GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2007 Hiroshi Morii *
|
||||
* Copyright (C) 2003 Rice1964 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __TXHIRESCACHE_H__
|
||||
#define __TXHIRESCACHE_H__
|
||||
|
@ -41,19 +32,19 @@ private:
|
|||
int _maxwidth;
|
||||
int _maxheight;
|
||||
int _maxbpp;
|
||||
boolean _haveCache;
|
||||
boolean _abortLoad;
|
||||
bool _haveCache;
|
||||
bool _abortLoad;
|
||||
TxImage *_txImage;
|
||||
TxQuantize *_txQuantize;
|
||||
TxReSample *_txReSample;
|
||||
boolean loadHiResTextures(const char * dir_path, boolean replace);
|
||||
bool loadHiResTextures(const char * dir_path, bool replace);
|
||||
public:
|
||||
~TxHiResCache();
|
||||
TxHiResCache(int maxwidth, int maxheight, int maxbpp, int options,
|
||||
const char *path, const char *ident,
|
||||
dispInfoFuncExt callback);
|
||||
boolean empty();
|
||||
boolean load(boolean replace);
|
||||
bool empty();
|
||||
bool load(bool replace);
|
||||
};
|
||||
|
||||
#endif /* __TXHIRESCACHE_H__ */
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,25 +1,16 @@
|
|||
/*
|
||||
* Texture Filtering
|
||||
* Version: 1.0
|
||||
*
|
||||
* Copyright (C) 2007 Hiroshi Morii All Rights Reserved.
|
||||
* Email koolsmoky(at)users.sourceforge.net
|
||||
* Web http://www.3dfxzone.it/koolsmoky
|
||||
*
|
||||
* this 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 Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* this 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 GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2007 Hiroshi Morii *
|
||||
* Copyright (C) 2003 Rice1964 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __TXIMAGE_H__
|
||||
#define __TXIMAGE_H__
|
||||
|
@ -28,32 +19,27 @@
|
|||
#include <png/png.h>
|
||||
#include "TxInternal.h"
|
||||
|
||||
#ifndef WIN32
|
||||
typedef struct tagBITMAPFILEHEADER {
|
||||
unsigned short bfType;
|
||||
unsigned long bfSize;
|
||||
unsigned short bfReserved1;
|
||||
unsigned short bfReserved2;
|
||||
unsigned long bfOffBits;
|
||||
unsigned short bfType;
|
||||
unsigned long bfSize;
|
||||
unsigned short bfReserved1;
|
||||
unsigned short bfReserved2;
|
||||
unsigned long bfOffBits;
|
||||
} BITMAPFILEHEADER;
|
||||
|
||||
typedef struct tagBITMAPINFOHEADER {
|
||||
unsigned long biSize;
|
||||
long biWidth;
|
||||
long biHeight;
|
||||
unsigned short biPlanes;
|
||||
unsigned short biBitCount;
|
||||
unsigned long biCompression;
|
||||
unsigned long biSizeImage;
|
||||
long biXPelsPerMeter;
|
||||
long biYPelsPerMeter;
|
||||
unsigned long biClrUsed;
|
||||
unsigned long biClrImportant;
|
||||
unsigned long biSize;
|
||||
long biWidth;
|
||||
long biHeight;
|
||||
unsigned short biPlanes;
|
||||
unsigned short biBitCount;
|
||||
unsigned long biCompression;
|
||||
unsigned long biSizeImage;
|
||||
long biXPelsPerMeter;
|
||||
long biYPelsPerMeter;
|
||||
unsigned long biClrUsed;
|
||||
unsigned long biClrImportant;
|
||||
} BITMAPINFOHEADER;
|
||||
#else
|
||||
typedef struct tagBITMAPFILEHEADER BITMAPFILEHEADER;
|
||||
typedef struct tagBITMAPINFOHEADER BITMAPINFOHEADER;
|
||||
#endif
|
||||
|
||||
#define DDSD_CAPS 0x00000001
|
||||
#define DDSD_HEIGHT 0x00000002
|
||||
|
@ -73,44 +59,44 @@ typedef struct tagBITMAPINFOHEADER BITMAPINFOHEADER;
|
|||
#define DDSCAPS_MIPMAP 0x00400000
|
||||
|
||||
typedef struct tagDDSPIXELFORMAT {
|
||||
unsigned long dwSize;
|
||||
unsigned long dwFlags;
|
||||
unsigned long dwFourCC;
|
||||
unsigned long dwRGBBitCount;
|
||||
unsigned long dwRBitMask;
|
||||
unsigned long dwGBitMask;
|
||||
unsigned long dwBBitMask;
|
||||
unsigned long dwRGBAlphaBitMask;
|
||||
unsigned long dwSize;
|
||||
unsigned long dwFlags;
|
||||
unsigned long dwFourCC;
|
||||
unsigned long dwRGBBitCount;
|
||||
unsigned long dwRBitMask;
|
||||
unsigned long dwGBitMask;
|
||||
unsigned long dwBBitMask;
|
||||
unsigned long dwRGBAlphaBitMask;
|
||||
} DDSPIXELFORMAT;
|
||||
|
||||
typedef struct tagDDSFILEHEADER {
|
||||
unsigned long dwMagic;
|
||||
unsigned long dwSize;
|
||||
unsigned long dwFlags;
|
||||
unsigned long dwHeight;
|
||||
unsigned long dwWidth;
|
||||
unsigned long dwLinearSize;
|
||||
unsigned long dwDepth;
|
||||
unsigned long dwMipMapCount;
|
||||
unsigned long dwReserved1[11];
|
||||
DDSPIXELFORMAT ddpf;
|
||||
unsigned long dwCaps1;
|
||||
unsigned long dwCaps2;
|
||||
unsigned long dwMagic;
|
||||
unsigned long dwSize;
|
||||
unsigned long dwFlags;
|
||||
unsigned long dwHeight;
|
||||
unsigned long dwWidth;
|
||||
unsigned long dwLinearSize;
|
||||
unsigned long dwDepth;
|
||||
unsigned long dwMipMapCount;
|
||||
unsigned long dwReserved1[11];
|
||||
DDSPIXELFORMAT ddpf;
|
||||
unsigned long dwCaps1;
|
||||
unsigned long dwCaps2;
|
||||
} DDSFILEHEADER;
|
||||
|
||||
class TxImage
|
||||
{
|
||||
private:
|
||||
boolean getPNGInfo(FILE *fp, png_structp *png_ptr, png_infop *info_ptr);
|
||||
boolean getBMPInfo(FILE *fp, BITMAPFILEHEADER *bmp_fhdr, BITMAPINFOHEADER *bmp_ihdr);
|
||||
boolean getDDSInfo(FILE *fp, DDSFILEHEADER *dds_fhdr);
|
||||
bool getPNGInfo(FILE *fp, png_structp *png_ptr, png_infop *info_ptr);
|
||||
bool getBMPInfo(FILE *fp, BITMAPFILEHEADER *bmp_fhdr, BITMAPINFOHEADER *bmp_ihdr);
|
||||
bool getDDSInfo(FILE *fp, DDSFILEHEADER *dds_fhdr);
|
||||
public:
|
||||
TxImage() {}
|
||||
~TxImage() {}
|
||||
uint8* readPNG(FILE* fp, int* width, int* height, uint16* format);
|
||||
boolean writePNG(uint8* src, FILE* fp, int width, int height, int rowStride, uint16 format, uint8 *palette);
|
||||
uint8* readBMP(FILE* fp, int* width, int* height, uint16* format);
|
||||
uint8* readDDS(FILE* fp, int* width, int* height, uint16* format);
|
||||
TxImage() {}
|
||||
~TxImage() {}
|
||||
uint8* readPNG(FILE* fp, int* width, int* height, uint16* format);
|
||||
bool writePNG(uint8* src, FILE* fp, int width, int height, int rowStride, uint16 format, uint8 *palette);
|
||||
uint8* readBMP(FILE* fp, int* width, int* height, uint16* format);
|
||||
uint8* readDDS(FILE* fp, int* width, int* height, uint16* format);
|
||||
};
|
||||
|
||||
#endif /* __TXIMAGE_H__ */
|
||||
|
|
|
@ -1,25 +1,16 @@
|
|||
/*
|
||||
* Texture Filtering
|
||||
* Version: 1.0
|
||||
*
|
||||
* Copyright (C) 2007 Hiroshi Morii All Rights Reserved.
|
||||
* Email koolsmoky(at)users.sourceforge.net
|
||||
* Web http://www.3dfxzone.it/koolsmoky
|
||||
*
|
||||
* this 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 Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* this 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 GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2007 Hiroshi Morii *
|
||||
* Copyright (C) 2003 Rice1964 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __INTERNAL_H__
|
||||
#define __INTERNAL_H__
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,25 +1,16 @@
|
|||
/*
|
||||
* Texture Filtering
|
||||
* Version: 1.0
|
||||
*
|
||||
* Copyright (C) 2007 Hiroshi Morii All Rights Reserved.
|
||||
* Email koolsmoky(at)users.sourceforge.net
|
||||
* Web http://www.3dfxzone.it/koolsmoky
|
||||
*
|
||||
* this 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 Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* this 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 GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2007 Hiroshi Morii *
|
||||
* Copyright (C) 2003 Rice1964 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __TXQUANTIZE_H__
|
||||
#define __TXQUANTIZE_H__
|
||||
|
@ -34,65 +25,64 @@
|
|||
class TxQuantize
|
||||
{
|
||||
private:
|
||||
TxUtil *_txUtil;
|
||||
int _numcore;
|
||||
TxUtil *_txUtil;
|
||||
int _numcore;
|
||||
|
||||
fxtCompressTexFuncExt _tx_compress_fxt1;
|
||||
dxtCompressTexFuncExt _tx_compress_dxtn;
|
||||
fxtCompressTexFuncExt _tx_compress_fxt1;
|
||||
dxtCompressTexFuncExt _tx_compress_dxtn;
|
||||
|
||||
/* fast optimized... well, sort of. */
|
||||
void ARGB1555_ARGB8888(uint32* src, uint32* dst, int width, int height);
|
||||
void ARGB4444_ARGB8888(uint32* src, uint32* dst, int width, int height);
|
||||
void RGB565_ARGB8888(uint32* src, uint32* dst, int width, int height);
|
||||
void A8_ARGB8888(uint32* src, uint32* dst, int width, int height);
|
||||
void AI44_ARGB8888(uint32* src, uint32* dst, int width, int height);
|
||||
void AI88_ARGB8888(uint32* src, uint32* dst, int width, int height);
|
||||
/* fast optimized... well, sort of. */
|
||||
void ARGB1555_ARGB8888(uint32* src, uint32* dst, int width, int height);
|
||||
void ARGB4444_ARGB8888(uint32* src, uint32* dst, int width, int height);
|
||||
void RGB565_ARGB8888(uint32* src, uint32* dst, int width, int height);
|
||||
void A8_ARGB8888(uint32* src, uint32* dst, int width, int height);
|
||||
void AI44_ARGB8888(uint32* src, uint32* dst, int width, int height);
|
||||
void AI88_ARGB8888(uint32* src, uint32* dst, int width, int height);
|
||||
|
||||
void ARGB8888_ARGB1555(uint32* src, uint32* dst, int width, int height);
|
||||
void ARGB8888_ARGB4444(uint32* src, uint32* dst, int width, int height);
|
||||
void ARGB8888_RGB565(uint32* src, uint32* dst, int width, int height);
|
||||
void ARGB8888_A8(uint32* src, uint32* dst, int width, int height);
|
||||
void ARGB8888_AI44(uint32* src, uint32* dst, int width, int height);
|
||||
void ARGB8888_AI88(uint32* src, uint32* dst, int width, int height);
|
||||
void ARGB8888_ARGB1555(uint32* src, uint32* dst, int width, int height);
|
||||
void ARGB8888_ARGB4444(uint32* src, uint32* dst, int width, int height);
|
||||
void ARGB8888_RGB565(uint32* src, uint32* dst, int width, int height);
|
||||
void ARGB8888_A8(uint32* src, uint32* dst, int width, int height);
|
||||
void ARGB8888_AI44(uint32* src, uint32* dst, int width, int height);
|
||||
void ARGB8888_AI88(uint32* src, uint32* dst, int width, int height);
|
||||
|
||||
/* quality */
|
||||
void ARGB8888_RGB565_ErrD(uint32* src, uint32* dst, int width, int height);
|
||||
void ARGB8888_ARGB1555_ErrD(uint32* src, uint32* dst, int width, int height);
|
||||
void ARGB8888_ARGB4444_ErrD(uint32* src, uint32* dst, int width, int height);
|
||||
void ARGB8888_AI44_ErrD(uint32* src, uint32* dst, int width, int height);
|
||||
void ARGB8888_AI88_Slow(uint32* src, uint32* dst, int width, int height);
|
||||
void ARGB8888_I8_Slow(uint32* src, uint32* dst, int width, int height);
|
||||
/* quality */
|
||||
void ARGB8888_RGB565_ErrD(uint32* src, uint32* dst, int width, int height);
|
||||
void ARGB8888_ARGB1555_ErrD(uint32* src, uint32* dst, int width, int height);
|
||||
void ARGB8888_ARGB4444_ErrD(uint32* src, uint32* dst, int width, int height);
|
||||
void ARGB8888_AI44_ErrD(uint32* src, uint32* dst, int width, int height);
|
||||
void ARGB8888_AI88_Slow(uint32* src, uint32* dst, int width, int height);
|
||||
void ARGB8888_I8_Slow(uint32* src, uint32* dst, int width, int height);
|
||||
|
||||
/* compressors */
|
||||
boolean FXT1(uint8 *src, uint8 *dest,
|
||||
int srcwidth, int srcheight, uint16 srcformat,
|
||||
int *destwidth, int *destheight, uint16 *destformat);
|
||||
boolean DXTn(uint8 *src, uint8 *dest,
|
||||
int srcwidth, int srcheight, uint16 srcformat,
|
||||
int *destwidth, int *destheight, uint16 *destformat);
|
||||
/* compressors */
|
||||
bool FXT1(uint8 *src, uint8 *dest,
|
||||
int srcwidth, int srcheight, uint16 srcformat,
|
||||
int *destwidth, int *destheight, uint16 *destformat);
|
||||
bool DXTn(uint8 *src, uint8 *dest,
|
||||
int srcwidth, int srcheight, uint16 srcformat,
|
||||
int *destwidth, int *destheight, uint16 *destformat);
|
||||
|
||||
public:
|
||||
TxQuantize();
|
||||
~TxQuantize();
|
||||
TxQuantize();
|
||||
~TxQuantize();
|
||||
|
||||
/* others */
|
||||
void P8_16BPP(uint32* src, uint32* dst, int width, int height, uint32* palette);
|
||||
/* others */
|
||||
void P8_16BPP(uint32* src, uint32* dst, int width, int height, uint32* palette);
|
||||
|
||||
boolean quantize(uint8* src, uint8* dest, int width, int height, uint16 srcformat, uint16 destformat, boolean fastQuantizer = 1);
|
||||
|
||||
boolean compress(uint8 *src, uint8 *dest,
|
||||
int srcwidth, int srcheight, uint16 srcformat,
|
||||
int *destwidth, int *destheight, uint16 *destformat,
|
||||
int compressionType);
|
||||
bool quantize(uint8* src, uint8* dest, int width, int height, uint16 srcformat, uint16 destformat, bool fastQuantizer = 1);
|
||||
|
||||
bool compress(uint8 *src, uint8 *dest,
|
||||
int srcwidth, int srcheight, uint16 srcformat,
|
||||
int *destwidth, int *destheight, uint16 *destformat,
|
||||
int compressionType);
|
||||
|
||||
#if 0 /* unused */
|
||||
void ARGB8888_I8(uint32* src, uint32* dst, int width, int height);
|
||||
void I8_ARGB8888(uint32* src, uint32* dst, int width, int height);
|
||||
|
||||
void ARGB1555_ABGR8888(uint32* src, uint32* dst, int width, int height);
|
||||
void ARGB4444_ABGR8888(uint32* src, uint32* dst, int width, int height);
|
||||
void ARGB8888_ABGR8888(uint32* src, uint32* dst, int width, int height);
|
||||
void ARGB8888_I8(uint32* src, uint32* dst, int width, int height);
|
||||
void I8_ARGB8888(uint32* src, uint32* dst, int width, int height);
|
||||
|
||||
void ARGB1555_ABGR8888(uint32* src, uint32* dst, int width, int height);
|
||||
void ARGB4444_ABGR8888(uint32* src, uint32* dst, int width, int height);
|
||||
void ARGB8888_ABGR8888(uint32* src, uint32* dst, int width, int height);
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
@ -1,25 +1,16 @@
|
|||
/*
|
||||
* Texture Filtering
|
||||
* Version: 1.0
|
||||
*
|
||||
* Copyright (C) 2007 Hiroshi Morii All Rights Reserved.
|
||||
* Email koolsmoky(at)users.sourceforge.net
|
||||
* Web http://www.3dfxzone.it/koolsmoky
|
||||
*
|
||||
* this 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 Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* this 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 GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2007 Hiroshi Morii *
|
||||
* Copyright (C) 2003 Rice1964 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#include "TxReSample.h"
|
||||
#include "TxDbg.h"
|
||||
|
@ -36,109 +27,110 @@
|
|||
int
|
||||
TxReSample::nextPow2(int num)
|
||||
{
|
||||
num = num - 1;
|
||||
num = num | (num >> 1);
|
||||
num = num | (num >> 2);
|
||||
num = num | (num >> 4);
|
||||
num = num | (num >> 8);
|
||||
num = num | (num >> 16);
|
||||
/*num = num | (num >> 32);*//* for 64bit architecture */
|
||||
num = num + 1;
|
||||
num = num - 1;
|
||||
num = num | (num >> 1);
|
||||
num = num | (num >> 2);
|
||||
num = num | (num >> 4);
|
||||
num = num | (num >> 8);
|
||||
num = num | (num >> 16);
|
||||
/*num = num | (num >> 32);*//* for 64bit architecture */
|
||||
num = num + 1;
|
||||
|
||||
return num;
|
||||
return num;
|
||||
}
|
||||
|
||||
boolean
|
||||
TxReSample::nextPow2(uint8** image, int* width, int* height, int bpp, boolean use_3dfx = 0)
|
||||
bool
|
||||
TxReSample::nextPow2(uint8** image, int* width, int* height, int bpp, bool use_3dfx = 0)
|
||||
{
|
||||
/* NOTE: bpp must be one of the follwing: 8, 16, 24, 32 bits per pixel */
|
||||
/* NOTE: bpp must be one of the follwing: 8, 16, 24, 32 bits per pixel */
|
||||
|
||||
if (!*image || !*width || !*height || !bpp)
|
||||
return 0;
|
||||
|
||||
int row_bytes = ((*width * bpp) >> 3);
|
||||
int o_row_bytes = row_bytes;
|
||||
int o_width = *width;
|
||||
int n_width = *width;
|
||||
int o_height = *height;
|
||||
int n_height = *height;
|
||||
|
||||
/* HACKALERT: I have explicitly subtracted (n) from width/height to
|
||||
* adjust textures that have (n) pixel larger width/height than
|
||||
* power of 2 size. This is a dirty hack for textures that have
|
||||
* munged aspect ratio by (n) pixel to the original.
|
||||
*/
|
||||
if (n_width > 64) n_width -= 4;
|
||||
else if (n_width > 16) n_width -= 2;
|
||||
else if (n_width > 4) n_width -= 1;
|
||||
|
||||
if (n_height > 64) n_height -= 4;
|
||||
else if (n_height > 16) n_height -= 2;
|
||||
else if (n_height > 4) n_height -= 1;
|
||||
|
||||
n_width = nextPow2(n_width);
|
||||
n_height = nextPow2(n_height);
|
||||
row_bytes = (n_width * bpp) >> 3;
|
||||
|
||||
/* 3dfx Glide3 format, W:H aspect ratio range (8:1 - 1:8) */
|
||||
if (use_3dfx) {
|
||||
if (n_width > n_height) {
|
||||
if (n_width > (n_height << 3))
|
||||
n_height = n_width >> 3;
|
||||
}
|
||||
else {
|
||||
if (n_height > (n_width << 3)) {
|
||||
n_width = n_height >> 3;
|
||||
row_bytes = (n_width * bpp) >> 3;
|
||||
}
|
||||
}
|
||||
DBG_INFO(80, "using 3dfx W:H aspect ratio range (8:1 - 1:8).\n");
|
||||
}
|
||||
|
||||
/* do we really need to do this ? */
|
||||
if (o_width == n_width && o_height == n_height)
|
||||
return 1; /* nope */
|
||||
|
||||
DBG_INFO(80, "expand image to next power of 2 dimensions. %d x %d -> %d x %d\n", o_width, o_height, n_width, n_height);
|
||||
|
||||
if (o_width > n_width)
|
||||
o_width = n_width;
|
||||
|
||||
if (o_height > n_height)
|
||||
o_height = n_height;
|
||||
|
||||
/* allocate memory to read in image */
|
||||
uint8 *pow2image = (uint8*)malloc(row_bytes * n_height);
|
||||
|
||||
/* read in image */
|
||||
if (pow2image) {
|
||||
int i, j;
|
||||
uint8 *tmpimage = *image, *tmppow2image = pow2image;
|
||||
|
||||
for (i = 0; i < o_height; i++) {
|
||||
/* copy row */
|
||||
memcpy(tmppow2image, tmpimage, ((o_width * bpp) >> 3));
|
||||
|
||||
/* expand to pow2 size by replication */
|
||||
for (j = ((o_width * bpp) >> 3); j < row_bytes; j++)
|
||||
tmppow2image[j] = tmppow2image[j - (bpp >> 3)];
|
||||
|
||||
tmppow2image += row_bytes;
|
||||
tmpimage += o_row_bytes;
|
||||
}
|
||||
/* expand to pow2 size by replication */
|
||||
for (i = o_height; i < n_height; i++)
|
||||
memcpy(&pow2image[row_bytes * i], &pow2image[row_bytes * (i - 1)], row_bytes);
|
||||
|
||||
free(*image);
|
||||
|
||||
*image = pow2image;
|
||||
*height = n_height;
|
||||
*width = n_width;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!*image || !*width || !*height || !bpp)
|
||||
return 0;
|
||||
|
||||
int row_bytes = ((*width * bpp) >> 3);
|
||||
int o_row_bytes = row_bytes;
|
||||
int o_width = *width;
|
||||
int n_width = *width;
|
||||
int o_height = *height;
|
||||
int n_height = *height;
|
||||
|
||||
/* HACKALERT: I have explicitly subtracted (n) from width/height to
|
||||
* adjust textures that have (n) pixel larger width/height than
|
||||
* power of 2 size. This is a dirty hack for textures that have
|
||||
* munged aspect ratio by (n) pixel to the original.
|
||||
*/
|
||||
if (n_width > 64) n_width -= 4;
|
||||
else if (n_width > 16) n_width -= 2;
|
||||
else if (n_width > 4) n_width -= 1;
|
||||
|
||||
if (n_height > 64) n_height -= 4;
|
||||
else if (n_height > 16) n_height -= 2;
|
||||
else if (n_height > 4) n_height -= 1;
|
||||
|
||||
n_width = nextPow2(n_width);
|
||||
n_height = nextPow2(n_height);
|
||||
row_bytes = (n_width * bpp) >> 3;
|
||||
|
||||
/* 3dfx Glide3 format, W:H aspect ratio range (8:1 - 1:8) */
|
||||
if (use_3dfx) {
|
||||
if (n_width > n_height) {
|
||||
if (n_width > (n_height << 3))
|
||||
n_height = n_width >> 3;
|
||||
} else {
|
||||
if (n_height > (n_width << 3)) {
|
||||
n_width = n_height >> 3;
|
||||
row_bytes = (n_width * bpp) >> 3;
|
||||
}
|
||||
}
|
||||
DBG_INFO(80, "using 3dfx W:H aspect ratio range (8:1 - 1:8).\n");
|
||||
}
|
||||
|
||||
/* do we really need to do this ? */
|
||||
if (o_width == n_width && o_height == n_height)
|
||||
return 1; /* nope */
|
||||
|
||||
DBG_INFO(80, "expand image to next power of 2 dimensions. %d x %d -> %d x %d\n", o_width, o_height, n_width, n_height);
|
||||
|
||||
if (o_width > n_width)
|
||||
o_width = n_width;
|
||||
|
||||
if (o_height > n_height)
|
||||
o_height = n_height;
|
||||
|
||||
/* allocate memory to read in image */
|
||||
uint8 *pow2image = (uint8*)malloc(row_bytes * n_height);
|
||||
|
||||
/* read in image */
|
||||
if (pow2image) {
|
||||
int i, j;
|
||||
uint8 *tmpimage = *image, *tmppow2image = pow2image;
|
||||
|
||||
for (i = 0; i < o_height; i++) {
|
||||
/* copy row */
|
||||
memcpy(tmppow2image, tmpimage, ((o_width * bpp) >> 3));
|
||||
|
||||
/* expand to pow2 size by replication */
|
||||
for(j = ((o_width * bpp) >> 3); j < row_bytes; j++)
|
||||
tmppow2image[j] = tmppow2image[j - (bpp >> 3)];
|
||||
|
||||
tmppow2image += row_bytes;
|
||||
tmpimage += o_row_bytes;
|
||||
}
|
||||
/* expand to pow2 size by replication */
|
||||
for (i = o_height; i < n_height; i++)
|
||||
memcpy(&pow2image[row_bytes * i], &pow2image[row_bytes * (i - 1)], row_bytes);
|
||||
|
||||
free(*image);
|
||||
|
||||
*image = pow2image;
|
||||
*height = n_height;
|
||||
*width = n_width;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Ken Turkowski
|
||||
|
@ -148,61 +140,62 @@ TxReSample::nextPow2(uint8** image, int* width, int* height, int bpp, boolean us
|
|||
double
|
||||
TxReSample::tent(double x)
|
||||
{
|
||||
if (x < 0.0) x = -x;
|
||||
if (x < 1.0) return (1.0 - x);
|
||||
return 0.0;
|
||||
if (x < 0.0) x = -x;
|
||||
if (x < 1.0) return (1.0 - x);
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
double
|
||||
TxReSample::gaussian(double x)
|
||||
{
|
||||
if (x < 0) x = -x;
|
||||
if (x < 2.0) return pow(2.0, -2.0 * x * x);
|
||||
return 0.0;
|
||||
if (x < 0) x = -x;
|
||||
if (x < 2.0) return pow(2.0, -2.0 * x * x);
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
double
|
||||
double
|
||||
TxReSample::sinc(double x)
|
||||
{
|
||||
if (x == 0) return 1.0;
|
||||
x *= M_PI;
|
||||
return (sin(x) / x);
|
||||
if (x == 0) return 1.0;
|
||||
x *= M_PI;
|
||||
return (sin(x) / x);
|
||||
}
|
||||
|
||||
double
|
||||
double
|
||||
TxReSample::lanczos3(double x)
|
||||
{
|
||||
if (x < 0) x = -x;
|
||||
if (x < 3.0) return (sinc(x) * sinc(x/3.0));
|
||||
return 0.0;
|
||||
if (x < 0) x = -x;
|
||||
if (x < 3.0) return (sinc(x) * sinc(x / 3.0));
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
/* Don P. Mitchell and Arun N. Netravali
|
||||
* Reconstruction Filters in Computer Graphics
|
||||
* SIGGRAPH '88
|
||||
* Proceedings of the 15th annual conference on Computer
|
||||
* Proceedings of the 15th annual conference on Computer
|
||||
* graphics and interactive techniques, pp221-228, 1988
|
||||
*/
|
||||
double
|
||||
TxReSample::mitchell(double x)
|
||||
{
|
||||
if (x < 0) x = -x;
|
||||
if (x < 2.0) {
|
||||
const double B = 1.0 / 3.0;
|
||||
const double C = 1.0 / 3.0;
|
||||
if (x < 1.0) {
|
||||
x = (((12.0 - 9.0 * B - 6.0 * C) * (x * x * x))
|
||||
+ ((-18.0 + 12.0 * B + 6.0 * C) * (x * x))
|
||||
+ (6.0 - 2.0 * B));
|
||||
} else {
|
||||
x = (((-1.0 * B - 6.0 * C) * (x * x * x))
|
||||
+ ((6.0 * B + 30.0 * C) * (x * x))
|
||||
+ ((-12.0 * B - 48.0 * C) * x)
|
||||
+ (8.0 * B + 24.0 * C));
|
||||
if (x < 0) x = -x;
|
||||
if (x < 2.0) {
|
||||
const double B = 1.0 / 3.0;
|
||||
const double C = 1.0 / 3.0;
|
||||
if (x < 1.0) {
|
||||
x = (((12.0 - 9.0 * B - 6.0 * C) * (x * x * x))
|
||||
+ ((-18.0 + 12.0 * B + 6.0 * C) * (x * x))
|
||||
+ (6.0 - 2.0 * B));
|
||||
}
|
||||
else {
|
||||
x = (((-1.0 * B - 6.0 * C) * (x * x * x))
|
||||
+ ((6.0 * B + 30.0 * C) * (x * x))
|
||||
+ ((-12.0 * B - 48.0 * C) * x)
|
||||
+ (8.0 * B + 24.0 * C));
|
||||
}
|
||||
return (x / 6.0);
|
||||
}
|
||||
return (x / 6.0);
|
||||
}
|
||||
return 0.0;
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
/* J. F. Kaiser and W. A. Reed
|
||||
|
@ -212,205 +205,205 @@ TxReSample::mitchell(double x)
|
|||
double
|
||||
TxReSample::besselI0(double x)
|
||||
{
|
||||
/* zero-order modified bessel function of the first kind */
|
||||
const double eps_coeff = 1E-16; /* small enough */
|
||||
double xh, sum, pow, ds;
|
||||
xh = 0.5 * x;
|
||||
sum = 1.0;
|
||||
pow = 1.0;
|
||||
ds = 1.0;
|
||||
int k = 0;
|
||||
while (ds > sum * eps_coeff) {
|
||||
k++;
|
||||
pow *= (xh / k);
|
||||
ds = pow * pow;
|
||||
sum = sum + ds;
|
||||
}
|
||||
return sum;
|
||||
/* zero-order modified bessel function of the first kind */
|
||||
const double eps_coeff = 1E-16; /* small enough */
|
||||
double xh, sum, pow, ds;
|
||||
xh = 0.5 * x;
|
||||
sum = 1.0;
|
||||
pow = 1.0;
|
||||
ds = 1.0;
|
||||
int k = 0;
|
||||
while (ds > sum * eps_coeff) {
|
||||
k++;
|
||||
pow *= (xh / k);
|
||||
ds = pow * pow;
|
||||
sum = sum + ds;
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
double
|
||||
TxReSample::kaiser(double x)
|
||||
{
|
||||
const double alpha = 4.0;
|
||||
const double half_window = 5.0;
|
||||
const double ratio = x / half_window;
|
||||
return sinc(x) * besselI0(alpha * sqrt(1 - ratio * ratio)) / besselI0(alpha);
|
||||
const double alpha = 4.0;
|
||||
const double half_window = 5.0;
|
||||
const double ratio = x / half_window;
|
||||
return sinc(x) * besselI0(alpha * sqrt(1 - ratio * ratio)) / besselI0(alpha);
|
||||
}
|
||||
|
||||
boolean
|
||||
bool
|
||||
TxReSample::minify(uint8 **src, int *width, int *height, int ratio)
|
||||
{
|
||||
/* NOTE: src must be ARGB8888, ratio is the inverse representation */
|
||||
/* NOTE: src must be ARGB8888, ratio is the inverse representation */
|
||||
|
||||
#if 0
|
||||
if (!*src || ratio < 2) return 0;
|
||||
if (!*src || ratio < 2) return 0;
|
||||
|
||||
/* Box filtering.
|
||||
* It would be nice to do Kaiser filtering.
|
||||
* N64 uses narrow strip textures which makes it hard to filter effectively.
|
||||
*/
|
||||
/* Box filtering.
|
||||
* It would be nice to do Kaiser filtering.
|
||||
* N64 uses narrow strip textures which makes it hard to filter effectively.
|
||||
*/
|
||||
|
||||
int x, y, x2, y2, offset, numtexel;
|
||||
uint32 A, R, G, B, texel;
|
||||
int x, y, x2, y2, offset, numtexel;
|
||||
uint32 A, R, G, B, texel;
|
||||
|
||||
int tmpwidth = *width / ratio;
|
||||
int tmpheight = *height / ratio;
|
||||
int tmpwidth = *width / ratio;
|
||||
int tmpheight = *height / ratio;
|
||||
|
||||
uint8 *tmptex = (uint8*)malloc((tmpwidth * tmpheight) << 2);
|
||||
uint8 *tmptex = (uint8*)malloc((tmpwidth * tmpheight) << 2);
|
||||
|
||||
if (tmptex) {
|
||||
numtexel = ratio * ratio;
|
||||
for (y = 0; y < tmpheight; y++) {
|
||||
offset = ratio * y * *width;
|
||||
for (x = 0; x < tmpwidth; x++) {
|
||||
A = R = G = B = 0;
|
||||
for (y2 = 0; y2 < ratio; y2++) {
|
||||
for (x2 = 0; x2 < ratio; x2++) {
|
||||
texel = ((uint32*)*src)[offset + *width * y2 + x2];
|
||||
A += (texel >> 24);
|
||||
R += ((texel >> 16) & 0x000000ff);
|
||||
G += ((texel >> 8) & 0x000000ff);
|
||||
B += (texel & 0x000000ff);
|
||||
}
|
||||
if (tmptex) {
|
||||
numtexel = ratio * ratio;
|
||||
for (y = 0; y < tmpheight; y++) {
|
||||
offset = ratio * y * *width;
|
||||
for (x = 0; x < tmpwidth; x++) {
|
||||
A = R = G = B = 0;
|
||||
for (y2 = 0; y2 < ratio; y2++) {
|
||||
for (x2 = 0; x2 < ratio; x2++) {
|
||||
texel = ((uint32*)*src)[offset + *width * y2 + x2];
|
||||
A += (texel >> 24);
|
||||
R += ((texel >> 16) & 0x000000ff);
|
||||
G += ((texel >> 8) & 0x000000ff);
|
||||
B += (texel & 0x000000ff);
|
||||
}
|
||||
}
|
||||
A = (A + ratio) / numtexel;
|
||||
R = (R + ratio) / numtexel;
|
||||
G = (G + ratio) / numtexel;
|
||||
B = (B + ratio) / numtexel;
|
||||
((uint32*)tmptex)[y * tmpwidth + x] = ((A << 24) | (R << 16) | (G << 8) | B);
|
||||
offset += ratio;
|
||||
}
|
||||
}
|
||||
A = (A + ratio) / numtexel;
|
||||
R = (R + ratio) / numtexel;
|
||||
G = (G + ratio) / numtexel;
|
||||
B = (B + ratio) / numtexel;
|
||||
((uint32*)tmptex)[y * tmpwidth + x] = ((A << 24) | (R << 16) | (G << 8) | B);
|
||||
offset += ratio;
|
||||
}
|
||||
free(*src);
|
||||
*src = tmptex;
|
||||
*width = tmpwidth;
|
||||
*height = tmpheight;
|
||||
|
||||
DBG_INFO(80, L"minification ratio:%d -> %d x %d\n", ratio, *width, *height);
|
||||
|
||||
return 1;
|
||||
}
|
||||
free(*src);
|
||||
*src = tmptex;
|
||||
*width = tmpwidth;
|
||||
*height = tmpheight;
|
||||
|
||||
DBG_INFO(80, L"minification ratio:%d -> %d x %d\n", ratio, *width, *height);
|
||||
DBG_INFO(80, L"Error: failed minification!\n");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
DBG_INFO(80, L"Error: failed minification!\n");
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
#else
|
||||
|
||||
if (!*src || ratio < 2) return 0;
|
||||
if (!*src || ratio < 2) return 0;
|
||||
|
||||
/* Image Resampling */
|
||||
|
||||
/* half width of filter window.
|
||||
* NOTE: must be 1.0 or larger.
|
||||
*
|
||||
* kaiser-bessel 5, lanczos3 3, mitchell 2, gaussian 1.5, tent 1
|
||||
*/
|
||||
double half_window = 5.0;
|
||||
/* Image Resampling */
|
||||
|
||||
int x, y, x2, y2, z;
|
||||
double A, R, G, B;
|
||||
uint32 texel;
|
||||
/* half width of filter window.
|
||||
* NOTE: must be 1.0 or larger.
|
||||
*
|
||||
* kaiser-bessel 5, lanczos3 3, mitchell 2, gaussian 1.5, tent 1
|
||||
*/
|
||||
double half_window = 5.0;
|
||||
|
||||
int tmpwidth = *width / ratio;
|
||||
int tmpheight = *height / ratio;
|
||||
int x, y, x2, y2, z;
|
||||
double A, R, G, B;
|
||||
uint32 texel;
|
||||
|
||||
/* resampled destination */
|
||||
uint8 *tmptex = (uint8*)malloc((tmpwidth * tmpheight) << 2);
|
||||
if (!tmptex) return 0;
|
||||
int tmpwidth = *width / ratio;
|
||||
int tmpheight = *height / ratio;
|
||||
|
||||
/* work buffer. single row */
|
||||
uint8 *workbuf = (uint8*)malloc(*width << 2);
|
||||
if (!workbuf) {
|
||||
free(tmptex);
|
||||
return 0;
|
||||
}
|
||||
/* resampled destination */
|
||||
uint8 *tmptex = (uint8*)malloc((tmpwidth * tmpheight) << 2);
|
||||
if (!tmptex) return 0;
|
||||
|
||||
/* prepare filter lookup table. only half width required for symetric filters. */
|
||||
double *weight = (double*)malloc((int)((half_window * ratio) * sizeof(double)));
|
||||
if (!weight) {
|
||||
free(tmptex);
|
||||
/* work buffer. single row */
|
||||
uint8 *workbuf = (uint8*)malloc(*width << 2);
|
||||
if (!workbuf) {
|
||||
free(tmptex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* prepare filter lookup table. only half width required for symetric filters. */
|
||||
double *weight = (double*)malloc((int)((half_window * ratio) * sizeof(double)));
|
||||
if (!weight) {
|
||||
free(tmptex);
|
||||
free(workbuf);
|
||||
return 0;
|
||||
}
|
||||
for (x = 0; x < half_window * ratio; x++) {
|
||||
//weight[x] = tent((double)x / ratio) / ratio;
|
||||
//weight[x] = gaussian((double)x / ratio) / ratio;
|
||||
//weight[x] = lanczos3((double)x / ratio) / ratio;
|
||||
//weight[x] = mitchell((double)x / ratio) / ratio;
|
||||
weight[x] = kaiser((double)x / ratio) / ratio;
|
||||
}
|
||||
|
||||
/* linear convolution */
|
||||
for (y = 0; y < tmpheight; y++) {
|
||||
for (x = 0; x < *width; x++) {
|
||||
texel = ((uint32*)*src)[y * ratio * *width + x];
|
||||
A = (double)(texel >> 24) * weight[0];
|
||||
R = (double)((texel >> 16) & 0xff) * weight[0];
|
||||
G = (double)((texel >> 8) & 0xff) * weight[0];
|
||||
B = (double)((texel) & 0xff) * weight[0];
|
||||
for (y2 = 1; y2 < half_window * ratio; y2++) {
|
||||
z = y * ratio + y2;
|
||||
if (z >= *height) z = *height - 1;
|
||||
texel = ((uint32*)*src)[z * *width + x];
|
||||
A += (double)(texel >> 24) * weight[y2];
|
||||
R += (double)((texel >> 16) & 0xff) * weight[y2];
|
||||
G += (double)((texel >> 8) & 0xff) * weight[y2];
|
||||
B += (double)((texel) & 0xff) * weight[y2];
|
||||
z = y * ratio - y2;
|
||||
if (z < 0) z = 0;
|
||||
texel = ((uint32*)*src)[z * *width + x];
|
||||
A += (double)(texel >> 24) * weight[y2];
|
||||
R += (double)((texel >> 16) & 0xff) * weight[y2];
|
||||
G += (double)((texel >> 8) & 0xff) * weight[y2];
|
||||
B += (double)((texel) & 0xff) * weight[y2];
|
||||
}
|
||||
if (A < 0) A = 0; else if (A > 255) A = 255;
|
||||
if (R < 0) R = 0; else if (R > 255) R = 255;
|
||||
if (G < 0) G = 0; else if (G > 255) G = 255;
|
||||
if (B < 0) B = 0; else if (B > 255) B = 255;
|
||||
((uint32*)workbuf)[x] = (((uint32)A << 24) | ((uint32)R << 16) | ((uint32)G << 8) | (uint32)B);
|
||||
}
|
||||
for (x = 0; x < tmpwidth; x++) {
|
||||
texel = ((uint32*)workbuf)[x * ratio];
|
||||
A = (double)(texel >> 24) * weight[0];
|
||||
R = (double)((texel >> 16) & 0xff) * weight[0];
|
||||
G = (double)((texel >> 8) & 0xff) * weight[0];
|
||||
B = (double)((texel) & 0xff) * weight[0];
|
||||
for (x2 = 1; x2 < half_window * ratio; x2++) {
|
||||
z = x * ratio + x2;
|
||||
if (z >= *width) z = *width - 1;
|
||||
texel = ((uint32*)workbuf)[z];
|
||||
A += (double)(texel >> 24) * weight[x2];
|
||||
R += (double)((texel >> 16) & 0xff) * weight[x2];
|
||||
G += (double)((texel >> 8) & 0xff) * weight[x2];
|
||||
B += (double)((texel) & 0xff) * weight[x2];
|
||||
z = x * ratio - x2;
|
||||
if (z < 0) z = 0;
|
||||
texel = ((uint32*)workbuf)[z];
|
||||
A += (double)(texel >> 24) * weight[x2];
|
||||
R += (double)((texel >> 16) & 0xff) * weight[x2];
|
||||
G += (double)((texel >> 8) & 0xff) * weight[x2];
|
||||
B += (double)((texel) & 0xff) * weight[x2];
|
||||
}
|
||||
if (A < 0) A = 0; else if (A > 255) A = 255;
|
||||
if (R < 0) R = 0; else if (R > 255) R = 255;
|
||||
if (G < 0) G = 0; else if (G > 255) G = 255;
|
||||
if (B < 0) B = 0; else if (B > 255) B = 255;
|
||||
((uint32*)tmptex)[y * tmpwidth + x] = (((uint32)A << 24) | ((uint32)R << 16) | ((uint32)G << 8) | (uint32)B);
|
||||
}
|
||||
}
|
||||
|
||||
free(*src);
|
||||
*src = tmptex;
|
||||
free(weight);
|
||||
free(workbuf);
|
||||
return 0;
|
||||
}
|
||||
for (x = 0; x < half_window * ratio; x++) {
|
||||
//weight[x] = tent((double)x / ratio) / ratio;
|
||||
//weight[x] = gaussian((double)x / ratio) / ratio;
|
||||
//weight[x] = lanczos3((double)x / ratio) / ratio;
|
||||
//weight[x] = mitchell((double)x / ratio) / ratio;
|
||||
weight[x] = kaiser((double)x / ratio) / ratio;
|
||||
}
|
||||
*width = tmpwidth;
|
||||
*height = tmpheight;
|
||||
|
||||
/* linear convolution */
|
||||
for (y = 0; y < tmpheight; y++) {
|
||||
for (x = 0; x < *width; x++) {
|
||||
texel = ((uint32*)*src)[y * ratio * *width + x];
|
||||
A = (double)(texel >> 24) * weight[0];
|
||||
R = (double)((texel >> 16) & 0xff) * weight[0];
|
||||
G = (double)((texel >> 8) & 0xff) * weight[0];
|
||||
B = (double)((texel ) & 0xff) * weight[0];
|
||||
for (y2 = 1; y2 < half_window * ratio; y2++) {
|
||||
z = y * ratio + y2;
|
||||
if (z >= *height) z = *height - 1;
|
||||
texel = ((uint32*)*src)[z * *width + x];
|
||||
A += (double)(texel >> 24) * weight[y2];
|
||||
R += (double)((texel >> 16) & 0xff) * weight[y2];
|
||||
G += (double)((texel >> 8) & 0xff) * weight[y2];
|
||||
B += (double)((texel ) & 0xff) * weight[y2];
|
||||
z = y * ratio - y2;
|
||||
if (z < 0) z = 0;
|
||||
texel = ((uint32*)*src)[z * *width + x];
|
||||
A += (double)(texel >> 24) * weight[y2];
|
||||
R += (double)((texel >> 16) & 0xff) * weight[y2];
|
||||
G += (double)((texel >> 8) & 0xff) * weight[y2];
|
||||
B += (double)((texel ) & 0xff) * weight[y2];
|
||||
}
|
||||
if (A < 0) A = 0; else if (A > 255) A = 255;
|
||||
if (R < 0) R = 0; else if (R > 255) R = 255;
|
||||
if (G < 0) G = 0; else if (G > 255) G = 255;
|
||||
if (B < 0) B = 0; else if (B > 255) B = 255;
|
||||
((uint32*)workbuf)[x] = (((uint32)A << 24) | ((uint32)R << 16) | ((uint32)G << 8) | (uint32)B);
|
||||
}
|
||||
for (x = 0; x < tmpwidth; x++) {
|
||||
texel = ((uint32*)workbuf)[x * ratio];
|
||||
A = (double)(texel >> 24) * weight[0];
|
||||
R = (double)((texel >> 16) & 0xff) * weight[0];
|
||||
G = (double)((texel >> 8) & 0xff) * weight[0];
|
||||
B = (double)((texel ) & 0xff) * weight[0];
|
||||
for (x2 = 1; x2 < half_window * ratio; x2++) {
|
||||
z = x * ratio + x2;
|
||||
if (z >= *width) z = *width - 1;
|
||||
texel = ((uint32*)workbuf)[z];
|
||||
A += (double)(texel >> 24) * weight[x2];
|
||||
R += (double)((texel >> 16) & 0xff) * weight[x2];
|
||||
G += (double)((texel >> 8) & 0xff) * weight[x2];
|
||||
B += (double)((texel ) & 0xff) * weight[x2];
|
||||
z = x * ratio - x2;
|
||||
if (z < 0) z = 0;
|
||||
texel = ((uint32*)workbuf)[z];
|
||||
A += (double)(texel >> 24) * weight[x2];
|
||||
R += (double)((texel >> 16) & 0xff) * weight[x2];
|
||||
G += (double)((texel >> 8) & 0xff) * weight[x2];
|
||||
B += (double)((texel ) & 0xff) * weight[x2];
|
||||
}
|
||||
if (A < 0) A = 0; else if (A > 255) A = 255;
|
||||
if (R < 0) R = 0; else if (R > 255) R = 255;
|
||||
if (G < 0) G = 0; else if (G > 255) G = 255;
|
||||
if (B < 0) B = 0; else if (B > 255) B = 255;
|
||||
((uint32*)tmptex)[y * tmpwidth + x] = (((uint32)A << 24) | ((uint32)R << 16) | ((uint32)G << 8) | (uint32)B);
|
||||
}
|
||||
}
|
||||
DBG_INFO(80, "minification ratio:%d -> %d x %d\n", ratio, *width, *height);
|
||||
|
||||
free(*src);
|
||||
*src = tmptex;
|
||||
free(weight);
|
||||
free(workbuf);
|
||||
*width = tmpwidth;
|
||||
*height = tmpheight;
|
||||
|
||||
DBG_INFO(80, "minification ratio:%d -> %d x %d\n", ratio, *width, *height);
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
}
|
|
@ -1,25 +1,16 @@
|
|||
/*
|
||||
* Texture Filtering
|
||||
* Version: 1.0
|
||||
*
|
||||
* Copyright (C) 2007 Hiroshi Morii All Rights Reserved.
|
||||
* Email koolsmoky(at)users.sourceforge.net
|
||||
* Web http://www.3dfxzone.it/koolsmoky
|
||||
*
|
||||
* this 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 Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* this 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 GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2007 Hiroshi Morii *
|
||||
* Copyright (C) 2003 Rice1964 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __TXRESAMPLE_H__
|
||||
#define __TXRESAMPLE_H__
|
||||
|
@ -29,17 +20,17 @@
|
|||
class TxReSample
|
||||
{
|
||||
private:
|
||||
double tent(double x);
|
||||
double gaussian(double x);
|
||||
double sinc(double x);
|
||||
double lanczos3(double x);
|
||||
double mitchell(double x);
|
||||
double besselI0(double x);
|
||||
double kaiser(double x);
|
||||
double tent(double x);
|
||||
double gaussian(double x);
|
||||
double sinc(double x);
|
||||
double lanczos3(double x);
|
||||
double mitchell(double x);
|
||||
double besselI0(double x);
|
||||
double kaiser(double x);
|
||||
public:
|
||||
boolean minify(uint8 **src, int *width, int *height, int ratio);
|
||||
boolean nextPow2(uint8** image, int* width, int* height, int bpp, boolean use_3dfx);
|
||||
int nextPow2(int num);
|
||||
bool minify(uint8 **src, int *width, int *height, int ratio);
|
||||
bool nextPow2(uint8** image, int* width, int* height, int bpp, bool use_3dfx);
|
||||
int nextPow2(int num);
|
||||
};
|
||||
|
||||
#endif /* __TXRESAMPLE_H__ */
|
||||
|
|
|
@ -1,26 +1,16 @@
|
|||
/*
|
||||
* Texture Filtering
|
||||
* Version: 1.0
|
||||
*
|
||||
* Copyright (C) 2007 Hiroshi Morii All Rights Reserved.
|
||||
* Email koolsmoky(at)users.sourceforge.net
|
||||
* Web http://www.3dfxzone.it/koolsmoky
|
||||
*
|
||||
* this 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 Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* this 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 GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2007 Hiroshi Morii *
|
||||
* Copyright (C) 2003 Rice1964 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#ifdef WIN32
|
||||
#pragma warning(disable: 4786)
|
||||
#endif
|
||||
|
@ -53,7 +43,7 @@ TxTexCache::~TxTexCache()
|
|||
}
|
||||
|
||||
TxTexCache::TxTexCache(int options, int cachesize, const char *path, const char *ident, dispInfoFuncExt callback) :
|
||||
TxCache((options & ~GZ_HIRESTEXCACHE), cachesize, path, ident, callback)
|
||||
TxCache((options & ~GZ_HIRESTEXCACHE), cachesize, path, ident, callback)
|
||||
{
|
||||
/* assert local options */
|
||||
if (_path.empty() || _ident.empty() || !_cacheSize)
|
||||
|
@ -75,9 +65,9 @@ TxCache((options & ~GZ_HIRESTEXCACHE), cachesize, path, ident, callback)
|
|||
#endif
|
||||
}
|
||||
|
||||
boolean TxTexCache::add(uint64 checksum, GHQTexInfo *info)
|
||||
bool TxTexCache::add(uint64_t checksum, GHQTexInfo *info)
|
||||
{
|
||||
if (_cacheSize <= 0) return 0;
|
||||
|
||||
return TxCache::add(checksum, info);
|
||||
}
|
||||
}
|
|
@ -1,25 +1,16 @@
|
|||
/*
|
||||
* Texture Filtering
|
||||
* Version: 1.0
|
||||
*
|
||||
* Copyright (C) 2007 Hiroshi Morii All Rights Reserved.
|
||||
* Email koolsmoky(at)users.sourceforge.net
|
||||
* Web http://www.3dfxzone.it/koolsmoky
|
||||
*
|
||||
* this 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 Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* this 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 GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2007 Hiroshi Morii *
|
||||
* Copyright (C) 2003 Rice1964 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __TXTEXCACHE_H__
|
||||
#define __TXTEXCACHE_H__
|
||||
|
@ -29,11 +20,11 @@
|
|||
class TxTexCache : public TxCache
|
||||
{
|
||||
public:
|
||||
~TxTexCache();
|
||||
TxTexCache(int options, int cachesize, const char *path, const char *ident,
|
||||
dispInfoFuncExt callback);
|
||||
boolean add(uint64 checksum, /* checksum hi:palette low:texture */
|
||||
GHQTexInfo *info);
|
||||
~TxTexCache();
|
||||
TxTexCache(int options, int cachesize, const char *path, const char *ident,
|
||||
dispInfoFuncExt callback);
|
||||
bool add(uint64_t checksum, /* checksum hi:palette low:texture */
|
||||
GHQTexInfo *info);
|
||||
};
|
||||
|
||||
#endif /* __TXTEXCACHE_H__ */
|
||||
|
|
|
@ -1,25 +1,16 @@
|
|||
/*
|
||||
* Texture Filtering
|
||||
* Version: 1.0
|
||||
*
|
||||
* Copyright (C) 2007 Hiroshi Morii All Rights Reserved.
|
||||
* Email koolsmoky(at)users.sourceforge.net
|
||||
* Web http://www.3dfxzone.it/koolsmoky
|
||||
*
|
||||
* this 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 Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* this 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 GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2007 Hiroshi Morii *
|
||||
* Copyright (C) 2003 Rice1964 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#include "TxUtil.h"
|
||||
#include "TxDbg.h"
|
||||
|
@ -27,203 +18,139 @@
|
|||
#include <malloc.h>
|
||||
#include <stdlib.h>
|
||||
#include <Common/stdtypes.h>
|
||||
#include <Project64-video/Renderer/types.h>
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/*
|
||||
* External libraries
|
||||
******************************************************************************/
|
||||
TxLoadLib::TxLoadLib()
|
||||
{
|
||||
#ifdef DXTN_DLL
|
||||
if (!_dxtnlib)
|
||||
_dxtnlib = LoadLibrary("dxtn");
|
||||
|
||||
if (_dxtnlib) {
|
||||
if (!_tx_compress_dxtn)
|
||||
_tx_compress_dxtn = (dxtCompressTexFuncExt)DLSYM(_dxtnlib, "tx_compress_dxtn");
|
||||
|
||||
if (!_tx_compress_fxt1)
|
||||
_tx_compress_fxt1 = (fxtCompressTexFuncExt)DLSYM(_dxtnlib, "fxt1_encode");
|
||||
}
|
||||
#else
|
||||
_tx_compress_dxtn = tx_compress_dxtn;
|
||||
_tx_compress_fxt1 = fxt1_encode;
|
||||
|
||||
#endif
|
||||
_tx_compress_dxtn = tx_compress_dxtn;
|
||||
_tx_compress_fxt1 = fxt1_encode;
|
||||
}
|
||||
|
||||
TxLoadLib::~TxLoadLib()
|
||||
{
|
||||
#ifdef DXTN_DLL
|
||||
/* free dynamic library */
|
||||
if (_dxtnlib)
|
||||
FreeLibrary(_dxtnlib);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
fxtCompressTexFuncExt
|
||||
TxLoadLib::getfxtCompressTexFuncExt()
|
||||
fxtCompressTexFuncExt TxLoadLib::getfxtCompressTexFuncExt()
|
||||
{
|
||||
return _tx_compress_fxt1;
|
||||
return _tx_compress_fxt1;
|
||||
}
|
||||
|
||||
dxtCompressTexFuncExt
|
||||
TxLoadLib::getdxtCompressTexFuncExt()
|
||||
dxtCompressTexFuncExt TxLoadLib::getdxtCompressTexFuncExt()
|
||||
{
|
||||
return _tx_compress_dxtn;
|
||||
return _tx_compress_dxtn;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Utilities
|
||||
******************************************************************************/
|
||||
uint32
|
||||
TxUtil::checksumTx(uint8 *src, int width, int height, uint16 format)
|
||||
uint32 TxUtil::checksumTx(uint8 *src, int width, int height, uint16 format)
|
||||
{
|
||||
int dataSize = sizeofTx(width, height, format);
|
||||
int dataSize = sizeofTx(width, height, format);
|
||||
|
||||
/* for now we use adler32 if something else is better
|
||||
* we can simply swtich later
|
||||
*/
|
||||
/* return (dataSize ? Adler32(src, dataSize, 1) : 0); */
|
||||
/* for now we use adler32 if something else is better
|
||||
* we can simply swtich later
|
||||
*/
|
||||
/* return (dataSize ? Adler32(src, dataSize, 1) : 0); */
|
||||
|
||||
/* zlib crc32 */
|
||||
return (dataSize ? crc32(crc32(0L, Z_NULL, 0), src, dataSize) : 0);
|
||||
/* zlib crc32 */
|
||||
return (dataSize ? crc32(crc32(0L, Z_NULL, 0), src, dataSize) : 0);
|
||||
}
|
||||
|
||||
int
|
||||
TxUtil::sizeofTx(int width, int height, uint16 format)
|
||||
int TxUtil::sizeofTx(int width, int height, uint16 format)
|
||||
{
|
||||
int dataSize = 0;
|
||||
int dataSize = 0;
|
||||
|
||||
/* a lookup table for the shifts would be better */
|
||||
switch (format) {
|
||||
case GR_TEXFMT_ARGB_CMP_FXT1:
|
||||
dataSize = (((width + 0x7) & ~0x7) * ((height + 0x3) & ~0x3)) >> 1;
|
||||
break;
|
||||
case GR_TEXFMT_ARGB_CMP_DXT1:
|
||||
dataSize = (((width + 0x3) & ~0x3) * ((height + 0x3) & ~0x3)) >> 1;
|
||||
break;
|
||||
case GR_TEXFMT_ARGB_CMP_DXT3:
|
||||
case GR_TEXFMT_ARGB_CMP_DXT5:
|
||||
dataSize = ((width + 0x3) & ~0x3) * ((height + 0x3) & ~0x3);
|
||||
break;
|
||||
case GR_TEXFMT_ALPHA_INTENSITY_44:
|
||||
case GR_TEXFMT_ALPHA_8:
|
||||
case GR_TEXFMT_INTENSITY_8:
|
||||
case GR_TEXFMT_P_8:
|
||||
dataSize = width * height;
|
||||
break;
|
||||
case GR_TEXFMT_ARGB_4444:
|
||||
case GR_TEXFMT_ARGB_1555:
|
||||
case GR_TEXFMT_RGB_565:
|
||||
case GR_TEXFMT_ALPHA_INTENSITY_88:
|
||||
dataSize = (width * height) << 1;
|
||||
break;
|
||||
case GR_TEXFMT_ARGB_8888:
|
||||
dataSize = (width * height) << 2;
|
||||
break;
|
||||
default:
|
||||
/* unsupported format */
|
||||
DBG_INFO(80, "Error: cannot get size. unsupported gfmt:%x\n", format);
|
||||
;
|
||||
}
|
||||
|
||||
return dataSize;
|
||||
}
|
||||
|
||||
#if 0 /* unused */
|
||||
uint32
|
||||
TxUtil::chkAlpha(uint32* src, int width, int height)
|
||||
{
|
||||
/* NOTE: _src must be ARGB8888
|
||||
* return values
|
||||
* 0x00000000: 8bit alpha
|
||||
* 0x00000001: 1bit alpha
|
||||
* 0xff000001: no alpha
|
||||
*/
|
||||
|
||||
int _size = width * height;
|
||||
uint32 alpha = 0;
|
||||
|
||||
__asm {
|
||||
mov esi, dword ptr [src];
|
||||
mov ecx, dword ptr [_size];
|
||||
mov ebx, 0xff000000;
|
||||
|
||||
tc1_loop:
|
||||
mov eax, dword ptr [esi];
|
||||
add esi, 4;
|
||||
|
||||
and eax, 0xff000000;
|
||||
jz alpha1bit;
|
||||
cmp eax, 0xff000000;
|
||||
je alpha1bit;
|
||||
jmp done;
|
||||
|
||||
alpha1bit:
|
||||
and ebx, eax;
|
||||
dec ecx;
|
||||
jnz tc1_loop;
|
||||
|
||||
or ebx, 0x00000001;
|
||||
mov dword ptr [alpha], ebx;
|
||||
|
||||
done:
|
||||
}
|
||||
|
||||
return alpha;
|
||||
}
|
||||
#endif
|
||||
|
||||
uint32
|
||||
TxUtil::checksum(uint8 *src, int width, int height, int size, int rowStride)
|
||||
{
|
||||
/* Rice CRC32 for now. We can switch this to Jabo MD5 or
|
||||
* any other custom checksum.
|
||||
* TODO: use *_HIRESTEXTURE option. */
|
||||
|
||||
if (!src) return 0;
|
||||
|
||||
return RiceCRC32(src, width, height, size, rowStride);
|
||||
}
|
||||
|
||||
uint64
|
||||
TxUtil::checksum64(uint8 *src, int width, int height, int size, int rowStride, uint8 *palette)
|
||||
{
|
||||
/* Rice CRC32 for now. We can switch this to Jabo MD5 or
|
||||
* any other custom checksum.
|
||||
* TODO: use *_HIRESTEXTURE option. */
|
||||
/* Returned value is 64bits: hi=palette crc32 low=texture crc32 */
|
||||
|
||||
if (!src) return 0;
|
||||
|
||||
uint64 crc64Ret = 0;
|
||||
|
||||
if (palette) {
|
||||
uint32 crc32 = 0, cimax = 0;
|
||||
switch (size & 0xff) {
|
||||
case 1:
|
||||
if (RiceCRC32_CI8(src, width, height, size, rowStride, &crc32, &cimax)) {
|
||||
crc64Ret = (uint64)RiceCRC32(palette, cimax + 1, 1, 2, 512);
|
||||
crc64Ret <<= 32;
|
||||
crc64Ret |= (uint64)crc32;
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
if (RiceCRC32_CI4(src, width, height, size, rowStride, &crc32, &cimax)) {
|
||||
crc64Ret = (uint64)RiceCRC32(palette, cimax + 1, 1, 2, 32);
|
||||
crc64Ret <<= 32;
|
||||
crc64Ret |= (uint64)crc32;
|
||||
}
|
||||
/* a lookup table for the shifts would be better */
|
||||
switch (format) {
|
||||
case GFX_TEXFMT_ARGB_CMP_FXT1:
|
||||
dataSize = (((width + 0x7) & ~0x7) * ((height + 0x3) & ~0x3)) >> 1;
|
||||
break;
|
||||
case GFX_TEXFMT_ARGB_CMP_DXT1:
|
||||
dataSize = (((width + 0x3) & ~0x3) * ((height + 0x3) & ~0x3)) >> 1;
|
||||
break;
|
||||
case GFX_TEXFMT_ARGB_CMP_DXT3:
|
||||
case GFX_TEXFMT_ARGB_CMP_DXT5:
|
||||
dataSize = ((width + 0x3) & ~0x3) * ((height + 0x3) & ~0x3);
|
||||
break;
|
||||
case GFX_TEXFMT_ALPHA_INTENSITY_44:
|
||||
case GFX_TEXFMT_ALPHA_8:
|
||||
case GFX_TEXFMT_INTENSITY_8:
|
||||
case GFX_TEXFMT_P_8:
|
||||
dataSize = width * height;
|
||||
break;
|
||||
case GFX_TEXFMT_ARGB_4444:
|
||||
case GFX_TEXFMT_ARGB_1555:
|
||||
case GFX_TEXFMT_RGB_565:
|
||||
case GFX_TEXFMT_ALPHA_INTENSITY_88:
|
||||
dataSize = (width * height) << 1;
|
||||
break;
|
||||
case GFX_TEXFMT_ARGB_8888:
|
||||
dataSize = (width * height) << 2;
|
||||
break;
|
||||
default:
|
||||
/* unsupported format */
|
||||
DBG_INFO(80, "Error: cannot get size. unsupported gfmt:%x\n", format);
|
||||
;
|
||||
}
|
||||
}
|
||||
if (!crc64Ret) {
|
||||
crc64Ret = (uint64)RiceCRC32(src, width, height, size, rowStride);
|
||||
}
|
||||
|
||||
return crc64Ret;
|
||||
return dataSize;
|
||||
}
|
||||
|
||||
uint32 TxUtil::checksum(uint8 *src, int width, int height, int size, int rowStride)
|
||||
{
|
||||
/* Rice CRC32 for now. We can switch this to Jabo MD5 or
|
||||
* any other custom checksum.
|
||||
* TODO: use *_HIRESTEXTURE option. */
|
||||
|
||||
if (!src) return 0;
|
||||
|
||||
return RiceCRC32(src, width, height, size, rowStride);
|
||||
}
|
||||
|
||||
uint64_t TxUtil::checksum64(uint8 *src, int width, int height, int size, int rowStride, uint8 *palette)
|
||||
{
|
||||
/* Rice CRC32 for now. We can switch this to Jabo MD5 or
|
||||
* any other custom checksum.
|
||||
* TODO: use *_HIRESTEXTURE option. */
|
||||
/* Returned value is 64bits: hi=palette crc32 low=texture crc32 */
|
||||
|
||||
if (!src) return 0;
|
||||
|
||||
uint64_t crc64Ret = 0;
|
||||
|
||||
if (palette)
|
||||
{
|
||||
uint32 crc32 = 0, cimax = 0;
|
||||
switch (size & 0xff)
|
||||
{
|
||||
case 1:
|
||||
if (RiceCRC32_CI8(src, width, height, size, rowStride, &crc32, &cimax))
|
||||
{
|
||||
crc64Ret = (uint64_t)RiceCRC32(palette, cimax + 1, 1, 2, 512);
|
||||
crc64Ret <<= 32;
|
||||
crc64Ret |= (uint64_t)crc32;
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
if (RiceCRC32_CI4(src, width, height, size, rowStride, &crc32, &cimax))
|
||||
{
|
||||
crc64Ret = (uint64_t)RiceCRC32(palette, cimax + 1, 1, 2, 32);
|
||||
crc64Ret <<= 32;
|
||||
crc64Ret |= (uint64_t)crc32;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!crc64Ret)
|
||||
{
|
||||
crc64Ret = (uint64_t)RiceCRC32(src, width, height, size, rowStride);
|
||||
}
|
||||
|
||||
return crc64Ret;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -242,7 +169,7 @@ TxUtil::checksum64(uint8 *src, int width, int height, int size, int rowStride, u
|
|||
** 65521. s1 is initialized to 1, s2 to zero. The Adler-32 checksum is stored
|
||||
** as s2*65536 + s1 in most-significant-byte first (network) order.
|
||||
**
|
||||
** 8.2. The Adler-32 algorithm
|
||||
** 8.2. The Adler-32 algorithm
|
||||
**
|
||||
** The Adler-32 algorithm is much faster than the CRC32 algorithm yet still
|
||||
** provides an extremely low probability of undetected errors.
|
||||
|
@ -261,59 +188,37 @@ TxUtil::checksum64(uint8 *src, int width, int height, int size, int rowStride, u
|
|||
** separately. (Any sequence of zeroes has a Fletcher checksum of zero.)
|
||||
*/
|
||||
|
||||
uint32
|
||||
TxUtil::Adler32(const uint8* data, int Len, uint32 dwAdler32)
|
||||
uint32 TxUtil::Adler32(const uint8* data, int Len, uint32 dwAdler32)
|
||||
{
|
||||
#if 1
|
||||
/* zlib adler32 */
|
||||
return adler32(dwAdler32, data, Len);
|
||||
#else
|
||||
register uint32 s1 = dwAdler32 & 0xFFFF;
|
||||
register uint32 s2 = (dwAdler32 >> 16) & 0xFFFF;
|
||||
int k;
|
||||
|
||||
while (Len > 0) {
|
||||
/* 5552 is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
|
||||
k = (Len < 5552 ? Len : 5552);
|
||||
Len -= k;
|
||||
while (k--) {
|
||||
s1 += *data++;
|
||||
s2 += s1;
|
||||
}
|
||||
/* 65521 is the largest prime smaller than 65536 */
|
||||
s1 %= 65521;
|
||||
s2 %= 65521;
|
||||
}
|
||||
|
||||
return (s2 << 16) | s1;
|
||||
#endif
|
||||
/* zlib adler32 */
|
||||
return adler32(dwAdler32, data, Len);
|
||||
}
|
||||
|
||||
uint32
|
||||
TxUtil::Adler32(const uint8* src, int width, int height, int size, int rowStride)
|
||||
uint32 TxUtil::Adler32(const uint8* src, int width, int height, int size, int rowStride)
|
||||
{
|
||||
int i;
|
||||
uint32 ret = 1;
|
||||
uint32 width_in_bytes = width * size;
|
||||
int i;
|
||||
uint32 ret = 1;
|
||||
uint32 width_in_bytes = width * size;
|
||||
|
||||
for (i = 0; i < height; i++) {
|
||||
ret = Adler32(src, width_in_bytes, ret);
|
||||
src += rowStride;
|
||||
}
|
||||
for (i = 0; i < height; i++)
|
||||
{
|
||||
ret = Adler32(src, width_in_bytes, ret);
|
||||
src += rowStride;
|
||||
}
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
// rotate left
|
||||
template<class T> static T __ROL__(T value, unsigned int count)
|
||||
{
|
||||
const unsigned int nbits = sizeof(T) * 8;
|
||||
count %= nbits;
|
||||
const unsigned int nbits = sizeof(T) * 8;
|
||||
count %= nbits;
|
||||
|
||||
T high = value >> (nbits - count);
|
||||
value <<= count;
|
||||
value |= high;
|
||||
return value;
|
||||
T high = value >> (nbits - count);
|
||||
value <<= count;
|
||||
value |= high;
|
||||
return value;
|
||||
}
|
||||
|
||||
/* Rice CRC32 for hires texture packs */
|
||||
|
@ -321,154 +226,156 @@ template<class T> static T __ROL__(T value, unsigned int count)
|
|||
* for Rice hires texture packs.
|
||||
*
|
||||
* BYTE* addr = (BYTE*)(gfx.RDRAM +
|
||||
* rdp.addr[rdp.tiles[tile].t_mem] +
|
||||
* (rdp.tiles[tile].ul_t * bpl) +
|
||||
* (((rdp.tiles[tile].ul_s<<rdp.tiles[tile].size)+1)>>1));
|
||||
* rdp.addr[rdp.tiles(tile).t_mem] +
|
||||
* (rdp.tiles(tile).ul_t * bpl) +
|
||||
* (((rdp.tiles(tile).ul_s<<rdp.tiles(tile).size)+1)>>1));
|
||||
* RiceCRC32(addr,
|
||||
* rdp.tiles[tile].width,
|
||||
* rdp.tiles[tile].height,
|
||||
* (unsigned short)(rdp.tiles[tile].format << 8 | rdp.tiles[tile].size),
|
||||
* rdp.tiles(tile).width,
|
||||
* rdp.tiles(tile).height,
|
||||
* (unsigned short)(rdp.tiles(tile).format << 8 | rdp.tiles(tile).size),
|
||||
* bpl);
|
||||
*/
|
||||
uint32
|
||||
TxUtil::RiceCRC32(const uint8* src, int width, int height, int size, int rowStride)
|
||||
uint32 TxUtil::RiceCRC32(const uint8* src, int width, int height, int size, int rowStride)
|
||||
{
|
||||
const uint8_t *row;
|
||||
uint32_t crc32Ret;
|
||||
int cur_height;
|
||||
uint32_t pos;
|
||||
uint32_t word;
|
||||
uint32_t word_hash = 0;
|
||||
uint32_t tmp;
|
||||
const uint32_t bytes_per_width = ((width << size) + 1) >> 1;
|
||||
const uint8_t *row;
|
||||
uint32_t crc32Ret;
|
||||
int cur_height;
|
||||
uint32_t pos;
|
||||
uint32_t word;
|
||||
uint32_t word_hash = 0;
|
||||
uint32_t tmp;
|
||||
const uint32_t bytes_per_width = ((width << size) + 1) >> 1;
|
||||
|
||||
row = src;
|
||||
crc32Ret = 0;
|
||||
row = src;
|
||||
crc32Ret = 0;
|
||||
|
||||
for (cur_height = height - 1; cur_height >= 0; cur_height--) {
|
||||
for (pos = bytes_per_width - 4; pos < 0x80000000u; pos -= 4) {
|
||||
word = *(uint32_t *)&row[pos];
|
||||
word_hash = pos ^ word;
|
||||
tmp = __ROL__(crc32Ret, 4);
|
||||
crc32Ret = word_hash + tmp;
|
||||
for (cur_height = height - 1; cur_height >= 0; cur_height--)
|
||||
{
|
||||
for (pos = bytes_per_width - 4; pos < 0x80000000u; pos -= 4)
|
||||
{
|
||||
word = *(uint32_t *)&row[pos];
|
||||
word_hash = pos ^ word;
|
||||
tmp = __ROL__(crc32Ret, 4);
|
||||
crc32Ret = word_hash + tmp;
|
||||
}
|
||||
crc32Ret += cur_height ^ word_hash;
|
||||
row += rowStride;
|
||||
}
|
||||
crc32Ret += cur_height ^ word_hash;
|
||||
row += rowStride;
|
||||
}
|
||||
return crc32Ret;
|
||||
return crc32Ret;
|
||||
}
|
||||
|
||||
boolean
|
||||
TxUtil::RiceCRC32_CI4(const uint8* src, int width, int height, int size, int rowStride,
|
||||
uint32* crc32, uint32* cimax)
|
||||
bool TxUtil::RiceCRC32_CI4(const uint8* src, int width, int height, int size, int rowStride, uint32* crc32, uint32* cimax)
|
||||
{
|
||||
const uint8_t *row;
|
||||
uint32_t crc32Ret;
|
||||
uint32_t cimaxRet;
|
||||
int cur_height;
|
||||
uint32_t pos;
|
||||
uint32_t word;
|
||||
uint32_t word_hash = 0;
|
||||
uint32_t tmp;
|
||||
const uint32_t bytes_per_width = ((width << size) + 1) >> 1;
|
||||
const uint8_t *row;
|
||||
uint32_t crc32Ret;
|
||||
uint32_t cimaxRet;
|
||||
int cur_height;
|
||||
uint32_t pos;
|
||||
uint32_t word;
|
||||
uint32_t word_hash = 0;
|
||||
uint32_t tmp;
|
||||
const uint32_t bytes_per_width = ((width << size) + 1) >> 1;
|
||||
|
||||
row = src;
|
||||
crc32Ret = 0;
|
||||
cimaxRet = 0;
|
||||
row = src;
|
||||
crc32Ret = 0;
|
||||
cimaxRet = 0;
|
||||
|
||||
for (cur_height = height - 1; cur_height >= 0; cur_height--) {
|
||||
for (pos = bytes_per_width - 4; pos < 0x80000000u; pos -= 4) {
|
||||
word = *(uint32_t *)&row[pos];
|
||||
if (cimaxRet != 15) {
|
||||
if ((word & 0xF) >= cimaxRet)
|
||||
cimaxRet = word & 0xF;
|
||||
if ((uint32_t)((uint8_t)word >> 4) >= cimaxRet)
|
||||
cimaxRet = (uint8_t)word >> 4;
|
||||
if (((word >> 8) & 0xF) >= cimaxRet)
|
||||
cimaxRet = (word >> 8) & 0xF;
|
||||
if ((uint32_t)((uint16_t)word >> 12) >= cimaxRet)
|
||||
cimaxRet = (uint16_t)word >> 12;
|
||||
if (((word >> 16) & 0xF) >= cimaxRet)
|
||||
cimaxRet = (word >> 16) & 0xF;
|
||||
if (((word >> 20) & 0xF) >= cimaxRet)
|
||||
cimaxRet = (word >> 20) & 0xF;
|
||||
if (((word >> 24) & 0xF) >= cimaxRet)
|
||||
cimaxRet = (word >> 24) & 0xF;
|
||||
if (word >> 28 >= cimaxRet )
|
||||
cimaxRet = word >> 28;
|
||||
}
|
||||
word_hash = pos ^ word;
|
||||
tmp = __ROL__(crc32Ret, 4);
|
||||
crc32Ret = word_hash + tmp;
|
||||
for (cur_height = height - 1; cur_height >= 0; cur_height--)
|
||||
{
|
||||
for (pos = bytes_per_width - 4; pos < 0x80000000u; pos -= 4)
|
||||
{
|
||||
word = *(uint32_t *)&row[pos];
|
||||
if (cimaxRet != 15)
|
||||
{
|
||||
if ((word & 0xF) >= cimaxRet)
|
||||
cimaxRet = word & 0xF;
|
||||
if ((uint32_t)((uint8_t)word >> 4) >= cimaxRet)
|
||||
cimaxRet = (uint8_t)word >> 4;
|
||||
if (((word >> 8) & 0xF) >= cimaxRet)
|
||||
cimaxRet = (word >> 8) & 0xF;
|
||||
if ((uint32_t)((uint16_t)word >> 12) >= cimaxRet)
|
||||
cimaxRet = (uint16_t)word >> 12;
|
||||
if (((word >> 16) & 0xF) >= cimaxRet)
|
||||
cimaxRet = (word >> 16) & 0xF;
|
||||
if (((word >> 20) & 0xF) >= cimaxRet)
|
||||
cimaxRet = (word >> 20) & 0xF;
|
||||
if (((word >> 24) & 0xF) >= cimaxRet)
|
||||
cimaxRet = (word >> 24) & 0xF;
|
||||
if (word >> 28 >= cimaxRet)
|
||||
cimaxRet = word >> 28;
|
||||
}
|
||||
word_hash = pos ^ word;
|
||||
tmp = __ROL__(crc32Ret, 4);
|
||||
crc32Ret = word_hash + tmp;
|
||||
}
|
||||
crc32Ret += cur_height ^ word_hash;
|
||||
row += rowStride;
|
||||
}
|
||||
crc32Ret += cur_height ^ word_hash;
|
||||
row += rowStride;
|
||||
}
|
||||
*crc32 = crc32Ret;
|
||||
*cimax = cimaxRet;
|
||||
return 1;
|
||||
*crc32 = crc32Ret;
|
||||
*cimax = cimaxRet;
|
||||
return 1;
|
||||
}
|
||||
|
||||
boolean
|
||||
TxUtil::RiceCRC32_CI8(const uint8* src, int width, int height, int size, int rowStride,
|
||||
uint32* crc32, uint32* cimax)
|
||||
bool TxUtil::RiceCRC32_CI8(const uint8* src, int width, int height, int size, int rowStride, uint32* crc32, uint32* cimax)
|
||||
{
|
||||
const uint8_t *row;
|
||||
uint32_t crc32Ret;
|
||||
uint32_t cimaxRet;
|
||||
int cur_height;
|
||||
uint32_t pos;
|
||||
uint32_t word;
|
||||
uint32_t word_hash = 0;
|
||||
uint32_t tmp;
|
||||
const uint32_t bytes_per_width = ((width << size) + 1) >> 1;
|
||||
const uint8_t *row;
|
||||
uint32_t crc32Ret;
|
||||
uint32_t cimaxRet;
|
||||
int cur_height;
|
||||
uint32_t pos;
|
||||
uint32_t word;
|
||||
uint32_t word_hash = 0;
|
||||
uint32_t tmp;
|
||||
const uint32_t bytes_per_width = ((width << size) + 1) >> 1;
|
||||
|
||||
row = src;
|
||||
crc32Ret = 0;
|
||||
cimaxRet = 0;
|
||||
row = src;
|
||||
crc32Ret = 0;
|
||||
cimaxRet = 0;
|
||||
|
||||
for (cur_height = height - 1; cur_height >= 0; cur_height--) {
|
||||
for (pos = bytes_per_width - 4; pos < 0x80000000u; pos -= 4) {
|
||||
word = *(uint32_t *)&row[pos];
|
||||
if (cimaxRet != 255) {
|
||||
if ((uint8_t)word >= cimaxRet)
|
||||
cimaxRet = (uint8_t)word;
|
||||
if ((uint32_t)((uint16_t)word >> 8) >= cimaxRet)
|
||||
cimaxRet = (uint16_t)word >> 8;
|
||||
if (((word >> 16) & 0xFF) >= cimaxRet)
|
||||
cimaxRet = (word >> 16) & 0xFF;
|
||||
if (word >> 24 >= cimaxRet)
|
||||
cimaxRet = word >> 24;
|
||||
}
|
||||
word_hash = pos ^ word;
|
||||
tmp = __ROL__(crc32Ret, 4);
|
||||
crc32Ret = word_hash + tmp;
|
||||
for (cur_height = height - 1; cur_height >= 0; cur_height--)
|
||||
{
|
||||
for (pos = bytes_per_width - 4; pos < 0x80000000u; pos -= 4)
|
||||
{
|
||||
word = *(uint32_t *)&row[pos];
|
||||
if (cimaxRet != 255)
|
||||
{
|
||||
if ((uint8_t)word >= cimaxRet)
|
||||
cimaxRet = (uint8_t)word;
|
||||
if ((uint32_t)((uint16_t)word >> 8) >= cimaxRet)
|
||||
cimaxRet = (uint16_t)word >> 8;
|
||||
if (((word >> 16) & 0xFF) >= cimaxRet)
|
||||
cimaxRet = (word >> 16) & 0xFF;
|
||||
if (word >> 24 >= cimaxRet)
|
||||
cimaxRet = word >> 24;
|
||||
}
|
||||
word_hash = pos ^ word;
|
||||
tmp = __ROL__(crc32Ret, 4);
|
||||
crc32Ret = word_hash + tmp;
|
||||
}
|
||||
crc32Ret += cur_height ^ word_hash;
|
||||
row += rowStride;
|
||||
}
|
||||
crc32Ret += cur_height ^ word_hash;
|
||||
row += rowStride;
|
||||
}
|
||||
*crc32 = crc32Ret;
|
||||
*cimax = cimaxRet;
|
||||
return 1;
|
||||
*crc32 = crc32Ret;
|
||||
*cimax = cimaxRet;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
TxUtil::log2(int num)
|
||||
int TxUtil::log2(int num)
|
||||
{
|
||||
#if defined(__GNUC__)
|
||||
return __builtin_ctz(num);
|
||||
return __builtin_ctz(num);
|
||||
#elif defined(_MSC_VER) && _MSC_VER >= 1400
|
||||
uint32_t i;
|
||||
_BitScanForward((DWORD *)&i, num);
|
||||
return i;
|
||||
uint32_t i;
|
||||
_BitScanForward((unsigned long *)&i, num);
|
||||
return i;
|
||||
#elif defined(__MSC__)
|
||||
__asm {
|
||||
mov eax, dword ptr [num];
|
||||
bsr eax, eax;
|
||||
mov dword ptr [i], eax;
|
||||
}
|
||||
__asm {
|
||||
mov eax, dword ptr[num];
|
||||
bsr eax, eax;
|
||||
mov dword ptr[i], eax;
|
||||
}
|
||||
#else
|
||||
switch (num) {
|
||||
switch (num) {
|
||||
case 1: return 0;
|
||||
case 2: return 1;
|
||||
case 4: return 2;
|
||||
|
@ -481,104 +388,99 @@ TxUtil::log2(int num)
|
|||
case 512: return 9;
|
||||
case 1024: return 10;
|
||||
case 2048: return 11;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
TxUtil::grLodLog2(int w, int h)
|
||||
int TxUtil::grLodLog2(int w, int h)
|
||||
{
|
||||
return (w >= h ? log2(w) : log2(h));
|
||||
return (w >= h ? log2(w) : log2(h));
|
||||
}
|
||||
|
||||
int
|
||||
TxUtil::grAspectRatioLog2(int w, int h)
|
||||
int TxUtil::grAspectRatioLog2(int w, int h)
|
||||
{
|
||||
return (w >= h ? log2(w/h) : -log2(h/w));
|
||||
return (w >= h ? log2(w / h) : -log2(h / w));
|
||||
}
|
||||
|
||||
int
|
||||
TxUtil::getNumberofProcessors()
|
||||
int TxUtil::getNumberofProcessors()
|
||||
{
|
||||
int numcore = 1, ret;
|
||||
int numcore = 1, ret;
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifndef _SC_NPROCESSORS_ONLN
|
||||
SYSTEM_INFO info;
|
||||
GetSystemInfo(&info);
|
||||
SYSTEM_INFO info;
|
||||
GetSystemInfo(&info);
|
||||
#define sysconf(a) info.dwNumberOfProcessors
|
||||
#define _SC_NPROCESSORS_ONLN
|
||||
#endif
|
||||
#endif
|
||||
#ifdef _SC_NPROCESSORS_ONLN
|
||||
ret = sysconf(_SC_NPROCESSORS_CONF);
|
||||
if (ret >= 1) {
|
||||
numcore = ret;
|
||||
}
|
||||
ret = sysconf(_SC_NPROCESSORS_ONLN);
|
||||
if (ret < 1) {
|
||||
numcore = ret;
|
||||
}
|
||||
ret = sysconf(_SC_NPROCESSORS_CONF);
|
||||
if (ret >= 1) {
|
||||
numcore = ret;
|
||||
}
|
||||
ret = sysconf(_SC_NPROCESSORS_ONLN);
|
||||
if (ret < 1) {
|
||||
numcore = ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
return numcore;
|
||||
return numcore;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Memory buffers for texture manipulations
|
||||
******************************************************************************/
|
||||
TxMemBuf::TxMemBuf()
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 2; i++) {
|
||||
_tex[i] = NULL;
|
||||
_size[i] = 0;
|
||||
}
|
||||
int i;
|
||||
for (i = 0; i < 2; i++) {
|
||||
_tex[i] = NULL;
|
||||
_size[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
TxMemBuf::~TxMemBuf()
|
||||
{
|
||||
shutdown();
|
||||
shutdown();
|
||||
}
|
||||
|
||||
boolean
|
||||
TxMemBuf::init(int maxwidth, int maxheight)
|
||||
bool TxMemBuf::init(int maxwidth, int maxheight)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 2; i++) {
|
||||
if (!_tex[i]) {
|
||||
_tex[i] = (uint8 *)malloc(maxwidth * maxheight * 4);
|
||||
_size[i] = maxwidth * maxheight * 4;
|
||||
int i;
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
if (!_tex[i])
|
||||
{
|
||||
_tex[i] = (uint8 *)malloc(maxwidth * maxheight * 4);
|
||||
_size[i] = maxwidth * maxheight * 4;
|
||||
}
|
||||
|
||||
if (!_tex[i])
|
||||
{
|
||||
shutdown();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!_tex[i]) {
|
||||
shutdown();
|
||||
return 0;
|
||||
void TxMemBuf::shutdown()
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 2; i++) {
|
||||
if (_tex[i]) free(_tex[i]);
|
||||
_tex[i] = NULL;
|
||||
_size[i] = 0;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
TxMemBuf::shutdown()
|
||||
uint8* TxMemBuf::get(unsigned int num)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 2; i++) {
|
||||
if (_tex[i]) free(_tex[i]);
|
||||
_tex[i] = NULL;
|
||||
_size[i] = 0;
|
||||
}
|
||||
return ((num < 2) ? _tex[num] : NULL);
|
||||
}
|
||||
|
||||
uint8*
|
||||
TxMemBuf::get(unsigned int num)
|
||||
uint32 TxMemBuf::size_of(unsigned int num)
|
||||
{
|
||||
return ((num < 2) ? _tex[num] : NULL);
|
||||
}
|
||||
|
||||
uint32
|
||||
TxMemBuf::size_of(unsigned int num)
|
||||
{
|
||||
return ((num < 2) ? _size[num] : 0);
|
||||
}
|
||||
return ((num < 2) ? _size[num] : 0);
|
||||
}
|
|
@ -1,25 +1,16 @@
|
|||
/*
|
||||
* Texture Filtering
|
||||
* Version: 1.0
|
||||
*
|
||||
* Copyright (C) 2007 Hiroshi Morii All Rights Reserved.
|
||||
* Email koolsmoky(at)users.sourceforge.net
|
||||
* Web http://www.3dfxzone.it/koolsmoky
|
||||
*
|
||||
* this 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 Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* this 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 GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2007 Hiroshi Morii *
|
||||
* Copyright (C) 2003 Rice1964 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __TXUTIL_H__
|
||||
#define __TXUTIL_H__
|
||||
|
@ -30,92 +21,87 @@
|
|||
#include "TxInternal.h"
|
||||
#include <string>
|
||||
|
||||
#ifndef DXTN_DLL
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
extern "C" {
|
||||
#endif
|
||||
void tx_compress_dxtn(int srccomps, int width, int height,
|
||||
const void *source, int destformat, void *dest,
|
||||
int destRowStride);
|
||||
void tx_compress_dxtn(int srccomps, int width, int height,
|
||||
const void *source, int destformat, void *dest,
|
||||
int destRowStride);
|
||||
|
||||
int fxt1_encode(int width, int height, int comps,
|
||||
const void *source, int srcRowStride,
|
||||
void *dest, int destRowStride);
|
||||
int fxt1_encode(int width, int height, int comps,
|
||||
const void *source, int srcRowStride,
|
||||
void *dest, int destRowStride);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* DXTN_DLL */
|
||||
|
||||
typedef void (*dxtCompressTexFuncExt)(int srccomps, int width,
|
||||
int height, const void *srcPixData,
|
||||
int destformat, void *dest,
|
||||
int dstRowStride);
|
||||
typedef void(*dxtCompressTexFuncExt)(int srccomps, int width,
|
||||
int height, const void *srcPixData,
|
||||
int destformat, void *dest,
|
||||
int dstRowStride);
|
||||
|
||||
typedef int (*fxtCompressTexFuncExt)(int width, int height, int comps,
|
||||
const void *source, int srcRowStride,
|
||||
void *dest, int destRowStride);
|
||||
typedef int(*fxtCompressTexFuncExt)(int width, int height, int comps,
|
||||
const void *source, int srcRowStride,
|
||||
void *dest, int destRowStride);
|
||||
|
||||
class TxLoadLib
|
||||
{
|
||||
private:
|
||||
#ifdef DXTN_DLL
|
||||
HMODULE _dxtnlib;
|
||||
#endif
|
||||
fxtCompressTexFuncExt _tx_compress_fxt1;
|
||||
dxtCompressTexFuncExt _tx_compress_dxtn;
|
||||
TxLoadLib();
|
||||
fxtCompressTexFuncExt _tx_compress_fxt1;
|
||||
dxtCompressTexFuncExt _tx_compress_dxtn;
|
||||
TxLoadLib();
|
||||
public:
|
||||
static TxLoadLib* getInstance() {
|
||||
static TxLoadLib txLoadLib;
|
||||
return &txLoadLib;
|
||||
}
|
||||
~TxLoadLib();
|
||||
fxtCompressTexFuncExt getfxtCompressTexFuncExt();
|
||||
dxtCompressTexFuncExt getdxtCompressTexFuncExt();
|
||||
static TxLoadLib* getInstance() {
|
||||
static TxLoadLib txLoadLib;
|
||||
return &txLoadLib;
|
||||
}
|
||||
~TxLoadLib();
|
||||
fxtCompressTexFuncExt getfxtCompressTexFuncExt();
|
||||
dxtCompressTexFuncExt getdxtCompressTexFuncExt();
|
||||
};
|
||||
|
||||
class TxUtil
|
||||
{
|
||||
private:
|
||||
uint32 Adler32(const uint8* data, int Len, uint32 Adler);
|
||||
uint32 Adler32(const uint8* src, int width, int height, int size, int rowStride);
|
||||
uint32 RiceCRC32(const uint8* src, int width, int height, int size, int rowStride);
|
||||
boolean RiceCRC32_CI4(const uint8* src, int width, int height, int size, int rowStride,
|
||||
uint32* crc32, uint32* cimax);
|
||||
boolean RiceCRC32_CI8(const uint8* src, int width, int height, int size, int rowStride,
|
||||
uint32* crc32, uint32* cimax);
|
||||
int log2(int num);
|
||||
uint32 Adler32(const uint8* data, int Len, uint32 Adler);
|
||||
uint32 Adler32(const uint8* src, int width, int height, int size, int rowStride);
|
||||
uint32 RiceCRC32(const uint8* src, int width, int height, int size, int rowStride);
|
||||
bool RiceCRC32_CI4(const uint8* src, int width, int height, int size, int rowStride,
|
||||
uint32* crc32, uint32* cimax);
|
||||
bool RiceCRC32_CI8(const uint8* src, int width, int height, int size, int rowStride,
|
||||
uint32* crc32, uint32* cimax);
|
||||
int log2(int num);
|
||||
public:
|
||||
TxUtil() { }
|
||||
~TxUtil() { }
|
||||
int sizeofTx(int width, int height, uint16 format);
|
||||
uint32 checksumTx(uint8 *data, int width, int height, uint16 format);
|
||||
TxUtil() { }
|
||||
~TxUtil() { }
|
||||
int sizeofTx(int width, int height, uint16 format);
|
||||
uint32 checksumTx(uint8 *data, int width, int height, uint16 format);
|
||||
#if 0 /* unused */
|
||||
uint32 chkAlpha(uint32* src, int width, int height);
|
||||
uint32 chkAlpha(uint32* src, int width, int height);
|
||||
#endif
|
||||
uint32 checksum(uint8 *src, int width, int height, int size, int rowStride);
|
||||
uint64 checksum64(uint8 *src, int width, int height, int size, int rowStride, uint8 *palette);
|
||||
int grLodLog2(int w, int h);
|
||||
int grAspectRatioLog2(int w, int h);
|
||||
int getNumberofProcessors();
|
||||
uint32 checksum(uint8 *src, int width, int height, int size, int rowStride);
|
||||
uint64_t checksum64(uint8 *src, int width, int height, int size, int rowStride, uint8 *palette);
|
||||
int grLodLog2(int w, int h);
|
||||
int grAspectRatioLog2(int w, int h);
|
||||
int getNumberofProcessors();
|
||||
};
|
||||
|
||||
class TxMemBuf
|
||||
{
|
||||
private:
|
||||
uint8 *_tex[2];
|
||||
uint32 _size[2];
|
||||
TxMemBuf();
|
||||
uint8 *_tex[2];
|
||||
uint32 _size[2];
|
||||
TxMemBuf();
|
||||
public:
|
||||
static TxMemBuf* getInstance() {
|
||||
static TxMemBuf txMemBuf;
|
||||
return &txMemBuf;
|
||||
}
|
||||
~TxMemBuf();
|
||||
boolean init(int maxwidth, int maxheight);
|
||||
void shutdown(void);
|
||||
uint8 *get(unsigned int num);
|
||||
uint32 size_of(unsigned int num);
|
||||
static TxMemBuf* getInstance() {
|
||||
static TxMemBuf txMemBuf;
|
||||
return &txMemBuf;
|
||||
}
|
||||
~TxMemBuf();
|
||||
bool init(int maxwidth, int maxheight);
|
||||
void shutdown(void);
|
||||
uint8 *get(unsigned int num);
|
||||
uint32 size_of(unsigned int num);
|
||||
};
|
||||
|
||||
#endif /* __TXUTIL_H__ */
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,62 +1,54 @@
|
|||
/*
|
||||
* DXTn codec
|
||||
* Version: 1.1
|
||||
*
|
||||
* Copyright (C) 2004 Daniel Borca All Rights Reserved.
|
||||
*
|
||||
* this 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 Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* this 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 GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2007 Hiroshi Morii *
|
||||
* Copyright (C) 2004 Daniel Borca *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef DXTN_H_included
|
||||
#define DXTN_H_included
|
||||
|
||||
TAPI int TAPIENTRY
|
||||
dxt1_rgb_encode (int width, int height, int comps,
|
||||
const void *source, int srcRowStride,
|
||||
void *dest, int destRowStride);
|
||||
dxt1_rgb_encode(int width, int height, int comps,
|
||||
const void *source, int srcRowStride,
|
||||
void *dest, int destRowStride);
|
||||
|
||||
TAPI int TAPIENTRY
|
||||
dxt1_rgba_encode (int width, int height, int comps,
|
||||
const void *source, int srcRowStride,
|
||||
void *dest, int destRowStride);
|
||||
dxt1_rgba_encode(int width, int height, int comps,
|
||||
const void *source, int srcRowStride,
|
||||
void *dest, int destRowStride);
|
||||
|
||||
TAPI int TAPIENTRY
|
||||
dxt3_rgba_encode (int width, int height, int comps,
|
||||
const void *source, int srcRowStride,
|
||||
void *dest, int destRowStride);
|
||||
dxt3_rgba_encode(int width, int height, int comps,
|
||||
const void *source, int srcRowStride,
|
||||
void *dest, int destRowStride);
|
||||
|
||||
TAPI int TAPIENTRY
|
||||
dxt5_rgba_encode (int width, int height, int comps,
|
||||
const void *source, int srcRowStride,
|
||||
void *dest, int destRowStride);
|
||||
dxt5_rgba_encode(int width, int height, int comps,
|
||||
const void *source, int srcRowStride,
|
||||
void *dest, int destRowStride);
|
||||
|
||||
TAPI void TAPIENTRY
|
||||
dxt1_rgb_decode_1 (const void *texture, int stride /* in pixels */,
|
||||
int i, int j, byte *rgba);
|
||||
dxt1_rgb_decode_1(const void *texture, int stride /* in pixels */,
|
||||
int i, int j, byte *rgba);
|
||||
|
||||
TAPI void TAPIENTRY
|
||||
dxt1_rgba_decode_1 (const void *texture, int stride /* in pixels */,
|
||||
int i, int j, byte *rgba);
|
||||
dxt1_rgba_decode_1(const void *texture, int stride /* in pixels */,
|
||||
int i, int j, byte *rgba);
|
||||
|
||||
TAPI void TAPIENTRY
|
||||
dxt3_rgba_decode_1 (const void *texture, int stride /* in pixels */,
|
||||
int i, int j, byte *rgba);
|
||||
dxt3_rgba_decode_1(const void *texture, int stride /* in pixels */,
|
||||
int i, int j, byte *rgba);
|
||||
|
||||
TAPI void TAPIENTRY
|
||||
dxt5_rgba_decode_1 (const void *texture, int stride /* in pixels */,
|
||||
int i, int j, byte *rgba);
|
||||
dxt5_rgba_decode_1(const void *texture, int stride /* in pixels */,
|
||||
int i, int j, byte *rgba);
|
||||
|
||||
#endif
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,38 +1,27 @@
|
|||
/*
|
||||
* FXT1 codec
|
||||
* Version: 1.1
|
||||
*
|
||||
* Copyright (C) 2004 Daniel Borca All Rights Reserved.
|
||||
*
|
||||
* 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
|
||||
* DANIEL BORCA 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.
|
||||
*/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2007 Hiroshi Morii *
|
||||
* Copyright (C) 2004 Daniel Borca *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef FXT1_H_included
|
||||
#define FXT1_H_included
|
||||
|
||||
TAPI int TAPIENTRY
|
||||
fxt1_encode (int width, int height, int comps,
|
||||
const void *source, int srcRowStride,
|
||||
void *dest, int destRowStride);
|
||||
fxt1_encode(int width, int height, int comps,
|
||||
const void *source, int srcRowStride,
|
||||
void *dest, int destRowStride);
|
||||
|
||||
TAPI void TAPIENTRY
|
||||
fxt1_decode_1 (const void *texture, int stride /* in pixels */,
|
||||
int i, int j, byte *rgba);
|
||||
fxt1_decode_1(const void *texture, int stride /* in pixels */,
|
||||
int i, int j, byte *rgba);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,29 +1,20 @@
|
|||
/*
|
||||
* Texture compression
|
||||
* Version: 1.0
|
||||
*
|
||||
* Copyright (C) 2004 Daniel Borca All Rights Reserved.
|
||||
*
|
||||
* this 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 Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* this 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 GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2007 Hiroshi Morii *
|
||||
* Copyright (C) 2004 Daniel Borca *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef INTERNAL_H_included
|
||||
#define INTERNAL_H_included
|
||||
|
||||
|
||||
/*****************************************************************************\
|
||||
* Texture compression stuff
|
||||
\*****************************************************************************/
|
||||
|
@ -31,19 +22,12 @@
|
|||
#define YUV
|
||||
#define ARGB
|
||||
|
||||
|
||||
/*****************************************************************************\
|
||||
* DLL stuff
|
||||
\*****************************************************************************/
|
||||
|
||||
#ifdef __WIN32__
|
||||
#define TAPI __declspec(dllexport)
|
||||
#define TAPIENTRY /*__stdcall*/
|
||||
#else
|
||||
#define TAPI
|
||||
#define TAPIENTRY
|
||||
#endif
|
||||
|
||||
|
||||
/*****************************************************************************\
|
||||
* 64bit types on 32bit machine
|
||||
|
@ -78,7 +62,6 @@ typedef struct {
|
|||
|
||||
#endif /* !__GNUC__ */
|
||||
|
||||
|
||||
/*****************************************************************************\
|
||||
* Config
|
||||
\*****************************************************************************/
|
||||
|
@ -131,16 +114,15 @@ typedef struct {
|
|||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
/*****************************************************************************\
|
||||
* Utility functions
|
||||
\*****************************************************************************/
|
||||
|
||||
void
|
||||
_mesa_upscale_teximage2d (unsigned int inWidth, unsigned int inHeight,
|
||||
unsigned int outWidth, unsigned int outHeight,
|
||||
unsigned int comps,
|
||||
const byte *src, int srcRowStride,
|
||||
unsigned char *dest);
|
||||
_mesa_upscale_teximage2d(unsigned int inWidth, unsigned int inHeight,
|
||||
unsigned int outWidth, unsigned int outHeight,
|
||||
unsigned int comps,
|
||||
const byte *src, int srcRowStride,
|
||||
unsigned char *dest);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,43 +1,28 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.3
|
||||
*
|
||||
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
|
||||
*
|
||||
* 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
|
||||
* BRIAN PAUL 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.
|
||||
*/
|
||||
|
||||
/* Copyright (C) 2007 Hiroshi Morii <koolsmoky(at)users.sourceforge.net>
|
||||
* _mesa_upscale_teximage2d speedup
|
||||
*/
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2007 Hiroshi Morii *
|
||||
* Copyright (C) 2004 Daniel Borca *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "types.h"
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
void
|
||||
_mesa_upscale_teximage2d (unsigned int inWidth, unsigned int inHeight,
|
||||
unsigned int outWidth, unsigned int outHeight,
|
||||
unsigned int comps,
|
||||
const byte *src, int srcRowStride,
|
||||
byte *dest)
|
||||
_mesa_upscale_teximage2d(unsigned int inWidth, unsigned int inHeight,
|
||||
unsigned int outWidth, unsigned int outHeight,
|
||||
unsigned int comps,
|
||||
const byte *src, int srcRowStride,
|
||||
byte *dest)
|
||||
{
|
||||
unsigned int i, j, k;
|
||||
|
||||
|
@ -45,49 +30,49 @@ _mesa_upscale_teximage2d (unsigned int inWidth, unsigned int inHeight,
|
|||
assert(outHeight >= inHeight);
|
||||
|
||||
#if 1 /* H.Morii - faster loops */
|
||||
for (i = 0; i < inHeight; i++) {
|
||||
for (j = 0; j < inWidth; j++) {
|
||||
const int aa = (i * outWidth + j) * comps;
|
||||
const int bb = i * srcRowStride + j * comps;
|
||||
for (k = 0; k < comps; k++) {
|
||||
dest[aa + k] = src[bb + k];
|
||||
}
|
||||
for (i = 0; i < inHeight; i++) {
|
||||
for (j = 0; j < inWidth; j++) {
|
||||
const int aa = (i * outWidth + j) * comps;
|
||||
const int bb = i * srcRowStride + j * comps;
|
||||
for (k = 0; k < comps; k++) {
|
||||
dest[aa + k] = src[bb + k];
|
||||
}
|
||||
}
|
||||
for (; j < outWidth; j++) {
|
||||
const int aa = (i * outWidth + j) * comps;
|
||||
const int bb = i * srcRowStride + (j - inWidth) * comps;
|
||||
for (k = 0; k < comps; k++) {
|
||||
dest[aa + k] = src[bb + k];
|
||||
}
|
||||
}
|
||||
}
|
||||
for (; j < outWidth; j++) {
|
||||
const int aa = (i * outWidth + j) * comps;
|
||||
const int bb = i * srcRowStride + (j - inWidth) * comps;
|
||||
for (k = 0; k < comps; k++) {
|
||||
dest[aa + k] = src[bb + k];
|
||||
}
|
||||
for (; i < outHeight; i++) {
|
||||
for (j = 0; j < inWidth; j++) {
|
||||
const int aa = (i * outWidth + j) * comps;
|
||||
const int bb = (i - inHeight) * srcRowStride + j * comps;
|
||||
for (k = 0; k < comps; k++) {
|
||||
dest[aa + k] = src[bb + k];
|
||||
}
|
||||
}
|
||||
for (; j < outWidth; j++) {
|
||||
const int aa = (i * outWidth + j) * comps;
|
||||
const int bb = (i - inHeight) * srcRowStride + (j - inWidth) * comps;
|
||||
for (k = 0; k < comps; k++) {
|
||||
dest[aa + k] = src[bb + k];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (; i < outHeight; i++) {
|
||||
for (j = 0; j < inWidth; j++) {
|
||||
const int aa = (i * outWidth + j) * comps;
|
||||
const int bb = (i - inHeight) * srcRowStride + j * comps;
|
||||
for (k = 0; k < comps; k++) {
|
||||
dest[aa + k] = src[bb + k];
|
||||
}
|
||||
}
|
||||
for (; j < outWidth; j++) {
|
||||
const int aa = (i * outWidth + j) * comps;
|
||||
const int bb = (i - inHeight) * srcRowStride + (j - inWidth) * comps;
|
||||
for (k = 0; k < comps; k++) {
|
||||
dest[aa + k] = src[bb + k];
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
for (i = 0; i < outHeight; i++) {
|
||||
const int ii = i % inHeight;
|
||||
for (j = 0; j < outWidth; j++) {
|
||||
const int jj = j % inWidth;
|
||||
const int ii = i % inHeight;
|
||||
for (j = 0; j < outWidth; j++) {
|
||||
const int jj = j % inWidth;
|
||||
const int aa = (i * outWidth + j) * comps;
|
||||
const int bb = ii * srcRowStride + jj * comps;
|
||||
for (k = 0; k < comps; k++) {
|
||||
dest[aa + k] = src[bb + k];
|
||||
}
|
||||
}
|
||||
for (k = 0; k < comps; k++) {
|
||||
dest[aa + k] = src[bb + k];
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
|
@ -1,3 +1,17 @@
|
|||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2007 Hiroshi Morii *
|
||||
* Copyright (C) 2004 Daniel Borca *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef TYPES_H_included
|
||||
#define TYPES_H_included
|
||||
|
||||
|
|
|
@ -1,24 +1,16 @@
|
|||
/*
|
||||
* Texture compression
|
||||
* Version: 1.0
|
||||
*
|
||||
* Copyright (C) 2004 Daniel Borca All Rights Reserved.
|
||||
*
|
||||
* this 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 Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* this 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 GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2007 Hiroshi Morii *
|
||||
* Copyright (C) 2004 Daniel Borca *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
|
@ -26,85 +18,79 @@
|
|||
#include "internal.h"
|
||||
#include "dxtn.h"
|
||||
|
||||
|
||||
#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
|
||||
#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
|
||||
#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2
|
||||
#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
|
||||
|
||||
|
||||
TAPI void TAPIENTRY
|
||||
fetch_2d_texel_rgb_dxt1 (int texImage_RowStride,
|
||||
const byte *texImage_Data,
|
||||
int i, int j,
|
||||
byte *texel)
|
||||
fetch_2d_texel_rgb_dxt1(int texImage_RowStride,
|
||||
const byte *texImage_Data,
|
||||
int i, int j,
|
||||
byte *texel)
|
||||
{
|
||||
dxt1_rgb_decode_1(texImage_Data, texImage_RowStride, i, j, texel);
|
||||
}
|
||||
|
||||
|
||||
TAPI void TAPIENTRY
|
||||
fetch_2d_texel_rgba_dxt1 (int texImage_RowStride,
|
||||
const byte *texImage_Data,
|
||||
int i, int j,
|
||||
byte *texel)
|
||||
fetch_2d_texel_rgba_dxt1(int texImage_RowStride,
|
||||
const byte *texImage_Data,
|
||||
int i, int j,
|
||||
byte *texel)
|
||||
{
|
||||
dxt1_rgba_decode_1(texImage_Data, texImage_RowStride, i, j, texel);
|
||||
}
|
||||
|
||||
|
||||
TAPI void TAPIENTRY
|
||||
fetch_2d_texel_rgba_dxt3 (int texImage_RowStride,
|
||||
const byte *texImage_Data,
|
||||
int i, int j,
|
||||
byte *texel)
|
||||
fetch_2d_texel_rgba_dxt3(int texImage_RowStride,
|
||||
const byte *texImage_Data,
|
||||
int i, int j,
|
||||
byte *texel)
|
||||
{
|
||||
dxt3_rgba_decode_1(texImage_Data, texImage_RowStride, i, j, texel);
|
||||
}
|
||||
|
||||
|
||||
TAPI void TAPIENTRY
|
||||
fetch_2d_texel_rgba_dxt5 (int texImage_RowStride,
|
||||
const byte *texImage_Data,
|
||||
int i, int j,
|
||||
byte *texel)
|
||||
fetch_2d_texel_rgba_dxt5(int texImage_RowStride,
|
||||
const byte *texImage_Data,
|
||||
int i, int j,
|
||||
byte *texel)
|
||||
{
|
||||
dxt5_rgba_decode_1(texImage_Data, texImage_RowStride, i, j, texel);
|
||||
}
|
||||
|
||||
|
||||
TAPI void TAPIENTRY
|
||||
tx_compress_dxtn (int srccomps, int width, int height,
|
||||
const byte *source, int destformat, byte *dest,
|
||||
int destRowStride)
|
||||
tx_compress_dxtn(int srccomps, int width, int height,
|
||||
const byte *source, int destformat, byte *dest,
|
||||
int destRowStride)
|
||||
{
|
||||
int srcRowStride = width * srccomps;
|
||||
int rv;
|
||||
|
||||
switch (destformat) {
|
||||
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
|
||||
rv = dxt1_rgb_encode(width, height, srccomps,
|
||||
source, srcRowStride,
|
||||
dest, destRowStride);
|
||||
break;
|
||||
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
|
||||
rv = dxt1_rgba_encode(width, height, srccomps,
|
||||
source, srcRowStride,
|
||||
dest, destRowStride);
|
||||
break;
|
||||
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
|
||||
rv = dxt3_rgba_encode(width, height, srccomps,
|
||||
source, srcRowStride,
|
||||
dest, destRowStride);
|
||||
break;
|
||||
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
|
||||
rv = dxt5_rgba_encode(width, height, srccomps,
|
||||
source, srcRowStride,
|
||||
dest, destRowStride);
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
|
||||
rv = dxt1_rgb_encode(width, height, srccomps,
|
||||
source, srcRowStride,
|
||||
dest, destRowStride);
|
||||
break;
|
||||
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
|
||||
rv = dxt1_rgba_encode(width, height, srccomps,
|
||||
source, srcRowStride,
|
||||
dest, destRowStride);
|
||||
break;
|
||||
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
|
||||
rv = dxt3_rgba_encode(width, height, srccomps,
|
||||
source, srcRowStride,
|
||||
dest, destRowStride);
|
||||
break;
|
||||
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
|
||||
rv = dxt5_rgba_encode(width, height, srccomps,
|
||||
source, srcRowStride,
|
||||
dest, destRowStride);
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
|
||||
/*return rv;*/
|
||||
}
|
||||
}
|
|
@ -1,42 +1,16 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
|
|
|
@ -1,44 +1,17 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
|
||||
#ifndef Util_H
|
||||
#define Util_H
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#define NOT_TMU0 0x00
|
||||
#define NOT_TMU1 0x01
|
||||
|
@ -55,7 +28,7 @@ void apply_shade_mods(VERTEX *v);
|
|||
void update();
|
||||
void update_scissor();
|
||||
|
||||
void set_message_combiner();
|
||||
void set_message_combiner(void);
|
||||
|
||||
float ScaleZ(float z);
|
||||
|
||||
|
@ -95,8 +68,8 @@ float ScaleZ(float z);
|
|||
static inline uint32_t bswap32(uint32_t val)
|
||||
{
|
||||
return (((val & 0xff000000) >> 24) |
|
||||
((val & 0x00ff0000) >> 8) |
|
||||
((val & 0x0000ff00) << 8) |
|
||||
((val & 0x00ff0000) >> 8) |
|
||||
((val & 0x0000ff00) << 8) |
|
||||
((val & 0x000000ff) << 24));
|
||||
}
|
||||
#endif
|
||||
|
@ -136,5 +109,3 @@ template<class T> static T __ROL__(T value, unsigned int count)
|
|||
value |= high;
|
||||
return value;
|
||||
}
|
||||
|
||||
#endif // ifndef Util_H
|
||||
|
|
|
@ -1,22 +1,16 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#define STRINGIZE2(s) #s
|
||||
#define STRINGIZE(s) STRINGIZE2(s)
|
||||
|
||||
|
@ -25,19 +19,19 @@
|
|||
#define VERSION_REVISION 0
|
||||
#define VERSION_BUILD 9999
|
||||
|
||||
#define VER_FILE_DESCRIPTION_STR "Glide 64 for Project64"
|
||||
#define VER_FILE_DESCRIPTION_STR "Project64-video"
|
||||
#define VER_FILE_VERSION VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION, VERSION_BUILD
|
||||
#define VER_FILE_VERSION_STR STRINGIZE(VERSION_MAJOR) \
|
||||
"." STRINGIZE(VERSION_MINOR) \
|
||||
"." STRINGIZE(VERSION_REVISION) \
|
||||
"." STRINGIZE(VERSION_BUILD) \
|
||||
|
||||
#define VER_PRODUCTNAME_STR "Glide64"
|
||||
#define VER_PRODUCTNAME_STR "Project64-video"
|
||||
#define VER_PRODUCT_VERSION VER_FILE_VERSION
|
||||
#define VER_PRODUCT_VERSION_STR VER_FILE_VERSION_STR
|
||||
#define VER_ORIGINAL_FILENAME_STR VER_PRODUCTNAME_STR ".dll"
|
||||
#define VER_INTERNAL_NAME_STR VER_PRODUCTNAME_STR
|
||||
#define VER_COPYRIGHT_STR "Copyright (C) 2013"
|
||||
#define VER_COPYRIGHT_STR "Copyright (C) 2017"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define VER_VER_DEBUG VS_FF_DEBUG
|
||||
|
|
|
@ -1,42 +1,16 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
|
|
|
@ -1,44 +1,17 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
|
||||
#ifndef RDP_H
|
||||
#define RDP_H
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#include <Common/stdtypes.h>
|
||||
|
||||
|
@ -728,4 +701,3 @@ extern int SwapOK;
|
|||
void load_palette(uint32_t addr, uint16_t start, uint16_t count);
|
||||
void setTBufTex(uint16_t t_mem, uint32_t cnt);
|
||||
|
||||
#endif // ifndef RDP_H
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include "trace.h"
|
||||
#include "Config.h"
|
||||
#include "settings.h"
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
/****************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
#include <Common/TraceModulesCommon.h>
|
||||
#include <Common/Trace.h>
|
||||
|
|
|
@ -1,47 +1,17 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// Created by Gonetz, 2008
|
||||
//
|
||||
//****************************************************************
|
||||
|
||||
/******************Turbo3D microcode*************************/
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
struct t3dGlobState {
|
||||
uint16_t pad0;
|
||||
|
|
|
@ -1,41 +1,17 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
typedef void(*rdp_instr)();
|
||||
|
||||
|
|
|
@ -1,42 +1,17 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
static void rsp_vertex(int v0, int n)
|
||||
{
|
||||
uint32_t addr = segoffset(rdp.cmd1) & 0x00FFFFFF;
|
||||
|
|
|
@ -1,45 +1,17 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
|
||||
//
|
||||
// vertex - loads vertices
|
||||
//
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
static void uc1_vertex()
|
||||
{
|
||||
|
|
|
@ -1,42 +1,17 @@
|
|||
/*
|
||||
* Glide64 - Glide video plugin for Nintendo 64 emulators.
|
||||
* Copyright (c) 2002 Dave2001
|
||||
* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
|
||||
*
|
||||
* This program 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 Foundation; either version 2 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
//****************************************************************
|
||||
//
|
||||
// Glide64 - Glide Plugin for Nintendo 64 emulators
|
||||
// Project started on December 29th, 2001
|
||||
//
|
||||
// Authors:
|
||||
// Dave2001, original author, founded the project in 2001, left it in 2002
|
||||
// Gugaman, joined the project in 2002, left it in 2002
|
||||
// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
|
||||
// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
|
||||
//
|
||||
//****************************************************************
|
||||
//
|
||||
// To modify Glide64:
|
||||
// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
|
||||
// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
|
||||
//
|
||||
//****************************************************************
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Project64-video - A Nintendo 64 gfx plugin. *
|
||||
* http://www.pj64-emu.com/ *
|
||||
* Copyright (C) 2017 Project64. All rights reserved. *
|
||||
* Copyright (C) 2003-2009 Sergey 'Gonetz' Lipski *
|
||||
* Copyright (C) 2002 Dave2001 *
|
||||
* *
|
||||
* License: *
|
||||
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
static void calc_point_light(VERTEX *v, float * vpos)
|
||||
{
|
||||
float light_intensity = 0.0f;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue