This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let point_abs = point.abs(); | |
| // This giant if statement determines which face the point is on. Then, it | |
| // returns the cosine of the x and y angle on that face (in fullx and fully) | |
| // and the index of the face itself, in a tuple. | |
| let (fullx, fully, face) = | |
| if point_abs.x >= point_abs.y && point_abs.x > point_abs.z { | |
| if point.x > 0.0 { | |
| ( | |
| point.z / (point.x*point.x + point.z*point.z).sqrt(), | |
| point.y / (point.x*point.x + point.y*point.y).sqrt(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| test bench_perlin2 ... bench: 27 ns/iter (+/- 5) | |
| test bench_perlin3 ... bench: 67 ns/iter (+/- 2) | |
| test bench_perlin4 ... bench: 81 ns/iter (+/- 3) | |
| test bench_simplectic2 ... bench: 40 ns/iter (+/- 5) | |
| test bench_simplectic3 ... bench: 94 ns/iter (+/- 11) | |
| test bench_simplectic4 ... bench: 188 ns/iter (+/- 7) | |
| test bench_simplex2 ... bench: 45 ns/iter (+/- 5) | |
| test bench_simplex3 ... bench: 107 ns/iter (+/- 12) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Copyright 2013 The noise-rs developers. For a full listing of the authors, | |
| // refer to the AUTHORS file at the top-level directory of this distribution. | |
| // | |
| // Licensed under the Apache License, Version 2.0 (the "License"); | |
| // you may not use this file except in compliance with the License. | |
| // You may obtain a copy of the License at | |
| // | |
| // http://www.apache.org/licenses/LICENSE-2.0 | |
| // | |
| // Unless required by applicable law or agreed to in writing, software |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extern crate cgmath; | |
| use self::cgmath::Matrix4; | |
| use scene::MeshComponent; | |
| macro_rules! scene( | |
| ($($comp_name:ident($comp_adder:ident, $comp_getter:ident, $comp_remover:ident, $comp_foreach:ident): $comp:ident),*) => ( | |
| pub struct Scene { | |
| transforms: Vec<Option<Matrix4<f32>>>, |