소스 검색

LOD: Add ability to get current level

Sometimes it's useful to have the current LOD level. This is awkward to do outside of LOD as it involves duplicating the logic inside of LOD.

One use case is the loading of progressively larger textures when the LOD activates a certain level.
donutcoffee 5 년 전
부모
커밋
ca3a8a298e
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      src/objects/LOD.js

+ 4 - 0
src/objects/LOD.js

@@ -32,6 +32,8 @@ LOD.prototype = Object.assign( Object.create( Object3D.prototype ), {
 	constructor: LOD,
 
 	isLOD: true,
+	
+	currentLevel: 0,
 
 	copy: function ( source ) {
 
@@ -146,6 +148,8 @@ LOD.prototype = Object.assign( Object.create( Object3D.prototype ), {
 				}
 
 			}
+			
+			this.currentLevel = i - 1;
 
 			for ( ; i < l; i ++ ) {