Library globals

Namespace globals . view

View source

view.nas

Nasal code for implementing view-specific functionality.

Classes

ViewAxis

Manages one translation/rotation axis. (For simplicity reasons the field-of-view parameter is also managed by this class.)

default_handler

Default view handler used by view.manager.

fly_by_view_handler

indices

manager

View manager. Administrates optional Nasal view handlers. Usage: view.manager.register(<view-id>, <view-handler>); view-id: the view's name (e.g. "Chase View") or index number view-handler: a hash with any combination of the functions listed in the following example, or none at all. Only define the interface functions that you really need! The hash may contain local variables and other, non-interface functions. Example: var some_view_handler = { init : func {}, # called only once at startup start : func {}, # called when view is switched to our view stop : func {}, # called when view is switched away from our view reset : func {}, # called with view.resetView() update : func { 0 }, # called iteratively if defined. Must return }; # interval in seconds until next invocation # Don't define it if you don't need it! view.manager.register("Some View", some_view_handler);

model_view_handler_class

Helper for views that can show multiplayer aircaft as well as the user's aircraft. Used by <manager> above.

pilot_view_limiter

point

view.point: handles smooth view movements

screenWidthCompens

Functions

calcMul

decrease

Handler. Decrease FOV by one step

hasmember

increase

Handler. Increase FOV by one step

indexof

Get view index by name.

normdeg

Normalize angle to -180 <= angle < 180

panViewDir

Pans the view horizontally. The argument specifies a relative rate (or number of "steps" -- same thing) to the standard rate.

panViewDir

panViewPitch

Pans the view vertically. The argument specifies a relative rate (or number of "steps" -- same thing) to the standard rate.

resetFOV

Handler. Reset FOV to default.

resetView

Reset view to default using current view manager (see default_handler).

resetViewDir

resetViewPos

setView

setViewByIndex

activate view by index number used in XML definition (e.g. >100)

set_default

If <from>/<path> exists and <to>/<path> doesn't, copy the former to the latter.

stepView

Handler. Step to the next (force=1) or next enabled view.

str

For debugging. Returns string containing description of <x>.

Variables

ACUITY

STEPS

Dynamically calculate limits so that it takes STEPS iterations to traverse the whole range, the maximum FOV is fixed at 120 degrees, and the minimum corresponds to normal maximum human visual acuity (~1 arc minute of resolution, although apparently people vary widely in this ability). Quick derivation of the math: mul^steps = max/min steps * ln(mul) = ln(max/min) mul = exp(ln(max/min) / steps)

VIEW_PAN_RATE

Standard view "slew" rate, in degrees/sec.

current

fdm_init_listener

fovProp

fovProp

index

max

model_view_handler

views

views