FPSCamera::FPSCamera(CollisionWorld* world) { Aspect = 4.0f / 3.0f; Fov = GLDegreesToRadians(80); Near = 0.1f; Far = 50.0f; state = 0; body = 0; collworld = world; isonground = false; array_state_set(anglecurve, 0, 0, 0); GLVec3Set(position, 0, 1.8f, 0); GLVec3Set(targetangles, 0, 0, 0); GLVec3Set(smoothedangles, 0, 0, 0); GLMatrixIdentity(view); if( world ) { body = world->AddDynamicSphere(CAMERA_RADIUS, 80); body->SetPosition(0, 0.1f, 0); } }
void FPSCamera::SetOrientation(float yaw, float pitch, float roll) { GLVec3Set(targetangles, yaw, pitch, roll); GLVec3Set(smoothedangles, yaw, pitch, roll); array_state_set(anglecurve, yaw, pitch, roll); }
void BasicCamera::SetPosition(float x, float y, float z) { FUNC_PROTO(Vec3Set)(targetpan, x, y, z); FUNC_PROTO(Vec3Set)(position, x, y, z); array_state_set(pancurve, x, y, z); finished = true; }
void BasicCamera::SetOrientation(float yaw, float pitch, float roll) { FUNC_PROTO(Vec3Set)(targetangles, yaw, pitch, roll); FUNC_PROTO(Vec3Set)(smoothedangles, yaw, pitch, roll); array_state_set(anglecurve, yaw, pitch, roll); finished = true; }
BasicCamera::BasicCamera() { distance = 1.0f; nearplane = 0.1f; farplane = 50.0f; fov = FUNC_PROTO(_PI) / 3; aspect = 4.0f / 3.0f; finished = true; array_state_set(anglecurve, 0, 0, 0); array_state_set(pancurve, 0, 0, 0); FUNC_PROTO(Vec3Set)(position, 0, 0, 0); FUNC_PROTO(Vec3Set)(targetangles, 0, 0, 0); FUNC_PROTO(Vec3Set)(smoothedangles, 0, 0, 0); FUNC_PROTO(Vec3Set)(targetpan, 0, 0, 0); FUNC_PROTO(Vec3Set)(position, 0, 0, 0); }
SpectatorCamera::SpectatorCamera() { Aspect = 4.0f / 3.0f; Fov = FUNC_PROTO(DegreesToRadians)(80); Near = 0.1f; Far = 50.0f; Speed = MOVEMENT_SPEED; state = 0; finished = true; array_state_set(anglecurve, 0, 0, 0); array_state_set(positioncurve, 0, 1.8f, 0); FUNC_PROTO(Vec3Set)(targetangles, 0, 0, 0); FUNC_PROTO(Vec3Set)(smoothedangles, 0, 0, 0); FUNC_PROTO(Vec3Assign)(smoothedposition, positioncurve.curr); FUNC_PROTO(MatrixIdentity)(view); }