瀏覽代碼

Use Vector3

Garrett Johnson 5 年之前
父節點
當前提交
d8c27be7f2
共有 1 個文件被更改,包括 5 次插入6 次删除
  1. 5 6
      examples/jsm/csm/Frustum.js

+ 5 - 6
examples/jsm/csm/Frustum.js

@@ -2,8 +2,7 @@
  * @author vHawk / https://github.com/vHawk/
  */
 
-import { MathUtils, Vector3, Matrix4 } from '../../../build/three.module.js';
-import FrustumVertex from './FrustumVertex.js';
+import { Vector3, Matrix4 } from '../../../build/three.module.js';
 
 const inverseProjectionMatrix = new Matrix4();
 
@@ -77,7 +76,7 @@ export default class Frustum {
 
 				for ( let j = 0; j < 4; j ++ ) {
 
-					cascade.vertices.near.push( new FrustumVertex().fromLerp( this.vertices.near[ j ], this.vertices.far[ j ], breaks[ i - 1 ] ) );
+					cascade.vertices.near.push( new Vector3().lerpVectors( this.vertices.near[ j ], this.vertices.far[ j ], breaks[ i - 1 ] ) );
 
 				}
 
@@ -91,7 +90,7 @@ export default class Frustum {
 
 				for ( let j = 0; j < 4; j ++ ) {
 
-					cascade.vertices.far.push( new FrustumVertex().fromLerp( this.vertices.near[ j ], this.vertices.far[ j ], breaks[ i ] ) );
+					cascade.vertices.far.push( new Vector3().lerpVectors( this.vertices.near[ j ], this.vertices.far[ j ], breaks[ i ] ) );
 
 				}
 
@@ -114,11 +113,11 @@ export default class Frustum {
 
 			point.set( this.vertices.near[ i ].x, this.vertices.near[ i ].y, this.vertices.near[ i ].z );
 			point.applyMatrix4( cameraMatrix );
-			result.vertices.near.push( new FrustumVertex( point.x, point.y, point.z ) );
+			result.vertices.near.push( new Vector3( point.x, point.y, point.z ) );
 
 			point.set( this.vertices.far[ i ].x, this.vertices.far[ i ].y, this.vertices.far[ i ].z );
 			point.applyMatrix4( cameraMatrix );
-			result.vertices.far.push( new FrustumVertex( point.x, point.y, point.z ) );
+			result.vertices.far.push( new Vector3( point.x, point.y, point.z ) );
 
 		}