So I'm about 80% done integrating the new terrain system into our engine. So far I absolutely love working with it. Great job Sinbad.
However, I'm changing over our terrain painting tools and I've run into an issue.
As far as I can tell there doesn't seem to be way to identify existing layers within a terrain. More specifically, I can't tell if a layer has already been added to a terrain.
What I have is a global sorted list of terain layer/splats loaded from an XML file. I'd like to be able to paint any layer onto a new terrain and automatically insert it (maintaining the global layer sort) on the fly.
1) I can't easily determine if the layer exists in the terrain without iterating all layers and all textures doing string compares on the texture names
2) The only way to add a layer is at the end of the list. I'd like to be able to insert into any position.
Would it be possible to change LayerInstance to have a 'uint8 layerId'? Then add something like these methods to Terrain...
Code: Select all
bool hasLayer( uint8 layerId ) const;
addLayer( uint8 layerId, Real worldSize, const StringVector* textureNames );
removeLayer( uint8 layerId );
Of course the interface is debatable, I'm just trying to get the concept across.
An alternative might be to just return mLayers non-const and allow inserts into the vec... However this seems messier I think?
Thoughts?