Simple coding tips 01 – Naming functions

Simple tip: Naming functions


Note how each function name begins with a verb and usually, each function ends with a noun. Naming your functions this way helps you think more clearly about what you’re doing and helps other people understand your code more thoroughly.

Tsunami texture mapping at long last

I added texture mapping and blend mapping to Tsunami. The textures aren’t mine, they’re from a book and it’s associated tutorial. It looks much better now than the bland triangles from before. There isn’t a whole lot else to say about this except that I still need to add in the material system, which is next on the list.

I was able to add in a blend mapping. It just takes 3 different textures and blends them together based on what is defined in the blend map. These textures were also taken from a book’s tutorials because I don’t really care to make the textures or the blend map for that matter.

Two dropbox instances for one Win7 user

I’m always afraid of websites randomly disappearing, especially when they have useful information on them. I happened to stumble across a website that explains how to set up multiple dropbox instances on a windows 7 or vista machine. I’m going to briefly just copy that info here for my own reference ( and yours 🙂 )

  1. Setup dropbox like normal with an account.
  2. Create a second user on your windows machine with a password.
  3. Login as that second user.
  4. Install dropbox again for that user and set it to synchronize a folder that both windows accounts can access.
  5. Log back into the original windows account.
  6. Find the dropbox.exe in the other user’s folder that you just created: c:\users\<username>appdata\roaming\dropbox\bin\dropbox.exe
  7. Make a shortcut to that .exe file somewhere.
  8. In the shortcut’s properties, change the “Target” field to something like this: runas /user:<username> /savecred C:\Users\<username>\AppData\Roaming\D ropbox\bin\Dropbox.exe
  9. Double click the shortcut, type in the password, and it should be working.

Lighting for Tsunami

I managed to get some lighting into Tsunami in the form of point lights, spot lights, and directional lights. Currently it only supports one light, but that will change. The next step I need to do is create a material system because, as of right now, there isn’t one and it’s a serious pain to pass stuff into the shaders manually.

The lighting in this image is vertex shaded lighting with ambient, diffuse, and specularity. The image is just a single spot light emanating from the camera in the direction of the camera, so it acts like a flash light. Wherever I point the camera, the light shines in that direction.

I’m not really sure if this is considered phong lighting/shading. I don’t really care that much since I’ll probably implement it later, but it seems that when people refer to phong lighting, they mean it’s per pixel, and the normals are interpolated and then renormalized on a per-pixel basis. These normals aren’t renormalized, but they are interpolated, since it’s a vertex shader that’s doing the work, but that’s about all. I’ve mentioned before that I planned on implementing a bunch of different lighting algorithms in the vertex shader and then doing the same for pixel shaders and then place them side by side to compare them, so eventually I’ll implement phong.

The next step on this ridiculous quest is to add texture mapping and the material system. For texture mapping, I’m just talking about basic diffuse texture mapping to at least make the ground plane look decent. I want crates too.