Files
V2TMUMemTester/Draw.c
2026-02-25 00:42:00 +00:00

61 lines
1.6 KiB
C

/* V2MemTest - A CLI Tool to test & fix Voodoo² TMU System
* Copyright (C) 2026 ChaCha
*
* 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 3 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, see <https://www.gnu.org/licenses/>.
*/
#include "cvg.h"
#include "glide.h"
#include "sst1init.h"
#include "Draw.h"
#define XY_ONE (1 << SST_XY_FRACBITS)
#define ST_ONE (1 << SST_ST_FRACBITS)
#define W_ONE (1 << SST_W_FRACBITS)
void
drawSquare( const SstRegs *sst,
const int x,
const int y,
const int tSize)
{
ISET(sst->vA.x,x);
ISET(sst->vA.y,y);
ISET(sst->vB.x,x+XY_ONE*tSize);
ISET(sst->vB.y,y);
ISET(sst->vC.x,x);
ISET(sst->vC.y,y+XY_ONE*tSize);
ISET(sst->s,0);
ISET(sst->t,0);
ISET(sst->w,W_ONE);
ISET(sst->dsdx,ST_ONE);
ISET(sst->dtdx,0);
ISET(sst->dwdx,0);
ISET(sst->dsdy,0);
ISET(sst->dtdy,ST_ONE);
ISET(sst->dwdy,0);
ISET(sst->triangleCMD,0);
ISET(sst->vA.x,x);
ISET(sst->vA.y,y+XY_ONE*tSize);
ISET(sst->vB.x,x+XY_ONE*tSize);
ISET(sst->vB.y,y);
ISET(sst->vC.x, x+XY_ONE*tSize);
ISET(sst->vC.y, y+XY_ONE*tSize);
ISET(sst->s,0);
ISET(sst->t,ST_ONE*tSize);
ISET(sst->w,W_ONE);
ISET(sst->triangleCMD, 0xFFFFFFFF);
}