Documentation
    Preparing search index...

    Interface SurfaceSizedCamera

    The protocol a camera declares to be told the surface's size on resize (§45, R-37) — implemented by ScreenCamera.

    Application.resize tests for this structurally (typeof camera.setSurfaceSize === "function") rather than with instanceof ScreenCamera, and that is a decision with two arguments behind it:

    • §47's fifth camera type is "custom projection camera". A user's own camera whose projection depends on the surface has exactly the same need, and there is no reason the application should feed the one camera class that ships and refuse the one the user wrote. Declaring a method is how a camera opts in.
    • Bytes. @fourjs/four's Application is in every bundle; an instanceof would name the class and pull ScreenCamera into all of them whether or not the application has one. The structural test names nothing, so a scene without a screen camera pays zero for this feature.

    The contract is ScreenCamera.setSurfaceSize's: record the size, validate it (§85), and do not rebuild the projection — the application calls updateProjectionMatrix itself, with the renderer's depthRange.

    interface SurfaceSizedCamera {
        setSurfaceSize(
            width: number,
            height: number,
            resolution?: number,
        ): unknown;
    }
    Index
    • Records a surface size in logical pixels, with its device-pixel ratio (§45).

      Parameters

      • width: number
      • height: number
      • Optionalresolution: number

      Returns unknown