features: rename s/_/-/g and make double sizes Floats default.
This commit is contained in:
parent
ecf7cd7bdc
commit
5d8024a485
@ -7,7 +7,8 @@ edition = "2018"
|
|||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
disable_inverse_cache = []
|
default = [ "float-as-double" ]
|
||||||
|
disable-inverse-cache = []
|
||||||
float-as-double = []
|
float-as-double = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
@ -172,7 +172,7 @@ impl Camera {
|
|||||||
/// Tuple::vector((2. as Float).sqrt() / 2., 0., -(2. as Float).sqrt() / 2.)
|
/// Tuple::vector((2. as Float).sqrt() / 2., 0., -(2. as Float).sqrt() / 2.)
|
||||||
/// );
|
/// );
|
||||||
/// ```
|
/// ```
|
||||||
#[cfg(not(feature = "disable_inverse_cache"))]
|
#[cfg(not(feature = "disable-inverse-cache"))]
|
||||||
pub fn ray_for_pixel(&self, px: usize, py: usize) -> Ray {
|
pub fn ray_for_pixel(&self, px: usize, py: usize) -> Ray {
|
||||||
// The offset from the edge of the canvas to the pixel's corner.
|
// The offset from the edge of the canvas to the pixel's corner.
|
||||||
let xoffset = (px as Float + 0.5) * self.pixel_size;
|
let xoffset = (px as Float + 0.5) * self.pixel_size;
|
||||||
@ -192,7 +192,7 @@ impl Camera {
|
|||||||
|
|
||||||
Ray::new(origin, direction)
|
Ray::new(origin, direction)
|
||||||
}
|
}
|
||||||
#[cfg(feature = "disable_inverse_cache")]
|
#[cfg(feature = "disable-inverse-cache")]
|
||||||
pub fn ray_for_pixel(&self, px: usize, py: usize) -> Ray {
|
pub fn ray_for_pixel(&self, px: usize, py: usize) -> Ray {
|
||||||
// The offset from the edge of the canvas to the pixel's corner.
|
// The offset from the edge of the canvas to the pixel's corner.
|
||||||
let xoffset = (px as Float + 0.5) * self.pixel_size;
|
let xoffset = (px as Float + 0.5) * self.pixel_size;
|
||||||
|
|||||||
@ -105,7 +105,7 @@ impl Sphere {
|
|||||||
/// let n = s.normal_at(Tuple::point(0., (2. as Float).sqrt()/2., -(2. as Float).sqrt()/2.));
|
/// let n = s.normal_at(Tuple::point(0., (2. as Float).sqrt()/2., -(2. as Float).sqrt()/2.));
|
||||||
/// assert_eq!(n, Tuple::vector(0., 0.97014, -0.24254));
|
/// assert_eq!(n, Tuple::vector(0., 0.97014, -0.24254));
|
||||||
/// ```
|
/// ```
|
||||||
#[cfg(not(feature = "disable_inverse_cache"))]
|
#[cfg(not(feature = "disable-inverse-cache"))]
|
||||||
pub fn normal_at(&self, world_point: Tuple) -> Tuple {
|
pub fn normal_at(&self, world_point: Tuple) -> Tuple {
|
||||||
let object_point = self.inverse_transform * world_point;
|
let object_point = self.inverse_transform * world_point;
|
||||||
let object_normal = object_point - Tuple::point(0., 0., 0.);
|
let object_normal = object_point - Tuple::point(0., 0., 0.);
|
||||||
@ -113,7 +113,7 @@ impl Sphere {
|
|||||||
world_normal.w = 0.;
|
world_normal.w = 0.;
|
||||||
world_normal.normalize()
|
world_normal.normalize()
|
||||||
}
|
}
|
||||||
#[cfg(feature = "disable_inverse_cache")]
|
#[cfg(feature = "disable-inverse-cache")]
|
||||||
pub fn normal_at(&self, world_point: Tuple) -> Tuple {
|
pub fn normal_at(&self, world_point: Tuple) -> Tuple {
|
||||||
let object_point = self.transform.inverse() * world_point;
|
let object_point = self.transform.inverse() * world_point;
|
||||||
let object_normal = object_point - Tuple::point(0., 0., 0.);
|
let object_normal = object_point - Tuple::point(0., 0., 0.);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user