About Store Forum Documentation Contact
Donations:
309$/mo



Post Reply 
EditorInterface::WorldTerrainSet
Author Message
Tottel Offline
Member

Post: #1
EditorInterface::WorldTerrainSet
Hi,

I'm using WorldTerrainGet and WorldTerrainSet to copy/paste parts of a terrain.
But I can't get it to paste the terrain, and I'm not sure about a number of things:

1. If I use WorldTerrainSet on an area without existing terrain, will it create new terrain? So far, nothing shows up. Not even if I overwrite existing terrain. I also tried with WorldTerrainSetHeight, just to see if that works. But that's also not working.

2. I'm not sure if the height image I get is correct. I want to draw it using height.draw(rect), but that crashes. Shouldn't I be able to draw this image?

I store the info like this:

Code:
m_Areas[x][y] = new AreaInfo(area, &heightMap, colorMap, &materialMap);

My AreaInfo looks like this:

Code:
class AreaInfo
{
   AreaInfo(VecI2& areaCoord, Image* heightMap, Image* colorMap, Edit.MaterialMap* matMap)
   {
      
      area = areaCoord;
      height = heightMap;
      color = colorMap;
      materialMap = matMap;      
   }
   VecI2 area;
   Image* height = null;
   Image* color = null;
   Edit.MaterialMap* materialMap = null;
}

And then I set it like this:

Code:
EI.worldTerrainSet(m_CurWorld, VecI2(x, y), *(m_Areas[x][y].height), *(m_Areas[x][y].materialMap), m_Areas[x][y].color);

Thanks
03-09-2014 02:07 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: EditorInterface::WorldTerrainSet
I've modified the included tutorial and it works fine:
Code:
// set terrain
   ok=EI.worldTerrainSetHeight(world_id, VecI2(0, 0), height, material_id);
  
   Image temp;
   ok=EI.worldTerrainGetHeight(world_id, VecI2(0, 0), temp); // get
   ok=EI.worldTerrainSetHeight(world_id, VecI2(1, 0), temp); // set

You need to provide at least one material.
Please see the tutorials.
03-11-2014 04:26 AM
Find all posts by this user Quote this message in a reply
Tottel Offline
Member

Post: #3
RE: EditorInterface::WorldTerrainSet
Hi Esenthel,
Thank you for the reply.

I did check the tutorial. I've noticed that the Set works right after getting (stored in local variables). But if I store the variables in an AreaInfo container, it doesn't work when I use them later. I'll have to wait until I'm back home before I can give you some source code.
03-11-2014 08:53 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: EditorInterface::WorldTerrainSet
Perhaps you have some bug in the code? I see that you're storing pointers to elements. Perhaps these elements get changed in the meantime, or even no longer exist?
03-11-2014 09:20 PM
Find all posts by this user Quote this message in a reply
Post Reply