void Shape::update() { // Get the total number of points of the shape std::size_t count = getPointCount(); if (count < 3) { m_vertices.resize(0); m_outlineVertices.resize(0); return; } m_vertices.resize(count + 2); // + 2 for center and repeated first point // Position for (std::size_t i = 0; i < count; ++i) m_vertices[i + 1].position = getPoint(i); m_vertices[count + 1].position = m_vertices[1].position; // Update the bounding rectangle m_vertices[0] = m_vertices[1]; // so that the result of getBounds() is correct m_insideBounds = m_vertices.getBounds(); // Compute the center and make it the first vertex m_vertices[0].position.x = m_insideBounds.left + m_insideBounds.width / 2; m_vertices[0].position.y = m_insideBounds.top + m_insideBounds.height / 2; // Color updateFillColors(); // Texture coordinates updateTexCoords(); // Outline updateOutline(); }
void ISimpleNode::updateGeometry() { updateGeometrySimpleNode(); // Color updateFillColors(); // Texture coordinates updateTexCoords(); }
void Shape::setFillColor(const Color& color) { m_fillColor = color; updateFillColors(); }