16#include "background.h"
26#define CAMERA_DIR ( M_PI / 2. )
38static double camera_VX = 0.;
39static double camera_VY = 0.;
234 NTracingZone( _ctx, 1 );
274 if ( ( p == NULL ) || !SOUND_PILOT_RELATIVE ) {
280 p->solid.vel.x, p->solid.vel.y );
288 if ( dt > DOUBLE_TOL ) {
293 NTracingZoneEnd( _ctx );
301 double k, dx, dy, max;
308 double a = atan2( dy, dx );
319 (
pow2( x ) +
pow2( y ) ) ) < 100 * 100 ) {
333 double x, y, dx, dy, mx, my, targ_x, targ_y, bias_x, bias_y, vx, vy;
336 if ( !pilot_isFlag( follow, PILOT_HYPERSPACE ) &&
346 const double diag2 = 100 * 100;
365 if ( target != NULL ) {
373 dir = angle_diff( atan2( vy, vx ), follow->
solid.
dir );
374 dir = ( M_PI -
FABS( dir ) ) / M_PI;
381 if (
pow2( bias_x ) +
pow2( bias_y ) > diag2 / 2. ) {
382 double a = atan2( bias_y, bias_x );
383 double r = sqrt( diag2 ) / 2.;
384 bias_x = r * cos( a );
385 bias_y = r * sin( a );
430 double d, x, y, z, tz, dx, dy;
449 d = sqrt( SCREEN_W * SCREEN_H );
450 znear =
MIN( conf.zoom_near, 1. / ( 0.8 + VMOD( follow->
solid.
vel ) /
d ) );
454 c =
MIN( SCREEN_W, SCREEN_H ) / 2;
457 zfar = conf.zoom_far;
458 znear =
MAX( znear, zfar );
464 if ( pilot_isFlag( follow, PILOT_STEALTH ) ) {
467 if ( target != NULL ) {
474 dx = ( SCREEN_W / 2. ) / (
FABS( x ) + 2. * target->
ship->
size );
475 dy = ( SCREEN_H / 2. ) / (
FABS( y ) + 2. * target->
ship->
size );
484 d =
CLAMP( -conf.zoom_speed, conf.zoom_speed, tz - z );
void background_moveDust(double x, double y)
Displaces the dust, useful with camera.
void cam_getDPos(double *dx, double *dy)
Gets the camera position differential (change in last frame).
void cam_setZoom(double zoom)
Sets the camera zoom.
void cam_zoomOverride(int enable)
Overrides the zoom system.
void cam_setTargetPilot(unsigned int follow, int soft_over)
Sets the target to follow.
void cam_getVel(double *vx, double *vy)
Gets the camera velocity.
void cam_setTargetPos(double x, double y, int soft_over)
Sets the camera target to a position.
static void cam_updatePilot(Pilot *follow, double dt)
Updates a camera following a pilot.
void cam_getPos(double *x, double *y)
Gets the camera position.
double cam_getZoomTarget(void)
Gets the camera zoom.
double cam_getZoom(void)
Gets the camera zoom.
static double camera_flyspeed
static unsigned int camera_followpilot
static void cam_updateFly(double x, double y, double dt)
Updates the camera flying to a position.
void cam_setZoomTarget(double zoom, double speed)
Sets the camera zoom target.
static double camera_zoomspeed
void cam_vel(double vx, double vy)
Sets the camera velocity.
void cam_update(double dt)
Updates the camera.
static void cam_updatePilotZoom(const Pilot *follow, const Pilot *target, double dt)
Updates the camera zoom.
int cam_getTarget(void)
Returns the camera's current target.
static void cam_updateManualZoom(double dt)
Updates the manual zoom target.
void gui_getOffset(double *x, double *y)
Gets the GUI offset.
Header file with generic functions and naev-specifics.
double nebu_getSightRadius(void)
Gets the nebula view radius.
Pilot * pilot_getTarget(Pilot *p)
Gets the target of a pilot using a fancy caching system.
Pilot * pilot_get(unsigned int id)
Pulls a pilot out of the pilot_stack based on ID.
int sound_updateListener(double dir, double px, double py, double vx, double vy)
Updates the sound listener.
The representation of an in-game pilot.