I want to do it to get a normal at given world point (which I currently normalize with the terrain Width(x) and Height(z) ) on the terrain.
What i'm currently trying to do :
Code: Select all
unsigned char* data = new unsigned char[texturePtr->getWidth() * texturePtr->getHeight() * 3];
texturePtr->getBuffer()->blitFromMemory(PixelBox(texturePtr->getWidth(),texturePtr->getHeight(), 1, PF_R8G8B8, (void*) data));
unsigned char* red = &data[(0 + 0 * texturePtr->getWidth()) * 3];
unsigned char* green = &data[(0 + 0 * texturePtr->getWidth()) * 3 + 1];
unsigned char* blue = &data[(0 + 0 * texturePtr->getWidth()) * 3 + 2];
std::cout<<"r " << *red << " g " << *green << "b " << *blue << std::endl;
Thanks for your help