mirror of
https://github.com/orange-cpp/omath.git
synced 2026-04-18 19:03:28 +00:00
added more unreachable checks
This commit is contained in:
@@ -41,6 +41,9 @@ namespace omath::cry_engine
|
|||||||
return mat_perspective_left_handed<float, MatStoreType::ROW_MAJOR, NDCDepthRange::ZERO_TO_ONE>(
|
return mat_perspective_left_handed<float, MatStoreType::ROW_MAJOR, NDCDepthRange::ZERO_TO_ONE>(
|
||||||
field_of_view, aspect_ratio, near, far);
|
field_of_view, aspect_ratio, near, far);
|
||||||
|
|
||||||
return mat_perspective_left_handed(field_of_view, aspect_ratio, near, far);
|
if (ndc_depth_range == NDCDepthRange::NEGATIVE_ONE_TO_ONE)
|
||||||
|
return mat_perspective_left_handed<float, MatStoreType::ROW_MAJOR, NDCDepthRange::NEGATIVE_ONE_TO_ONE>(
|
||||||
|
field_of_view, aspect_ratio, near, far);
|
||||||
|
std::unreachable();
|
||||||
}
|
}
|
||||||
} // namespace omath::unity_engine
|
} // namespace omath::unity_engine
|
||||||
|
|||||||
@@ -41,6 +41,10 @@ namespace omath::frostbite_engine
|
|||||||
return mat_perspective_left_handed<float, MatStoreType::ROW_MAJOR, NDCDepthRange::ZERO_TO_ONE>(
|
return mat_perspective_left_handed<float, MatStoreType::ROW_MAJOR, NDCDepthRange::ZERO_TO_ONE>(
|
||||||
field_of_view, aspect_ratio, near, far);
|
field_of_view, aspect_ratio, near, far);
|
||||||
|
|
||||||
return mat_perspective_left_handed(field_of_view, aspect_ratio, near, far);
|
if (ndc_depth_range == NDCDepthRange::NEGATIVE_ONE_TO_ONE)
|
||||||
|
return mat_perspective_left_handed<float, MatStoreType::ROW_MAJOR, NDCDepthRange::NEGATIVE_ONE_TO_ONE>(
|
||||||
|
field_of_view, aspect_ratio, near, far);
|
||||||
|
|
||||||
|
std::unreachable();
|
||||||
}
|
}
|
||||||
} // namespace omath::unity_engine
|
} // namespace omath::unity_engine
|
||||||
|
|||||||
@@ -50,12 +50,13 @@ namespace omath::iw_engine
|
|||||||
{0, 0, far / (far - near), -(near * far) / (far - near)},
|
{0, 0, far / (far - near), -(near * far) / (far - near)},
|
||||||
{0, 0, 1, 0},
|
{0, 0, 1, 0},
|
||||||
};
|
};
|
||||||
|
if (ndc_depth_range == NDCDepthRange::NEGATIVE_ONE_TO_ONE)
|
||||||
return {
|
return {
|
||||||
{1.f / (aspect_ratio * fov_half_tan), 0, 0, 0},
|
{1.f / (aspect_ratio * fov_half_tan), 0, 0, 0},
|
||||||
{0, 1.f / (fov_half_tan), 0, 0},
|
{0, 1.f / (fov_half_tan), 0, 0},
|
||||||
{0, 0, (far + near) / (far - near), -(2.f * far * near) / (far - near)},
|
{0, 0, (far + near) / (far - near), -(2.f * far * near) / (far - near)},
|
||||||
{0, 0, 1, 0},
|
{0, 0, 1, 0},
|
||||||
};
|
};
|
||||||
|
std::unreachable();
|
||||||
};
|
};
|
||||||
} // namespace omath::iw_engine
|
} // namespace omath::iw_engine
|
||||||
|
|||||||
@@ -50,12 +50,13 @@ namespace omath::source_engine
|
|||||||
{0, 0, far / (far - near), -(near * far) / (far - near)},
|
{0, 0, far / (far - near), -(near * far) / (far - near)},
|
||||||
{0, 0, 1, 0},
|
{0, 0, 1, 0},
|
||||||
};
|
};
|
||||||
|
if (ndc_depth_range == NDCDepthRange::NEGATIVE_ONE_TO_ONE)
|
||||||
return {
|
return {
|
||||||
{1.f / (aspect_ratio * fov_half_tan), 0, 0, 0},
|
{1.f / (aspect_ratio * fov_half_tan), 0, 0, 0},
|
||||||
{0, 1.f / (fov_half_tan), 0, 0},
|
{0, 1.f / (fov_half_tan), 0, 0},
|
||||||
{0, 0, (far + near) / (far - near), -(2.f * far * near) / (far - near)},
|
{0, 0, (far + near) / (far - near), -(2.f * far * near) / (far - near)},
|
||||||
{0, 0, 1, 0},
|
{0, 0, 1, 0},
|
||||||
};
|
};
|
||||||
|
std::unreachable();
|
||||||
}
|
}
|
||||||
} // namespace omath::source_engine
|
} // namespace omath::source_engine
|
||||||
|
|||||||
@@ -40,7 +40,10 @@ namespace omath::unity_engine
|
|||||||
if (ndc_depth_range == NDCDepthRange::ZERO_TO_ONE)
|
if (ndc_depth_range == NDCDepthRange::ZERO_TO_ONE)
|
||||||
return omath::mat_perspective_right_handed<float, MatStoreType::ROW_MAJOR, NDCDepthRange::ZERO_TO_ONE>(
|
return omath::mat_perspective_right_handed<float, MatStoreType::ROW_MAJOR, NDCDepthRange::ZERO_TO_ONE>(
|
||||||
field_of_view, aspect_ratio, near, far);
|
field_of_view, aspect_ratio, near, far);
|
||||||
|
if (ndc_depth_range == NDCDepthRange::NEGATIVE_ONE_TO_ONE)
|
||||||
return omath::mat_perspective_right_handed(field_of_view, aspect_ratio, near, far);
|
return omath::mat_perspective_right_handed<float, MatStoreType::ROW_MAJOR,
|
||||||
|
NDCDepthRange::NEGATIVE_ONE_TO_ONE>(field_of_view, aspect_ratio,
|
||||||
|
near, far);
|
||||||
|
std::unreachable();
|
||||||
}
|
}
|
||||||
} // namespace omath::unity_engine
|
} // namespace omath::unity_engine
|
||||||
|
|||||||
Reference in New Issue
Block a user