瀏覽代碼

Display current lod vertex in realtime in Model.hx view.

clementlandrin 11 月之前
父節點
當前提交
e717a5a334
共有 1 個文件被更改,包括 9 次插入9 次删除
  1. 9 9
      hide/view/Model.hx

+ 9 - 9
hide/view/Model.hx

@@ -615,15 +615,6 @@ class Model extends FileView {
 				var selectLod = lodsEl.find("select");
 				selectLod.on("change", function(){
 					hmd.forcedLod = Std.int(lodsEl.find("select").val());
-
-					var lodsCountEl = lodsEl.find("#vertexes-count");
-					if (hmd.forcedLod >= 0) {
-						var lodVertexesCount = @:privateAccess hmd.lods[hmd.forcedLod].vertexCount;
-						lodsCountEl.text(lodVertexesCount);
-					}
-					else {
-						lodsCountEl.text('-');
-					}
 				});
 
 				var lodsLine = lodsEl.find(".line");
@@ -1389,6 +1380,15 @@ class Model extends FileView {
 				cursor?.css({left: '${line.position().left + line.width() * hxd.Math.clamp((1 - hxd.Math.pow(screenRatio, lodPow)), 0, 1)}px'});
 				cursor?.find(".ratio").text('${round(hxd.Math.clamp(hxd.Math.pow(screenRatio, lodPow) * 100, 0, 100), 2)}%');
 			}
+
+			var hmd = selectedMesh != null ? Std.downcast(selectedMesh.primitive, h3d.prim.HMDModel) : null;
+			if ( hmd != null ) {
+				var lodsCountEl = sceneEditor.properties.element.find("#vertexes-count");
+				var curLod = hmd.forcedLod >= 0 ? hmd.forcedLod : hmd.screenRatioToLod(@:privateAccess selectedMesh.curScreenRatio);
+				var lodVertexesCount = @:privateAccess hmd.lods[curLod].vertexCount;
+				lodsCountEl.text(lodVertexesCount);
+			}
+			
 		}
 	}