| 12345678910111213141516171819202122 |
- use std::{
- env::var,
- f32::consts::TAU,
- fs::File,
- io::{Result, Write},
- path::PathBuf
- };
- fn main() -> Result<()> {
- println!("cargo:rerun-if-changed=build.rs");
- let mut path = PathBuf::from(var("OUT_DIR")
- .expect("Cargo didn't set OUT_DIR"));
- path.push("normals.rs");
- let mut f = File::create(path)?;
- f.write_all(b"[0.0,")?;
- for n in 1..256 {
- write!(f, "{},", (n as f32 / 255.0 * TAU).sin())?;
- }
- f.write_all(b"]")
- }
|