当前位置: 首页>>代码示例>>C++>>正文


C++ CurvePtr::getArea1方法代码示例

本文整理汇总了C++中CurvePtr::getArea1方法的典型用法代码示例。如果您正苦于以下问题:C++ CurvePtr::getArea1方法的具体用法?C++ CurvePtr::getArea1怎么用?C++ CurvePtr::getArea1使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CurvePtr的用法示例。


在下文中一共展示了CurvePtr::getArea1方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: doCreateTile

bool WaterElevationLayer::doCreateTile(int level, int tx, int ty, TileStorage::Slot *data)
{
    if (Logger::DEBUG_LOGGER != NULL) {
        ostringstream oss;
        oss << "ElevationRoad tile " << getProducerId() << " " << level << " " << tx << " " << ty;
        Logger::DEBUG_LOGGER->log("DEM", oss.str());
    }
    if (level >= displayLevel) {
        TileCache::Tile *t = graphProducer->findTile(level, tx, ty);
        assert(t != NULL);

        ObjectTileStorage::ObjectSlot *graphData = dynamic_cast<ObjectTileStorage::ObjectSlot*>(t->getData());
        GraphPtr g = graphData->data.cast<Graph>();

        if (g->getCurveCount() == 0) {
            return false;
        }

        ptr<FrameBuffer> fb = SceneManager::getCurrentFrameBuffer();

        vec3d q = getTileCoords(level, tx, ty);
        vec2d nx, ny, lx, ly;
        getDeformParameters(q, nx, ny, lx, ly);

        float scale = 2.0f * (getTileSize() - 1.0f - (2.0f * getTileBorder())) / q.z;

        vec3d tileOffset = vec3d(q.x + q.z / 2.0f, q.y + q.z / 2.0f, scale / getTileSize());
        //tileOffsetU->set(vec3f(q.x + q.z / 2.0f, q.y + q.z / 2.0f, scale / getTileSize()));
        tileOffsetU->set(vec3f(0.0, 0.0, 1.0));

        fb->clear(false, false, true);

        if (g->getAreaCount() > 0) {
            //fillOffsetU->set(vec3f(q.x + q.z / 2.0f, q.y + q.z / 2.0f, scale / getTileSize()));
            fillOffsetU->set(vec3f(0.0, 0.0, 1.0));
            depthU->set(0.02f);
            colorU->set(vec4f(0.0f, 0.0f, 0.0f, 0.0f));

            fb->setDepthTest(true, ALWAYS);
            fb->setColorMask(false, false, false, true);
            fb->setDepthMask(true);

            mesh->setMode(TRIANGLES);
            mesh->clear();
            tess->beginPolygon(mesh);
            ptr<Graph::AreaIterator> ai = g->getAreas();
            while (ai->hasNext()) {
                AreaPtr a = ai->next();
                GraphLayer::drawArea(tileOffset, a, *tess);
            }
            tess->endPolygon();
            fb->draw(fillProg, *mesh);

            riverU->set(1);

            ai = g->getAreas();
            while (ai->hasNext()) {
                AreaPtr a = ai->next();
                bool island = true;
                for (int j = 0; j < a->getCurveCount(); ++j) {
                    int o;
                    island &= (a->getCurve(j, o)->getType() == WaterElevationCurveData::ISLAND);
                    if (!island) {
                        break;
                    }
                }
                for (int j = 0; j < a->getCurveCount(); ++j) {
                    int orientation;
                    CurvePtr p = a->getCurve(j, orientation);
                    if (island) {
                        orientation = 1 - orientation;
                    } else {
                        if (p->getType() == WaterElevationCurveData::ISLAND) {
                            continue;
                        }
                    }
                    if (orientation != 0) {
                        GraphLayer::drawCurve(tileOffset, p, vec4f(0, 12, 1, 2), fb, layerProgram, *(meshuv), &nx, &ny, &lx, &ly);
                    } else {
                        GraphLayer::drawCurve(tileOffset, p, vec4f(0, -12, 1, 2), fb, layerProgram, *(meshuv), &nx, &ny, &lx, &ly);
                    }
                }
            }

            fb->setDepthTest(true, NOTEQUAL);
            fb->setColorMask(false, false, true, false);
            fb->setDepthMask(false);

            riverU->set(2);

            ptr<Graph::CurveIterator> ci = g->getCurves();
            while (ci->hasNext()) {
                CurvePtr c = ci->next();
                float w = c->getWidth();
                float tw = w;
                if (w * scale <= 1 || (c->getParent() == NULL && level != 0) || c->getType() == WaterElevationCurveData::LAKE || c->getType() == WaterElevationCurveData::RIVER || c->getArea1() != NULL) {//== WaterElevationCurveData::RIVER) {
                    continue;
                }
                ElevationCurveData *cData = dynamic_cast<ElevationCurveData*>(findCurveData(c));
                ElevationGraphLayer::drawCurveAltitude(tileOffset, c, cData, tw, tw / w, max(1.0f, 1.0f / scale), false, fb, layerProgram, *meshuv, &nx, &ny, &lx, &ly);
//.........这里部分代码省略.........
开发者ID:AzeronX,项目名称:proland-4.0,代码行数:101,代码来源:WaterElevationLayer.cpp


注:本文中的CurvePtr::getArea1方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。