You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
10 lines
382 B
10 lines
382 B
#include "Material.h"
|
|
#include "Ray.h"
|
|
#include <math.h>
|
|
bool LamberMaterial::Scatter(const Ray & input_ray, const HitPoint & hit_point, Ray & out_ray)
|
|
{
|
|
Vector3 random_vector = UnitRandomVector3InSphere();
|
|
Vector3 new_direction = hit_point.mNormal + random_vector;
|
|
out_ray.Set(hit_point.mPosition, new_direction, input_ray.mLightAttenuation*mDiffuse);
|
|
return true;
|
|
}
|