About Store Forum Documentation Contact



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

Post: #1
Problems with calling Edit::Heightmap.setMaterial
I try to set the material of a heightmap field in the Custom Editor mode...

Now I'm getting errors that are really confusing to me:

Code:
Edit::Area a = Edit::Area(VecI2(iteratorTX,iteratorTY), user);

.
.
.

Edit::Heightmap(*a.heightmap()).setMaterial(iteratorAX,iteratorAY,grass,grassPer​centage,rock,rockPercentage,rubble,rubblePercentage);

I get the following errors:

1>c:\users\gian-reto\documents\local\esenthelenginesdk_new\editor\texturizer.cpp(175): error C2558: struct 'EE::Image': Kein Kopierkonstruktor verfügbar oder der Kopierkonstruktor is als 'explicit' deklariert
1> Diese Diagnose trat in der vom Compiler generierten Funktion "EE::Edit::Heightmap::Heightmap(EE::Edit::Heightmap &)" auf.
1>c:\users\gian-reto\documents\local\esenthelenginesdk_new\editor\texturizer.cpp(175): error C2558: struct 'EE::Image': Kein Kopierkonstruktor verfügbar oder der Kopierkonstruktor is als 'explicit' deklariert
1> Diese Diagnose trat in der vom Compiler generierten Funktion "EE::Edit::Heightmap::Heightmap(EE::Edit::Heightmap &)" auf.
1>c:\users\gian-reto\documents\local\esenthelenginesdk_new\editor\texturizer.cpp(175): error C2558: struct 'EE::Image': Kein Kopierkonstruktor verfügbar oder der Kopierkonstruktor is als 'explicit' deklariert
1> Diese Diagnose trat in der vom Compiler generierten Funktion "EE::Edit::Heightmap::Heightmap(EE::Edit::Heightmap &)" auf.
1>c:\users\gian-reto\documents\local\esenthelenginesdk_new\editor\texturizer.cpp(175): error C2558: struct 'EE::Image': Kein Kopierkonstruktor verfügbar oder der Kopierkonstruktor is als 'explicit' deklariert
1> Diese Diagnose trat in der vom Compiler generierten Funktion "EE::Edit::Heightmap::Heightmap(EE::Edit::Heightmap &)" auf.

translated to english:
1>c:\users\gian-reto\documents\local\esenthelenginesdk_new\editor\texturizer.cpp(175): error C2558: struct 'EE::Image': No copy constructor available or the copy constructor is marked as 'explicit'
1> This diagnosys happened in the function generated by the compiler "EE::Edit::Heightmap::Heightmap(EE::Edit::Heightmap &)"


Now I didn't change the EE::Image class, and the code above contains the only call to Edit::Heightmap in the whole class... any idea what could be the problem here?
04-13-2012 12:45 PM
Find all posts by this user Quote this message in a reply
Gian-Reto Offline
Member

Post: #2
RE: Problems with calling Edit::Heightmap.setMaterial
Okay, I think I have now an idea what could be wrong. I think I just have no idea how to use the MaterialPtr class.

This is how I initalize my material pointers:

Code:
    CChar *mtrlPath = (CChar *) "C:\\Users\\Gian-Reto\\Documents\\local\\EsenthelEngineSDK\\Data\\Mtrl\\Ground";
    EE::MaterialPtr grass;
    grass.find("Just Add Bison.gfx", mtrlPath);
    EE::MaterialPtr rock;
    rock.find("Hunting Grounds.gfx", mtrlPath);
    EE::MaterialPtr rubble;
    rubble.find("Fractured Flow.gfx", mtrlPath);

Any chance someone could give me an example how to do that better (as in, the correct way)?
It seems to me, now that I think of it, that I might want to get the materials from the material palette. Loading them directly from a file would be better though, if that is possible....
04-13-2012 11:09 PM
Find all posts by this user Quote this message in a reply
Zervox Offline
Member

Post: #3
RE: Problems with calling Edit::Heightmap.setMaterial
.gfx is not materials they are images, you have to either make materials with those images or

MaterialPtr ptr;
ptr->base_0.get("Just Add Bison.gfx", mtrlPath);
04-14-2012 12:18 PM
Find all posts by this user Quote this message in a reply
Gian-Reto Offline
Member

Post: #4
RE: Problems with calling Edit::Heightmap.setMaterial
Thanks for the reply, Zervox

Sadly I tried your suggestions, but the error is still the same.

In the header file for the Heightmap.setMaterial Method, it seems that the function is expecting MaterialPointers. How could I make the materials, so that the function doesn't need to do it (As it seems to me it does something wrong while creating the images)? What do I need to do?
04-14-2012 10:39 PM
Find all posts by this user Quote this message in a reply
Zervox Offline
Member

Post: #5
RE: Problems with calling Edit::Heightmap.setMaterial
My suggestion was a MaterialPtr which shouldn't be a problem.
04-14-2012 11:26 PM
Find all posts by this user Quote this message in a reply
Gian-Reto Offline
Member

Post: #6
RE: Problems with calling Edit::Heightmap.setMaterial
Yes, thats what I use. But it seems there is still some EE:Image involved, and some method tries to invoke the copy constructor...
04-15-2012 12:52 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #7
RE: Problems with calling Edit::Heightmap.setMaterial
Quote:Edit::Area(VecI2(iteratorTX,iteratorTY), user);
Edit::Heightmap(*a.heightmap()).
just a note: you're trying to create new temporary variables which is incorrect, you should access those already available from World.
04-19-2012 04:20 AM
Find all posts by this user Quote this message in a reply
Gian-Reto Offline
Member

Post: #8
RE: Problems with calling Edit::Heightmap.setMaterial
Hi Esenthel

How do I access those? I don't see where in the code this is done...

I'm sorry but I think I need a little bit more help with this problem, I can't figure it out by myself.

EDIT: Okay, first part of the mystery solved.... still, even with the "World Editor.h" file included I don't see how I access the ares of the exisiting world

In "Edit Area.cpp" for example there is a call to area() from "WE Area.h" without any object present. I don't see any code that makes Edit Area extend from WE Area (though that could be me beeing a C++ noob)...
How on earth does that work? Is this the Method I should call to get the actual areas from?
(This post was last modified: 04-23-2012 10:03 AM by Gian-Reto.)
04-23-2012 09:50 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #9
RE: Problems with calling Edit::Heightmap.setMaterial
Hi, I wrote to you in a different thread that World Editor source code already has a tutorial for editing areas. you access them by World.grid.
04-26-2012 06:05 AM
Find all posts by this user Quote this message in a reply
Gian-Reto Offline
Member

Post: #10
RE: Problems with calling Edit::Heightmap.setMaterial
Okay, I'll try it with World.grid.... I found the call to it in the editor code, even though its a single line, commented out. But maybe I'll be able to figure it out.
(This post was last modified: 04-26-2012 08:13 AM by Gian-Reto.)
04-26-2012 08:13 AM
Find all posts by this user Quote this message in a reply
Gian-Reto Offline
Member

Post: #11
RE: Problems with calling Edit::Heightmap.setMaterial
I changed the way I get to the Area / Heightmap, but I still get the same errors as noted in the opening post.

The code involved (minus a lot of logic that has nothing to do with the materials itself) looks like this at the moment:

Code:
    CChar *mtrlPath = (CChar *) "C:\\Users\\Gian-Reto\\Documents\\local

    MaterialPtr grass;
    grass->base_0.get("Just Add Bison.gfx", mtrlPath);

    MaterialPtr rock;
    rock->base_0.get("Hunting Grounds.gfx", mtrlPath);

    MaterialPtr rubble;
    rubble->base_0.get("Fractured Flow.gfx", mtrlPath);

...

Edit::Heightmap *hm = ((Edit::Area*) Edit::World.grid.get(VecI2(iteratorTX,iteratorTY))->data())->heightmap();

...
  hm->setMaterial(iteratorAX,iteratorAY,grass,grassPercentage,rock,rockPercentage,r​ubble,rubblePercentage);

Whats the problem with the materials?
Why does setMaterial try to copy the materialPointers?
04-27-2012 08:54 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #12
RE: Problems with calling Edit::Heightmap.setMaterial
Please don't keep emailing me asking for help - http://www.esenthel.com/community/showth...p?tid=3331

according to the EE headers you need to call:
1. once Edit::Area::setChanged before making any change
2. call hm->setMaterial on each pixel
3. once Edit::Area::hmChanged

also your codes have many mistakes:
((Edit::Area*) Edit::World.grid.get - you shouldnt do any manual casting

MaterialPtr rubble;
rubble->base_0.get("Fractured Flow.gfx", mtrlPath);
you cannot load material from a texture:
MaterialPtr rubble="path to material/mtrlfile.mtrl";

you should look at the cpp tutorials in the SDK folder to learn the basics about handling EE functions.
05-01-2012 01:02 PM
Find all posts by this user Quote this message in a reply
Gian-Reto Offline
Member

Post: #13
RE: Problems with calling Edit::Heightmap.setMaterial
Ok, thanks for the help... I'll correct my code and see if I get it to work now.

EDIT: Got it to work, but I get an Unknown Exception when calling my texturizer Function. Well, anway, one step further, still not there...

EDIT 2:

I get an access violation when calling

Code:
area->heightmap()->setMaterial(iteratorAX,iteratorAY,grass,grassPercentage,rock,rockPercentage,r​ubble,rubblePercentage);

area is now defined this way:

Code:
Edit::Area *area = Edit::World.grid.get(VecI2(iteratorTX,iteratorTY))->data();

I'll try to narrow the problem further down, but after looking at the tutorials I see the method used elsewhere, there it seems to work... so it must have something to do with the way I get the area and/or the heightmap of this area...
(This post was last modified: 05-02-2012 11:53 PM by Gian-Reto.)
05-01-2012 07:37 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #14
RE: Problems with calling Edit::Heightmap.setMaterial
maybe the "heightmap()->" is NULL and you need to call hmCreate first?

also please make sure to operate only on areas within the range of World.visibleArea()
other areas are unloaded and applied changes will not be saved, then you can call World.cameraGoTo(area) to move camera, wait a few frames until new areas are loaded, and apply changes to them.
05-06-2012 05:31 AM
Find all posts by this user Quote this message in a reply
Gian-Reto Offline
Member

Post: #15
RE: Problems with calling Edit::Heightmap.setMaterial
I don't check for null in my code, but I am pretty sure that there SHOULD be a heightmap as I call the method on a loaded world with a heightmap.

The second possibility though makes a lot of sense.... I start at x=0, y=0 and try to iterate through to x=2048, y=2048 (well, not literally, as I call one area after the other (32 in each direction) and then all heightfields on these (64 in each direction), but you get the point), without moving the camera anywhere.

Is there a possibility to just load the heightmap for a certain area into memory, and unload it after all heightfields of an area have been processed, or is moving the camera the easiest way?
05-06-2012 01:29 PM
Find all posts by this user Quote this message in a reply
Post Reply