• Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Butterfly #229

Sign in to follow this  


So, I've been working on different methods of loading/generating terrain, and so far I've got the 3 basic ones:

generatePlain - essentially creates a grid with set y value
loadHeightmap - loads data from a *.bmp heightmap
generateFromFunc - sweetness that you can pass any function to

For the project I'm working on, most of the terrain will be procedurally generated, so I'll probably end up using the last one the most often. Here's a sample:

// y-generation func
float sine(int x, int z) {
return sin(x) + sin(z); }

// function prototype to generate the terrain
void cOGLTerrain::generateFromFunc(cCallback2_* func, GLint x, GLint z,
GLfloat w, GLfloat h, GLfloat xOff=0,
GLfloat yOff=0, GLfloat zOff=0)

// actual call which generates above terrain
hills.generateFromFunc(new cCallback2

// woot, templated callbacks are sexy :D

Now to correct the normal generation :/
Sign in to follow this  


Recommended Comments

You know what I meant :P :P :P
*Mushu find-replaces all the plains in his code...

:P :P :P

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement