summaryrefslogtreecommitdiff
path: root/src/nw4r/g3d/res/g3d_resanmvis.cpp
blob: 4e411537ff8b12d601de6f1817d5a257d41cfe94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "nw4r/g3d.h" // IWYU pragma: export

namespace nw4r {
namespace g3d {

bool ResAnmVis::GetAnmResult(u32 idx, f32 frame) const {
    const ResAnmVisAnmData *pAnmData = GetNodeAnm(idx);
    const ResAnmVisInfoData &rInfoData = ref().info;

    if (pAnmData->flags & ResAnmVisAnmData::FLAG_CONST) {
        return pAnmData->flags & ResAnmVisAnmData::FLAG_ENABLE;
    }

    f32 fClippedFrame = detail::ClipFrame(rInfoData, frame);
    int iClippedFrame = static_cast<int>(math::FFloor(fClippedFrame));

    return detail::GetResBoolAnmFramesResult(&pAnmData->visibility, iClippedFrame);
}

} // namespace g3d
} // namespace nw4r