void Robot :: move(float v1, float v2, SPTR<Map> m) { SPTR<Posture> prev = _pos; _pos->move(v1, v2, _radius * 2); _update_bb(); // update bumpers & go back if there is a collision if(_check_collision(m)) { float theta = _pos->theta(); _pos = prev; _pos->set_theta(theta); _collision = true; } // update Lasers for (size_t i = 0; i < _Lasers.size(); ++i) _Lasers[i]->update(_pos, m); // update Radars for (size_t i = 0; i < _Radars.size(); ++i) _Radars[i].update(_pos, m); // update light sensors for (size_t i = 0; i < _LightSensors.size(); ++i) _LightSensors[i].update(_pos, m); // update camera if (_use_camera) _camera.update(_pos, m); }
/** * gst_gl_display_add_context: * @display: a #GstGLDisplay * @context: (transfer none): a #GstGLContext * * Returns: whether @context was successfully added. %FALSE may be returned * if there already exists another context for @context's active thread. * * Must be called with the object lock held. * * Since: 1.6 */ gboolean gst_gl_display_add_context (GstGLDisplay * display, GstGLContext * context) { GstGLContext *collision = NULL; GstGLDisplay *context_display; gboolean ret = TRUE; GThread *thread; GWeakRef *ref; g_return_val_if_fail (GST_IS_GL_DISPLAY (display), FALSE); g_return_val_if_fail (GST_IS_GL_CONTEXT (context), FALSE); context_display = gst_gl_context_get_display (context); g_assert (context_display == display); gst_object_unref (context_display); thread = gst_gl_context_get_thread (context); if (thread) { collision = _get_gl_context_for_thread_unlocked (display, thread); g_thread_unref (thread); /* adding the same context is a no-op */ if (context == collision) { ret = TRUE; goto out; } if (_check_collision (context, collision)) { ret = FALSE; goto out; } } ref = g_new0 (GWeakRef, 1); g_weak_ref_init (ref, context); display->priv->contexts = g_list_prepend (display->priv->contexts, ref); out: if (collision) gst_object_unref (collision); GST_DEBUG_OBJECT (display, "%ssuccessfully inserted context %" GST_PTR_FORMAT, ret ? "" : "un", context); return ret; }