Skip to content
LuoLei Zhao edited this page Apr 29, 2017 · 1 revision

Overview and Function

This file centralizes all functions related to the camera and model orientation and position. It controls everything related to the camera movement, as well as the pivot point around which the model rotates. The model position remains stationary, with the camera moving.

Functions Initialized

focus: Forces the camera to orient itself so it directly faces whatever the current pivot point is set to.

onEvent: A general update function that calls when the user performs some action in the UI. It detects the type of action (mouse click, button press), and orients the camera appropriately in response to the action specified.

onUpdate(int frame, float, time, float dt): A general update function that updates the camera position with th ecurrent panVector that is set in the onEvent function when the user attempts to move the camera through the UI.

enablePivotSelectorMode(bool enabled): Called when the user presses the control key. Enables a special mode that allows users to set the pivot point around which the model can rotate. Temporarily sets the colormap to a special prog_df shader while this mode is on. The shader sets the current active layer of the pivot point to yellow, and all other layers to a dark red. This is intended to help the user easily determine which layer the pivot point is set to.

resetPivot: Sets the pivot point back to the origin point of the model.

setCamPos(float x, float y, float z): immediately sets the camera at a certain point in space and calls an update.

setCamPos(float w, float ix, float iy, float iz): immediately sets the camera at a certain orientation. The input is accepted as a 4 dimensional quaternion. It then calls an update so the changes are immediately visible.

setCamNearFar(float nearPlane, float farPlane: Sets the maximum bounds for which items are drawn. Items too close to the camera or too far away will not be drawn. Setting the planes too far apart from each other will reduce precision when drawing the depth of a particle.

setPivotPoint(float x, float y, float z): immediately sets the pivot point around which the model rotates.

requestUpdatePos(): Updates the javascript User interface with the current locations of the camera and the pivot point.

Global Variables

Globals set

Globals used

Clone this wiki locally