This commit is contained in:
John Hunter
2023-03-31 15:34:28 +01:00
parent d729124351
commit cc679393c5
6 changed files with 398 additions and 1051 deletions
+1
View File
@@ -1 +1,2 @@
/target
Cargo.lock
Generated
+364 -994
View File
File diff suppressed because it is too large Load Diff
+7 -11
View File
@@ -11,7 +11,7 @@ vulkano = "0.32"
vulkano-shaders = "0.32"
# The Vulkan library doesn't provide any functionality to create and handle windows, as
# this would be out of scope. In order to open a window, we are going to use the `winit` crate.
winit = "0.27"
winit = "0.28"
# The `vulkano_win` crate is the link between `vulkano` and `winit`. Vulkano doesn't know about winit,
# and winit doesn't know about vulkano, so import a crate that will provide a link between the two.
vulkano-win = "0.32"
@@ -26,19 +26,15 @@ bytemuck = { version = "1.13", features = [
cgmath = "0.18"
rodio = "0.16"
egui = "0.21"
egui_winit_vulkano = "0.23"
egui = "0.20"
egui_winit_vulkano = "0.22"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
ash = "*"
utf-8 = "0.7"
serde = { version = "*", features = ["derive"] }
serde_json = "*"
utf-8 = "*"
rayon = "*"
rayon = "1.7"
rand = "0.8.5"
+4 -4
View File
@@ -24,7 +24,7 @@ layout(location=1)in vec4 tri_pos;
layout(location=0)out vec4 f_color;
/// SHARED CODE ///
vec3 shading(vec3 normal, vec3 position)
vec3 shading(vec3 normal, vec4 position)
{
vec3 accum=vec3(0.,0.,0.);
mat3 rotation=mat3(pc.world[0].xyz,pc.world[1].xyz,pc.world[2].xyz);
@@ -32,7 +32,7 @@ vec3 shading(vec3 normal, vec3 position)
for(int i=0;i<light_uniforms.light_count;i++)
{
accum+=light_uniforms.col[i].xyz*((dot(normalize(rotation*normal),normalize(light_uniforms.pos[i].xyz-position))*.5)+.5);
accum+=light_uniforms.col[i].xyz*((dot(normalize(rotation*normal),normalize(light_uniforms.pos[i].xyz-position.xyz))*.5)+.5);
}
return accum;
@@ -135,7 +135,7 @@ void main(){
{
vec3 n=getNormal(p,td.y);
//f_color=vec4(1.);
f_color=vec4(shading(n, p),1.);
f_color=vec4(shading(n, inverse(pc.world)*vec4(p,1.)),1.);
vec4 tpoint=camera_uniforms.proj*camera_uniforms.view*pc.world*vec4(p,1);
gl_FragDepth=(tpoint.z/tpoint.w);
@@ -151,7 +151,7 @@ void main(){
//Mesh Surface Entrypoint
void main(){
f_color=vec4(shading(tri_normal, tri_pos.xyz),1.);
f_color=vec4(shading(tri_normal, tri_pos),1.);
}
#endif
+1 -1
View File
@@ -54,7 +54,7 @@ pub fn gui_up(gui: &mut Gui, state: &mut GState) {
gui.immediate_ui(|gui| {
let ctx = gui.context();
egui::SidePanel::left(Id::new("main_left"))
.frame(Frame::default().fill(Color32::from_rgba_unmultiplied(100, 100, 100, 200)))
.frame(Frame::default().fill(Color32::from_rgba_unmultiplied(50, 50, 50, 200)))
.show(&ctx, |ui| {
ui.vertical_centered(|ui| {
ui.add(egui::widgets::Label::new("Efficient Realtime Rendering of Complex Closed Form Implicit Surfaces Using Modern RTX Enabled GPUs"));
+21 -41
View File
@@ -30,7 +30,7 @@ use vulkano::swapchain::{PresentMode, SwapchainPresentInfo};
use vulkano::VulkanLibrary;
use winit::event::{DeviceEvent, ElementState, MouseButton, VirtualKeyCode};
use egui_winit_vulkano::Gui;
use egui_winit_vulkano::{Gui,GuiConfig};
use rayon::prelude::*;
use vulkano::pipeline::StateMode::Fixed;
use vulkano::{
@@ -236,13 +236,9 @@ fn main() {
vulkano_shaders::shader! {
ty: "vertex",
path: "src/triangle.vert.glsl",
types_meta: {
use bytemuck::{Pod, Zeroable};
#[derive(Clone, Copy, Zeroable, Pod, Debug)]
},
vulkan_version: "1.2",
spirv_version: "1.5"
spirv_version: "1.5",
custom_derives: [Debug, Clone, Copy],
}
}
@@ -250,14 +246,10 @@ fn main() {
vulkano_shaders::shader! {
ty: "fragment",
path: "src/frag.glsl",
types_meta: {
use bytemuck::{Pod, Zeroable};
#[derive(Clone, Copy, Zeroable, Pod, Debug)]
},
vulkan_version: "1.2",
spirv_version: "1.5",
define: [("triangle","1")]
define: [("triangle","1")],
custom_derives: [Debug, Clone, Copy],
}
}
@@ -265,13 +257,9 @@ fn main() {
vulkano_shaders::shader! {
ty: "mesh",
path: "src/implicit.mesh.glsl",
types_meta: {
use bytemuck::{Pod, Zeroable};
#[derive(Clone, Copy, Zeroable, Pod, Debug)]
},
vulkan_version: "1.2",
spirv_version: "1.5"
spirv_version: "1.5",
custom_derives: [Debug, Clone, Copy],
}
}
@@ -279,13 +267,9 @@ fn main() {
vulkano_shaders::shader! {
ty: "task",
path: "src/implicit.task.glsl",
types_meta: {
use bytemuck::{Pod, Zeroable};
#[derive(Clone, Copy, Zeroable, Pod, Debug)]
},
vulkan_version: "1.2",
spirv_version: "1.5"
spirv_version: "1.5",
custom_derives: [Debug, Clone, Copy],
}
}
@@ -293,14 +277,10 @@ fn main() {
vulkano_shaders::shader! {
ty: "fragment",
path: "src/frag.glsl",
types_meta: {
use bytemuck::{Pod, Zeroable};
#[derive(Clone, Copy, Zeroable, Pod, Debug)]
},
vulkan_version: "1.2",
spirv_version: "1.5",
define: [("implicit","1")]
define: [("implicit","1")],
custom_derives: [Debug, Clone, Copy],
}
}
@@ -308,13 +288,9 @@ fn main() {
vulkano_shaders::shader!{
ty: "compute",
path: "src/fuzz.comp.glsl",
types_meta: {
use bytemuck::{Pod, Zeroable};
#[derive(Clone, Copy, Zeroable, Pod, Debug)]
},
vulkan_version: "1.2",
spirv_version: "1.5",
custom_derives: [Debug, Clone, Copy],
}
}
@@ -483,9 +459,13 @@ fn main() {
let mut gui = Gui::new_with_subpass(
&event_loop,
surface.clone(),
None,
queue.clone(),
Subpass::from(render_pass.clone(), 1).unwrap(),
GuiConfig {
preferred_format: Some(images[0].format()),
is_overlay: true,
samples: SampleCount::Sample4
}
);
let mut campos = Point3 {
@@ -707,11 +687,11 @@ fn main() {
* Matrix4::from_angle_z(Deg(180f32))
* Matrix4::from_translation(Point3::origin() - campos);
let pc = mesh_vs::ty::PushConstantData {
let pc = mesh_vs::PushConstantData {
world: Matrix4::identity().into(),
};
let uniform_data = implicit_fs::ty::Camera {
let uniform_data = implicit_fs::Camera {
view: view.into(),
proj: proj.into(),
campos: (campos).into(),
@@ -740,7 +720,7 @@ fn main() {
col[i][2] = light.colour.z;
}
let uniform_data = mesh_fs::ty::Lights {
let uniform_data = mesh_fs::Lights {
pos,
col,
light_count: gstate.lights.len() as u32,
@@ -815,7 +795,7 @@ fn main() {
[1.,1.,1.,1.,5.,1.]
),true);
let compute_result_buffer:Subbuffer<[cs::ty::Results]> = uniform_buffer.allocate_slice((fake_csg.len()+1) as u64).unwrap();
let compute_result_buffer:Subbuffer<[cs::Results]> = uniform_buffer.allocate_slice((fake_csg.len()+1) as u64).unwrap();
let compute_layout = compute_pipeline.layout().set_layouts().get(0).unwrap();