summaryrefslogtreecommitdiff
path: root/plugins/peopsxgl/gte_accuracy.c
diff options
context:
space:
mode:
authorSND\edgbla_cp <SND\edgbla_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2011-07-26 17:00:47 +0000
committerSND\edgbla_cp <SND\edgbla_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97>2011-07-26 17:00:47 +0000
commit9cbd44224d555eb5d9fbd044676e92924407b57b (patch)
treefe82f1d1dbf85e40ea27c82aa154c323efec8a76 /plugins/peopsxgl/gte_accuracy.c
parentbe2f9d6ef7c59535773efb10f59793b2d4de9eb3 (diff)
downloadpcsxr-9cbd44224d555eb5d9fbd044676e92924407b57b.tar.gz
peopsogl1, vertex accuracy.
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@69230 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'plugins/peopsxgl/gte_accuracy.c')
-rw-r--r--plugins/peopsxgl/gte_accuracy.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/plugins/peopsxgl/gte_accuracy.c b/plugins/peopsxgl/gte_accuracy.c
new file mode 100644
index 00000000..3af37ab0
--- /dev/null
+++ b/plugins/peopsxgl/gte_accuracy.c
@@ -0,0 +1,66 @@
+/***************************************************************************
+ * Copyright (C) 2011 by Blade_Arma *
+ * *
+ * 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 *
+ * (at your option) 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., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307 USA. *
+ ***************************************************************************/
+
+#include "stdafx.h"
+#include "externals.h"
+
+// TODO: use malloc and pointer to the array's center.
+float gteCoords[0x800 * 2][0x800 * 2][2];
+
+void CALLBACK GPUaddVertex(short sx, short sy, long long fx, long long fy, long long fz)
+{
+ if(bGteAccuracy)
+ {
+ if(sx >= -0x800 && sx <= 0x7ff &&
+ sy >= -0x800 && sy <= 0x7ff)
+ {
+ gteCoords[sy + 0x800][sx + 0x800][0] = fx / 65536.0f;
+ gteCoords[sy + 0x800][sx + 0x800][1] = fy / 65536.0f;
+ }
+ }
+}
+
+void resetGteVertices()
+{
+ if(bGteAccuracy)
+ {
+ memset(gteCoords, 0x00, sizeof(gteCoords));
+ }
+}
+
+int getGteVertex(short sx, short sy, float *fx, float *fy)
+{
+ if(bGteAccuracy)
+ {
+ if(sx >= -0x800 && sx <= 0x7ff &&
+ sy >= -0x800 && sy <= 0x7ff)
+ {
+ if(((int)gteCoords[sy + 0x800][sx + 0x800][0]) == sx &&
+ ((int)gteCoords[sy + 0x800][sx + 0x800][1]) == sy)
+ {
+ *fx = gteCoords[sy + 0x800][sx + 0x800][0];
+ *fy = gteCoords[sy + 0x800][sx + 0x800][1];
+
+ return 1;
+ }
+ }
+ }
+
+ return 0;
+}