2017-04-26 10:23:36 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* *
|
|
|
|
* 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. *
|
|
|
|
* *
|
|
|
|
****************************************************************************/
|
2017-05-16 07:41:05 +00:00
|
|
|
#include <Project64-video/rdp.h>
|
|
|
|
#include <Project64-video/Gfx_1.3.h>
|
|
|
|
#include <Project64-video/trace.h>
|
|
|
|
#include <Project64-video/ucode.h>
|
|
|
|
#include "ucode00.h"
|
2013-04-04 21:22:19 +00:00
|
|
|
|
2017-05-16 07:41:05 +00:00
|
|
|
//
|
|
|
|
// vertex - loads vertices
|
|
|
|
//
|
|
|
|
|
|
|
|
void uc3_vertex()
|
2013-04-04 21:22:19 +00:00
|
|
|
{
|
2016-01-25 11:14:01 +00:00
|
|
|
int v0 = ((rdp.cmd0 >> 16) & 0xFF) / 5; // Current vertex
|
|
|
|
int n = (uint16_t)((rdp.cmd0 & 0xFFFF) + 1) / 0x210; // Number to copy
|
2013-04-04 21:22:19 +00:00
|
|
|
|
2016-01-25 11:14:01 +00:00
|
|
|
if (v0 >= 32)
|
|
|
|
v0 = 31;
|
2013-04-04 21:22:19 +00:00
|
|
|
|
2016-01-25 11:14:01 +00:00
|
|
|
if ((v0 + n) > 32)
|
|
|
|
n = 32 - v0;
|
2013-04-04 21:22:19 +00:00
|
|
|
|
2016-01-25 11:14:01 +00:00
|
|
|
rsp_vertex(v0, n);
|
2013-04-04 21:22:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// tri1 - renders a triangle
|
|
|
|
//
|
|
|
|
|
2017-05-16 07:41:05 +00:00
|
|
|
void uc3_tri1()
|
2013-04-04 21:22:19 +00:00
|
|
|
{
|
2016-02-11 09:58:42 +00:00
|
|
|
WriteTrace(TraceRDP, TraceDebug, "uc3:tri1 #%d - %d, %d, %d - %08lx - %08lx", rdp.tri_n,
|
2016-01-25 11:14:01 +00:00
|
|
|
((rdp.cmd1 >> 16) & 0xFF) / 5,
|
|
|
|
((rdp.cmd1 >> 8) & 0xFF) / 5,
|
|
|
|
((rdp.cmd1) & 0xFF) / 5, rdp.cmd0, rdp.cmd1);
|
|
|
|
|
2017-08-16 22:18:19 +00:00
|
|
|
gfxVERTEX *vtx[3] = {
|
2017-05-19 20:03:52 +00:00
|
|
|
&rdp.vtx(((rdp.cmd1 >> 16) & 0xFF) / 5),
|
|
|
|
&rdp.vtx(((rdp.cmd1 >> 8) & 0xFF) / 5),
|
|
|
|
&rdp.vtx((rdp.cmd1 & 0xFF) / 5)
|
2016-01-25 11:14:01 +00:00
|
|
|
};
|
|
|
|
|
2017-05-19 20:03:52 +00:00
|
|
|
rsp_tri1(vtx);
|
2013-04-04 21:22:19 +00:00
|
|
|
}
|
|
|
|
|
2017-05-16 07:41:05 +00:00
|
|
|
void uc3_tri2()
|
2013-04-04 21:22:19 +00:00
|
|
|
{
|
2016-02-11 09:58:42 +00:00
|
|
|
WriteTrace(TraceRDP, TraceDebug, "uc3:tri2 #%d, #%d - %d, %d, %d - %d, %d, %d", rdp.tri_n, rdp.tri_n + 1,
|
2016-01-25 11:14:01 +00:00
|
|
|
((rdp.cmd0 >> 16) & 0xFF) / 5,
|
|
|
|
((rdp.cmd0 >> 8) & 0xFF) / 5,
|
|
|
|
((rdp.cmd0) & 0xFF) / 5,
|
|
|
|
((rdp.cmd1 >> 16) & 0xFF) / 5,
|
|
|
|
((rdp.cmd1 >> 8) & 0xFF) / 5,
|
|
|
|
((rdp.cmd1) & 0xFF) / 5);
|
|
|
|
|
2017-08-16 22:18:19 +00:00
|
|
|
gfxVERTEX *vtx[6] = {
|
2017-05-19 20:03:52 +00:00
|
|
|
&rdp.vtx(((rdp.cmd0 >> 16) & 0xFF) / 5),
|
|
|
|
&rdp.vtx(((rdp.cmd0 >> 8) & 0xFF) / 5),
|
|
|
|
&rdp.vtx((rdp.cmd0 & 0xFF) / 5),
|
|
|
|
&rdp.vtx(((rdp.cmd1 >> 16) & 0xFF) / 5),
|
|
|
|
&rdp.vtx(((rdp.cmd1 >> 8) & 0xFF) / 5),
|
|
|
|
&rdp.vtx((rdp.cmd1 & 0xFF) / 5)
|
2016-01-25 11:14:01 +00:00
|
|
|
};
|
|
|
|
|
2017-05-19 20:03:52 +00:00
|
|
|
rsp_tri2(vtx);
|
2013-04-04 21:22:19 +00:00
|
|
|
}
|
|
|
|
|
2017-05-16 07:41:05 +00:00
|
|
|
void uc3_quad3d()
|
2013-04-04 21:22:19 +00:00
|
|
|
{
|
2016-02-11 09:58:42 +00:00
|
|
|
WriteTrace(TraceRDP, TraceDebug, "uc3:quad3d #%d, #%d", rdp.tri_n, rdp.tri_n + 1);
|
2016-01-25 11:14:01 +00:00
|
|
|
|
2017-08-16 22:18:19 +00:00
|
|
|
gfxVERTEX *vtx[6] = {
|
2017-05-19 20:03:52 +00:00
|
|
|
&rdp.vtx(((rdp.cmd1 >> 24) & 0xFF) / 5),
|
|
|
|
&rdp.vtx(((rdp.cmd1 >> 16) & 0xFF) / 5),
|
|
|
|
&rdp.vtx(((rdp.cmd1 >> 8) & 0xFF) / 5),
|
|
|
|
&rdp.vtx((rdp.cmd1 & 0xFF) / 5),
|
|
|
|
&rdp.vtx(((rdp.cmd1 >> 24) & 0xFF) / 5),
|
|
|
|
&rdp.vtx(((rdp.cmd1 >> 8) & 0xFF) / 5)
|
2016-01-25 11:14:01 +00:00
|
|
|
};
|
|
|
|
|
2017-05-19 20:03:52 +00:00
|
|
|
rsp_tri2(vtx);
|
2017-05-16 07:41:05 +00:00
|
|
|
}
|