static void touch_timer_fire(unsigned long data) { unsigned long data0; unsigned long data1; bool down; data0 = readl(ts.io + S3C2410_ADCDAT0); data1 = readl(ts.io + S3C2410_ADCDAT1); down = get_down(data0, data1); if (down) { if (ts.count == (1 << ts.shift)) { ts.xp >>= ts.shift; ts.yp >>= ts.shift; dev_dbg(ts.dev, "%s: X=%lu, Y=%lu, count=%d\n", __func__, ts.xp, ts.yp, ts.count); input_report_abs(ts.input, ABS_X, ts.xp); input_report_abs(ts.input, ABS_Y, ts.yp); input_report_key(ts.input, BTN_TOUCH, 1); input_sync(ts.input); ts.xp = 0; ts.yp = 0; ts.count = 0; } s3c_adc_start(ts.client, 0, 1 << ts.shift); } else {
void bc_perspective_camera::get_extend_points(extend& p_points) const { auto l_fov_tan = 2 * std::tanf(m_field_of_view / 2); auto l_near_clip_height = l_fov_tan * get_near_clip(); auto l_near_clip_width = l_near_clip_height * m_aspect_ratio; auto l_far_clip_height = l_fov_tan * get_far_clip(); auto l_far_clip_width = l_far_clip_height * m_aspect_ratio; auto l_near_clip_center = get_position() + get_forward() * get_near_clip(); auto l_far_clip_center = get_position() + get_forward() * get_far_clip(); p_points[0] = l_near_clip_center + get_left() * (l_near_clip_width / 2) + get_down() * (l_near_clip_height / 2); p_points[1] = l_near_clip_center + get_left() * (l_near_clip_width / 2) + get_up() * (l_near_clip_height / 2); p_points[2] = l_near_clip_center + get_right() * (l_near_clip_width / 2) + get_up() * (l_near_clip_height / 2); p_points[3] = l_near_clip_center + get_right() * (l_near_clip_width / 2) + get_down() * (l_near_clip_height / 2); p_points[4] = l_far_clip_center + get_left() * (l_far_clip_width / 2) + get_down() * (l_far_clip_height / 2); p_points[5] = l_far_clip_center + get_left() * (l_far_clip_width / 2) + get_up() * (l_far_clip_height / 2); p_points[6] = l_far_clip_center + get_right() * (l_far_clip_width / 2) + get_up() * (l_far_clip_height / 2); p_points[7] = l_far_clip_center + get_right() * (l_far_clip_width / 2) + get_down() * (l_far_clip_height / 2); }
struct gmi_set* gmi_base_adjacent(struct gmi_model* m, struct gmi_ent* e, int dim) { int from_dim; struct agm_ent a; a = agm_from_gmi(e); from_dim = agm_dim_from_type(a.type); if (dim == from_dim - 1) return get_down(to_base(m)->topo, a); else if (dim == from_dim + 1) return get_up(to_base(m)->topo, a); gmi_fail("only one-level adjacencies supported"); return 0; }
void bc_free_camera::update(core_platform::bc_clock::update_param p_clock_update_param, const platform::bc_pointing_device& p_pointing_device, const platform::bc_key_device& p_key_device) { core::bc_vector3f l_position = get_position(); bcFLOAT l_move_speed = m_shift_pressed ? m_move_speed * 6 : m_ctrl_pressed ? m_move_speed * 0.25 : m_move_speed; bcFLOAT l_rotate_speed = m_rotate_speed; l_move_speed *= p_clock_update_param.m_elapsed_second; l_rotate_speed *= p_clock_update_param.m_elapsed_second; if (m_w_pressed) { l_position += get_forward() * l_move_speed; } if (m_s_pressed) { l_position += get_back() * l_move_speed; } if (m_a_pressed) { l_position += get_left() * l_move_speed; } if (m_d_pressed) { l_position += get_right() * l_move_speed; } if (m_e_pressed) { l_position += get_down() * l_move_speed; } if (m_q_pressed) { l_position += get_up() * l_move_speed; } core::bc_vector3f l_direction = get_direction(); if (m_rmb_pressed) { bcFLOAT l_pi = 3.14159265358979323846 / 2; auto l_dx = -m_dx * l_rotate_speed; auto l_dy = m_dy * l_rotate_speed; if (m_dy > l_pi) { m_dy = l_pi; } if (m_dy < -l_pi) { m_dy = -l_pi; } core::bc_matrix3f l_rotation_y; core::bc_matrix3f l_rotation_x; core::bc_matrix3f l_rotation; core::bc_vector3f l_right = get_right(); core::bc_vector3f l_up = get_up(); if(graphic::bc_render_api_info::is_left_handed()) { l_rotation_y.rotation_euler_lh(l_up, -l_dx); l_rotation_x.rotation_euler_lh(l_right, l_dy); } else { l_rotation_y.rotation_euler_rh(l_up, -l_dx); l_rotation_x.rotation_euler_rh(l_right, l_dy); } l_rotation = l_rotation_y * l_rotation_x; l_direction = l_rotation * l_direction; l_direction.normalize(); } auto l_lookat = l_position + l_direction; set_look_at(l_position, l_lookat, core::bc_vector3f(0, 1, 0)); m_dx = 0; m_dy = 0; }