本文整理汇总了C++中Model::GetType方法的典型用法代码示例。如果您正苦于以下问题:C++ Model::GetType方法的具体用法?C++ Model::GetType怎么用?C++ Model::GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model
的用法示例。
在下文中一共展示了Model::GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Push
void RenderSector::Push(const Model &model, const glm::vec3 &pos)
{
// Если сектор надо перестроить и модель статическая - перестраиваем сектор.
if (mIsNeedBuild && model.GetType() == Model::Static)
{
auto &dst = mModel.GetMesh();
const auto &src = model.GetMesh();
if (dst->Empty())
{
mModel.SetTexture(model.GetTexture());
}
if (mModel.GetTexture() == model.GetTexture())
{
size_t size = dst->SizeVertex();
dst->Push(*src);
for (size_t i = size; i < dst->SizeVertex(); ++i)
{
dst->Vertex(i).vertex += pos;
}
}
else
{
LOG(warning) << "Батчинг меша в секторе пропущен. Текстуры не совпадают.";
}
}
}
示例2: GetShaderProgramWithType
void Graphic::Renderer::ActivateAppropriteToModelSubroutines(const Model& model) const
{
constexpr unsigned numOfUsedSubroutines = 4;
GLuint subroutinesArray[numOfUsedSubroutines];
const ShaderProgram* const shaderProg = GetShaderProgramWithType(ShaderProgram::Type::Main);
assert(shaderProg);
const GLint shadeSubUniformLoc = glGetSubroutineUniformLocation(shaderProg->id, GL_FRAGMENT_SHADER, "shadeModel");
const GLint toObjectLocalCoordSubUniformLoc = glGetSubroutineUniformLocation(shaderProg->id, GL_FRAGMENT_SHADER, "toObjectLocalCoord");
const GLint getNormalVecSubUniformLoc = glGetSubroutineUniformLocation(shaderProg->id, GL_FRAGMENT_SHADER, "getNormalVec");
const GLint drawObjectSubUniformLoc = glGetSubroutineUniformLocation(shaderProg->id, GL_VERTEX_SHADER, "drawObject");
assert(shadeSubUniformLoc < numOfUsedSubroutines
&& toObjectLocalCoordSubUniformLoc < numOfUsedSubroutines
&& getNormalVecSubUniformLoc < numOfUsedSubroutines);
#ifdef _DEBUG
if ( -1 == shadeSubUniformLoc
|| -1 == toObjectLocalCoordSubUniformLoc
|| -1 == getNormalVecSubUniformLoc
|| -1 == drawObjectSubUniformLoc)
{
std::cout << "Failed to get subroutines uniform location. \n";
return;
}
#endif // _DEBUG
if (model.material.HasTextureWithType(Texture::Type::Cube))
subroutinesArray[drawObjectSubUniformLoc] = drawObjectSubroutines[1];
else
subroutinesArray[drawObjectSubUniformLoc] = drawObjectSubroutines[0];
switch (model.GetType())
{
case Model::Type::commonModel:
subroutinesArray[shadeSubUniformLoc] = shadeModelSubroutine[0];
//subroutinesArray[shadeSubUniformLoc] = modelSubroutine;
break;
case Model::Type::lightModel:
subroutinesArray[shadeSubUniformLoc] = shadeModelSubroutine[0];
break;
case Model::Type::skyBoxModel:
//subroutinesArray[shadeSubUniformLoc] = shadeModelSubroutine[2];
break;
default:
break;
}
if (model.material.HasTextureWithType(Texture::Type::Normal))
{
subroutinesArray[toObjectLocalCoordSubUniformLoc] = normalTextureSubroutines[0];
subroutinesArray[getNormalVecSubUniformLoc] = normalTextureSubroutines[1];
}
else
{
subroutinesArray[toObjectLocalCoordSubUniformLoc] = noNormalTextureSubroutines[0];
subroutinesArray[getNormalVecSubUniformLoc] = noNormalTextureSubroutines[1];
}
glUniformSubroutinesuiv(GL_FRAGMENT_SHADER, 4, subroutinesArray);
}