mirror of https://github.com/zeldaret/tp.git
J2DGrafContext: Use inlines from debug, improved parameter names
This commit is contained in:
parent
dd70aed513
commit
66b3dc12ae
|
|
@ -9,23 +9,23 @@
|
|||
|
||||
class J2DGrafContext {
|
||||
public:
|
||||
/* 802E8B08 */ J2DGrafContext(f32, f32, f32, f32);
|
||||
/* 802E90C0 */ void scissor(JGeometry::TBox2<f32> const&);
|
||||
/* 802E8B08 */ J2DGrafContext(f32 x, f32 y, f32 width, f32 height);
|
||||
/* 802E90C0 */ void scissor(JGeometry::TBox2<f32> const& bounds);
|
||||
void setColor(JUtility::TColor c) { this->setColor(c, c, c, c); }
|
||||
/* 802E9118 */ void setColor(JUtility::TColor, JUtility::TColor, JUtility::TColor,
|
||||
JUtility::TColor);
|
||||
/* 802E9118 */ void setColor(JUtility::TColor colorTL, JUtility::TColor colorTR,
|
||||
JUtility::TColor colorBR, JUtility::TColor colorBL);
|
||||
/* 802E9234 */ void setLineWidth(u8);
|
||||
/* 802E9260 */ void fillBox(JGeometry::TBox2<f32> const&);
|
||||
/* 802E9368 */ void drawFrame(JGeometry::TBox2<f32> const&);
|
||||
/* 802E9488 */ void line(JGeometry::TVec2<f32>, JGeometry::TVec2<f32>);
|
||||
/* 802E9564 */ void lineTo(JGeometry::TVec2<f32>);
|
||||
/* 802E9260 */ void fillBox(JGeometry::TBox2<f32> const& box);
|
||||
/* 802E9368 */ void drawFrame(JGeometry::TBox2<f32> const& box);
|
||||
/* 802E9488 */ void line(JGeometry::TVec2<f32> start, JGeometry::TVec2<f32> end);
|
||||
/* 802E9564 */ void lineTo(JGeometry::TVec2<f32> pos);
|
||||
void lineTo(f32 x, f32 y) { this->lineTo(JGeometry::TVec2<f32>(x, y)); }
|
||||
void moveTo(f32 x, f32 y) { this->moveTo(JGeometry::TVec2<f32>(x, y)); }
|
||||
|
||||
void moveTo(JGeometry::TVec2<f32> pos) { mPrevPos = pos; }
|
||||
|
||||
/* 802E95D4 */ virtual ~J2DGrafContext() {}
|
||||
/* 802E90E4 */ virtual void place(JGeometry::TBox2<f32> const&);
|
||||
/* 802E90E4 */ virtual void place(JGeometry::TBox2<f32> const& bounds);
|
||||
/* 802E961C */ virtual void place(f32 x, f32 y, f32 width, f32 height) {
|
||||
JGeometry::TBox2<f32> box(x, y, x + width, y + height);
|
||||
this->place(box);
|
||||
|
|
|
|||
|
|
@ -14,10 +14,8 @@
|
|||
//
|
||||
|
||||
/* 802E8B08-802E8BB4 2E3448 00AC+00 0/0 2/2 0/0 .text __ct__14J2DGrafContextFffff */
|
||||
J2DGrafContext::J2DGrafContext(f32 left, f32 top, f32 right, f32 bottom)
|
||||
: mBounds(left, top, left + right, top + bottom),
|
||||
mScissorBounds(left, top, left + right, top + bottom), mColorTL(-1), mColorTR(-1),
|
||||
mColorBR(-1), mColorBL(-1) {
|
||||
J2DGrafContext::J2DGrafContext(f32 x, f32 y, f32 width, f32 height)
|
||||
: mBounds(x, y, x + width, y + height), mScissorBounds(x, y, x + width, y + height) {
|
||||
JUtility::TColor color(-1);
|
||||
setColor(color);
|
||||
setLineWidth(6);
|
||||
|
|
@ -28,18 +26,19 @@ void J2DGrafContext::setPort() {
|
|||
setScissor();
|
||||
setup2D();
|
||||
|
||||
f32 x_origin = mBounds.i.x;
|
||||
f32 y_origin = mBounds.i.y;
|
||||
f32 width = mBounds.f.x;
|
||||
f32 height = mBounds.f.y;
|
||||
JGeometry::TBox2<float> bounds(mBounds);
|
||||
|
||||
if (x_origin < 0.0f) {
|
||||
x_origin = 0.0f;
|
||||
if (bounds.i.x < 0.0f) {
|
||||
bounds.i.x = 0.0f;
|
||||
}
|
||||
if (y_origin < 0.0f) {
|
||||
y_origin = 0.0f;
|
||||
if (bounds.i.y < 0.0f) {
|
||||
bounds.i.y = 0.0f;
|
||||
}
|
||||
GXSetViewport(x_origin, y_origin, width - x_origin, height - y_origin, 0.0f, 1.0f);
|
||||
GXSetViewport(bounds.i.x, bounds.i.y, bounds.getWidth(), bounds.getHeight(), 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
static inline void GXSetTexCoordGen(GXTexCoordID dst, GXTexGenType type, GXTexGenSrc src, u32 mtx) {
|
||||
GXSetTexCoordGen2(dst, type, src, mtx, GX_FALSE, GX_PTIDENTITY);
|
||||
}
|
||||
|
||||
/* 802E8C44-802E8E20 2E3584 01DC+00 1/0 1/0 0/0 .text setup2D__14J2DGrafContextFv */
|
||||
|
|
@ -60,13 +59,13 @@ void J2DGrafContext::setup2D() {
|
|||
GXLoadPosMtxImm(mPosMtx, 0);
|
||||
Mtx mtx;
|
||||
PSMTXIdentity(mtx);
|
||||
GXLoadTexMtxImm(mtx, 0x3c, GX_MTX3x4);
|
||||
GXLoadTexMtxImm(mtx, GX_IDENTITY, GX_MTX3x4);
|
||||
GXSetChanCtrl(GX_COLOR0A0, GX_FALSE, GX_SRC_REG, GX_SRC_VTX, GX_LIGHT_NULL, GX_DF_NONE,
|
||||
GX_AF_NONE);
|
||||
GXSetChanCtrl(GX_COLOR1A1, GX_FALSE, GX_SRC_REG, GX_SRC_REG, GX_LIGHT_NULL, GX_DF_NONE,
|
||||
GX_AF_NONE);
|
||||
GXSetCurrentMtx(0);
|
||||
GXSetTexCoordGen2(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, 0x3c, GX_FALSE, 0x7d);
|
||||
GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_RGBA4, 0);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGBX8, 0xf);
|
||||
|
|
|
|||
Loading…
Reference in New Issue