TerrainGrid Implementation

Because TerrainGrid is not available under the com.jme3 packages, I downloaded the source straight from the trunk, however there are numerous errors, mainly with LRUCache being abstract, as well as the HeightMapGrid being an interface trying to be instantiated within the TerrainGrid.java source. How do I go about implementing this new method, am I doing something wrong? BTW com.jme3tests also does not have demos for this. Thanks for the help!

Well it seems to kill the app for me, but I recieve a variant of that, mine gets an error in TerrainGrid updateChildren. Similar effects though yes

I double checked the source code, and can assure you that the code works as is. LRUCache is not abstract at all, HeightMapGrid is asked for getHeightMapAt but is not instanciated, it is provided through constructors as expected, and there are three tests in the jme3tests.terrain package (named TerrainFractalGridTest, TerrainGridAlphaMapTest, TerrainGridTest) to be used as references.

Could you post some code samples of what you see as problem?

Wow now I am super confused, I just updated the IDE to the latest version, (using Help->Check for updates, now it is not recognizing com.jme3tests as a package <<.

To begin with, TerrainGrid is not registered in my IDE at all, it cannot import the file. The sad part here is that I can see it clearly in the jME3 Google Code trunk, nonetheless, that is where I got my code from. Here are the links:




I placed these files in my packages, and LRUCache doesnt work unless I import from sun.misc.LRUCache; However, from that source, it is abstract. In your code in the SVN, LRUCache is just… there I guess, you dont import it at all. I use JDK 1.6, jMP 3 Alpha 4, and my IDE is up to date.

So you just copied some java code from the google code and put them in the packages? Or did you check out the whole jme3 project from svn? If not the latter, you should do it. LRUCache used by TerrainGrid is simply placed beside the TerrainGrid class in the same package.

Yes, I edited my above post, I didnt check out the whole code, however I placed the LRU code inside, executor however returns some errors

How are you accessing exectuor if it is a member of TerrainQuad, extending classes do not give you access to their private members do they?

what kind of errors?

wouldn’t it be easier if you checkout everything for a start?

Executor is set as protected, so descendant classes can use it, though it still cannot be used outside of the package.

On further look, it seems I have an outdated package, I cannot check our the source , some weird SVN errors , however the jme3 source as it is (with your code in it) is part of a branch, I believe the default .jar in the jMP installation is getting from the trunk, where executor is protected (and where LRUCache.java doesnt exist)< how can I update jMP to look at this branch and update the .jars

If you check out the whole code, you’ll see that executor is changed to protected for subclassing, and you will have many more classes, that you will need. For example two HeightMapGrid implementations (ImageBasedHeightMapGrid and FractalHeightMapGrid), and also the tests that show you how to use them. :slight_smile:

Lol you always beat me to posting haha, I am glad that the issue is neither your code or my coding, just some wrong version of jME I have. Can you please guide me to downloading this new source and integrating it into jMP?

Thanks normen, I will get right back to you once the whole process is finished << I uninstalled Netbeans last night , what a shame lol :smiley:

Personally I think its way much more worth it to postpone such minor problems until they get solved instead of reconfiguring ones whole setup each time. Also you can use those instructions for jMP too.

Not entirely sure what you mean, but I need to get TerrainGrid working, because it seems ideal for my situation, and about the “green” zones outside the “blue” zones (as per the image on the post), I want to make those inaccessible to the camera, definitely possible I am sure, just want to do some testing. Also, by editing the .j3md file associated with the test, as well as mountains.zip’s files, I can add support for just more than three textures per material, right?

What I mean is that theres surely lots of other code you need to write for your project still.

Works like a charm, though every once in a blue moon some ArrayOutOfBounds exceptions come up, thank you so much guys, will get back to you if the exceptions persist and I cant find the issue in the source

EDIT - Hmm seemed that was just a roaming exception, doesn’t seem to come up again (even tho I made absolutely no changes to the code, maybe rapid succession of opening the game caused it?) Nonetheless, its a great terrain system

Is it possible you’re seeing this exception?


it’s kind of “random” for me too, doesn’t result in any predictable pattern and doesn’t always kill the app.