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


C++ ManualObject::setDebugDisplayEnabled方法代码示例

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


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

示例1: createTestMap

void createTestMap(SceneManager* mSceneMgr)
{
    std::vector<QGears::MapFileSerializer::SBlock> blocks;
    createReferenceFileInstance([&](Ogre::DataStreamPtr& stream, QGears::WorldMapFile& file)
    {
        QGears::MapFileSerializer s;
        s.importMapFile( stream, file );
        blocks = s.mBlocks;
    });

    if (blocks.empty())
    {
        // Load failed
        return;
    }
/*
    // TODO: Get PSX textures working
    QGears::TxzFileSerializer s;
    createReferenceTextureFileInstance(s);

    std::vector<std::vector<TxzFileSerializer::rgba>> data = s.GetWorldMapTexture(19);
    test(data);
*/

    LoadTextures();

    int c = 0;

    const auto kSpace = From16BitFixedPoint(8182);

    size_t numBlocks = blocks.size();

    int mapX = 0;
    int mapY = 0;



    for ( unsigned int k=0; k<numBlocks; k++ )
    {
        // 7x9 size
        QGears::MapFileSerializer::SBlock& block = blocks[k];

        int blockX = 0;
        int blockY = 0;

        for ( size_t i=0; i<block.mMeshes.size(); i++ )
        {
            QGears::MapFileSerializer::SBlockPart& part = block.mMeshes[i];

            for ( size_t j=0; j<part.mTris.size(); j++)
            {
                QGears::MapFileSerializer::BlockTriangle& tri = part.mTris.at(j);

                ManualObject* manual = nullptr;
                auto it = gObjToTextureId.find(tri.TextureInfo);
                if (it==gObjToTextureId.end())
                {
                    manual = mSceneMgr->createManualObject(("zzz_manual" + std::to_string(c++)).c_str());
                    manual->begin(gTextures[tri.TextureInfo].mName, RenderOperation::OT_TRIANGLE_LIST);
                    manual->setDebugDisplayEnabled(true);
                    manual->setDynamic(false);
                    gObjToTextureId[tri.TextureInfo] = manual;
                }
                else
                {
                    manual = it->second;
                }

                const float xPos = (blockX * kSpace) + (mapX * kSpace * 4);
                const float yPos = (blockY * kSpace) + (mapY * kSpace * 4);

                // v1
                QGears::MapFileSerializer::Vertex v1 = part.mVertices.at(tri.Vertex2Index);
                manual->position(From16BitFixedPoint(v1.X)+xPos, From16BitFixedPoint(v1.Y), From16BitFixedPoint(v1.Z)+yPos);
                manual->textureCoord(ToTextureCoordU(tri.uVertex2, tri.TextureInfo), ToTextureCoordV(tri.vVertex2, tri.TextureInfo));

                // v2
                v1 = part.mVertices.at(tri.Vertex1Index);
                manual->position(From16BitFixedPoint(v1.X)+xPos, From16BitFixedPoint(v1.Y), From16BitFixedPoint(v1.Z)+yPos);
                manual->textureCoord(ToTextureCoordU(tri.uVertex1, tri.TextureInfo), ToTextureCoordV(tri.vVertex1, tri.TextureInfo));

                // v3
                v1 = part.mVertices.at(tri.Vertex0Index);
                manual->position(From16BitFixedPoint(v1.X)+xPos, From16BitFixedPoint(v1.Y), From16BitFixedPoint(v1.Z)+yPos);
                manual->textureCoord(ToTextureCoordU(tri.uVertex0, tri.TextureInfo), ToTextureCoordV(tri.vVertex0, tri.TextureInfo));


            }

            blockX++;
            if (blockX >= 4 )
            {
                blockX = 0;
                blockY++;
            }
        }
        mapX++;
        if (mapX >= 9 )
        {
            mapX = 0;
//.........这里部分代码省略.........
开发者ID:adrielvel,项目名称:q-gears,代码行数:101,代码来源:WorldMapModule.cpp


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