mirror of https://github.com/aap/librw.git
flushing old changes to ps2test
This commit is contained in:
parent
99c15d5ed7
commit
90b624fc3a
|
@ -1,6 +1,8 @@
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
|
#define PAL
|
||||||
|
|
||||||
#include <rw.h>
|
#include <rw.h>
|
||||||
using rw::uint8;
|
using rw::uint8;
|
||||||
using rw::uint16;
|
using rw::uint16;
|
||||||
|
@ -17,7 +19,13 @@ typedef uint16 ushort;
|
||||||
typedef uint32 uint;
|
typedef uint32 uint;
|
||||||
|
|
||||||
#define WIDTH 640
|
#define WIDTH 640
|
||||||
|
#ifdef PAL
|
||||||
|
#define HEIGHT 512
|
||||||
|
#define VMODE GS_PAL
|
||||||
|
#else
|
||||||
#define HEIGHT 448
|
#define HEIGHT 448
|
||||||
|
#define VMODE GS_NTSC
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "ps2.h"
|
#include "ps2.h"
|
||||||
|
|
||||||
|
@ -210,7 +218,8 @@ GsInitDispCtx(GsDispCtx *disp, int width, int height, int psm)
|
||||||
}
|
}
|
||||||
|
|
||||||
disp->pmode.d = GS_MAKE_PMODE(0, 1, 1, 1, 0, 0x00);
|
disp->pmode.d = GS_MAKE_PMODE(0, 1, 1, 1, 0, 0x00);
|
||||||
disp->bgcolor.d = 0x404040;
|
// disp->bgcolor.d = 0x404040;
|
||||||
|
disp->bgcolor.d = 0x000000;
|
||||||
disp->dispfb1.d = 0;
|
disp->dispfb1.d = 0;
|
||||||
disp->dispfb2.d = GS_MAKE_DISPFB(0, width/64, psm, 0, 0);
|
disp->dispfb2.d = GS_MAKE_DISPFB(0, width/64, psm, 0, 0);
|
||||||
disp->display1.d = 0;
|
disp->display1.d = 0;
|
||||||
|
@ -254,7 +263,7 @@ GsInitDrawCtx(GsDrawCtx *draw, int width, int height, int psm, int zpsm)
|
||||||
void
|
void
|
||||||
GsPutDrawCtx(GsDrawCtx *draw)
|
GsPutDrawCtx(GsDrawCtx *draw)
|
||||||
{
|
{
|
||||||
printquad(*(uint128*)&draw->frame1);
|
// printquad(*(uint128*)&draw->frame1);
|
||||||
toGIF(draw, 9);
|
toGIF(draw, 9);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,8 +312,8 @@ clearscreen(int r, int g, int b)
|
||||||
uint128 *p, tmp;
|
uint128 *p, tmp;
|
||||||
p = packetbuf;
|
p = packetbuf;
|
||||||
|
|
||||||
x = (2048 + 640)<<4;
|
x = (2048 + WIDTH)<<4;
|
||||||
y = (2048 + 448)<<4;
|
y = (2048 + HEIGHT)<<4;
|
||||||
|
|
||||||
MAKE128(tmp, 0xe, GIF_MAKE_TAG(5, 1, 0, 0, GIF_PACKED, 1));
|
MAKE128(tmp, 0xe, GIF_MAKE_TAG(5, 1, 0, 0, GIF_PACKED, 1));
|
||||||
*p++ = tmp;
|
*p++ = tmp;
|
||||||
|
@ -595,8 +604,8 @@ drawAtomic(rw::Atomic *atomic)
|
||||||
}
|
}
|
||||||
MAKEQ(tmp, DMAend, 0, 0, 0);
|
MAKEQ(tmp, DMAend, 0, 0, 0);
|
||||||
*curVifPtr++ = tmp;
|
*curVifPtr++ = tmp;
|
||||||
for(lp = packetbuf; lp < curVifPtr; lp++)
|
// for(lp = packetbuf; lp < curVifPtr; lp++)
|
||||||
printquad4(*lp);
|
// printquad4(*lp);
|
||||||
toVIF1chain(packetbuf);
|
toVIF1chain(packetbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -665,6 +674,8 @@ initrw(void)
|
||||||
|
|
||||||
world = rw::World::create();
|
world = rw::World::create();
|
||||||
camera = rw::Camera::create();
|
camera = rw::Camera::create();
|
||||||
|
camera->frameBuffer = rw::Raster::create(WIDTH, HEIGHT, 0, rw::Raster::CAMERA);
|
||||||
|
camera->zBuffer = rw::Raster::create(WIDTH, HEIGHT, 0, rw::Raster::ZBUFFER);
|
||||||
camera->setFrame(rw::Frame::create());
|
camera->setFrame(rw::Frame::create());
|
||||||
rw::V3d t = { 0.0f, 0.0f, -4.0f };
|
rw::V3d t = { 0.0f, 0.0f, -4.0f };
|
||||||
// rw::V3d t = { 0.0f, 0.0f, -40.0f };
|
// rw::V3d t = { 0.0f, 0.0f, -40.0f };
|
||||||
|
@ -678,9 +689,12 @@ initrw(void)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int vsynchInt = 0;
|
||||||
|
|
||||||
int
|
int
|
||||||
vsynch(int id)
|
vsynch(int id)
|
||||||
{
|
{
|
||||||
|
vsynchInt = 1;
|
||||||
frames++;
|
frames++;
|
||||||
ExitHandler();
|
ExitHandler();
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -715,7 +729,7 @@ main()
|
||||||
// GsResetCrt(GS_INTERLACED, GS_NTSC, GS_FRAME);
|
// GsResetCrt(GS_INTERLACED, GS_NTSC, GS_FRAME);
|
||||||
// GsInitCtx(&gsCtx, 640, 224, GS_PSMCT32, GS_PSMZ32);
|
// GsInitCtx(&gsCtx, 640, 224, GS_PSMCT32, GS_PSMZ32);
|
||||||
|
|
||||||
GsResetCrt(GS_INTERLACED, GS_NTSC, GS_FIELD);
|
GsResetCrt(GS_INTERLACED, VMODE, GS_FIELD);
|
||||||
GsInitCtx(&gsCtx, WIDTH, HEIGHT, GS_PSMCT32, GS_PSMZ32);
|
GsInitCtx(&gsCtx, WIDTH, HEIGHT, GS_PSMCT32, GS_PSMZ32);
|
||||||
|
|
||||||
initrender();
|
initrender();
|
||||||
|
@ -731,6 +745,33 @@ main()
|
||||||
// drawtest();
|
// drawtest();
|
||||||
// drawtri();
|
// drawtri();
|
||||||
|
|
||||||
|
float angle = 40.0f;
|
||||||
|
int drawbuf = 0;
|
||||||
|
int dispbuf = 1;
|
||||||
|
for(;;){
|
||||||
|
clearscreen(0x80, 0x80, 0x80);
|
||||||
|
|
||||||
|
rw::V3d t = { 0.0f, 0.0f, -4.0f };
|
||||||
|
camera->getFrame()->translate(&t, rw::COMBINEREPLACE);
|
||||||
|
rw::V3d axis = { 0.0f, 1.0f, 0.0f };
|
||||||
|
camera->getFrame()->rotate(&axis, angle, rw::COMBINEPOSTCONCAT);
|
||||||
|
angle += 1.0f;
|
||||||
|
|
||||||
|
camera->beginUpdate();
|
||||||
|
beginCamera();
|
||||||
|
FORLIST(lnk, clump->atomics)
|
||||||
|
drawAtomic(rw::Atomic::fromClump(lnk));
|
||||||
|
camera->endUpdate();
|
||||||
|
printf("");
|
||||||
|
|
||||||
|
while(vsynchInt == 0);
|
||||||
|
GsPutDrawCtx(&gsCtx.draw[drawbuf]);
|
||||||
|
GsPutDispCtx(&gsCtx.disp[dispbuf]);
|
||||||
|
drawbuf = !drawbuf;
|
||||||
|
dispbuf = !dispbuf;
|
||||||
|
vsynchInt = 0;
|
||||||
|
}
|
||||||
|
/*
|
||||||
camera->beginUpdate();
|
camera->beginUpdate();
|
||||||
beginCamera();
|
beginCamera();
|
||||||
FORLIST(lnk, clump->atomics)
|
FORLIST(lnk, clump->atomics)
|
||||||
|
@ -738,7 +779,9 @@ main()
|
||||||
camera->endUpdate();
|
camera->endUpdate();
|
||||||
|
|
||||||
printf("hello %p\n", clump);
|
printf("hello %p\n", clump);
|
||||||
for(;;);
|
for(;;)
|
||||||
// printf("");
|
printf("");
|
||||||
|
*/
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue