本文整理汇总了C++中mhwrender::MDrawContext::getLightingMode方法的典型用法代码示例。如果您正苦于以下问题:C++ MDrawContext::getLightingMode方法的具体用法?C++ MDrawContext::getLightingMode怎么用?C++ MDrawContext::getLightingMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mhwrender::MDrawContext
的用法示例。
在下文中一共展示了MDrawContext::getLightingMode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execute
/*
From the draw context, get the list of lights and queue the ones we are interested in
into the "desired list"
*/
MStatus shadowPrepass::execute( const MHWRender::MDrawContext & context )
{
MHWRender::MRenderer* theRenderer = MHWRender::MRenderer::theRenderer();
if (!theRenderer)
return MStatus::kSuccess;
// Skip lighting modes where there are no lights which can
// cast shadows
MHWRender::MDrawContext::LightingMode lightingMode = context.getLightingMode();
if (lightingMode != MHWRender::MDrawContext::kSelectedLights &&
lightingMode != MHWRender::MDrawContext::kSceneLights)
{
return MStatus::kSuccess;
}
MHWRender::MDrawContext::LightFilter lightFilter =
MHWRender::MDrawContext::kFilteredIgnoreLightLimit;
unsigned int nbSceneLights = context.numberOfActiveLights(lightFilter);
for (unsigned int i=0; i<nbSceneLights; i++)
{
MHWRender::MLightParameterInformation* lightInfo =
context.getLightParameterInformation( i, lightFilter );
if (!lightInfo)
continue;
// Get the actually Maya light node
MStatus status = MStatus::kFailure;
MDagPath lightPath = lightInfo->lightPath(&status);
if (status != MStatus::kSuccess || !lightPath.isValid())
continue;
// Would be good to have an API method here to indicate if it
// casts shadows
MIntArray intVals;
// Check if light is enabled, and emits any lighting
MHWRender::MLightParameterInformation::StockParameterSemantic semantic =
MHWRender::MLightParameterInformation::kLightEnabled;
if (MStatus::kSuccess == lightInfo->getParameter( semantic, intVals ))
{
if (intVals.length())
{
if (intVals[0] == 0)
continue;
}
}
semantic = MHWRender::MLightParameterInformation::kEmitsDiffuse;
if (MStatus::kSuccess == lightInfo->getParameter( semantic, intVals ))
{
if (intVals.length())
{
if (intVals[0] == 0)
continue;
}
}
semantic = MHWRender::MLightParameterInformation::kEmitsSpecular;
if (MStatus::kSuccess == lightInfo->getParameter( semantic, intVals ))
{
if (intVals.length())
{
if (intVals[0] == 0)
continue;
}
}
// Check if local shadows are enabled.
semantic = MHWRender::MLightParameterInformation::kShadowOn;
if (MStatus::kSuccess == lightInfo->getParameter( semantic, intVals ))
{
if (intVals.length())
{
if (intVals[0] == 0)
continue;
}
}
// Check if the shadow is "dirty"
bool shadowIsDirty = false;
semantic = MHWRender::MLightParameterInformation::kShadowDirty;
if (MStatus::kSuccess == lightInfo->getParameter( semantic, intVals ))
{
if (intVals.length())
{
if (intVals[0] == 0)
// continue;
shadowIsDirty = intVals[0] != 0 ? true : false ;
}
}
// Check the light list to prune, if not already pruned
bool prune = false;
if (lightingMode != MHWRender::MDrawContext::kSelectedLights)
//.........这里部分代码省略.........