HI, im trying to read data from a mapped resource that is in FLOAT_32 format
the texture is 4096*4096.. I'm trying to read into a 2D array of floats like this : heightmap_array[4096][4096]....
it seems to work ok, but I suspect something is wrong..because it seems to be too low res or something: (but the file doesn't have mipmaps) the problem might be in this line:
int rowStart = mappedResource.RowPitch*(row / sizeof(float));
not sure if this is really right.. meaning the sizeof(float) part.. is that needed? however without it, it seems to not get enough data to fill the array
{
int heightmapsize = 4096;
d3d11DevCon->Map(heightmap_res, NULL, D3D11_MAP_READ, NULL, &mappedResource);
if (!sptr)
{
d3d11DevCon->Unmap(heightmap_res, 0);
heightmap_res->Release();
MessageBox(NULL, L"Error mapping heightmap data",
L"Error", MB_OK | MB_ICONERROR);
return;
}
for (int row = 0; row < heightmapsize; row++)
{
int rowStart = mappedResource.RowPitch*(row / sizeof(float));
for (int col = 0; col < heightmapsize; col++)
{
heightmap_array[col][row] = sptr[(rowStart + col)];
}
}
heightmap_res->Release();
}