ok so heres the problem
Im making a small program to load up a heightmap as a terrain and then export it as a .x object. This is to be used to load terrain objects into cartography shop.
The problem Im having is the mesh it exports apparently has nothing to do with the terrain i am loading or the dbSaveMesh() command does nothing.
the terrain displays properly and such and I was reading a post on this forum about how you cant use dbMakeMeshFromObject() on very large terrains.
My approach was to read each limb out as an object and attach it as a limb on a new object.
here's my code
#include <stdio.h>
#include "dbstart.h"
int buildMap(char* fname);
int main(int argc, char** argv) {
dbHideMouse();
dbSyncOn ( );
dbSyncRate ( 0 );
if (argc < 2)
return -1;
buildMap(argv[argc-1]);
//make the root object
dbMakeObjectFromLimb(1, 10, 1);
dbPerformCheckListForObjectLimbs(1);
for (int i=2; i<dbChecklistQuantity(); i++) {
//object 5 is the limb object
dbMakeObjectFromLimb(1, 5, i);
//mesh 6 is the mesh object
dbMakeMeshFromObject(6, 5);
//add the limb
dbAddLimb(10, i, 6);
dbDeleteObject(5);
dbDeleteMesh(6);
}
dbMakeMeshFromObject(12, 10);
dbSaveMesh("mesh.x", 12);
return 0;
}
int buildMap(char* fname) {
if (!fname) return -1;
dbSetupTerrain();
dbMakeObjectTerrain(1);
dbSetTerrainHeightMap(1, fname);
dbSetTerrainScale(1, 6, 3.0f, 6);
dbSetTerrainLight(1, 1, -0.25f, 0, 1, 1, 0.78f, 0.5f);
dbSetTerrainSplit(1, 8);
dbBuildTerrain(1);
return 0;
}
its more than likely just me not knowing how to use the commands but anyone have any ideas?