So, I've made some progress here but I'm still not done.
I figured out that I need three Vector3f variables:
Vector3f location = new Vector3f(0.0f, 0.0f, 0.0f);
Vector3f velocity = new Vector3f(0.0f, 0.0f, 0.0f);
Vector3f rotation = new Vector3f(0.0f, 0.0f, 0.0f);
During each game loop, I adjust my location based on my velocity:
location.x += velocity.x * speed * time_delta;
location.y += velocity.y * speed * time_delta;
location.z += velocity.z * speed * time_delta;
If the player is holding down the left mouse button, I adjust the rotation:
if (Mouse.isButtonDown(0)) {
rotation.x += ((float)Mouse.getDY() / 5.0f) % 360.0f;
rotation.y -= ((float)Mouse.getDX() / 5.0f) % 360.0f;
}
rotation.z += ((float)Mouse.getDWheel() / 10.0f) % 360.0f;
Then during the drawing portion of my game loop, I use the rotation variable to translate the display into the proper orientation and the location variable to translate into the proper location:
GL11.glRotatef(
rotation.x,
1.0f,
0.0f,
0.0f
);
GL11.glRotatef(
rotation.y,
0.0f,
1.0f,
0.0f
);
GL11.glRotatef(
rotation.z,
0.0f,
0.0f,
1.0f
);
GL11.glTranslatef(
location.x,
location.y,
location.z
);
All of this works absolutely beautifully.
But here's what I'm still confused about:
If the player is holding down the right mouse button, I want to accelerate the vehicle in the direction that the player is currently facing. How do I adjust the velocity variable based on the current rotation?