Changed the UniformSphereSample trait to return a borrowed vector.

This commit is contained in:
Sébastien Crozet 2013-08-16 18:08:51 +02:00
parent 61e985634b
commit d8db04cce5
2 changed files with 15 additions and 9 deletions

View File

@ -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];
}

View File

@ -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
}
}