void Augmentor::augment(ColorImage &frame, const Homography& H, bool lost) { if(!lost) { render_bounds(frame, H); render_title(frame); } else { std::string lost_msg = "LOST!"; cv::Size text_size = cv::getTextSize(lost_msg, font_face_, font_scale_, TEXT_OUTER_THICKNESS, nullptr); cv::Point text_origin = cv::Point((frame.cols - text_size.width)/2, (frame.rows - text_size.height)/2); render_text(frame, lost_msg, text_origin); } }
void CmpCharacterModelRender::render() const { ICmpOrientation_CPtr cmpOrientation = m_objectManager->get_component(m_objectID, cmpOrientation); ICmpPosition_CPtr cmpPosition = m_objectManager->get_component(m_objectID, cmpPosition); const Vector3d& p = cmpPosition->position(); const Vector3d& n = cmpOrientation->nuv_axes()->n(); const Vector3d& u = cmpOrientation->nuv_axes()->u(); const Vector3d& v = cmpOrientation->nuv_axes()->v(); if(m_modelPose != NULL) { RBTMatrix_CPtr mat = construct_model_matrix(p, n, u, v); glPushMatrix(); glMultMatrixd(&mat->rep()[0]); // Render the model. model()->render(m_modelPose); // Render the active item (if any). ICmpInventory_Ptr cmpInventory = m_objectManager->get_component(m_objectID, cmpInventory); assert(cmpInventory); ObjectID activeItem = cmpInventory->active_item(); if(activeItem.valid()) { ICmpBasicModelRender_Ptr cmpItemRender = m_objectManager->get_component(activeItem, cmpItemRender); if(cmpItemRender) { cmpItemRender->render_child(); } } glPopMatrix(); } if(m_highlights) { // If the object should be highlighted, render the object's bounds. render_bounds(p); } // Render the object's NUV axes. render_nuv_axes(p, n, u, v); }