浏览代码

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 ++ ) {