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


C++ Director::getRenderer方法代码示例

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


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

示例1: end

void BillboardParticleSystem::end()
{
    _endCommand.init(_globalZOrder);
    _endCommand.func = CC_CALLBACK_0(BillboardParticleSystem::onEnd, this);

    Director* director = Director::getInstance();
    CCASSERT(nullptr != director, "Director is null when seting matrix stack");
    Renderer *renderer = director->getRenderer();
    renderer->addCommand(&_endCommand);

}
开发者ID:tieunun,项目名称:FantasyWarrior3D,代码行数:11,代码来源:BillboardParticleSystem.cpp

示例2: end

void RenderTexture::end()
{
    _endCommand.init(_globalZOrder);
    _endCommand.func = CC_CALLBACK_0(RenderTexture::onEnd, this);

    Director* director = Director::getInstance();
    CCASSERT(nullptr != director, "Director is null when seting matrix stack");
    
    Renderer *renderer = director->getRenderer();
    renderer->addCommand(&_endCommand);
    renderer->popGroup();
    
    director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
    director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);

}
开发者ID:2276225819,项目名称:Game,代码行数:16,代码来源:CCRenderTexture.cpp

示例3: clear

void TextureManager::clear() {
    Director *director = Director::getInstance();
    auto glView = director->getOpenGLView();
    auto renderer = director->getRenderer();

    long long start = currentTimeMillis();
    CCLOG("texMgr clear texModuleCount=%d", texModuleMap.size());
    renderer->render();
    CCLOG("render before success");

    int textureCosts[TEXTURE_COUNT] = {0};

    int curLoopCounter = Director::loopCounter;

    for(auto& entry : texModuleMap) {
        auto tm = entry.second;

        for(int i = 0; i < TEXTURE_COUNT; ++i) {
            if(textures[i] == tm->tex) {
                textureCosts[i] += (tm->lastCallCounter - curLoopCounter) * tm->width * tm->height;
                break;
            }
        }
    }

    int min = INT_MAX;
    int index = -1;

    for(int i = 0; i < TEXTURE_COUNT; ++i) {
        CCLOG("textureCosts[%d]=%d", i, textureCosts[i]);

        if(min > textureCosts[i]) {
            min = textureCosts[i];
            index = i;
        }
    }

    int length = TEXTURE_SIZE * TEXTURE_SIZE << 2;
    byte *data = new byte[length];
    memset(data, 0, length);
    textures[index]->initWithData(data, length, Texture2D::PixelFormat::RGBA8888, TEXTURE_SIZE, TEXTURE_SIZE, Size(TEXTURE_SIZE, TEXTURE_SIZE));
    textureBins[index]->init(TEXTURE_SIZE, TEXTURE_SIZE);

    std::vector<int> toDeletes;

    for(auto& entry : texModuleMap) {
        auto tm = entry.second;

        if(tm->tex == textures[index]) {
            CC_SAFE_DELETE(tm);
            toDeletes.push_back(entry.first);
        }
    }

    for(auto id : toDeletes) {
        texModuleMap.erase(id);
    }

	toDeletes.clear();

	for (auto& entry : texCoordCalculatedMap) {
		auto tex = entry.second;
		if (tex == textures[index]) {
			toDeletes.push_back(entry.first);
		}
	}

	for (auto id : toDeletes) {
		texCoordCalculatedMap.erase(id);
	}

    CC_SAFE_DELETE_ARRAY(data);
    CCLOG("after texMgr clear texModuleCount=%d, clearTexId=%d, recalculate count %d, cost Time=%lld", texModuleMap.size(), index, toDeletes.size(), currentTimeMillis() - start);
}
开发者ID:289,项目名称:DouPo,代码行数:74,代码来源:TextureManager.cpp


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