本文整理汇总了C++中shader::IProgramObject::SetFlag方法的典型用法代码示例。如果您正苦于以下问题:C++ IProgramObject::SetFlag方法的具体用法?C++ IProgramObject::SetFlag怎么用?C++ IProgramObject::SetFlag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类shader::IProgramObject
的用法示例。
在下文中一共展示了IProgramObject::SetFlag方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Enable
void SMFRenderStateGLSL::Enable(const CSMFGroundDrawer* smfGroundDrawer, const DrawPass::e& drawPass) {
if (useLuaShaders) {
// use raw, GLSLProgramObject::Enable also calls RecompileIfNeeded
glUseProgram(glslShaders[GLSL_SHADER_CURRENT]->GetObjID());
// diffuse textures are always bound (SMFGroundDrawer::SetupBigSquare)
glActiveTexture(GL_TEXTURE0);
return;
}
Shader::IProgramObject* shader = glslShaders[GLSL_SHADER_CURRENT];
const CSMFReadMap* smfMap = smfGroundDrawer->GetReadMap();
const GL::LightHandler* cLightHandler = smfGroundDrawer->GetLightHandler();
GL::LightHandler* mLightHandler = const_cast<GL::LightHandler*>(cLightHandler); // XXX
const float3 cameraPos = camera->GetPos();
const float3 fogParams = {sky->fogStart, sky->fogEnd, globalRendering->viewRange};
const float2 mapParams = {readMap->GetCurrMinHeight(), readMap->GetCurrMaxHeight()};
shader->SetFlag("HAVE_SHADOWS", shadowHandler->ShadowsLoaded());
shader->SetFlag("HAVE_INFOTEX", infoTextureHandler->IsEnabled());
shader->Enable();
shader->SetUniform2v<const char*, float>("mapHeights", &mapParams.x);
shader->SetUniform3v<const char*, float>("cameraPos", &cameraPos.x);
shader->SetUniformMatrix4x4<const char*, float>("viewMat", false, camera->GetViewMatrix());
shader->SetUniformMatrix4x4<const char*, float>("viewMatInv", false, camera->GetViewMatrixInverse());
shader->SetUniformMatrix4x4<const char*, float>("viewProjMat", false, camera->GetViewProjectionMatrix());
shader->SetUniformMatrix4x4<const char*, float>("shadowMat", false, shadowHandler->GetShadowViewMatrix());
shader->SetUniform4v<const char*, float>("shadowParams", shadowHandler->GetShadowParams());
shader->SetUniform3v<const char*, float>("fogParams", &fogParams.x);
shader->SetUniform<const char*, float>("infoTexIntensityMul", float(infoTextureHandler->InMetalMode()) + 1.0f);
if (cLightHandler->NumConfigLights() > 0) {
mLightHandler->Update();
shader->SetUniform4v<const char*, float>("fwdDynLights", cLightHandler->NumUniformVecs(), cLightHandler->GetRawLightDataPtr());
}
switch (drawPass) {
case DrawPass::WaterReflection: { shader->SetUniform4v<const char*, float>("clipPlane", IWater::MapReflClipPlane()); } break;
case DrawPass::WaterRefraction: { shader->SetUniform4v<const char*, float>("clipPlane", IWater::MapRefrClipPlane()); } break;
default: {} break;
}
if (shadowHandler->ShadowsLoaded())
shadowHandler->SetupShadowTexSampler(GL_TEXTURE4);
glActiveTexture(GL_TEXTURE2); glBindTexture(GL_TEXTURE_2D, smfMap->GetDetailTexture());
glActiveTexture(GL_TEXTURE5); glBindTexture(GL_TEXTURE_2D, smfMap->GetNormalsTexture());
glActiveTexture(GL_TEXTURE6); glBindTexture(GL_TEXTURE_2D, smfMap->GetSpecularTexture());
glActiveTexture(GL_TEXTURE7); glBindTexture(GL_TEXTURE_2D, smfMap->GetSplatDetailTexture());
glActiveTexture(GL_TEXTURE8); glBindTexture(GL_TEXTURE_2D, smfMap->GetSplatDistrTexture());
glActiveTexture(GL_TEXTURE9); glBindTexture(GL_TEXTURE_CUBE_MAP, cubeMapHandler->GetSkyReflectionTextureID());
glActiveTexture(GL_TEXTURE10); glBindTexture(GL_TEXTURE_2D, smfMap->GetSkyReflectModTexture());
glActiveTexture(GL_TEXTURE11); glBindTexture(GL_TEXTURE_2D, smfMap->GetBlendNormalsTexture());
glActiveTexture(GL_TEXTURE12); glBindTexture(GL_TEXTURE_2D, smfMap->GetLightEmissionTexture());
glActiveTexture(GL_TEXTURE13); glBindTexture(GL_TEXTURE_2D, smfMap->GetParallaxHeightTexture());
glActiveTexture(GL_TEXTURE14); glBindTexture(GL_TEXTURE_2D, infoTextureHandler->GetCurrentInfoTexture());
for (int i = 0; i < CSMFReadMap::NUM_SPLAT_DETAIL_NORMALS; i++) {
if (smfMap->GetSplatNormalTexture(i) != 0) {
glActiveTexture(GL_TEXTURE15 + i); glBindTexture(GL_TEXTURE_2D, smfMap->GetSplatNormalTexture(i));
}
}
glActiveTexture(GL_TEXTURE0);
}