Skip to content

Instantly share code, notes, and snippets.

@pixelnerve
pixelnerve / gist:6000287
Last active December 19, 2015 18:38
User input for camera control with a Byte
enum CamMoveStates
{
CamMoveNone = 0
, CamMoveForward = (1<<0)
, CamMoveBackwards = (1<<1)
, CamMoveLeft = (1<<2)
, CamMoveRight = (1<<3)
, CamMoveUp = (1<<4)
, CamMoveDown = (1<<5)
};
@pixelnerve
pixelnerve / gist:5995780
Last active December 19, 2015 17:59
Simple Quaternion Camera
void ViewFromPositionAndOrientation( Vec3& p, Quat& q, Mat4* dst )
{
Vec3 negP = q.toMatrix44() * -p;
*dst = Mat4::createTranslation( negP ) * q.toMatrix44();
}
---- Update Method