Sleep is lovely

So the last week hasn't been particularly productive. I've managed to get my GPU splatter almost completely working minus one little thing that will be annoying to handle. I think I'm going to put it off to the side and get to work on calibrating the camera array we have in the lab. Camera calibration is not particularly fun, but oh well, it must be done.

I've been refactoring my game engine code lately to abstract the physics-related code so that I avoid having to deal with Bullet directly. I've also started working towards my first game. I'm currently happy with the codebase I have, so diving into a game will really show me whether or not my design decisions were good or bad. If the latter, then I get a chance to refactor and learn from my mistakes.

Another thing I've decided is that the "experimental" C++0x stuff in GCC is awesome, and I've been modifying my code to use some of the useful stuff it offers. Initializer lists really made certain parts of my code look much nicer because I get to avoid dealing with boost::array and/or std::vector when dealing with static data. Whenever appropriate, I plan on taking advantage of the new auto keyword to make code shorter and more concise; No longer will I have to write things like std::vector<sometype>::const_iterator (or even have to typedef them!). There's a bunch of other small things that are cool too, like "raw" strings, smart pointers, variadic templates, rvalue references + move semantics, a null pointer constant, fixes for the "double bracket" issue with templated types, a foreach loop, and so on!

Perhaps one of the things I'm super excited for, though, are the lambda functions. Alas, I have to wait for GCC 4.5 to enter the world of stable releases before I can use them. Nevertheless, I installed the prerelease to play around with them some. I think a lot of these C++0x features are really going to make C++ code far more concise, almost like [some things] in Python. Here's my attempt at writing a simple "list comprehension" that writes the squares of the numbers from 1 to 10:

#include <iostream>
#include <algorithm>
#include <iterator>

int main(int argc, char *argv[]) {
  int i = 1;
  int data[10] = {};

  std::generate(
    data, data + 10,
    [&i]() -> int { return (i * i++);  });
 
  std::copy(
    data, data + 10,
    std::ostream_iterator<int>(std::cout, " "));
  
  std::cout << std::endl;

 return 0;
}

I don't know about any of you, but I think that's about as concise as one is going to get in a language like C++. I'm looking forward to playing around with these lambdas for my simple event processing functions that are registered with my engine's windowing system. All I ask is that the C++0x standard doesn't change dramatically between now and its official "release".

Anyways, I actually pulled an all-nighter last night (no reason in particular), hence the title of this post. Off I go to enjoy some amazing sleep.

FIZZICKS!!!!

I haven't done a whole lot with my game engine stuff over the past week (been focusing on implementing GPU splatting for my research), but I decided to capture a video today. It's a little low quality, but it shows off the basics. For the most part, there's enough functionality in there to start working on a game, but I want to make the code simpler and easier to work with. Anyways, here's the video:



Currently I'm using Bullet for Physics, CEGUI for the in-game GUI, DevIL for loading images, OpenGL for rendering and a whole lot of boost to make my life easier. The windowing (Cocoa, Carbon, X11 or Win32) is my own. Eventually I might do the same for the image loading and in-game GUI so that there are less dependencies, but for now I don't really care too much about that. I'm planning out a simple game to make eventually, so look forward to that in the future. Perhaps not the very near future, but quite possibly by the end of the year.

Modeling 101

Okay, this is far from me giving you a 101 class on modeling, because when it comes to drawing/modeling/things of that nature I suck pretty bad. Nevertheless, I amazed myself at how quickly I could whip up a "stick man" model with a basic skeleton using Blender.



He's in a sitting pose, waving I think. Yeah, I have skills *cough*. Anyways, other than a crash here and there, Blender is a pretty decent piece of software. Some of the keyboard shortcuts are non-intuitive but once you get them down you'll be unstoppable.

That screenshots also shows off my integration of CEGUI into my WIP. I struggled with two issues that I'll share with people. The first issue was that you need to have the OpenGL viewport set up correctly when initializing CEGUI. Unfortunately my initialization was occurring before I called glViewport, but that was easily resolved. The second thing was that having any VBOs/VAOs bound messes up CEGUI (for now). Be sure to release any bound buffers/arrays before rendering things.

CEGUI is a pretty hefty library, but it looks to be incredibly robust and still actively developed. I loved how I could manually inject input events into the CEGUI system, which meant easy integration into my own windowing system. I noticed that some other systems used existing input libraries or hooked into something like GLUT or SDL. I also love the ability to use describe things in XML. I think CEGUI and I will get along quite fine until I decide to write my own UI system.

There was a bit of messing around getting things to link properly, but I managed to get everything working in the end. I'll finish off by pointing out qmake. I use it for my Makefile generation and I absolutely love it, mainly because it's incredibly simple. CMake is another option if you happen to be looking for one.