pub struct CameraHelper {
pub node: ObjectRef,
/* private fields */
}Expand description
new CameraHelper( camera ) — a LineSegments of the camera’s frustum,
cone, up triangle, target line and cross hairs, in the camera’s local
space, drawn with vertex colours.
Three sets this.matrix = camera.matrixWorld — the helper shares the
camera’s world matrix object — with matrixAutoUpdate = false, so every
updateMatrixWorld() traversal that reaches the helper multiplies in
whatever the camera’s world matrix holds at that moment. The port’s
Object3D::matrix_alias is that
sharing, read at the same point of the traversal; webgpu_camera depends
on it, since the helper sits before the camera in the scene and so sees the
camera’s matrix from the previous traversal.
A camera with no scene-graph node (the port’s OrthographicCamera) cannot
be aliased; its helper takes a copy of the camera’s world matrix instead.
Fields§
§node: ObjectRefThe LineSegments itself.
Implementations§
Source§impl CameraHelper
impl CameraHelper
Sourcepub fn new(camera: &dyn RenderCamera) -> Self
pub fn new(camera: &dyn RenderCamera) -> Self
new CameraHelper( camera ).
Three’s constructor calls camera.updateProjectionMatrix() first; both
of the port’s cameras compute their projection in new and on every
update_projection_matrix(), so the call is already made by the time a
helper can be built for them.
Sourcepub fn set_colors(
&self,
frustum: Color,
cone: Color,
up: Color,
target: Color,
cross: Color,
)
pub fn set_colors( &self, frustum: Color, cone: Color, up: Color, target: Color, cross: Color, )
CameraHelper.setColors( frustum, cone, up, target, cross ) — vertices
0–23 frustum, 24–31 cone, 32–37 up, 38–39 target, 40–49 cross (the
p–c line included).
Sourcepub fn update(&self, camera: &dyn RenderCamera)
pub fn update(&self, camera: &dyn RenderCamera)
CameraHelper.update(): every named point un-projected from NDC
through the camera’s projectionMatrixInverse alone (three’s _camera
has an identity world matrix — the helper’s own matrix places it).
camera.reversedDepth is never set on the port’s cameras, so the near
and far planes are the coordinate system’s: -1/1 under WebGL, 0/1
under WebGPU.