diff --git a/panda/src/display/graphicsEngine.cxx b/panda/src/display/graphicsEngine.cxx index 8d5bf88d71..6aedb7b527 100644 --- a/panda/src/display/graphicsEngine.cxx +++ b/panda/src/display/graphicsEngine.cxx @@ -123,6 +123,9 @@ GraphicsEngine(Pipeline *pipeline) : _auto_flip = auto_flip; _portal_enabled = false; _flip_state = FS_flip; + + _singular_warning_last_frame = false; + _singular_warning_this_frame = false; } //////////////////////////////////////////////////////////////////// @@ -1058,6 +1061,9 @@ void GraphicsEngine:: cull_to_bins(const GraphicsEngine::Windows &wlist, Thread *current_thread) { PStatTimer timer(_cull_pcollector, current_thread); + _singular_warning_last_frame = _singular_warning_this_frame; + _singular_warning_this_frame = false; + // Keep track of the cameras we have already used in this thread to // render DisplayRegions. typedef pmap AlreadyCulled; @@ -1404,6 +1410,28 @@ setup_scene(GraphicsStateGuardian *gsg, DisplayRegionPipelineReader *dr) { CPT(TransformState) camera_transform = camera.get_transform(scene_parent, current_thread); CPT(TransformState) world_transform = scene_parent.get_transform(camera, current_thread); + if (camera_transform->is_invalid()) { + // There must be a singular transform over the scene. + if (!_singular_warning_last_frame) { + display_cat.warning() + << "Scene " << scene_root << " has net scale (" + << scene_root.get_scale(NodePath()) << "); cannot render.\n"; + _singular_warning_this_frame = true; + } + return NULL; + } + + if (world_transform->is_invalid()) { + // There must be a singular transform over the camera. + if (!_singular_warning_last_frame) { + display_cat.warning() + << "Camera " << camera << " has net scale (" + << camera.get_scale(NodePath()) << "); cannot render.\n"; + } + _singular_warning_this_frame = true; + return NULL; + } + CPT(RenderState) initial_state = camera_node->get_initial_state(); if (window->get_inverted()) { diff --git a/panda/src/display/graphicsEngine.h b/panda/src/display/graphicsEngine.h index aaf44c0c48..5ac538c6d2 100644 --- a/panda/src/display/graphicsEngine.h +++ b/panda/src/display/graphicsEngine.h @@ -330,6 +330,10 @@ private: FS_flip, // All windows are done drawing and have flipped. }; FlipState _flip_state; + + bool _singular_warning_last_frame; + bool _singular_warning_this_frame; + ReMutex _lock; static PStatCollector _wait_pcollector;