@animech-public/playcanvas
Version:
PlayCanvas WebGL game engine
45 lines (44 loc) • 1.99 kB
TypeScript
/**
* A frustum is a shape that defines the viewing space of a camera. It can be used to determine
* visibility of points and bounding spheres. Typically, you would not create a Frustum shape
* directly, but instead query {@link CameraComponent#frustum}.
*
* @category Math
*/
export class Frustum {
planes: any[];
/**
* Updates the frustum shape based on the supplied 4x4 matrix.
*
* @param {import('../math/mat4.js').Mat4} matrix - The matrix describing the shape of the
* frustum.
* @example
* // Create a perspective projection matrix
* const projMat = pc.Mat4();
* projMat.setPerspective(45, 16 / 9, 1, 1000);
*
* // Create a frustum shape that is represented by the matrix
* const frustum = new pc.Frustum();
* frustum.setFromMat4(projMat);
*/
setFromMat4(matrix: import("../math/mat4.js").Mat4): void;
/**
* Tests whether a point is inside the frustum. Note that points lying in a frustum plane are
* considered to be outside the frustum.
*
* @param {import('../math/vec3.js').Vec3} point - The point to test.
* @returns {boolean} True if the point is inside the frustum, false otherwise.
*/
containsPoint(point: import("../math/vec3.js").Vec3): boolean;
/**
* Tests whether a bounding sphere intersects the frustum. If the sphere is outside the
* frustum, zero is returned. If the sphere intersects the frustum, 1 is returned. If the
* sphere is completely inside the frustum, 2 is returned. Note that a sphere touching a
* frustum plane from the outside is considered to be outside the frustum.
*
* @param {import('./bounding-sphere.js').BoundingSphere} sphere - The sphere to test.
* @returns {number} 0 if the bounding sphere is outside the frustum, 1 if it intersects the
* frustum and 2 if it is contained by the frustum.
*/
containsSphere(sphere: import("./bounding-sphere.js").BoundingSphere): number;
}