summaryrefslogtreecommitdiff
path: root/src/egg/gfx/eggGlobalDrawState.cpp
blob: 06e2b3836bb667602f80e1f9263eadd42b493fe5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "egg/gfx/eggGlobalDrawState.h"

#include "common.h"
#include "egg/gfx/eggStateEfb.h"
#include "egg/gfx/eggStateGX.h"
#include "rvl/MTX/mtx.h"

namespace EGG {

Screen const *GlobalDrawState::spScreen;
u16 GlobalDrawState::sCameraId;
u32 GlobalDrawState::sDrawFlag;

// unknown
nw4r::math::MTX34 GlobalDrawState::sMtx;

GlobalDrawState sState;

void GlobalDrawState::beginDrawView(u16 cameraId, const nw4r::math::MTX34 &mtx, const Screen &screen) {
    spScreen = &screen;
    sCameraId = cameraId;
    MTXCopy(mtx, sMtx);
    StateEfb::Clean();
}

void GlobalDrawState::setDrawSettingGX(bool b1, bool b2) {
    StateGX::GXSetColorUpdate_((sDrawFlag & 1) != 0);
    StateGX::GXSetAlphaUpdate_((sDrawFlag & 2) != 0);
    StateGX::GXSetDither_((sDrawFlag & 4) != 0);
    StateGX::GXSetDstAlpha_(false, 0);
    if (b2 && spScreen != nullptr) {
        spScreen->SetProjectionGX();
    }
}


} // namespace EGG