Jump to content
  • Advertisement
Sign in to follow this  
mysigninname

L3DT & XNA

This topic is 2633 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, so im using L3DT to make heightmap bmp's for xna to read.

Here's the code that does it;


public float[,] LoadHeightData(Texture2D heightMap)
{
width = heightMap.Width;
length = heightMap.Height;

Color[] heightMapColors = new Color[width * length];
heightMap.GetData(heightMapColors);


float[,] heightData = new float[width, length];
for (int x = 0; x < width; x++)
for (int y = 0; y < length; y++)
heightData[x, y] = heightMapColors[x + y * width].R / 4.0f;

return heightData;
}




Basically it's not reading the heightmaps correctly and i was wondering if anyone else has experience using L3DT and XNA, perhaps they can help me out.
Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Would anyone know how to read data from a 16-bit png? Im used to reading from bmps in 8bit, thanks to Reimers tutorials, but could anyone help me out trying to read 16bit png's?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!