About Store Forum Documentation Contact



Post Reply 
Problems with calling Edit::Heightmap.setMaterial
Author Message
Gian-Reto Offline
Member

Post: #16
RE: Problems with calling Edit::Heightmap.setMaterial
Okay, I now use this code to move the cam to each area befor calling setMaterial on it, which seems to work fine (cam ends up in southeast corner of the Terrain where it should after working through terrain from NW to SE)
Code:
Edit::World.cameraGoTo(VecI2(iteratorTX,iteratorTY));

but no matter what method I try to call on the area heightmap though, I get an access violation as soon as I try that.

Do I need to wait for the are to be loaded before calling anything on its heightmap? At the moment I move on with my code after having moved the cam to the area. Is it a good idea to sleep for some seconds to give the World Editor / EE time to catch up?
(This post was last modified: 05-11-2012 07:57 AM by Gian-Reto.)
05-11-2012 07:56 AM
Find all posts by this user Quote this message in a reply
Gian-Reto Offline
Member

Post: #17
RE: Problems with calling Edit::Heightmap.setMaterial
EDIT: After some more testing it looks like it works like a charm for a single area. There must be an error in my loop somewhere... disregard my questions for now, I need to test more first I think.

EDIT 2:
Okay, I got it to work... with an ugly hack.

As moving the camera with CameraGoTo() would not work for me (somehow the cam did not move, and the editor crashed as soon as I tried to set the material in an area outside the original visible area), I just set the visible area large enough so the full terrain is visible all the time.

It works for me with an empty 2x2km heightmap, using around 1,5G, and might even work for larger terrain if I was able to afford the professional VS and could do 64 bit builds, but its far from ideal.
Any idea how I get the editor to load the areas the cam is looking on? Or how to load areas to memory without moving the cam?

Also, two strange things I noticed:
1. the area with the coordinates 0,0 in the grid is in the middle of the map and not in a corner as I would have expected. The grid numbering starts with negative numbers. Might have to do with the second weird thing...
2. The area size in the editor seems to be Independent from the area size of the built game, which you can set in the editor. If i click on info in editor I see a value of 64m for the areasize, but in the editor view I clearly can see that the area is only 32m in size.
(This post was last modified: 05-14-2012 08:36 PM by Gian-Reto.)
05-14-2012 10:54 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #18
RE: Problems with calling Edit::Heightmap.setMaterial
Hello,

Yes indeed the loading/unloading areas without camera may be useful, so I added this to the roadmap.

You will get access violation if you will operate on pointers if not checking them for NULL values.

about your 1 and 2 issues:
please enable "view/cursor position information" in the world editor menu, and you will get precise position about the mouse cursor in world space, which will help you understand the world area coordinates.
05-16-2012 11:34 AM
Find all posts by this user Quote this message in a reply
Gian-Reto Offline
Member

Post: #19
RE: Problems with calling Edit::Heightmap.setMaterial
So if I understand this correct, if I move the camera with CameraGoTo, the Cam Image should change immidiatly, and the Area should be loaded?

Thanks for the help. I'll check out this menu option for sure.
05-16-2012 11:14 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #20
RE: Problems with calling Edit::Heightmap.setMaterial
next SDK will have following methods for Edit::Area class
Code:
Bool load              (); // make sure that this Area is loaded into memory, false on fail
void unloadIfOutOfRange(); // unload this area if it's out of visible range

you will no longer need to manipulate the camera or wait few frames to load the area
05-23-2012 08:50 PM
Find all posts by this user Quote this message in a reply
Gian-Reto Offline
Member

Post: #21
RE: Problems with calling Edit::Heightmap.setMaterial
Cool, thanks Esenthel. that was quick! smile
05-27-2012 10:59 PM
Find all posts by this user Quote this message in a reply
Post Reply