View::setCamera() should accept nullptr

FIXES=[441757817]
This commit is contained in:
Mathias Agopian
2025-09-05 11:52:13 -07:00
committed by Mathias Agopian
parent 220119d855
commit 88e4ddeec7
3 changed files with 9 additions and 4 deletions

View File

@@ -231,7 +231,7 @@ public class View {
*
* <p>
* The View does not take ownership of the Scene pointer. Before destroying a Camera, be sure
* to remove it from all assoicated Views.
* to remove it from all associated Views. If the camera isn't set, Renderer::render() will result in a no-op.
* </p>
*
* @see #getCamera

View File

@@ -185,12 +185,13 @@ public:
* View.\n
* The View doesn't take ownership of the Camera pointer (which
* acts as a reference).
* If the camera isn't set, Renderer::render() will result in a no-op.
*
* @note
* There is no reference-counting.
* Make sure to dissociate a Camera from all Views before destroying it.
*/
void setCamera(Camera* UTILS_NONNULL camera) noexcept;
void setCamera(Camera* UTILS_NULLABLE camera) noexcept;
/**
* Returns whether a Camera is set.
@@ -201,13 +202,17 @@ public:
/**
* Returns the Camera currently associated with this View.
* @return A reference to the Camera associated to this View.
* Undefined behavior if hasCamera() is false.
* @return A reference to the Camera associated to this View if hasCamera() is true.
* @see hasCamera()
*/
Camera& getCamera() noexcept;
/**
* Returns the Camera currently associated with this View.
* Undefined behavior if hasCamera() is false.
* @return A reference to the Camera associated to this View.
* @see hasCamera()
*/
Camera const& getCamera() const noexcept {
return const_cast<View*>(this)->getCamera();

View File

@@ -550,7 +550,7 @@ private:
FScene* mScene = nullptr;
// The camera set by the user, used for culling and viewing
FCamera* /* UTILS_NONNULL */ mCullingCamera = nullptr; // FIXME: should always be non-null
FCamera* mCullingCamera = nullptr;
// The optional (debug) camera, used only for viewing
FCamera* mViewingCamera = nullptr;