MCPcopy Create free account
hub / github.com/doldecomp/mkdd / drawContents

Method drawContents

libs/JSystem/J2DGraph/J2DWindowEx.cpp:310–384  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

308}
309
310void J2DWindowEx::drawContents(const JGeometry::TBox2<f32>& p1)
311{
312 if (!p1.isValid() || mContentsMaterial == nullptr) {
313 return;
314 }
315 if (!mContentsMaterial->isVisible()) {
316 return;
317 }
318 mContentsMaterial->setGX();
319 GXClearVtxDesc();
320 GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
321 GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT);
322 JUTColor TStack_b4(mContentsColorA);
323 JUTColor TStack_bc(mContentsColorC);
324 JUTColor TStack_b8(mContentsColorB);
325 JUTColor TStack_c0(mContentsColorD);
326 if (mContentsMaterial->getColorBlock()->getColorChan(1)->getMatSrc() == 1) {
327 if (mContentsMaterial->getMaterialAlphaCalc() == 1) {
328 TStack_b4.a = (TStack_b4.a * mColorAlpha) / 0xff;
329 TStack_bc.a = (TStack_bc.a * mColorAlpha) / 0xff;
330 TStack_b8.a = (TStack_b8.a * mColorAlpha) / 0xff;
331 TStack_c0.a = (TStack_c0.a * mColorAlpha) / 0xff;
332 }
333 } else if (mIsInfluencedAlpha) {
334 GXSetChanMatColor(GX_ALPHA0, JUTColor(mColorAlpha));
335 }
336 bool bVar5 = false;
337 f32 in_f31;
338 f32 in_f30;
339 f32 in_f29;
340 f32 in_f28;
341 if (mContentsMaterial->getTevBlock() != nullptr) {
342 if (mContentsMaterial->getTevBlock()->getTexture(0)) {
343 bVar5 = true;
344 GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT);
345 f32 dVar15 = mContentsMaterial->getTevBlock()->getTexture(0)->getWidth();
346 f32 dVar14 = mContentsMaterial->getTevBlock()->getTexture(0)->getHeight();
347
348 f32 dVar12 = p1.getWidth();
349 f32 dVar13 = p1.getHeight();
350 in_f31 = -(dVar12 / dVar15 - 1.0f) / 2;
351 in_f30 = -((dVar13 / dVar14) - 1.0f) / 2;
352 in_f29 = in_f31 + (dVar12 / dVar15);
353 in_f28 = in_f30 + (dVar13 / dVar14);
354 }
355 }
356 GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_F32, 0);
357 GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_F32, 0);
358 GXBegin(GX_QUADS, GX_VTXFMT0, 4);
359
360 f32 zero = 0.0f;
361 GXPosition3f32(p1.i.x, p1.i.y, zero);
362 GXColor1u32(TStack_b4);
363 if (bVar5) {
364 GXTexCoord2f32(in_f31, in_f30);
365 }
366 GXPosition3f32(p1.f.x, p1.i.y, zero);
367 GXColor1u32(TStack_b8);

Callers

nothing calls this directly

Calls 15

GXPosition3f32Function · 0.85
GXColor1u32Function · 0.85
GXTexCoord2f32Function · 0.85
GXEndFunction · 0.85
getColorChanMethod · 0.80
isValidMethod · 0.45
isVisibleMethod · 0.45
setGXMethod · 0.45
getMatSrcMethod · 0.45
getColorBlockMethod · 0.45
getMaterialAlphaCalcMethod · 0.45
getTevBlockMethod · 0.45

Tested by

no test coverage detected