TerrainGrid eats the runtime exceptions

I’m struggling to get TerrainGrid to work. One problem I ran into was that in TerrainQuad (line 189):



[java]

if (!FastMath.isPowerOfTwo(quadSize - 1)) {

throw new RuntimeException(“size given: " + quadSize + " Terrain quad sizes may only be (2^N + 1)”);

}

[/java]



Is not visible anywhere. I guess the background loading executor used by terrain grid eats it. Suggestion: add a log statement.

Damn executors. I just committed a fix for that on trunk.

And what issues are you having with terrain grid?

1 Like

I’m trying to get my working TerrainQuad be visible as part of a TerrainGrid. But I’ll hack away at it until I can formulate better questions, right now I’m just fumbling :slight_smile:

@Sploreg said:
Damn executors. I just committed a fix for that on trunk.
And what issues are you having with terrain grid?


Cracked the issue, it was (as usual) wrong expectations about how things work. When dealing with a TerrainQuad I created it, set up physics and all that. Then I did:
[java]float terrainHeight = terrain.getHeight(Vector2f.ZERO);[/java]

So that I could position the camera a little bit above the terrain.

However, with TerrainGrid that return NaN because the terrain hasn't been loaded in the background yet, which positioned the camera... somewhere else :)

So I will have to make sure my app-initialization is better at handling background initialization, which anyway is a good thing, I've only been lazy about it.