static bool CompareSpectra(const Spectrum& s0, const Spectrum& s1) { TEST_PROPERTY(s0.red(), s1.red()); TEST_PROPERTY(s0.green(), s1.green()); TEST_PROPERTY(s0.blue(), s1.blue()); return false; }
void VectorMapLayer::renderTile(RenderContext& rc, const WorldGeometry* /* world */, const QuadtreeTile* tile) const { #ifndef VESTA_OGLES2 rc.setVertexInfo(VertexSpec::PositionColor); Material simpleMaterial; simpleMaterial.setDiffuse(Spectrum(1.0f, 1.0f, 1.0f)); simpleMaterial.setOpacity(1.0f); rc.bindMaterial(&simpleMaterial); float tileArc = float(PI) * tile->extent(); Vector2f southwest = tile->southwest(); SpherePatch box; box.west = float(PI) * southwest.x(); box.east = box.west + tileArc; box.south = float(PI) * southwest.y(); box.north = box.south + tileArc; AlignedBox<float, 2> bounds(Vector2f(box.west, box.south), Vector2f(box.east, box.north)); for (vector<counted_ptr<MapElement> >::const_iterator iter = m_elements.begin(); iter != m_elements.end(); ++iter) { const MapElement* element = iter->ptr(); bool tileContainsElement = false; if (element) { AlignedBox<float, 2> elementBox = element->bounds(); if (!elementBox.isNull()) { if (elementBox.min().x() < bounds.max().x() && elementBox.max().x() > bounds.min().x() && elementBox.min().y() < bounds.max().y() && elementBox.max().y() > bounds.min().y()) { tileContainsElement = true; } } } if (tileContainsElement) { Spectrum color = element->color(); glColor4f(color.red(), color.green(), color.blue(), element->opacity()); if (element->opacity() < 1.0f) { glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } else { glDisable(GL_BLEND); } element->render(box.west, box.south, box.east, box.north); } } glDisable(GL_BLEND); #endif }