Infinite Procedural Terrain Engine

I tried to run it today, and got this output:

CraigsBook:src craigmacomber$ python main.py
Hello World
DirectStart: Starting the game.
Known pipe types:
osxGraphicsPipe
(all display modules loaded.)
Sun Dec 12 18:46:11 CraigsBook.local Python[6505] : kCGErrorIllegalArgument: CGSCopyRegion : Null pointer
Sun Dec 12 18:46:11 CraigsBook.local Python[6505] : kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
running from:/Users/craigmacomber/Desktop/Panda-3d-Procedural-Terrain-Engine/src
instancing world…
:pstats(warning): Ignoring spurious connection_reset() message
:gobj(error): shaders/stephen4.sha: invalid parameter name (uniform in float4 region1Limits)
:gobj(error): shaders/stephen4.sha: invalid parameter name (uniform in float4 region2Limits)
:gobj(error): shaders/stephen4.sha: invalid parameter name (uniform in float4 region3Limits)
:gobj(error): shaders/stephen4.sha: invalid parameter name (uniform in float4 region4Limits)
:gobj(error): shaders/stephen4.sha: invalid parameter name (uniform in sampler2d region1ColorMap)
:gobj(error): shaders/stephen4.sha: invalid parameter name (uniform in sampler2d region2ColorMap)
:gobj(error): shaders/stephen4.sha: invalid parameter name (uniform in sampler2d region3ColorMap)
:gobj(error): shaders/stephen4.sha: invalid parameter name (uniform in sampler2d region4ColorMap)
:gobj(error): shaders/stephen4.sha: invalid parameter name (uniform in sampler2d detailTexture)
:gobj(error): Shader encountered an error.
setting up water plane at z=60.0
:grutil(error): Failed to load heightfield image heightmaps/ID123X0.0Y0.0.png!
:grutil(error): No valid heightfield image has been set!
tile generated at 0.0 0.0
:grutil(error): No valid heightfield image has been set!
:grutil(error): No valid heightfield image has been set!
:grutil(error): No valid heightfield image has been set!
:grutil(error): No valid heightfield image has been set!
:grutil(error): No valid heightfield image has been set!
:grutil(error): No valid heightfield image has been set!
:grutil(error): No valid heightfield image has been set!
:grutil(error): No valid heightfield image has been set!
:grutil(error): No valid heightfield image has been set!
:grutil(error): No valid heightfield image has been set!

and no visible terrain (I suspect because the shader failed to load). I suspect part of the issue is my using panda 1.7.0 which does not have all the new shader param options.

As for the height map issue, I had to make a heightmaps folder. You should make the code create it (os.mkdir I think) of include it in the repo (you might need to put some dummy file in it).

Once I get the shader working (update panda), I’ll have some more feedback.

Edit:
I looked in terrain.py and say a loop. I changed it to this:

        ys=self.image.getYSize()-1
        gh=self.terrain.getHeight
        sg=self.image.setGray
        yo= self.yOffset
        for x in range(self.image.getXSize()):
            xo=x + self.xOffset
            for y in range(ys+1):
                sg(x, ys-y, gh(xo, y + yo))

which cut the runtime of that code to about 66%. nothing special just localizing and avoiding some extra calls. I don’t really get what that code does, but faster is better right?