Place meshes on terrain

Blitz3D Forums/Blitz3D Programming/Place meshes on terrain

Paulo, you need something like:
For x = 0 to <bitmap width>-1
 For y = 0 to <bitmap height>-1
  LockBuffer TextureBuffer(bitmap handle)
  rgb = ReadPixelFast(x,y,TextureBuffer(bitmap handle))
  UnlockBuffer TextureBuffer(bitmap handle)
  nClrR = rgb Shr 16 And %11111111
  nClrG = rgb Shr 8 And %11111111
  nClrB = rgb And %11111111
  If nClrG=255
   MakeTreeAt(x,y)
  Endif
 Next
Next

I'd make the bitmap separate from the others (not an alpha channel), so it's easier to change.
Make it black and spray it green (rgb=0,255,0) where you want trees.
Whenever a green pixel is found the coords will be sent to the MakeTreeAt() routine.