Commit bb577d56 authored by Lubosz Sarnecki's avatar Lubosz Sarnecki

controller: Rename PushPullScaleLock to XrdTransformLock.

Document XrdTransformLock.
parent 278cba2e
......@@ -340,7 +340,7 @@ xrd_controller_set_pointer
xrd_controller_set_pointer_tip
xrd_controller_update_pose_hand_grip
XRD_TYPE_CONTROLLER
PushPullScaleLock
XrdTransformLock
</SECTION>
<SECTION>
......
......@@ -796,29 +796,29 @@ _action_push_pull_scale_cb (OpenVRAction *action,
if (fabs (x_state) < priv->analog_threshold &&
fabs (y_state) < priv->analog_threshold)
{
grab_state->push_pull_scale_lock = LOCKED_NONE;
grab_state->transform_lock = XRD_TRANSFORM_LOCK_NONE;
g_free (event);
return;
}
if (grab_state->push_pull_scale_lock == LOCKED_NONE)
if (grab_state->transform_lock == XRD_TRANSFORM_LOCK_NONE)
{
if (fabs (x_state) > fabs (y_state) &&
fabs (x_state) > priv->analog_threshold)
grab_state->push_pull_scale_lock = LOCKED_SCALE;
grab_state->transform_lock = XRD_TRANSFORM_LOCK_SCALE;
else if (fabs (y_state) > fabs (x_state) &&
fabs (y_state) > priv->analog_threshold)
grab_state->push_pull_scale_lock = LOCKED_PUSHPULL;
grab_state->transform_lock = XRD_TRANSFORM_LOCK_PUSH_PULL;
}
if (grab_state->push_pull_scale_lock == LOCKED_SCALE)
if (grab_state->transform_lock == XRD_TRANSFORM_LOCK_SCALE)
{
double factor = x_state * priv->scroll_to_scale_ratio;
xrd_window_manager_scale (priv->manager, grab_state, (float) factor,
ms_since_last_poll);
}
else if (grab_state->push_pull_scale_lock == LOCKED_PUSHPULL)
else if (grab_state->transform_lock == XRD_TRANSFORM_LOCK_PUSH_PULL)
_perform_push_pull (self, controller, graphene_vec3_get_y (&event->state),
ms_since_last_poll);
......
......@@ -39,7 +39,7 @@ xrd_controller_init (XrdController *self)
self->hover_state.distance = 1.0f;
self->hover_state.window = NULL;
self->grab_state.window = NULL;
self->grab_state.push_pull_scale_lock = LOCKED_NONE;
self->grab_state.transform_lock = XRD_TRANSFORM_LOCK_NONE;
}
XrdController *
......@@ -110,7 +110,7 @@ xrd_controller_reset_grab_state (XrdController *self)
graphene_quaternion_init_identity (
&self->grab_state.inverse_controller_rotation);
graphene_quaternion_init_identity (&self->grab_state.window_rotation);
self->grab_state.push_pull_scale_lock = LOCKED_NONE;
self->grab_state.transform_lock = XRD_TRANSFORM_LOCK_NONE;
}
void
......
......@@ -19,15 +19,26 @@ G_BEGIN_DECLS
#define XRD_TYPE_CONTROLLER xrd_controller_get_type()
G_DECLARE_FINAL_TYPE (XrdController, xrd_controller, XRD, CONTROLLER, GObject)
/**
* XrdTransformLock:
* @XRD_TRANSFORM_LOCK_NONE: The grab action does not currently have a transformation it is locked to.
* @XRD_TRANSFORM_LOCK_PUSH_PULL: Only push pull transformation can be performed.
* @XRD_TRANSFORM_LOCK_SCALE: Only a scale transformation can be performed.
*
* The type of transformation the grab action is currently locked to.
* This will be detected at the begginging of a grab transformation
* and reset after the transformation is done.
*
**/
typedef enum {
LOCKED_NONE,
LOCKED_PUSHPULL,
LOCKED_SCALE
} PushPullScaleLock;
XRD_TRANSFORM_LOCK_NONE,
XRD_TRANSFORM_LOCK_PUSH_PULL,
XRD_TRANSFORM_LOCK_SCALE
} XrdTransformLock;
typedef struct HoverState
{
XrdWindow *window;
XrdWindow *window;
graphene_matrix_t pose;
float distance;
graphene_point_t intersection_2d;
......@@ -43,7 +54,7 @@ typedef struct GrabState
graphene_quaternion_t inverse_controller_rotation;
graphene_point3d_t grab_offset;
PushPullScaleLock push_pull_scale_lock;
XrdTransformLock transform_lock;
} GrabState;
XrdController *xrd_controller_new (guint64 controller_handle);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment