Пример #1
0
void Scene::onPolyhedronChanged()
{
    // Update Polyhedron
    auto symbol = "#" + wild::conversion_cast<std::string>(wild::mod(_index, 80) + 1);

    _pgeometry->setSymbol(symbol);
    _pgeometry->setFaceMask(static_cast<osgKaleido::PolyhedronGeometry::FaceMask>(_faces));

    auto polyhedron = _pgeometry->getOrCreatePolyhedron();

    OSG_INFO << polyhedron->getName() << " (" << polyhedron->getDualName() << "*)" << std::endl;
    OSG_INFO << polyhedron->getWythoffSymbol() << std::endl;
    OSG_INFO << polyhedron->getVertexConfiguration() << std::endl;
    OSG_INFO << polyhedron->getVertexCount() << std::endl;
    OSG_INFO << polyhedron->getFaceCount() << std::endl;

    // Update Vertices
    osg::ref_ptr<osg::Vec3Array> vertices = osgKaleido::createVertexArray(*polyhedron);

    auto stateSet = _vgeode->getOrCreateStateSet();
    auto offsets = stateSet->getUniform("offsets");

    copy(offsets, vertices, osg::Vec3());

    // Update Text
    _text->setText(polyhedron->getName() + "\n" + polyhedron->getWythoffSymbol());
}