I just got a problem with terrain. The normals seem to not be affected by rotation.
When i display terrain normals i can see they do not match terrain inclination.
That make lighting fail with shadows at wrong place.
Here is how I added my terrain with rotation.
Code: Select all
smgr->addTerrainSceneNode("map.bmp", 0, -1, pos, irr::core::vector3df(0, -90, 0));
I checked CTerrainSceneNode.cpp and I found that CTerrainSceneNode::setScale calls calculateNormals.
I'm surprised that setRotation doesn't call it since a rotation modifies normals as scaling does.
So I modified it like this :
Code: Select all
void CTerrainSceneNode::setRotation(const core::vector3df& rotation)
{
TerrainData.Rotation = rotation;
applyTransformation();
calculateNormals(RenderBuffer); // I added this line
ForceRecalculation = true;
}
I'm using irrlicht 1.8.
Is that a bug from irrlicht ? Is my fix correct ?