Skip to content

Commit

Permalink
updates svg as we go
Browse files Browse the repository at this point in the history
  • Loading branch information
organizedgrime committed Nov 5, 2024
1 parent 987a6c4 commit ca58056
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 106 deletions.
152 changes: 50 additions & 102 deletions current.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/bones/polyhedron/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub struct Render {

//impl rand::
pub fn random_positions(n: usize) -> Vec<Vec3> {
vec![Vec3::new(random(), random(), random()).normalized(); n]
vec![Vec3::new(random(), random(), random()).normalized() * 4.0; n]
}

impl Render {
Expand Down
14 changes: 12 additions & 2 deletions src/render/controls.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use std::io::Read;

use iced::{alignment::Vertical, Length};
use iced_aw::{menu::Item, menu_bar};
use iced_wgpu::Renderer;
use iced_widget::{button, column, container, row, text, Row};
use iced_widget::{button, column, container, pick_list::Handle, row, text, Row};
use iced_winit::{
core::{Color, Element, Theme},
runtime::{Program, Task},
Expand Down Expand Up @@ -71,7 +73,15 @@ impl Program for Controls {
]
.spacing(10.0);

let svg = iced::widget::svg("current.svg");
let mut svg = String::new();
let mut data = vec![];
std::fs::File::open("current.svg")
.unwrap()
//.read_to_string(&mut svg)
.read_to_end(&mut data)
.unwrap();
log::info!("svg:\n{svg}");
let svg = iced::widget::svg(iced::widget::svg::Handle::from_memory(data));

container(
column![
Expand Down
2 changes: 1 addition & 1 deletion src/render/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ pub struct ModelState {
impl Default for ModelState {
fn default() -> Self {
let x = Self {
polyhedron: { Polyhedron::preset(&PresetMessage::Dodecahedron) },
polyhedron: { Polyhedron::preset(&PresetMessage::Octahedron) },
transform: Mat4::identity(),
};
//log::error!("poly: {:?}", x.polyhedron);
Expand Down

0 comments on commit ca58056

Please sign in to comment.