No problem.
The code I modified to account for y scale.
The thing about the code its part of several procedual generation class and components not in the native code. Its something I put together.
It needs to be faster in general and unload the computation on a GPU. I want the base computation to less then a second.
I welcome anyone who want to assist getting the code more feature rich, faster, and preppef to be added
Vivienne
[quote=“TikariSakari”]Thank you for the code. I might need something like this at some point, if I need to generate random battle maps. I was also considering of using the terrain with procedural map generation, so this will potentially save me a bit of time in the future.
This is not something that actually matters, but still good thing to know/do. You should probably have the for loops x and y the opposite way to avoid possible cache misses when indexing the array.
So instead of:
for(unsigned x = 0; x<width_; x++)
{
for(unsigned y = 0; y<height_; y++)
{
/// incremennt memory which seems to work
int index = x+(y*height_);
unsigned col = inputData1[index]* 255; /// create color value
swapping x and y around
for(unsigned y = 0; y<height_; y++)
{
for(unsigned x = 0; x<width_; x++)
{
/// incremennt memory which seems to work
int index = x+(y*height_);
unsigned col = inputData1[index]* 255; /// create color value
But since you are most likely only building this once and if the width/height isn’t a huge number there is a possibility that not that many misses even happen or even if they do, it might not matter.[/quote]