Match CScriptSpecialFunction::PreRender

Former-commit-id: 3a23d993a0
This commit is contained in:
Luke Street 2022-10-02 16:34:41 -04:00
parent bacc5daa55
commit 5d42957243
1 changed files with 26 additions and 19 deletions

View File

@ -504,28 +504,35 @@ void CScriptSpecialFunction::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId
} }
void CScriptSpecialFunction::PreRender(CStateManager&, const CFrustumPlanes& frustum) { void CScriptSpecialFunction::PreRender(CStateManager&, const CFrustumPlanes& frustum) {
if (xe8_function != kSF_FogVolume && xe8_function != kSF_ViewFrustumTester) { switch (xe8_function) {
return; case kSF_FogVolume:
} case kSF_ViewFrustumTester: {
if (!GetActive()) { if (!GetActive()) {
return; break;
} }
bool val; bool val;
if (xe8_function == kSF_FogVolume) { if (xe8_function == kSF_FogVolume) {
val = frustum.BoxInFrustumPlanes( CVector3f pos = GetTranslation();
CAABox(GetTranslation() - x10c_vector3f, GetTranslation() + x10c_vector3f)); CVector3f max = pos + x10c_vector3f;
max[kDZ] += xfc_float1;
CAABox aabb(pos - x10c_vector3f, max);
val = frustum.BoxInFrustumPlanes(aabb);
} else { } else {
val = frustum.PointInFrustumPlanes(GetTranslation()); val = frustum.PointInFrustumPlanes(GetTranslation());
} }
if (x1e4_30_ == val) { if (x1e4_30_ == val) {
return; break;
} }
if (!val) { if (val) {
x1e4_29_frustumExited = true;
} else {
x1e4_28_frustumEntered = true; x1e4_28_frustumEntered = true;
} else {
x1e4_29_frustumExited = true;
}
x1e4_30_ = val;
break;
}
} }
} }