36 lines
1.1 KiB
Rust
36 lines
1.1 KiB
Rust
use crate::core::shape::CreateShape;
|
|
use crate::core::texture::FloatTexture;
|
|
use crate::utils::{Arena, FileLoc, ParameterDictionary};
|
|
use shared::core::shape::Shape;
|
|
use shared::shapes::CylinderShape;
|
|
use shared::utils::Transform;
|
|
use std::collections::HashMap;
|
|
|
|
impl CreateShape for CylinderShape {
|
|
fn create(
|
|
render_from_object: Transform,
|
|
object_from_render: Transform,
|
|
reverse_orientation: bool,
|
|
parameters: ParameterDictionary,
|
|
float_textures: HashMap<String, FloatTexture>,
|
|
loc: FileLoc,
|
|
arena: &mut Arena,
|
|
) -> Result<Vec<Shape>, String> {
|
|
let radius = parameters.get_one_float("radius", 1.);
|
|
let z_min = parameters.get_one_float("zmin", -1.);
|
|
let z_max = parameters.get_one_float("zmax", 1.);
|
|
let phi_max = parameters.get_one_float("phimax", 360.);
|
|
let shape = CylinderShape::new(
|
|
render_from_object,
|
|
object_from_render,
|
|
reverse_orientation,
|
|
radius,
|
|
z_min,
|
|
z_max,
|
|
phi_max,
|
|
);
|
|
|
|
arena.alloc(Shape::Cylinder(shape));
|
|
Ok(vec![Shape::Cylinder(shape)])
|
|
}
|
|
}
|