Changed the UniformSphereSample trait to return a borrowed vector.
This commit is contained in:
parent
61e985634b
commit
d8db04cce5
|
@ -5,13 +5,5 @@ pub trait UniformSphereSample {
|
|||
fn sample(&fn(&'static Self));
|
||||
|
||||
/// Gets the list of all samples.
|
||||
fn sample_list() -> ~[&'static Self] {
|
||||
let mut res = ~[];
|
||||
|
||||
do UniformSphereSample::sample::<Self> |s| {
|
||||
res.push(s)
|
||||
}
|
||||
|
||||
res
|
||||
}
|
||||
fn sample_list() -> &[Self];
|
||||
}
|
||||
|
|
|
@ -149,6 +149,13 @@ impl UniformSphereSample for Vec2<f64> {
|
|||
f(sample)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn sample_list() -> &[Vec2<f64>] {
|
||||
let res: &[Vec2<f64>] = SAMPLES_2_F64;
|
||||
|
||||
res
|
||||
}
|
||||
}
|
||||
|
||||
impl UniformSphereSample for Vec3<f64> {
|
||||
|
@ -158,4 +165,11 @@ impl UniformSphereSample for Vec3<f64> {
|
|||
f(sample)
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn sample_list() -> &[Vec3<f64>] {
|
||||
let res: &[Vec3<f64>] = SAMPLES_3_F64;
|
||||
|
||||
res
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue