summaryrefslogtreecommitdiff
path: root/src/nw4r/g3d/res/g3d_resanmfog.cpp
blob: 1bdde3c64d3200a41c85097c17e136a997ad8b38 (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
#include "nw4r/g3d.h" // IWYU pragma: export

namespace nw4r {
namespace g3d {

void ResAnmFog::GetAnmResult(FogAnmResult *pResult, f32 frame) const {
    const ResAnmFogData &r = ref();
    u32 flags = r.flags;

    const ResAnmScnInfoData &rInfoData = ofs_to_ptr<ResAnmScnData>(r.toResAnmScnData)->info;

    f32 clippedFrame = detail::ClipFrame(rInfoData, frame);

    bool startZConstant = (flags & ResAnmFogData::FLAG_START_CONST) != 0;
    bool endZConstant = (flags & ResAnmFogData::FLAG_END_CONST) != 0;
    bool colorConstant = (flags & ResAnmFogData::FLAG_COLOR_CONST) != 0;

    pResult->type = r.type;
    pResult->startz = detail::GetResAnmResult(&r.startz, frame, startZConstant);
    pResult->endz = detail::GetResAnmResult(&r.endz, frame, endZConstant);
    pResult->color = detail::GetResColorAnmResult(&r.color, clippedFrame, colorConstant);
}

} // namespace g3d
} // namespace nw4r