-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added lines and texture-overflow tests
- Loading branch information
1 parent
da6b472
commit b0a94a8
Showing
12 changed files
with
5,659 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
include $(PSN00BSDK)/sdk-common.mk | ||
|
||
TARGET = lines.elf | ||
LIBS += -lpsxgte -lpsxapi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <psxgpu.h> | ||
#include <psxgte.h> | ||
#include <psxetc.h> | ||
|
||
DISPENV disp; | ||
DRAWENV draw; | ||
|
||
#define SCR_W 320 | ||
#define SCR_H 240 | ||
|
||
void setResolution(int w, int h) { | ||
SetDefDispEnv(&disp, 0, 0, w, h); | ||
SetDefDrawEnv(&draw, 0, 0, w, h); | ||
|
||
PutDispEnv(&disp); | ||
PutDrawEnv(&draw); | ||
} | ||
|
||
void initVideo() | ||
{ | ||
ResetGraph(0); | ||
setResolution(SCR_W, SCR_H); | ||
SetDispMask(1); | ||
} | ||
|
||
void fillRect(int x, int y, int w, int h, int r, int g, int b) { | ||
FILL f; | ||
setFill(&f); | ||
setRGB0(&f, r, g, b); | ||
setXY0(&f, x, y); | ||
setWH(&f, w, h); | ||
|
||
DrawPrim(&f); | ||
} | ||
|
||
void clearScreen() { | ||
fillRect(0, 0, 512, 256, 0xff, 0xff, 0xff); | ||
fillRect(512, 0, 512, 256, 0xff, 0xff, 0xff); | ||
fillRect(0, 256, 512, 256, 0xff, 0xff, 0xff); | ||
fillRect(512, 256, 0x3f1, 256, 0xff, 0xff, 0xff); | ||
} | ||
|
||
int main() { | ||
initVideo(); | ||
InitGeom(); | ||
printf("\ngpu/lines\n"); | ||
|
||
for (;;) { | ||
const int PI = 4096/2; | ||
const int CX = SCR_W/2; | ||
const int CY = SCR_H/2; | ||
const int SEGS = 6; | ||
const int ANGLE = 2 * PI / SEGS; | ||
const int H_ANGLE = ANGLE / 2; | ||
const int SCALE = 48; | ||
|
||
clearScreen(); | ||
|
||
for (int s = 0; s < SEGS; s++) { | ||
LINE_F2 l; | ||
|
||
setLineF2(&l); | ||
setRGB0(&l, 0, 0, 0); | ||
l.x0 = CX + icos(ANGLE * s - H_ANGLE) / SCALE; | ||
l.y0 = CY + isin(ANGLE * s - H_ANGLE) / SCALE; | ||
l.x1 = CX + icos(ANGLE * s + H_ANGLE) / SCALE; | ||
l.y1 = CY + isin(ANGLE * s + H_ANGLE) / SCALE; | ||
|
||
DrawPrim(&l); | ||
} | ||
|
||
VSync(0); | ||
} | ||
return 0; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
include $(PSN00BSDK)/sdk-common.mk | ||
|
||
TARGET = texture-overflow.elf | ||
LIBS += -lpsxapi |
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <psxgpu.h> | ||
#include <psxetc.h> | ||
#include "lena.h" | ||
#include "cube.h" | ||
|
||
DISPENV disp; | ||
DRAWENV draw; | ||
|
||
#define SCR_W 320 | ||
#define SCR_H 240 | ||
|
||
void setResolution(int w, int h) { | ||
SetDefDispEnv(&disp, 0, 0, w, h); | ||
SetDefDrawEnv(&draw, 0, 0, w, h); | ||
|
||
PutDispEnv(&disp); | ||
PutDrawEnv(&draw); | ||
} | ||
|
||
void initVideo() | ||
{ | ||
ResetGraph(0); | ||
setResolution(SCR_W, SCR_H); | ||
SetDispMask(1); | ||
} | ||
|
||
void fillRect(int x, int y, int w, int h, int r, int g, int b) { | ||
FILL f; | ||
setFill(&f); | ||
setRGB0(&f, r, g, b); | ||
setXY0(&f, x, y); | ||
setWH(&f, w, h); | ||
|
||
DrawPrim(&f); | ||
} | ||
|
||
void clearVram() { | ||
fillRect(0, 0, 512, 256, 0xff, 0x00, 0x00); | ||
fillRect(512, 0, 512, 256, 0xff, 0x00, 0x00); | ||
fillRect(0, 256, 512, 256, 0xff, 0x00, 0x00); | ||
fillRect(512, 256, 0x3f1, 256, 0xff, 0x00, 0x00); | ||
} | ||
|
||
void setTexPage(int x, int y) { | ||
DR_TPAGE e; | ||
unsigned short texpage = getTPage(/* 15bit */ 2, /* semi-transparency mode */ 0, /*x*/x, /*y*/y); | ||
setDrawTPage(&e, /* Drawing to display area */ 1, /* dithering */ 0, texpage); | ||
DrawPrim(&e); | ||
} | ||
|
||
|
||
int main() { | ||
initVideo(); | ||
printf("\ngpu/texture-overflow\n"); | ||
|
||
clearVram(); | ||
|
||
TIM_IMAGE tim; | ||
GetTimInfo((unsigned int*)lena_tim, &tim); | ||
LoadImage(tim.prect, tim.paddr); | ||
|
||
GetTimInfo((unsigned int*)cube_tim, &tim); | ||
LoadImage(tim.prect, tim.paddr); | ||
|
||
for (;;) { | ||
fillRect(0, 0, SCR_W, SCR_H, 0xff, 0xff, 0xff); | ||
|
||
setTexPage(896, 256); | ||
|
||
SPRT s; | ||
setSprt(&s); | ||
setSemiTrans(&s, 0); | ||
setRGB0(&s, 128, 128, 128 ); | ||
s.x0 = 16; | ||
s.y0 = 16; | ||
s.w = 256; | ||
s.h = 128; | ||
s.u0 = 0; | ||
s.v0 = 0; | ||
|
||
DrawPrim(&s); | ||
|
||
VSync(0); | ||
} | ||
return 0; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.