With the help of Travis from the advanced forum, I added this method to the ITerrainSceneNode object:
Code: Select all
bool CTerrainSceneNode::loadHeightMapFromArray(irr::f32 heights[], int width, video::SColor vertexColor, s32 smoothFactor)BUT now I can't pass an array to addArrTerrainSceneNode! I get a compiler error, although Irrlicht compiles fine. Here's what I'm trying to do:
Code: Select all
scene::ITerrainSceneNode* getTerrainFromImage(video::IImage* idata,const core::vector3df &position,const core::vector3df &rotation,const core::vector3df &scale,const video::SColor vertexColor)
{
short data_size=idata->getDimension().Width*idata->getDimension().Height;
irr::f32 darray[data_size];
for (s32 x = 0; x < idata->getDimension().Width; ++x)
{
for (s32 z = 0; z < idata->getDimension().Height; ++z)
{
darray[x*idata->getDimension().Width+z]=(irr::f32)idata->getPixel(x,z).getAverage();
}
}
scene::ITerrainSceneNode* terr=smgr->addArrTerrainSceneNode(darray, (int)idata->getDimension().Width, position, rotation, scale, vertexColor);
return terr;
}I'm posting here because I think this is a c++ mistake by me and thus I don't want to post in a forum which clearly states "NO questions about C++...".