Before getting carried away with the platformer rambling, again, here’s something about PolyAnim. Yesterday I added automatic polygon triangulation for concave polygons into PolyAnims LWJGL-renderer. This is mainly for convenience, since the triangulation is quite expensive – it remains to be seen if this is fast enough for more general use. At least with simpler scenes it might work alright. Convex polygons should still be preferred for speed reasons, but I admit it: they’re major pain in the ass when animating. It’s cumbersome to build and animate non-convex shapes from several convex pieces.. Hopefully somebody will contribute faster triangulation code at some point!
What else.. I’ve been working a lot on the platformer engine. JBox2D got an update, so I ditched the old polygonal approach (which had a lot of problems, as Box2D is very picky about the shape of the collision polygons) and implemented the collision geometry using the new feature: edge chains. They work nicely and are just perfect for this kind of usage. I use triangulation with convex decomposition now only for the renderer, which luckily doesn’t mind very thin triangles. I’ve added more eye candy as well, generation of level outlines and support for background/foreground polygons (which are not collidable, of course). I still need to implement other decoration elements, such as a stripe of grass blades running along top edge of things, for example. Parallax scrolling is something I want to have in too, I mean, if you’re making a side scroller, why shouldn’t there be parallax scrolling!?
And finally I did bite the bullet and implemented those damn PBuffers (enjoy the picture there, that’s them buffers giving me hard time!). They work okay when FBO is not available, but they’re yucky to code. Luckily LWJGL makes it a bit less painful than it truly is. Looking back, in Funguloids things were almost too easy, as I had Ogre at my disposal! Along with PBuffers the thing now supports plain old frame buffer copying as well, though I couldn’t be bothered to make bloom work with it (lighting does, though, which is more important anyway).
While fighting with PBuffers, I noticed I could make the bloom much faster and more importantly allow for more shader effects if I used RTT (render-to-texture) same size as the screen dimensions. I could then render the scene only once to the RTT (currently I have to render twice!), have bloom shaders use that and actually do the final additive composition in the fragment shader too. Having a screen sized RTT would allow some neat shader effects like screen distortions and shock waves. There’s one problem, many cards don’t support rectangular (non power-of-two) RTTs.. The solution: separate rendering paths. I would implement several render paths with varying amount of shader and RTT usage, then determine what the host system supports and have things running nice and solid. Sounds like bit of work to me, but I guess the end results would be worth the trouble. We shall see.
Oh, and I’ve finished my bachelor’s thesis, like a month ago. Forgot to mention that earlier. Now I’d need to decide if I continue to write master’s thesis on the same subject, or choose something completely different. If only I could think of a subject having to do with game programming, that would certainly help with the motivation..