Thank you for your fast reply. I did the following (just as a test):

   csRef<iSimpleFormerState> former_state =
   SCF_QUERY_INTERFACE(i_terra_former, iSimpleFormerState);
   static float terr_map[5][5] = {    {0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
                                      {0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
                                      {0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
                                      {0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
                                      {0.0f, 0.0f, 0.0f, 0.0f, 0.0f}};
   former_state->SetHeightmap(&terr_map[0][0], 5, 5);

   csRef<iTerrainFactoryState> factory_state =
   SCF_QUERY_INTERFACE(i_terrain_factory, iTerrainFactoryState);
   factory_state->SetTerraFormer(i_terra_former);

   csRef<iMeshObject> terrain_mesh = i_terrain_factory->NewInstance ();

csRef<iTerrainObjectState> terrain_state = SCF_QUERY_INTERFACE(terrain_mesh, iTerrainObjectState);
   static csArray<iMaterialWrapper *> mat_array;
   mat_array.Push(tm);
   terrain_state->SetMaterialPalette(mat_array);

   csRef<iMeshWrapper> terrain =
   i_engine->CreateMeshWrapper(terrain_mesh, "Terrain", main_sector);

Now my application crashes without any error message. Even in my debug tool I don't get any clue why this happens (no exception etc.).
Have I done something wrong?

Greetings
Luder



Jorrit Tyberghein wrote:

A terraformer is something that implements the interface iTerraFormer.
Currently there is only one plugin in CS that implements this and that
is the simpleformer plugin which can read heightmap files for the
landscape engine. This simpleformer terraformer plugins is used by
maps like terrainf and terrain. The terraformer is responsible for
producing the data that the terrain engine needs. If you want to get
data for the terrain engine that comes from another source (i.e. other
then a heightmap image) then you can write your own implementation of
the iTerraFormer plugin (and also iTerraSampler). In that
implementation you can produce the data for the terrain engine from
any kind of input you want.

Another (perhaps easier) solution is to just use the existing
simpleformer plugin. It has a method
iSimpleFormerState->SetHeightmap() which accepts an iImage as input
(for getting the heightmap data from). There is a csImageMemory class
which you can use to create an iImage directly from memory data. You
can convert your 2D array to an csImageMemory instance and then give
the resulting image to the SetHeightmap() function.

Greetings,

Greetings,


--
Project Manager of Crystal Space (http://www.crystalspace3d.org)
and CEL (http://cel.crystalspace3d.org)
Support Crystal Space. Donate at
https://sourceforge.net/donate/index.php?group_id=649


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Crystal-main mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/crystal-main
Unsubscribe: mailto:[EMAIL PROTECTED]





-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Crystal-main mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/crystal-main
Unsubscribe: mailto:[EMAIL PROTECTED]

Reply via email to