本文整理汇总了C++中Objects::getNormalDirection方法的典型用法代码示例。如果您正苦于以下问题:C++ Objects::getNormalDirection方法的具体用法?C++ Objects::getNormalDirection怎么用?C++ Objects::getNormalDirection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Objects
的用法示例。
在下文中一共展示了Objects::getNormalDirection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EstimateDirectIllumination
// only light sampling..
// left only for reference
inline void EstimateDirectIllumination (
const Scene * thisScene,
const Intersection * intersectionInfo,
const Ray & ray,
double & light_pdf,
Spectrum & lightSourceSamplingContribution
)
{
Objects * obj = intersectionInfo->object;
BRDFModels * brdf = obj->brdf_model;
Vector newRayDirection;
Vector normalDirection;
normalDirection = intersectionInfo->normal;
Attenuation attenuationFactor;
bool delta_brdf_hitEmissive = false;
bool occludedByObjects = true;
Spectrum lightIntensity;
light_pdf = 0; // to be added
if ( brdf->surfaceFlag == surface_delta )
{
return;
}
// Spectrum lightSourceSamplingContribution;
// Spectrum brdfSamplingContribution;
// light source sampling evaluation
Objects * light;
light = thisScene->AquireOneOfEmissiveObjects();
Pnt3D pointOnLight;
int i = 0;
while ( i < 2 && occludedByObjects == true )
{
pointOnLight = light->samplePointOnObject();
occludedByObjects = thisScene->Occluded(
intersectionInfo->intersectionPoint,
pointOnLight,
light
);
i++;
}
if ( occludedByObjects == false )
{
newRayDirection = Normalize( pointOnLight - intersectionInfo->intersectionPoint );
brdf->BRDF(
ray.direction,
newRayDirection,
attenuationFactor
);
attenuationFactor.Scaled_by_Spectrum_Value( obj->material_type->color );
// light pdf in angular form
// should be returned for MIS
light_pdf = light->PDF_in_solid_angle ( pointOnLight, intersectionInfo->intersectionPoint, newRayDirection );
// not sure !!!
double pointSamplePdf = light->PDF();
Ray nextRay( intersectionInfo->intersectionPoint, newRayDirection );
Vector normal_on_light;
light->getNormalDirection( pointOnLight, normal_on_light );
double geometryTerm = GeometricTerm( nextRay, normalDirection, pointOnLight, normal_on_light );
lightIntensity = light->emission;
lightSourceSamplingContribution = Attenuate_Light_Spectrum(
attenuationFactor,
lightIntensity
) * geometryTerm / pointSamplePdf;
}
else
{
if ( DebugMode )
{
printf( "Direct illimination can not sample a point on light source" );
}
}
}