8:30 – 4:30 FP
- Reflection cube maps today
- And they are working! The trick to handling rotating reflections is the following (note that the camera matrix is determined before the model roation, and the surface normal is calculated after the rotation.):
M3DMatrix44f mCameraRotOnly;
M3DMatrix44f mInverseCamera;
M3DMatrix33f mNormalMat;
const M3DMatrix44f &mCamera = modelViewStack.GetMatrix();
modelViewStack.PushMatrix();
modelViewStack.Rotate(angle, 0.0f, 1.0f, 0.0f);
orient44fromMat44(mCameraRotOnly, mCamera);
orient33fromMat44(mNormalMat, modelViewStack.GetMatrix());
m3dInvertMatrix44(mInverseCamera, mCameraRotOnly);
projectionStack.PushMatrix();
projectionStack.MultMatrix(modelViewStack.GetMatrix());
glUseProgram(reflectionShader);
glUniformMatrix4fv(locMVPReflect, 1, GL_FALSE, projectionStack.GetMatrix());
glUniformMatrix4fv(locMVReflect, 1, GL_FALSE, modelViewStack.GetMatrix());
glUniformMatrix3fv(locNormalReflect, 1, GL_FALSE, mNormalMat);
glUniformMatrix4fv(locInvertedCamera, 1, GL_FALSE, mInverseCamera);
triangleBatch.Draw();
glUseProgram(NULL);
projectionStack.PopMatrix();
modelViewStack.PopMatrix();

- It seems to be a nice day for pretty pictures. Here’s an example of multitexturing:

- And now that our connection is better, maybe I’ll install R on fgmdev
You must be logged in to post a comment.