Macaw OS C reference

Function newterrainfn

#include <macaw3d.h>
int newterrainfn(
    int cells,
    double (*height)(double u, double v),
    int texture,
    double tiles
);

Makes hills like newterrain, but your own function works out how high each point is.

Parameters

cellsint
How many squares it has along each side. 0 or less: 32.
heightdouble (*)(double u, double v)
Your function, called once for each corner as the terrain is made. It gets u (across x) and v (along z), each 0 to 1, and returns a height from 0 to 1. NULL: flat.
textureint
The picture to cover it with. 0: plain light grey.
tilesdouble
How many times the texture repeats across the whole terrain. 0 or less: cells / 4.

Returns int

The new terrain's number.

In Shapes, terrain and models, with newcube, newsphere, newcylinder, newcone, newplane, newterrain, newmesh, newmodel, newsprite, newpivot.