本文整理汇总了C++中Args::appendToPreamble方法的典型用法代码示例。如果您正苦于以下问题:C++ Args::appendToPreamble方法的具体用法?C++ Args::appendToPreamble怎么用?C++ Args::appendToPreamble使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Args
的用法示例。
在下文中一共展示了Args::appendToPreamble方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setShaderArgs
void UniversalMaterial::setShaderArgs(Args& args) const {
args.appendToPreamble(m_macros);
static const bool OPTIONAL = true;
if (m_bsdf->lambertian().notBlack() || m_bsdf->lambertian().nonUnitAlpha()) {
if (m_bsdf->lambertian().texture()) {
args.setUniform(SYMBOL_lambertianMap, m_bsdf->lambertian().texture(), OPTIONAL);
if (m_bsdf->lambertian().constant() != Color4::one()) {
args.setUniform(SYMBOL_lambertianConstant, m_bsdf->lambertian().constant(), OPTIONAL);
}
} else {
args.setUniform(SYMBOL_lambertianConstant, m_bsdf->lambertian().constant(), OPTIONAL);
}
}
if (m_bsdf->glossy().notBlack()) {
if (m_bsdf->glossy().texture()) {
args.setUniform(SYMBOL_glossyMap, m_bsdf->glossy().texture(), OPTIONAL);
if (m_bsdf->glossy().constant() != Color4::one()) {
args.setUniform(SYMBOL_glossyConstant, m_bsdf->glossy().constant(), OPTIONAL);
}
} else {
args.setUniform(SYMBOL_glossyConstant, m_bsdf->glossy().constant(), OPTIONAL);
}
}
if (m_customConstant.isFinite()) {
args.setUniform(SYMBOL_customConstant, m_customConstant, OPTIONAL);
}
if (m_customMap) {
args.setUniform(SYMBOL_customMap, m_customMap->texture(), OPTIONAL);
}
if (m_emissive.notBlack()) {
args.setUniform(SYMBOL_emissiveConstant, m_emissive.constant(), OPTIONAL);
if (m_emissive.texture()) {
args.setUniform(SYMBOL_emissiveMap, m_emissive.texture(), OPTIONAL);
}
}
if (m_bump && (m_bump->settings().scale != 0)) {
args.setUniform(SYMBOL_normalBumpMap, m_bump->normalBumpMap()->texture(), OPTIONAL);
if (m_bump->settings().iterations > 0) {
args.setUniform(SYMBOL_bumpMapScale, m_bump->settings().scale, OPTIONAL);
args.setUniform(SYMBOL_bumpMapBias, m_bump->settings().bias, OPTIONAL);
}
}
if (m_numLightMapDirections > 0) {
// LightMap or first RNM
args.setUniform(SYMBOL_lightMapConstant, m_lightMap[0].constant().average());
args.setUniform(SYMBOL_lightMap0, m_lightMap[0].texture(), OPTIONAL);
if (m_numLightMapDirections == 3) {
alwaysAssertM
((m_lightMap[1].constant() == m_lightMap[0].constant()) &&
(m_lightMap[2].constant() == m_lightMap[0].constant()),
"All light maps must use the same constant");
// Radiosity Normal Map
args.setUniform(SYMBOL_lightMap1, m_lightMap[1].texture(), OPTIONAL);
args.setUniform(SYMBOL_lightMap2, m_lightMap[2].texture(), OPTIONAL);
}
}
debugAssert(isNull(m_bump) || m_bump->settings().iterations >= 0);
}