コード例 #1
0
 public Vector3 Sample(Triangle triangle, float u, float v)
 {
     Vector3 normal = triangle.SurfaceNormal(u, v);
     if (!_isRough) return normal;
     return new Vector3(normal.x + (float) (_rng.NextDouble() - 0.5) * _twoRoughness,
         normal.y + (float) (_rng.NextDouble() - 0.5) * _twoRoughness,
         normal.z + (float) (_rng.NextDouble() - 0.5) * _twoRoughness).Normalized();
 }