Terrain.setLocked() does not work


I noticed JME Terrain has a setLocked() method that claims to improve the performance by making terrain un-editable. (internally use Mesh.setStatic())

it ends up calling TerrainPatch.lockMesh()

I enabled it but I did not notice any performance improvement and the terrain is still editable. I already checked and can confirm all buffers on the terrain meshes are set to Static usage.

Anybody knows why this does not work as expected?

1 Like

I recall seeing somewhere that it is just a hint. Hint to GPU? It doesn’t prevent anything. It just allows the GPU to optimize, if it wants to. There is probably a lot of variation how it works in practice.


That is my understanding as well. Like, a “static” mesh is a holdover from a time when that mattered more. It seems to make no difference today.

…and I suspect the author of JME’s terrain stuff was confused as to its use when calling it “lock”. It definitely doesn’t lock anything. You can still edit a static mesh.

1 Like