本文整理汇总了C++中CModel::GetFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ CModel::GetFlags方法的具体用法?C++ CModel::GetFlags怎么用?C++ CModel::GetFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CModel
的用法示例。
在下文中一共展示了CModel::GetFlags方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Filter
void SortModelRenderer::Filter(CModelFilter& filter, int passed, int flags)
{
for (std::vector<SModel*>::iterator it = m->models.begin(); it != m->models.end(); ++it)
{
SModel* smdl = *it;
CModel* mdl = smdl->GetModel();
if (flags && !(mdl->GetFlags() & flags))
continue;
if (filter.Filter(mdl))
mdl->SetFlags(mdl->GetFlags() | passed);
else
mdl->SetFlags(mdl->GetFlags() & ~passed);
}
}
示例2: Render
// Render submitted models (filtered by flags) using the given modifier
void SortModelRenderer::Render(const RenderModifierPtr& modifier, int flags)
{
int pass = 0;
if (m->models.size() == 0)
return;
do
{
int streamflags = modifier->BeginPass(pass);
CModelDefPtr lastmdef;
CTexturePtr lasttex;
m->vertexRenderer->BeginPass(streamflags);
for(std::vector<SModel*>::iterator it = m->models.begin(); it != m->models.end(); ++it)
{
SModel* smdl = *it;
CModel* mdl = smdl->GetModel();
if (flags && !(mdl->GetFlags() & flags))
continue;
ENSURE(smdl->GetKey() == m);
CModelDefPtr mdef = mdl->GetModelDef();
CTexturePtr tex = mdl->GetTexture();
// Prepare per-CModelDef data if changed
if (mdef != lastmdef)
{
m->vertexRenderer->PrepareModelDef(streamflags, mdef);
lastmdef = mdef;
}
// Prepare necessary RenderModifier stuff
if (tex != lasttex)
{
modifier->PrepareTexture(pass, tex);
lasttex = tex;
}
modifier->PrepareModel(pass, mdl);
// Render the model
m->vertexRenderer->RenderModel(streamflags, mdl, smdl->m_Data);
}
m->vertexRenderer->EndPass(streamflags);
} while(!modifier->EndPass(pass++));
}
示例3: Render
//.........这里部分代码省略.........
break;
}
// For each of the technique's passes, render all the models in this run
for (int pass = 0; pass < currentTech->GetNumPasses(); ++pass)
{
currentTech->BeginPass(pass);
const CShaderProgramPtr& shader = currentTech->GetShader(pass);
int streamflags = shader->GetStreamFlags();
modifier->BeginPass(shader);
m->vertexRenderer->BeginPass(streamflags);
// When the shader technique changes, textures need to be
// rebound, so ensure there are no remnants from the last pass.
// (the vector size is set to 0, but memory is not freed)
currentTexs.clear();
texBindings.clear();
texBindingNames.clear();
CModelDef* currentModeldef = NULL;
CShaderUniforms currentStaticUniforms;
for (size_t idx = idxTechStart; idx < idxTechEnd; ++idx)
{
CModel** models = techBuckets[idx].models;
size_t numModels = techBuckets[idx].numModels;
for (size_t i = 0; i < numModels; ++i)
{
CModel* model = models[i];
if (flags && !(model->GetFlags() & flags))
continue;
const CMaterial::SamplersVector& samplers = model->GetMaterial().GetSamplers();
size_t samplersNum = samplers.size();
// make sure the vectors are the right virtual sizes, and also
// reallocate if there are more samplers than expected.
if (currentTexs.size() != samplersNum)
{
currentTexs.resize(samplersNum, NULL);
texBindings.resize(samplersNum, CShaderProgram::Binding());
texBindingNames.resize(samplersNum, CStrIntern());
// ensure they are definitely empty
std::fill(texBindings.begin(), texBindings.end(), CShaderProgram::Binding());
std::fill(currentTexs.begin(), currentTexs.end(), (CTexture*)NULL);
std::fill(texBindingNames.begin(), texBindingNames.end(), CStrIntern());
}
// bind the samplers to the shader
for (size_t s = 0; s < samplersNum; ++s)
{
const CMaterial::TextureSampler& samp = samplers[s];
CShaderProgram::Binding bind = texBindings[s];
// check that the handles are current
// and reevaluate them if necessary
if (texBindingNames[s] == samp.Name && bind.Active())
{
bind = texBindings[s];
}
else