1#include <game/mLib/m_3d.hpp>
3#include <game/mLib/m_video.hpp>
4#include <lib/egg/gx/eggGlobalDrawState.hpp>
5#include <lib/egg/gx/eggScreenEffectBase.hpp>
8void m3d::screenEffectReset(
int cameraID,
EGG::Screen &scr) {
10 m3d::getCamera(cameraID).GetCameraMtx(&mtx);
11 EGG::GlobalDrawState::sDrawFlag = 5;
12 EGG::GlobalDrawState::beginDrawView(cameraID, mtx, scr);
13 EGG::ScreenEffectBase::sScreen.CopyFromAnother(scr);
16bool m3d::capture_c::create(
18 u16 width, u16 height,
19 GXTexFmt texFmt, GXTexFilter texFilter,
29 size_t bufSize = GXGetTexBufferSize(width, height, texFmt, 0, 0);
30 mTexBuffer = heap->alloc(bufSize, 0x20);
31 if (mTexBuffer ==
nullptr) {
35 mBufferSize = bufSize;
36 mTexIsHalfSize = texIsHalfSize;
38 mTexFilter = texFilter;
40 GXInitTexObj(&mTexObj, mTexBuffer, width, height, texFmt, GX_CLAMP, GX_CLAMP, 0);
41 GXInitTexObjLOD(&mTexObj, mTexFilter, mTexFilter, 0.0f, 0.0f, 0.0f, 0, 0, 0);
45void m3d::capture_c::remove() {
46 if (mTexBuffer !=
nullptr) {
47 EGG::Heap::free(mTexBuffer,
nullptr);
53void m3d::capture_c::capture(u16 width, u16 height,
bool texIsHalfSize) {
54 captureEx(mTexWidth, mTexHeight, mTexFmt, mTexFmt, mTexFilter, mTexIsHalfSize, width, height, texIsHalfSize);
57void m3d::capture_c::captureEx(
58 u16 width, u16 height,
59 GXTexFmt texFmt, GXTexFmt tex2Fmt,
60 GXTexFilter texFilter,
62 u16 srcTexWidth, u16 srcTexHeight,
72 GXInitTexObj(&mTexObj, mTexBuffer, actualW, actualH, tex2Fmt, GX_CLAMP, GX_CLAMP, 0);
73 GXInitTexObjLOD(&mTexObj, texFilter, texFilter, 0, 0, 0, 0.0f, 0.0f, 0.0f);
74 GXSetCopyFilter(0,
nullptr, 0,
nullptr);
76 GXSetTexCopySrc(srcTexWidth, srcTexHeight, width, height);
77 GXSetTexCopyDst(actualW, actualH, texFmt, texIsHalfSize);
78 GXCopyTex(mTexBuffer, srcTexHalfSize);
80 GXRenderModeObj &s = mVideo::m_video->mRenderModeObj;
81 GXSetCopyFilter(s.mAntialias, &s.mSamplePattern, 1, s.mFilterWeights);