Momentan arbeite ich an einem ADAS-Projekt zur Visualisierung von Straßenmodellen (Fahrbahnmitte, Fahrbahnbegrenzungen etc.) mit ROS und OGRE (Object-Oriented Graphics Rendering Engine). Eingaben sind Geometriepunkte (x, y, z).Texturkoordinaten in Ogre
Ich kann die Linien mit Ogre :: RenderOperation :: OT_TRIANGLE_STRIP zeichnen. Ich habe Materialien erstellt, um durchgezogene Linien, gepunktete Lügen, doppelte durchgezogene Linien usw. eindeutig zu visualisieren. Wie finde ich Texturkoordinaten für diese Geometriepunkte?
Aktuelle Code sieht wie folgt aus:
geometry_msgs::Point p0 = _msg.shape_points.front();
for(int i = 1; i < _msg.shape_points.size(); ++i)
{
const geometry_msgs::Point& p1(_msg.shape_points[i]);
const float dx = p1.x - p0.x;
const float dy = p1.y - p0.y;
const float phi = atan2(dy, dx);
const float wx = sin(phi) * lane_mark_width_;
const float wy = -cos(phi) * lane_mark_width_;
if (i == 1)
{
lane_boundary_->position(p0.x - wx, p0.y - wy, p0.z);
lane_boundary_->textureCoord(p0.x , p0.y);
lane_boundary_->position(p0.x + wx, p0.y + wy, p0.z);
lane_boundary_->textureCoord(p0.x, p0.y);
}
lane_boundary_->position(p1.x - wx, p1.y - wy, p1.z);
lane_boundary_->textureCoord(p1.x, p1.y);
lane_boundary_->position(p1.x + wx, p1.y + wy, p1.z);
lane_boundary_->textureCoord(p1.x, p1.y);
p0 = p1;
}
Danke
Was ist der Typ von 'lane_boundary_'? – pergy
Es ist ein manuelles Objekt: Ogre :: ManualObject * lane_boundary_ – StrongSoul
dann, ich weiß nicht, wie das funktionieren kann, weil Sie Ihre Zeichenaufrufe zwischen 'beginnen' und 'end' aufrufen müssen, wie in [Docs ] (http://www.ogre3d.org/docs/api/1.9/class_ogre_1_1_manual_object.html#details). Für die spätere Aktualisierung verwenden Sie 'beginUpdate'. – pergy