@huukhanhnguyen/types / objects/camera
objects/camera
CameraData
CameraData =
PerspectiveCamera|OrthographicCamera
A camera. Which PROJECTION it is follows from WHICH FIELD IS PRESENT, the way a block's behaviors are enabled by being present. This is not the object's kind: CameraObject.type is explicit, never sniffed. Both fields at once, or neither, is not a camera; the union says so in TypeScript, and the model package's validation says so for JSON, which can still express it.
Absent by the same rule: zoom (a three.js viewport knob, absent from glTF, USD, BCF and USD's own GfCamera) and any sensor / film back / focal length (fov is an angle and needs no length unit; a film back is an EXPORTER convention — USD's camera carries one — never a scene fact).
CameraEntity
CameraEntity =
CameraData& {gizmoSize?:number; }
A camera's Entity tier: its projection (CameraData) plus what only a VIEWPORT needs to draw it.
There is NO target here, and its absence is a decision rather than an omission. A camera's pose needs 3 DOF — including roll — so a single aim point cannot round-trip one: a look-at gesture computes the Euler and writes it to the instance's transformation (see the note above), and the aim point is not kept. LightEntity DOES store a target for exactly the reason this one cannot: a light aims with a bare Vector that carries no roll, so a point expresses it losslessly.
CameraInstance
CameraInstance =
BaseInstance& { }
A camera has no surfaces; material is not on this kind.
CameraObject
CameraObject =
BaseObject& {data:CameraEntity;instances:CameraInstance[];type:"camera"; }
A camera in the scene. Projection is CameraData; placement is instances[i].transformation.
OrthographicCamera
OrthographicCamera = {
far?:number;height:number;near?:number; }
A camera that projects through a BOX.
height is the world height visible, in the model's unit. ONE number, not four edges: left/right/top/bottom is the RENDERER's form (three.js feeds it straight to the projection matrix), while one number is the document form every other system stores — Blender ortho_scale, BCF ViewToWorldScale, glTF xmag/ymag, SketchUp height. The four edges are DERIVED, from this height plus the consumer's aspect.
A view's crop rectangle is a different subject and lives on the placement (viewObject.crop), not here.
far?
optionalfar?:number
height
height:
number
near?
optionalnear?:number
PerspectiveCamera
PerspectiveCamera = {
far?:number;fov:number;near?:number; }
A camera that projects through an ANGLE.
fov is the VERTICAL field of view in DEGREES. Stated here because three live conventions disagree and none of them errors at a boundary: glTF's spec is radians, three.js is degrees, and BCF's FieldOfView is HORIZONTAL degrees. Vertical degrees is the pick, stated on the type so every writer converts at its own door instead of rediscovering the question.
far?
optionalfar?:number
fov
fov:
number
near?
optionalnear?:number