JSRUN 用代码说话

视锥体(Frustum)

编辑教程

视锥体(Frustum)

Frustums 用于确定相机视野内的东西。 它有助于加速渲染过程——位于摄像机视锥体外的物体可以安全地排除在渲染之外。

该类主要用于渲染器内部计算 camera 或 shadowCamera的视锥体。

构造器(Constructor)

Frustum(p0 : Plane, p1 : Plane, p2 : Plane, p3 : Plane, p4 : Plane, p5 : Plane)
  • p0 - (可选参数) Plane.
  • p1 - (可选参数) Plane.
  • p2 - (可选参数) Plane.
  • p3 - (可选参数) Plane.
  • p4 - (可选参数) Plane.
  • p5 - (可选参数) Plane.

使用6个面来构建一个视锥体。

属性(Properties)

.planes : Array

包含6个平面 planes 的数组。

方法(Methods)

.clone () : Frustum

返回一个与当前对象有相同参数的视锥体。

.containsPoint ( point : Vector3 ) : Boolean

point - Vector3 to test.

检测该点 point 是否在视锥体内。

.copy ( frustum : Frustum ) : Frustum

frustum - 用于拷贝的视锥体。

将传入 frustum 的属性拷贝到当前对象。

.intersectsBox ( box : Box3 ) : Boolean

box - Box3 用于检测是否要交的包围盒。

返回 true 如果该 box 与视锥体相交。

.intersectsObject ( object : Object3D ) : Boolean

检测 object 的包围球 bounding sphere 是否与视锥体相交。

注意:该对象必须有一个 Geometry 或 BufferGeometry ,因为这样才能计算出包围球。

.intersectsSphere ( sphere : Sphere ) : Boolean

sphere - Sphere 用于检查是否相交。

返回true 如果球sphere与视锥体相交。

.intersectsSprite ( sprite : Sprite ) : Boolean

检查精灵sprite是否与截锥体相交。

.set ( p0 : Plane, p1 : Plane, p2 : Plane, p3 : Plane, p4 : Plane, p5 : Plane ) : Frustum

使用传入的平面设置当前视锥体。没有隐式的顺序。

.setFromMatrix ( matrix : Matrix4 ) : Frustum

matrix - Matrix4 用于设置 planes

WebGLRenderer 使用 Camera的投影矩阵(projectionMatrix ) 和相机世界变换矩阵的逆矩阵 matrixWorldInverse 来设置视锥体。

JSRUN闪电教程系统是国内最先开创的教程维护系统, 所有工程师都可以参与共同维护的闪电教程,让知识的积累变得统一完整、自成体系。 大家可以一起参与进共编,让零散的知识点帮助更多的人。
X
支付宝
9.99
无法付款,请点击这里
金额: 0
备注:
转账时请填写正确的金额和备注信息,到账由人工处理,可能需要较长时间
如有疑问请联系QQ:565830900
正在生成二维码, 此过程可能需要15秒钟