本文整理汇总了C++中ShadeContext::DiffuseIllum方法的典型用法代码示例。如果您正苦于以下问题:C++ ShadeContext::DiffuseIllum方法的具体用法?C++ ShadeContext::DiffuseIllum怎么用?C++ ShadeContext::DiffuseIllum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShadeContext
的用法示例。
在下文中一共展示了ShadeContext::DiffuseIllum方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getGradientValue
// Calculates 0..1 value which is given to the gradient
float BerconGradient::getGradientValue(ShadeContext& sc) {
switch (p_type) {
case 0: { // UVW
break; // Handled in main evaluation
}
case 1: { // Normal
switch (p_normalFunction) {
case 0: { // Perpendicular / Parallel
return fabs(getGradientValueNormal(sc));
}
case 1: { // Towards / Away
return (getGradientValueNormal(sc) + 1.f) / 2.f;
}
case 2: { // Fresnel
// NOTE: Should this get IOR from sc.GetIOR()?
// I think not since its just a map, not material.
// You get more predictable behaviour with constant 1.f.
static float n1 = 1.0f;
float cti = fabs(getGradientValueNormal(sc));
float stt = (n1 / p_ior) * sqrt(1 - cti * cti);
float ctt = sqrt(1 - stt * stt);
float rs = (p_ior * ctt - n1 * cti ) / (p_ior * ctt + n1 * cti);
rs = rs * rs;
float rp = (n1 * ctt - p_ior * cti ) / (n1 * ctt + p_ior * cti);
rp = rp * rp;
return 1.f - 0.5f * (rs + rp);
}
}
}
case 2: { // Distance
return getGradientValueDist(sc);
}
case 3: { // Light
return Intens(sc.DiffuseIllum());
}
case 4: { // Map
return p_maptex?p_maptex->EvalMono(sc):0.f; // TODO: Evaluate submaps color, bump is tougher DELTA shift with BerconSC?
}
case 5: { // Random
seedRandomGen(sc);
return (float)sfrand();
break;
}
case 6: { // Particle age
Object *ob = sc.GetEvalObject();
if (ob && ob->IsParticleSystem()) {
ParticleObject *obj = (ParticleObject*)ob;
TimeValue t = sc.CurTime();
TimeValue age = obj->ParticleAge(t,sc.mtlNum);
TimeValue life = obj->ParticleLife(t,sc.mtlNum);
if (age>=0 && life>=0)
return float(age)/float(life);
}
break;
}
case 7: { // Particle speed
Object *ob = sc.GetEvalObject();
if (ob && ob->IsParticleSystem()) {
ParticleObject *obj = (ParticleObject*)ob;
/*IChkMtlAPI* chkMtlAPI = static_cast<IChkMtlAPI*>(obj->GetInterface(I_NEWMTLINTERFACE));
if ((chkMtlAPI&&chkMtlAPI->SupportsParticleIDbyFace()))
return (Length(obj->ParticleVelocity(sc.CurTime(),chkMtlAPI->GetParticleFromFace(sc.FaceNumber()))) - p_rangeMin) / (p_rangeMax - p_rangeMin);
else*/
return Length(obj->ParticleVelocity(sc.CurTime(),sc.mtlNum));
}
break;
}
case 8: { // Particle size
Object *ob = sc.GetEvalObject();
if (ob && ob->IsParticleSystem()) {
ParticleObject *obj = (ParticleObject*)ob;
return obj->ParticleSize(sc.CurTime(),sc.mtlNum);
}
break;
}
default:
break;
}
return 0.f;
}