Cleaning up a bit

Published May 13, 2010
Advertisement
Last week I did a lot of ad-hoc coding, just to get features in. This week I started to do some cleanup of that code, moving code into more generalized APIs.

I added a uniform interface for the shaders, and did the same thing with textures. When I add a texture to a node now, I also have to tell which uniform this texture should link to. The rest is handled automatically.

I will do the same thing with post-processing, but I haven't come to that just yet.

I've also worked a bit more on random object placement based on the attribute map for the terrain. Guybrush has made 6 pine meshes + 3 stone meshes for me. I added those into the mix + added random scale and random rotation. Trees only rotate around the y axis, while stones can randomly rotate around all three axis. I had to perform the rotation on the model matrix after I scale, which took a bit of thinking and testing to figure out :P

I have to go back to the shadow casting code a bit and figure out a couple of things... first off I really need to change to a directional light caster. Right now I use a point light, which doesn't work well (obviously). I need also to look into how to generate texture coordinates on the meshes for the shadow map that is generated. It doesn't work to just place the shadow map onto the tex-coord for the UVW map and get the correct shadowing. Not sure how to solve that problem. It's important to get the right look in the scene though, because it looks a bit strange when trees doesn't cast shadows on each others, and stones doesn't receive any shadows either.

0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement