53 manager_(manager), outer_radius_(outer_radius),
54 inner_radius_(inner_radius),
name_(name), polygon_type_(CIRCLE)
56 manual_ = manager->createManualObject();
85 Ogre::RenderOperation::OT_TRIANGLE_STRIP);
93 double next_theta = 2.0 * M_PI /
resolution * (i + 1);
99 (1.0 - radius_ratio * sin(
theta)) / 2.0);
105 (1.0 -sin(
theta)) / 2.0);
110 manual_->textureCoord((1 + radius_ratio * cos(next_theta)) / 2.0,
111 (1.0 - radius_ratio * sin(next_theta)) / 2.0);
116 manual_->textureCoord((1 + cos(next_theta)) / 2.0,
117 (1.0 -sin(next_theta)) / 2.0);
160 const std::string name):
163 texture_ = Ogre::TextureManager::getSingleton().createManual(
165 Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
172 material_ = Ogre::MaterialManager::getSingleton().create(
174 Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
176 material_->getTechnique(0)->getPass(0)->createTextureUnitState(
177 texture_->getName());
178 material_->setReceiveShadows(
false);
179 material_->getTechnique(0)->setLightingEnabled(
true);
180 material_->getTechnique(0)->getPass(0)->setCullingMode(Ogre::CULL_NONE);
181 material_->getTechnique(0)->getPass(0)->setLightingEnabled(
false);
182 material_->getTechnique(0)->getPass(0)->setDepthWriteEnabled(
false);
183 material_->getTechnique(0)->getPass(0)->setDepthCheckEnabled(
true);
185 material_->getTechnique(0)->getPass(0)->setVertexColourTracking(Ogre::TVC_DIFFUSE);
186 material_->getTechnique(0)->getPass(0)->createTextureUnitState(texture_->getName());
187 material_->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
189 material_->getTechnique(0)->getPass(0)
190 ->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
199 Ogre::MaterialManager::getSingleton().remove(
material_->getName());
204 return ScopedPixelBuffer(
texture_->getBuffer());
209 return name_ +
"Material";
213 Ogre::SceneNode* parent,
215 scene_manager_(manager), size_(
size), enable_(true), text_(
"")
217 node_ = parent->createChildSceneNode();
222 node_->detachAllObjects();
235 Ogre::Camera* camera = panel->
getCamera();
236 Ogre::Quaternion
q = camera->getDerivedOrientation();
271 color_.r = color.red() / 255.0;
273 color_.b = color.blue() / 255.0;
284 Ogre::SceneManager* manager,
285 Ogre::SceneNode* parent,
297 target_text_node_ =
node_->createChildSceneNode();
299 msg_->setVisible(
false);
302 target_text_node_->attachObject(msg_);
303 createArrows(context);
305 updateTextUnderLine();
323 Ogre::MaterialManager::getSingleton().remove(
upper_material_->getName());
324 Ogre::MaterialManager::getSingleton().remove(
lower_material_->getName());
325 Ogre::MaterialManager::getSingleton().remove(
left_material_->getName());
326 Ogre::MaterialManager::getSingleton().remove(
right_material_->getName());
344 msg_->setVisible(
false);
349 const double size_factor = 0.15;
354 Ogre::RenderOperation::OT_TRIANGLE_LIST);
360 size_ * size_factor * 2,
364 size_ * size_factor * 2,
372 Ogre::RenderOperation::OT_TRIANGLE_LIST);
376 -
size_ * size_factor,
380 -
size_ * size_factor * 2,
384 -
size_ * size_factor * 2,
391 Ogre::RenderOperation::OT_TRIANGLE_LIST);
403 -
size_ * size_factor,
411 Ogre::RenderOperation::OT_TRIANGLE_LIST);
423 -
size_ * size_factor,
429 upper_material_->getTechnique(0)->setSceneBlending( Ogre::SBT_TRANSPARENT_ALPHA );
432 lower_material_->getTechnique(0)->setSceneBlending( Ogre::SBT_TRANSPARENT_ALPHA );
435 left_material_->getTechnique(0)->setSceneBlending( Ogre::SBT_TRANSPARENT_ALPHA );
438 right_material_->getTechnique(0)->setSceneBlending( Ogre::SBT_TRANSPARENT_ALPHA );
446 static uint32_t
count = 0;
448 ss <<
"TargetVisualizerDisplayTriangle" <<
count++;
460 Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
463 Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
466 Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
469 Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
526 Ogre::Vector3 text_position(
size_ * cos(45.0 / 180.0 * M_PI)
528 size_ * sin(45.0 / 180.0 * M_PI)
532 Ogre::Vector3 msg_size =
msg_->
GetAABB().getSize();
539 Ogre::Vector3
A(
size_ * cos(45.0 / 180.0 * M_PI),
540 size_ * sin(45.0 / 180.0 * M_PI),
542 Ogre::Vector3 B(text_position + Ogre::Vector3(-
size_ / 4.0, 0, 0));
543 Ogre::Vector3 C(text_position + Ogre::Vector3(msg_size[0], 0, 0));
560 msg_->setVisible(enable);
587 Ogre::SceneNode* parent,
592 static int count = 0;
593 ss <<
"FacingVisualizer" <<
count++;
594 texture_object_.reset(
new TextureObject(128, 128, ss.str()));
596 texture_object_->getMaterialName()));
597 node_->attachObject(square_object_->getManualObject());
609 Ogre::SceneNode* parent,
623 QColor transparent(0, 0, 0, 0);
625 QColor white(255, 255, 255,
color_.a * 255);
626 QImage Hud = buffer.
getQImage(128, 128, transparent);
628 double inner_line_width = 10;
637 double mouse_cy_offset = 5;
639 QPainter painter( &Hud );
640 painter.setRenderHint(QPainter::Antialiasing,
true);
641 painter.setPen(QPen(foreground,
line_width, Qt::SolidLine));
642 painter.setBrush(white);
645 double offset_rate = fmod(
now.toSec(), 10) / 10.0;
646 double theta_offset = offset_rate * M_PI * 2.0;
647 for (
size_t ci = 0; ci <
text.length(); ci++) {
648 double theta = M_PI * 2.0 /
text.length() * ci + theta_offset;
650 QFont
font(
"DejaVu Sans Mono");
651 font.setPointSize(8);
653 painter.setFont(
font);
654 painter.translate(cx +
r * cos(
theta),
656 painter.rotate(
theta / M_PI * 180 + 90);
657 painter.drawText(0, 0,
text.substr(ci, 1).c_str());
660 painter.setPen(QPen(foreground, inner_line_width, Qt::SolidLine));
661 painter.setBrush(transparent);
662 painter.drawEllipse(cx - inner_r, cy - inner_r,
663 inner_r * 2, inner_r * 2);
664 double mouse_c_x = cx;
665 double mouse_c_y = cy - mouse_cy_offset;
666 double start_angle = -25 * M_PI / 180;
667 double end_angle = -125 * M_PI / 180;
668 painter.setPen(QPen(foreground,
line_width, Qt::SolidLine));
669 painter.drawChord(mouse_c_x - mouse_r, mouse_c_y - mouse_r,
670 2.0 * mouse_r, 2.0 * mouse_r,
671 start_angle * 180 / M_PI * 16,
672 end_angle * 180 / M_PI * 16);