Ejemplo n.º 1
0
//===========================================================================
/*virtual*/ bool Plane::CalculateSurfacePoint( const Scene::Ray& ray, const Scene& scene, Scene::SurfacePoint& surfacePoint ) const
{
	double numerator = c3ga::lc( center - ray.point, normal );
	double denominator = c3ga::lc( ray.direction, normal );
	if( denominator == 0.0 )
		return false;

	double lambda = numerator / denominator;
	if( lambda < 0.0 )
		return false;

	surfacePoint.point = ray.CalculateRayPoint( lambda );

	if( numerator < 0.0 )
		surfacePoint.normal = normal;
	else
		surfacePoint.normal = -normal;

	surfacePoint.materialProperties = materialProperties;
	ApplyTextures( surfacePoint, scene.Eye() );
	return true;
}