summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-12-16 22:00:01 -0500
committerpommicket <pommicket@gmail.com>2022-12-16 22:00:01 -0500
commit7c8aac1bfb839a1aa4076a71fbc1dd70dd487e35 (patch)
tree628e24a9161015a0199c8a56d531961dbb8dc174 /src
parentbac9af4139315daae65323c9cd84a5c867844399 (diff)
Code Quality™
Diffstat (limited to 'src')
-rw-r--r--src/main.rs8
-rw-r--r--src/sdf.rs4
-rw-r--r--src/win.rs4
3 files changed, 7 insertions, 9 deletions
diff --git a/src/main.rs b/src/main.rs
index d3700bb..a2b7e88 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -75,11 +75,11 @@ impl View {
}
fn yaw_by(&mut self, yaw: f32) {
- self.rotation = self.rotation * Rot3::from_euler_angles(0.0, yaw, 0.0);
+ self.rotation *= Rot3::from_euler_angles(0.0, yaw, 0.0);
}
fn pitch_by(&mut self, pitch: f32) {
- self.rotation = self.rotation * Rot3::from_euler_angles(pitch, 0.0, 0.0);
+ self.rotation *= Rot3::from_euler_angles(pitch, 0.0, 0.0);
}
fn translation(&self) -> Mat4 {
@@ -235,7 +235,7 @@ void main() {
);
//println!("{fshader_source}");
- println!("scene: {}", scene.to_string());
+ println!("scene: {}", scene.export_string());
window
.link_program(program,
@@ -273,7 +273,7 @@ fn gen_program(window: &mut win::Window, program: &mut win::Program) -> Result<(
#[allow(dead_code)] // @TODO @TEMPORARY
fn gen_program_from_string(window: &mut win::Window, program: &mut win::Program, s: &str) -> Result<(), String> {
- let scene = sdf::Scene::from_string(s).ok_or_else(|| "bad scene string".to_string())?;
+ let scene = sdf::Scene::import_string(s).ok_or_else(|| "bad scene string".to_string())?;
gen_program_from_scene(window, program, &scene)
}
diff --git a/src/sdf.rs b/src/sdf.rs
index db0a776..52120db 100644
--- a/src/sdf.rs
+++ b/src/sdf.rs
@@ -539,7 +539,7 @@ pub struct Scene {
}
impl Scene {
- pub fn to_string(&self) -> String {
+ pub fn export_string(&self) -> String {
let mut data: Vec<u8> = vec![];
// write errors should never happen
// that said, we don't want to panic if for whatever reason this fails.
@@ -548,7 +548,7 @@ impl Scene {
}
/// returns None if `s` is not a valid SDF string
- pub fn from_string(s: &str) -> Option<Self> {
+ pub fn import_string(s: &str) -> Option<Self> {
let bytes = decode_hex(s)?;
serde_cbor::from_reader(&bytes[..]).ok()?
}
diff --git a/src/win.rs b/src/win.rs
index dd685f1..3decdfd 100644
--- a/src/win.rs
+++ b/src/win.rs
@@ -404,9 +404,7 @@ impl Shader {
unsafe fn new_with_id(id: GLuint, r#type: GLenum, source: &str) -> Result<Self, String> {
if id == 0 {
- return Err(format!("couldn't create shader (GL error {})", unsafe {
- gl::GetError()
- }));
+ return Err(format!("couldn't create shader (GL error {})", gl::GetError()));
}
{