About Store Forum Documentation Contact



Post Reply 
Recreate EE Heightmap from Area mesh?
Author Message
necdel Offline
Member

Post: #1
Recreate EE Heightmap from Area mesh?
Hi, another quick one, If I wanted to recreate the Heightmap from my world areas, is that possible?

I have tried the following,

Code:
Game.Area* the_area = Game.World.areaLoaded(a);
        
Mesh &mesh = the_area.getData().mshg.meshes[0];

Heightmap areaHeightmap;

areaHeightmap.build(mesh, 0, 1.0, true, NULL, NULL, NULL, NULL, NULL , NULL , NULL , NULL);

That just doesnt seem to do it for me, if I iterate over the mesh and print the height it is all 0.

Thank you for your time! Having a blast trying to figure the engine out.

EE 1.0 SDK 22
(This post was last modified: 04-12-2013 08:37 PM by necdel.)
04-12-2013 08:35 PM
Find all posts by this user Quote this message in a reply
Ozmodian Offline
Member

Post: #2
RE: Recreate EE Heightmap from Area mesh?
Hi necdel,

Why are you trying to do this? the height is not stored in the mesh i don't think. I actually just thought the mesh pointer was there b/c the engine needed it, I don't think you can access it like that (totally not sure though). Also, don't forget you are getting a pointer so you could be setting the mesh to NULL when you do the build a new heightmap.

But back to my original question, why would you try this? I know from your PM that you saw in my tutorial how to manage the relationship between area and heightmap.
04-12-2013 09:13 PM
Find all posts by this user Quote this message in a reply
necdel Offline
Member

Post: #3
RE: Recreate EE Heightmap from Area mesh?
Just seeing what is possible with the engine mostly. I guess I should clarify that its not the heightmap image I am trying to access, that I see is possible with the height() image from an area, I was just using the iteration to verify if I was in fact loading the mesh or not. I was just wondering if I could somehow recreate the original heightmap data structure that the engine uses, and get me access to all of the functions within the heightmap, the material blending, grabbing colors at xy and whatnot.
04-12-2013 09:37 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: Recreate EE Heightmap from Area mesh?
You can create MeshBase (software mesh) from the existing hardware mesh, and iterate all vertexes.
You can extract all vertex info (position, material blends, etc).
04-17-2013 12:57 PM
Find all posts by this user Quote this message in a reply
necdel Offline
Member

Post: #5
RE: Recreate EE Heightmap from Area mesh?
Thanks for the reply Esenthel.

Still a bit confused between software and hardware meshes and all that.

So on one side it would look like this to grab my bases?
Code:
Mems<MeshBase> meshes;
meshes.setNum(the_area.getData().mshg.meshes[0].parts.elms());

        for(int i =0; i < the_area.getData().mshg.meshes[0].parts.elms();  i++)
               {
                 the_area.getData().mshg.meshes[0].parts[i].setBase();
                  
                 meshes[i].add(the_area.getData().mshg.meshes[0].parts[i].base);
                  
               }

On the setting side it would be something along the lines of:

Code:
the_area.getData().mshg.meshes[0].parts.setNum(meshes.elms());

(loop through parts)    
             the_area.getData().mshg.meshes[0].parts[i].base.add(meshes[i]);

do i need to call parts[i].setRender after adding the base?

Thanks again
04-18-2013 06:06 PM
Find all posts by this user Quote this message in a reply
fatcoder Offline
Member

Post: #6
RE: Recreate EE Heightmap from Area mesh?
Yes, you need to call setRender if you want to actually draw these meshes on screen. You should also call setBox (I think its called), which is useful for frustum culling. You may also want to call delBase when you're finished working with the meshes to free up some memory (if you don't need the base mesh anymore).
04-19-2013 01:00 AM
Find all posts by this user Quote this message in a reply
Post Reply