本文整理汇总了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);
}
示例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);
}
示例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);
}