Difference between revisions of "How the camera works"
Rob Linden (talk | contribs) |
m |
||
(11 intermediate revisions by 8 users not shown) | |||
Line 1: | Line 1: | ||
{{ViewerArchNav}} | {{ViewerArchNav}} | ||
[[Category:Viewer Architecture]] | |||
The viewer is authoritative about camera position. The server uses the client's reported camera position to decide which objects to transmit to the client. | The viewer is authoritative about camera position. The server uses the client's reported camera position to decide which objects to transmit to the client. | ||
Second Life uses a different coordinate frame than OpenGL. Our frame is | Second Life uses a different coordinate frame than OpenGL. Our frame is X-at(forward), Y-left, Z-up. This is the infamous CFR (Cory's Favorite Reference) frame. See llviewercamera.h. | ||
The viewer camera is implemented in newview/llviewercamera.cpp based on llmath/llcamera.cpp. | The viewer camera is implemented in newview/llviewercamera.cpp based on llmath/llcamera.cpp. | ||
Line 9: | Line 10: | ||
The camera position and look-at vector is transmitted by send_agent_update() in llviewermessage.cpp. This function is called once per frame and can transmit packets up to 20 times per second. Note that it does not transmit unless the agent or camera position or rotation have changed. | The camera position and look-at vector is transmitted by send_agent_update() in llviewermessage.cpp. This function is called once per frame and can transmit packets up to 20 times per second. Note that it does not transmit unless the agent or camera position or rotation have changed. | ||
Camera movement can be accomplished with the keyboard ( | Camera movement can be accomplished with the keyboard (Ctrl-Alt-AWSD) or mouse (Alt-drag). Movement commands call into LLAgent::cameraOrbitAround() and similar functions. This accumulates motion and rotation through the frame. | ||
The camera has several "modes", including third person, first person ("mouselook"), appearance editing, etc. These are managed in LLAgent, not LLViewerCamera. | The camera has several "modes", including third person, first person ("mouselook"), appearance editing, etc. These are managed in LLAgent, not LLViewerCamera. | ||
LSL Interconnects with the client camera: [[:Category:LSL Camera]] | |||
There are also significant camera controls in: | |||
- llfollowcam : processing of movement by the LSL script function llSetCameraParams. But it is still llAgent which invokes code in llfollowcam. | |||
- lljoystickbutton : appears to receive flycam input | |||
- llviewerjoystick : appears to process flycam input. Makes specific mention of 3dnavigator. |
Latest revision as of 10:18, 18 November 2008
The viewer is authoritative about camera position. The server uses the client's reported camera position to decide which objects to transmit to the client.
Second Life uses a different coordinate frame than OpenGL. Our frame is X-at(forward), Y-left, Z-up. This is the infamous CFR (Cory's Favorite Reference) frame. See llviewercamera.h.
The viewer camera is implemented in newview/llviewercamera.cpp based on llmath/llcamera.cpp.
The camera position and look-at vector is transmitted by send_agent_update() in llviewermessage.cpp. This function is called once per frame and can transmit packets up to 20 times per second. Note that it does not transmit unless the agent or camera position or rotation have changed.
Camera movement can be accomplished with the keyboard (Ctrl-Alt-AWSD) or mouse (Alt-drag). Movement commands call into LLAgent::cameraOrbitAround() and similar functions. This accumulates motion and rotation through the frame.
The camera has several "modes", including third person, first person ("mouselook"), appearance editing, etc. These are managed in LLAgent, not LLViewerCamera.
LSL Interconnects with the client camera: Category:LSL Camera
There are also significant camera controls in:
- llfollowcam : processing of movement by the LSL script function llSetCameraParams. But it is still llAgent which invokes code in llfollowcam.
- lljoystickbutton : appears to receive flycam input
- llviewerjoystick : appears to process flycam input. Makes specific mention of 3dnavigator.