I've written this little routine that creates a terrain mesh for me, but at the mo its got hardcoded variables.. I'd like to seperate it from my main program loop and make it into a function that I could call, whenever its needed. But, I'm not too sure how to go about it.
Here's some snippets of the code:
I need these, but I realize I cant put them into a function.
Then comes the rest of the code..
As you can see I'm using the global handle surf, which is fine if I'm only calling the function once - but if I want to use it twice ?.
Ideally, I'd just like to call the function, like this:
global terrainpatch=make_terrain(terrainpatch)
And that would be that !. But I'm just alittle puzzled how I can go about it.
Any Help Guys ?...pretty please !.
Here's some snippets of the code:
Global terrain_pivot=CreatePivot() Global mesh_land=CreateMesh(terrain_pivot) Global surf=CreateSurface(mesh_land)
I need these, but I realize I cant put them into a function.
Then comes the rest of the code..
... AddVertex surf,x+cenx#,y+ceny#,0,0,0,0 0 AddVertex surf,x+cenx#,(y+1.0)+ceny#,0, 1,0, 0 ...
As you can see I'm using the global handle surf, which is fine if I'm only calling the function once - but if I want to use it twice ?.
Ideally, I'd just like to call the function, like this:
global terrainpatch=make_terrain(terrainpatch)
And that would be that !. But I'm just alittle puzzled how I can go about it.
Any Help Guys ?...pretty please !.