@@ -20,8 +20,6 @@
|
||||
|
||||
#include <math/mat4.h>
|
||||
|
||||
#include <utils/Panic.h>
|
||||
|
||||
#include <math/vec2.h>
|
||||
#include <math/vec3.h>
|
||||
#include <math/vec4.h>
|
||||
@@ -36,10 +34,6 @@ using namespace math;
|
||||
void Camera::setProjection(double const fovInDegrees, double const aspect,
|
||||
double const near, double const far, Fov const direction) {
|
||||
|
||||
FILAMENT_CHECK_PRECONDITION(near > 0 && far > near)
|
||||
<< "Camera preconditions not met in setProjection(): near <= 0 or far <= near, near="
|
||||
<< near << ", far=" << far;
|
||||
|
||||
setCustomProjection(
|
||||
projection(direction, fovInDegrees, aspect, near),
|
||||
projection(direction, fovInDegrees, aspect, near, far),
|
||||
@@ -49,10 +43,6 @@ void Camera::setProjection(double const fovInDegrees, double const aspect,
|
||||
void Camera::setLensProjection(double const focalLengthInMillimeters,
|
||||
double const aspect, double const near, double const far) {
|
||||
|
||||
FILAMENT_CHECK_PRECONDITION(near > 0 && far > near)
|
||||
<< "Camera preconditions not met in setLensProjection(): near <= 0 or far <= near, near="
|
||||
<< near << ", far=" << far;
|
||||
|
||||
setCustomProjection(
|
||||
projection(focalLengthInMillimeters, aspect, near),
|
||||
projection(focalLengthInMillimeters, aspect, near, far),
|
||||
|
||||
@@ -95,8 +95,13 @@ mat4 FCamera::projection(double const focalLengthInMillimeters,
|
||||
void UTILS_NOINLINE FCamera::setCustomProjection(mat4 const& projection,
|
||||
mat4 const& projectionForCulling, double const near, double const far) noexcept {
|
||||
|
||||
FILAMENT_CHECK_PRECONDITION(near != far)
|
||||
<< "Camera preconditions not met in setCustomProjection(): near = far = " << near;
|
||||
FILAMENT_CHECK_PRECONDITION(near > 0)
|
||||
<< "Camera preconditions not met in setCustomProjection(): near <= 0, near=" << near;
|
||||
auto const& featureFlags = mEngine.features.engine.debug;
|
||||
FILAMENT_FLAG_GUARDED_CHECK_PRECONDITION(far > near,
|
||||
featureFlags.assert_camera_projection_near_far)
|
||||
<< "Camera preconditions not met in setCustomProjection(): far <= near, near="
|
||||
<< near << ", far=" << far;
|
||||
|
||||
for (auto& eyeProjection: mEyeProjection) {
|
||||
eyeProjection = projection;
|
||||
@@ -110,8 +115,13 @@ void UTILS_NOINLINE FCamera::setCustomEyeProjection(mat4 const* projection, size
|
||||
mat4 const& projectionForCulling, double const near, double const far) {
|
||||
const Engine::Config& config = mEngine.getConfig();
|
||||
|
||||
FILAMENT_CHECK_PRECONDITION(near != far)
|
||||
<< "Camera preconditions not met in setCustomEyeProjection(): near = far = " << near;
|
||||
FILAMENT_CHECK_PRECONDITION(near > 0)
|
||||
<< "Camera preconditions not met in setCustomEyeProjection(): near <= 0, near=" << near;
|
||||
auto const& featureFlags = mEngine.features.engine.debug;
|
||||
FILAMENT_FLAG_GUARDED_CHECK_PRECONDITION(far > near,
|
||||
featureFlags.assert_camera_projection_near_far)
|
||||
<< "Camera preconditions not met in setCustomEyeProjection(): far <= near, near="
|
||||
<< near << ", far=" << far;
|
||||
|
||||
FILAMENT_CHECK_PRECONDITION(count >= config.stereoscopicEyeCount)
|
||||
<< "All eye projections must be supplied together, count must be >= "
|
||||
|
||||
@@ -778,6 +778,7 @@ public:
|
||||
bool assert_material_instance_texture_descriptor_set_compatible =
|
||||
CORRECTNESS_ASSERTION_DEFAULT;
|
||||
bool assert_texture_can_generate_mipmap = CORRECTNESS_ASSERTION_DEFAULT;
|
||||
bool assert_camera_projection_near_far = CORRECTNESS_ASSERTION_DEFAULT;
|
||||
} debug;
|
||||
struct {
|
||||
bool disable_gpu_frame_complete_metric = false;
|
||||
@@ -847,6 +848,9 @@ public:
|
||||
{ "engine.debug.assert_texture_can_generate_mipmap",
|
||||
"Assert if a texture has the correct usage set for generating mipmaps.",
|
||||
&features.engine.debug.assert_texture_can_generate_mipmap, false },
|
||||
{ "engine.debug.assert_camera_projection_near_far",
|
||||
"Assert that the near plane is smaller than the far plane.",
|
||||
&features.engine.debug.assert_camera_projection_near_far, false },
|
||||
{ "material.check_crc32_after_loading",
|
||||
"Verify the checksum of package data when a material is loaded.",
|
||||
&features.material.check_crc32_after_loading, false },
|
||||
|
||||
Reference in New Issue
Block a user