You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers. No questions about C++ programming or topics which are answered in the tutorials!
So I wrote a basic terrain editor. My terrain has a shader which uses normals (NORMAL semantic) to calculate lighting and the texture blending. However, whenever I alter the mesh's vertices's positions manually, then the shader won't update the lighting/texture on the mesh itself until I've completely deleted the mesh and re-loaded it.
How would I solve it? I scoured over the forums and I've tried the meshBuffer->setDirty() method and also sceneManager->getMeshManipulator()->recalculateNormals( meshBuffer ) but neither of those seem to work.
after you`ve altered the mesh in order to force normals recalculation. If it works this way, you can call it only if a key/button was pressed or sth alike, as it may be a bit costly operation to call frequently.
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
Shortly said, its because it operates the buffer in a bit different way, which in your case doesn`t do what you need as you have discovered yourself. Note that after you edit the vertices you call setPosition() on the terrain to apply the changes to the terrain (you`re using the example from the code snippets), you don`t need to call both setPosition() and setScale() or it will be even slower. If you call setScale() the current frame, make sure you don`t call setPosition() as well, because you don`t really need to.
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."