Returns the current triangle count for the terrain's active LOD level. Takes entity (terrain entity handle), camera (camera entity handle). Returns triangle count (number of triangles being rendered for the current LOD level).
entity
Int
camera
Int
; Create terrain and camera
Local terrain:Int = b3dCreateTerrain("heightmap.bmp", 128)
Local camera:Int = b3dCreateCamera()
b3dPositionEntity(camera, 0, 100, -500)
; Configure LOD thresholds
b3dSetTerrainLOD(terrain, 0, 1000, 2000, 3000)
; Game loop - display triangle count
While running
sysUpdateEvents()
; Get current triangle count (changes with camera distance)
Local triangles:Int = b3dGetTerrainTriangleCount(terrain, camera)
; Move camera
If inpIsKeyDown(VKEY_W) Then
b3dMoveEntity(camera, 0, 0, 10)
EndIf
; Render and display
b3dCls3D()
b3dRenderWorld()
b3dFlip3D()
; Show triangle count (updates when LOD changes)
Print "Terrain triangles: " & ToString(triangles)
Wend