clippy
This commit is contained in:
+177
-149
@@ -1,7 +1,7 @@
|
||||
#![feature(variant_count)]
|
||||
use std::{
|
||||
error::Error,
|
||||
fs::{File, remove_file, rename},
|
||||
fs::{remove_file, rename, File},
|
||||
io::{Cursor, Read, Write},
|
||||
path::{Path, PathBuf},
|
||||
sync::Arc,
|
||||
@@ -19,42 +19,38 @@ const MSAA_SAMPLES_ACTUAL: u32 = if MSAA_ENABLE { MSAA_SAMPLES } else { 1 };
|
||||
use bytemuck::{Pod, Zeroable};
|
||||
use egui_winit_vulkano::{Gui, GuiConfig};
|
||||
use foldhash::{HashMap, HashMapExt, HashSet};
|
||||
use glam::{self, EulerRot, Mat3, Mat4, Vec3, vec3};
|
||||
use glam::{self, vec3, EulerRot, Mat3, Mat4, Vec3};
|
||||
use instruction_set::InputTypes;
|
||||
use log::{error, info, trace};
|
||||
use rayon::prelude::*;
|
||||
use simplelog::{CombinedLogger, Config, TermLogger, WriteLogger};
|
||||
use vulkano::{
|
||||
Validated, Version, VulkanError, VulkanLibrary,
|
||||
buffer::{
|
||||
Buffer, BufferCreateInfo, BufferUsage, Subbuffer,
|
||||
allocator::{SubbufferAllocator, SubbufferAllocatorCreateInfo},
|
||||
Buffer, BufferCreateInfo, BufferUsage, Subbuffer,
|
||||
},
|
||||
command_buffer::{
|
||||
AutoCommandBufferBuilder, CommandBufferUsage, CopyBufferInfo, PrimaryCommandBufferAbstract,
|
||||
RenderPassBeginInfo, SubpassBeginInfo, SubpassContents,
|
||||
allocator::StandardCommandBufferAllocator,
|
||||
allocator::StandardCommandBufferAllocator, AutoCommandBufferBuilder, CommandBufferUsage,
|
||||
CopyBufferInfo, PrimaryCommandBufferAbstract, RenderPassBeginInfo, SubpassBeginInfo,
|
||||
SubpassContents,
|
||||
},
|
||||
descriptor_set::{
|
||||
DescriptorSet, WriteDescriptorSet, allocator::StandardDescriptorSetAllocator,
|
||||
allocator::StandardDescriptorSetAllocator, DescriptorSet, WriteDescriptorSet,
|
||||
},
|
||||
device::{
|
||||
Device, DeviceCreateInfo, DeviceExtensions, DeviceFeatures, DeviceOwned, Queue,
|
||||
QueueCreateInfo, QueueFlags, physical::PhysicalDeviceType,
|
||||
physical::PhysicalDeviceType, Device, DeviceCreateInfo, DeviceExtensions, DeviceFeatures,
|
||||
DeviceOwned, Queue, QueueCreateInfo, QueueFlags,
|
||||
},
|
||||
format::Format,
|
||||
image::{Image, ImageCreateInfo, ImageType, ImageUsage, view::ImageView},
|
||||
image::{view::ImageView, Image, ImageCreateInfo, ImageType, ImageUsage},
|
||||
instance::{Instance, InstanceCreateInfo, InstanceExtensions},
|
||||
memory::allocator::{
|
||||
AllocationCreateInfo, MemoryAllocatePreference, MemoryTypeFilter, StandardMemoryAllocator,
|
||||
},
|
||||
pipeline::{
|
||||
ComputePipeline, DynamicState, GraphicsPipeline, Pipeline, PipelineBindPoint,
|
||||
PipelineLayout, PipelineShaderStageCreateInfo,
|
||||
cache::{PipelineCache, PipelineCacheCreateInfo},
|
||||
compute::ComputePipelineCreateInfo,
|
||||
graphics::{
|
||||
GraphicsPipelineCreateInfo,
|
||||
color_blend::{ColorBlendAttachmentState, ColorBlendState},
|
||||
depth_stencil::{DepthState, DepthStencilState},
|
||||
input_assembly::InputAssemblyState,
|
||||
@@ -62,16 +58,20 @@ use vulkano::{
|
||||
rasterization::{CullMode, FrontFace, RasterizationState},
|
||||
vertex_input::{Vertex, VertexDefinition},
|
||||
viewport::{Viewport, ViewportState},
|
||||
GraphicsPipelineCreateInfo,
|
||||
},
|
||||
layout::PipelineDescriptorSetLayoutCreateInfo,
|
||||
ComputePipeline, DynamicState, GraphicsPipeline, Pipeline, PipelineBindPoint,
|
||||
PipelineLayout, PipelineShaderStageCreateInfo,
|
||||
},
|
||||
render_pass::{Framebuffer, FramebufferCreateInfo, RenderPass, Subpass},
|
||||
shader::{ShaderModule, SpecializationConstant},
|
||||
swapchain::{
|
||||
PresentMode, Surface, SurfaceInfo, Swapchain, SwapchainCreateInfo, SwapchainPresentInfo,
|
||||
acquire_next_image,
|
||||
acquire_next_image, PresentMode, Surface, SurfaceInfo, Swapchain, SwapchainCreateInfo,
|
||||
SwapchainPresentInfo,
|
||||
},
|
||||
sync::{self, GpuFuture},
|
||||
Validated, Version, VulkanError, VulkanLibrary,
|
||||
};
|
||||
use winit::{
|
||||
application::ApplicationHandler,
|
||||
@@ -204,17 +204,20 @@ impl App {
|
||||
let library = VulkanLibrary::new().expect("Vulkan is not installed???");
|
||||
let required_extensions = Surface::required_extensions(event_loop).unwrap();
|
||||
|
||||
let instance = Instance::new(library, InstanceCreateInfo {
|
||||
enabled_extensions: InstanceExtensions {
|
||||
ext_surface_maintenance1: true,
|
||||
..required_extensions
|
||||
let instance = Instance::new(
|
||||
library,
|
||||
InstanceCreateInfo {
|
||||
enabled_extensions: InstanceExtensions {
|
||||
ext_surface_maintenance1: true,
|
||||
..required_extensions
|
||||
},
|
||||
engine_name: Some("ImplEng".to_owned()),
|
||||
engine_version: Version::major_minor(0, 1),
|
||||
application_name: Some(env!("CARGO_PKG_NAME").to_owned()),
|
||||
application_version: app_version(),
|
||||
..Default::default()
|
||||
},
|
||||
engine_name: Some("ImplEng".to_owned()),
|
||||
engine_version: Version::major_minor(0, 1),
|
||||
application_name: Some(env!("CARGO_PKG_NAME").to_owned()),
|
||||
application_version: app_version(),
|
||||
..Default::default()
|
||||
})
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let mut device_extensions = DeviceExtensions {
|
||||
@@ -288,34 +291,37 @@ impl App {
|
||||
device_extensions.khr_dynamic_rendering = true;
|
||||
}
|
||||
|
||||
let (device, mut queues) = Device::new(physical_device, DeviceCreateInfo {
|
||||
enabled_extensions: device_extensions,
|
||||
queue_create_infos: vec![
|
||||
QueueCreateInfo {
|
||||
queue_family_index: graphics_queue_index,
|
||||
..Default::default()
|
||||
let (device, mut queues) = Device::new(
|
||||
physical_device,
|
||||
DeviceCreateInfo {
|
||||
enabled_extensions: device_extensions,
|
||||
queue_create_infos: vec![
|
||||
QueueCreateInfo {
|
||||
queue_family_index: graphics_queue_index,
|
||||
..Default::default()
|
||||
},
|
||||
QueueCreateInfo {
|
||||
queue_family_index: transfer_queue_index,
|
||||
..Default::default()
|
||||
},
|
||||
],
|
||||
enabled_features: DeviceFeatures {
|
||||
mesh_shader: true,
|
||||
task_shader: true,
|
||||
sample_rate_shading: true,
|
||||
//shader_float16: true,
|
||||
shader_int16: true,
|
||||
shader_int8: true,
|
||||
storage_buffer8_bit_access: true,
|
||||
geometry_shader: true,
|
||||
primitive_fragment_shading_rate: true,
|
||||
maintenance4: true,
|
||||
dynamic_rendering: DYNAMIC_STATE,
|
||||
..DeviceFeatures::empty()
|
||||
},
|
||||
QueueCreateInfo {
|
||||
queue_family_index: transfer_queue_index,
|
||||
..Default::default()
|
||||
},
|
||||
],
|
||||
enabled_features: DeviceFeatures {
|
||||
mesh_shader: true,
|
||||
task_shader: true,
|
||||
sample_rate_shading: true,
|
||||
//shader_float16: true,
|
||||
shader_int16: true,
|
||||
shader_int8: true,
|
||||
storage_buffer8_bit_access: true,
|
||||
geometry_shader: true,
|
||||
primitive_fragment_shading_rate: true,
|
||||
maintenance4: true,
|
||||
dynamic_rendering: DYNAMIC_STATE,
|
||||
..DeviceFeatures::empty()
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
})
|
||||
)
|
||||
.expect("Unable to initialize device");
|
||||
|
||||
let graphics_queue = queues.next().expect("Unable to retrieve queues");
|
||||
@@ -331,13 +337,15 @@ impl App {
|
||||
Default::default(),
|
||||
));
|
||||
|
||||
let uniform_buffer_allocator =
|
||||
SubbufferAllocator::new(memory_allocator.clone(), SubbufferAllocatorCreateInfo {
|
||||
let uniform_buffer_allocator = SubbufferAllocator::new(
|
||||
memory_allocator.clone(),
|
||||
SubbufferAllocatorCreateInfo {
|
||||
buffer_usage: BufferUsage::UNIFORM_BUFFER | BufferUsage::STORAGE_BUFFER,
|
||||
memory_type_filter: MemoryTypeFilter::PREFER_DEVICE
|
||||
| MemoryTypeFilter::HOST_SEQUENTIAL_WRITE,
|
||||
..Default::default()
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
let pipeline_cache = get_pipeline_cache(device.clone());
|
||||
|
||||
@@ -487,10 +495,13 @@ impl ApplicationHandler for App {
|
||||
let surface_capabilities = self
|
||||
.device
|
||||
.physical_device()
|
||||
.surface_capabilities(&surface, SurfaceInfo {
|
||||
present_mode: Some(present_mode),
|
||||
..Default::default()
|
||||
})
|
||||
.surface_capabilities(
|
||||
&surface,
|
||||
SurfaceInfo {
|
||||
present_mode: Some(present_mode),
|
||||
..Default::default()
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let (image_format, _) = self
|
||||
@@ -499,26 +510,30 @@ impl ApplicationHandler for App {
|
||||
.surface_formats(&surface, Default::default())
|
||||
.unwrap()[0];
|
||||
|
||||
Swapchain::new(self.device.clone(), surface.clone(), SwapchainCreateInfo {
|
||||
min_image_count: 3
|
||||
.max(surface_capabilities.min_image_count)
|
||||
.min(surface_capabilities.max_image_count.unwrap_or(u32::MAX)),
|
||||
Swapchain::new(
|
||||
self.device.clone(),
|
||||
surface.clone(),
|
||||
SwapchainCreateInfo {
|
||||
min_image_count: 3
|
||||
.max(surface_capabilities.min_image_count)
|
||||
.min(surface_capabilities.max_image_count.unwrap_or(u32::MAX)),
|
||||
|
||||
image_format,
|
||||
image_extent: window_size.into(),
|
||||
image_format,
|
||||
image_extent: window_size.into(),
|
||||
|
||||
image_usage: ImageUsage::COLOR_ATTACHMENT | ImageUsage::TRANSFER_DST,
|
||||
image_usage: ImageUsage::COLOR_ATTACHMENT | ImageUsage::TRANSFER_DST,
|
||||
|
||||
composite_alpha: surface_capabilities
|
||||
.supported_composite_alpha
|
||||
.into_iter()
|
||||
.next()
|
||||
.unwrap(),
|
||||
composite_alpha: surface_capabilities
|
||||
.supported_composite_alpha
|
||||
.into_iter()
|
||||
.next()
|
||||
.unwrap(),
|
||||
|
||||
present_mode,
|
||||
present_mode,
|
||||
|
||||
..Default::default()
|
||||
})
|
||||
..Default::default()
|
||||
},
|
||||
)
|
||||
.unwrap()
|
||||
};
|
||||
|
||||
@@ -1034,19 +1049,19 @@ impl App {
|
||||
fake_csg.push(CSG {
|
||||
name: format!("fuzz_{i}"),
|
||||
parts: vec![
|
||||
CSGPart::opcode(InstructionSet::OPMulVec3Float, vec![
|
||||
Inputs::Variable,
|
||||
Inputs::Float(0.9),
|
||||
]),
|
||||
CSGPart::opcode(
|
||||
InstructionSet::OPMulVec3Float,
|
||||
vec![Inputs::Variable, Inputs::Float(0.9)],
|
||||
),
|
||||
CSGPart::opcode(InstructionSet::OPDupVec3, vec![Inputs::Variable]),
|
||||
CSGPart::opcode(InstructionSet::OPAddVec3Vec3, vec![
|
||||
Inputs::Variable,
|
||||
Inputs::Vec3(vec3(-0.7, i as f32, -0.7)),
|
||||
]),
|
||||
CSGPart::opcode(InstructionSet::OPSDFSphere, vec![
|
||||
Inputs::Float(0.5),
|
||||
Inputs::Variable,
|
||||
]),
|
||||
CSGPart::opcode(
|
||||
InstructionSet::OPAddVec3Vec3,
|
||||
vec![Inputs::Variable, Inputs::Vec3(vec3(-0.7, i as f32, -0.7))],
|
||||
),
|
||||
CSGPart::opcode(
|
||||
InstructionSet::OPSDFSphere,
|
||||
vec![Inputs::Float(0.5), Inputs::Variable],
|
||||
),
|
||||
//CSGPart::opcode(InstructionSet::OPNop,vec![]),
|
||||
//CSGPart::opcode(InstructionSet::OPDupVec3,
|
||||
// vec![Inputs::Variable]),
|
||||
@@ -1056,21 +1071,21 @@ impl App {
|
||||
// CSGPart::opcode(InstructionSet::OPAddVec3Vec3,
|
||||
// vec![Inputs::Variable, Inputs::Vec3([-0.0, -0.0,
|
||||
// -0.0].into())]),
|
||||
CSGPart::opcode(InstructionSet::OPSDFSphere, vec![
|
||||
Inputs::Float(1.2),
|
||||
Inputs::Variable,
|
||||
]),
|
||||
CSGPart::opcode(
|
||||
InstructionSet::OPSDFSphere,
|
||||
vec![Inputs::Float(1.2), Inputs::Variable],
|
||||
),
|
||||
//CSGPart::opcode(InstructionSet::OPSDFBox,
|
||||
// vec![Inputs::Variable,
|
||||
// Inputs::Vec3([0.7, 0.7, 0.7].into())]),
|
||||
CSGPart::opcode(InstructionSet::OPMinFloat, vec![
|
||||
Inputs::Variable,
|
||||
Inputs::Variable,
|
||||
]),
|
||||
CSGPart::opcode(InstructionSet::OPDivFloatFloat, vec![
|
||||
Inputs::Variable,
|
||||
Inputs::Float(0.9),
|
||||
]),
|
||||
CSGPart::opcode(
|
||||
InstructionSet::OPMinFloat,
|
||||
vec![Inputs::Variable, Inputs::Variable],
|
||||
),
|
||||
CSGPart::opcode(
|
||||
InstructionSet::OPDivFloatFloat,
|
||||
vec![Inputs::Variable, Inputs::Float(0.9)],
|
||||
),
|
||||
CSGPart::opcode(InstructionSet::OPStop, vec![Inputs::Variable]),
|
||||
],
|
||||
pos: Vec3::ZERO,
|
||||
@@ -1106,7 +1121,7 @@ impl App {
|
||||
for (i, val) in scene.iter().skip(1).take(32).enumerate() {
|
||||
for (y, code) in val.iter().enumerate() {
|
||||
spec_constants.insert(
|
||||
(1000 + (i * 8) + (y * 2) + 0) as u32,
|
||||
(1000 + (i * 8) + (y * 2)) as u32,
|
||||
SpecializationConstant::U32(code & 0xFFFF),
|
||||
);
|
||||
spec_constants.insert(
|
||||
@@ -1324,10 +1339,13 @@ impl App {
|
||||
}
|
||||
|
||||
builder
|
||||
.next_subpass(Default::default(), SubpassBeginInfo {
|
||||
contents: SubpassContents::SecondaryCommandBuffers,
|
||||
..Default::default()
|
||||
})
|
||||
.next_subpass(
|
||||
Default::default(),
|
||||
SubpassBeginInfo {
|
||||
contents: SubpassContents::SecondaryCommandBuffers,
|
||||
..Default::default()
|
||||
},
|
||||
)
|
||||
.unwrap()
|
||||
.execute_commands(guicb)
|
||||
.unwrap()
|
||||
@@ -1420,18 +1438,21 @@ fn framebuffer_generation(
|
||||
.map(|image| {
|
||||
let view = ImageView::new_default(image.clone()).unwrap();
|
||||
|
||||
Framebuffer::new(render_pass.clone(), FramebufferCreateInfo {
|
||||
attachments: if MSAA_ENABLE {
|
||||
vec![
|
||||
intermediary.as_ref().unwrap().clone(),
|
||||
view,
|
||||
depth_buffer.clone(),
|
||||
]
|
||||
} else {
|
||||
vec![view, depth_buffer.clone()]
|
||||
Framebuffer::new(
|
||||
render_pass.clone(),
|
||||
FramebufferCreateInfo {
|
||||
attachments: if MSAA_ENABLE {
|
||||
vec![
|
||||
intermediary.as_ref().unwrap().clone(),
|
||||
view,
|
||||
depth_buffer.clone(),
|
||||
]
|
||||
} else {
|
||||
vec![view, depth_buffer.clone()]
|
||||
},
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
})
|
||||
)
|
||||
.unwrap()
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
@@ -1444,7 +1465,7 @@ fn pipeline_recompile(
|
||||
cache: &Arc<PipelineCache>,
|
||||
shader_modules: &ShaderModules,
|
||||
debug: &PreviousDebug,
|
||||
scene: &Vec<[u32; 4]>,
|
||||
scene: &[[u32; 4]],
|
||||
viewport: Option<&Viewport>,
|
||||
) -> (Arc<GraphicsPipeline>, Arc<GraphicsPipeline>) {
|
||||
let device = cache.device();
|
||||
@@ -1494,7 +1515,7 @@ fn pipeline_recompile(
|
||||
for (i, val) in scene.iter().skip(1).take(32).enumerate() {
|
||||
for (y, code) in val.iter().enumerate() {
|
||||
spec_constants.insert(
|
||||
(1000 + (i * 8) + (y * 2) + 0) as u32,
|
||||
(1000 + (i * 8) + (y * 2)) as u32,
|
||||
SpecializationConstant::U32(code & 0xFFFF),
|
||||
);
|
||||
spec_constants.insert(
|
||||
@@ -1799,19 +1820,19 @@ fn object_size_dependent_setup(
|
||||
];
|
||||
|
||||
let example = vec![
|
||||
CSGPart::opcode(InstructionSet::OPMulVec3Float, vec![
|
||||
Inputs::Variable,
|
||||
Inputs::Float(0.9),
|
||||
]),
|
||||
CSGPart::opcode(
|
||||
InstructionSet::OPMulVec3Float,
|
||||
vec![Inputs::Variable, Inputs::Float(0.9)],
|
||||
),
|
||||
CSGPart::opcode(InstructionSet::OPDupVec3, vec![Inputs::Variable]),
|
||||
CSGPart::opcode(InstructionSet::OPAddVec3Vec3, vec![
|
||||
Inputs::Variable,
|
||||
Inputs::Vec3([-0.7, -1.2, -0.7].into()),
|
||||
]),
|
||||
CSGPart::opcode(InstructionSet::OPSDFSphere, vec![
|
||||
Inputs::Float(0.5),
|
||||
Inputs::Variable,
|
||||
]),
|
||||
CSGPart::opcode(
|
||||
InstructionSet::OPAddVec3Vec3,
|
||||
vec![Inputs::Variable, Inputs::Vec3([-0.7, -1.2, -0.7].into())],
|
||||
),
|
||||
CSGPart::opcode(
|
||||
InstructionSet::OPSDFSphere,
|
||||
vec![Inputs::Float(0.5), Inputs::Variable],
|
||||
),
|
||||
//CSGPart::opcode(InstructionSet::OPNop,vec![]),
|
||||
//CSGPart::opcode(InstructionSet::OPDupVec3, vec![Inputs::Variable]),
|
||||
//CSGPart::opcode(InstructionSet::OPAddVec3Vec3, vec![Inputs::Variable,
|
||||
@@ -1820,20 +1841,20 @@ fn object_size_dependent_setup(
|
||||
// Inputs::Vec3([-0.0, -0.0, -0.0].into())]),
|
||||
// CSGPart::opcode(InstructionSet::OPSDFSphere,vec![Inputs::Float(1.2),
|
||||
// Inputs::Variable]),
|
||||
CSGPart::opcode(InstructionSet::OPSDFTorus, vec![
|
||||
Inputs::Vec2([0.7, 0.4].into()),
|
||||
Inputs::Variable,
|
||||
]),
|
||||
CSGPart::opcode(
|
||||
InstructionSet::OPSDFTorus,
|
||||
vec![Inputs::Vec2([0.7, 0.4].into()), Inputs::Variable],
|
||||
),
|
||||
//CSGPart::opcode(InstructionSet::OPSDFBox, vec![Inputs::Vec3([0.7, 0.4, 0.7].into()),
|
||||
// Inputs::Variable]),
|
||||
CSGPart::opcode(InstructionSet::OPMinFloat, vec![
|
||||
Inputs::Variable,
|
||||
Inputs::Variable,
|
||||
]),
|
||||
CSGPart::opcode(InstructionSet::OPDivFloatFloat, vec![
|
||||
Inputs::Variable,
|
||||
Inputs::Float(0.9),
|
||||
]),
|
||||
CSGPart::opcode(
|
||||
InstructionSet::OPMinFloat,
|
||||
vec![Inputs::Variable, Inputs::Variable],
|
||||
),
|
||||
CSGPart::opcode(
|
||||
InstructionSet::OPDivFloatFloat,
|
||||
vec![Inputs::Variable, Inputs::Float(0.9)],
|
||||
),
|
||||
CSGPart::opcode(InstructionSet::OPStop, vec![Inputs::Variable]),
|
||||
];
|
||||
|
||||
@@ -2066,11 +2087,15 @@ fn object_size_dependent_setup(
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let staging = SubbufferAllocator::new(allocator.clone(), SubbufferAllocatorCreateInfo {
|
||||
buffer_usage: BufferUsage::TRANSFER_SRC,
|
||||
memory_type_filter: MemoryTypeFilter::PREFER_HOST | MemoryTypeFilter::HOST_SEQUENTIAL_WRITE,
|
||||
..Default::default()
|
||||
});
|
||||
let staging = SubbufferAllocator::new(
|
||||
allocator.clone(),
|
||||
SubbufferAllocatorCreateInfo {
|
||||
buffer_usage: BufferUsage::TRANSFER_SRC,
|
||||
memory_type_filter: MemoryTypeFilter::PREFER_HOST
|
||||
| MemoryTypeFilter::HOST_SEQUENTIAL_WRITE,
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
|
||||
let csg_scene = gpu_buffer(
|
||||
scene.clone(),
|
||||
@@ -2197,10 +2222,13 @@ fn get_pipeline_cache(device: Arc<Device>) -> Arc<PipelineCache> {
|
||||
};
|
||||
|
||||
unsafe {
|
||||
PipelineCache::new(device, PipelineCacheCreateInfo {
|
||||
initial_data,
|
||||
..Default::default()
|
||||
})
|
||||
PipelineCache::new(
|
||||
device,
|
||||
PipelineCacheCreateInfo {
|
||||
initial_data,
|
||||
..Default::default()
|
||||
},
|
||||
)
|
||||
}
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
+7
-10
@@ -346,16 +346,13 @@ pub(crate) fn load_csg(
|
||||
.map(|inpart| {
|
||||
let ty = inpart.get("type").ok_or("no type!")?.as_str();
|
||||
let csgpart = CSGPart::opcode(InstructionSet::OPNop, vec![]);
|
||||
match ty {
|
||||
"sphere" => {
|
||||
let _blend = get_f32(inpart, "blend")?;
|
||||
let _shell = get_percentage(inpart, "shell%")?;
|
||||
let _power = get_f32_default(inpart, "power", 2.)?;
|
||||
let _rgb = get_rgb(inpart)?;
|
||||
let _trs = get_trs(inpart)?;
|
||||
let _half = get_half(inpart)?;
|
||||
},
|
||||
_ => {}, //return Err("unknown type of csg".to_owned()),
|
||||
if ty == "sphere" {
|
||||
let _blend = get_f32(inpart, "blend")?;
|
||||
let _shell = get_percentage(inpart, "shell%")?;
|
||||
let _power = get_f32_default(inpart, "power", 2.)?;
|
||||
let _rgb = get_rgb(inpart)?;
|
||||
let _trs = get_trs(inpart)?;
|
||||
let _half = get_half(inpart)?;
|
||||
}
|
||||
Ok(csgpart)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user