Array Troubles

Hi all. I've been having some trouble regarding code that I am using from a tutorial on 3D Perlin Noise Terrain Generation.

Currently, I have been using the tutorial to build my own terrain generator, however, the tutorial is written in BlitzMax, so I've been porting it to C++, my language of choice.

So basically, there is a class terrainGenerator that creates an instance of my noiseGenerator class. The noiseGenerator class manages everything that has to do with the core Perlin noise algorithm. The terrainGenerator class has a higher level algorithm that creates terrain using the noiseGenerator's algorithm.
The main function for the terrainGenerator is int lookupBlock(float x,float y,float z); which takes the position of the map, and returns an integer of the block type at that position (BLOCK_AIR,BLOCK_DIRT...etc)

The problem is, in the noise generator class, there are a few functions:
1
2
3
float GetNoise1D(float X,int Ocatves,float Randoms[]);
float GetNoise2D(float X,float Y, int Octaves, float Randoms[]);
float GetNoise3D(float X,float Y, float Z,int Octaves,float Randoms[]);

And as you can see, each one takes a float array Randoms[] (which to my knowledge is the same as a pointer to the first element of the array, *Randoms)
Now, the lookupBlock function makes several calls to both GetNoise2D as well as GetNoise3d. The calls look like this:
1
2
noiseGen->GetNoise3D(x,y,z,4,Generators[0])*0.2
noiseGen->GetNoise3D(x,y,z,4,Generators[8])*0.5

So I assumed that, since the function GetNoise3D takes an array of random integers between (inclusive) -1, and 1, that Generators was an array of different random integer arrays. So an array within an array. What I want is to pass that big random array of random integers to the GetNoise3D function, and be able to pass different ones stored in the Generators[20] arrays, to create different noise outputs by the noise generator for use by the terrain generator.
I'm a little bit confused, so sorry if my explanation kind of sucks, but it's a little difficult to explain. >_<
Thanks.

What I want is to pass that big random array of random integers to the GetNoise3D function, and be able to pass different ones stored in the Generators[20] arrays, to create different noise outputs by the noise generator for use by the terrain generator.


This sentence is very confusing. Try to explain it in several sentences and/or with examples. Trying to express your thoughts to somebody else so that they will understand is actually a very good way to understand it yourself - sometimes when you explain to somebody you finally really understand your troubles yourself.
Yeah, I figured it out via. toilet think. Thanks though xD
Topic archived. No new replies allowed.