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

4 years ago
  1. #include "Material.h"
  2. #include "Ray.h"
  3. #include <math.h>
  4. bool LamberMaterial::Scatter(const Ray & input_ray, const HitPoint & hit_point, Ray & out_ray)
  5. {
  6. Vector3 random_vector = UnitRandomVector3InSphere();
  7. Vector3 new_direction = hit_point.mNormal + random_vector;
  8. out_ray.Set(hit_point.mPosition, new_direction, input_ray.mLightAttenuation*mDiffuse);
  9. return true;
  10. }