]> git.nega.tv - josh/narcissus/commitdiff
Let there be light!
authorJoshua Simmons <josh@nega.tv>
Wed, 16 Nov 2022 23:42:12 +0000 (00:42 +0100)
committerJoshua Simmons <josh@nega.tv>
Wed, 16 Nov 2022 23:42:12 +0000 (00:42 +0100)
narcissus/src/main.rs
narcissus/src/shaders/basic.frag.glsl
narcissus/src/shaders/basic.frag.spv

index 277d13c3f1da4ea8ea59fdf66028cb92c3c46600..fa32f451dbaebd35f5894d2e75574f907cf5fb6e 100644 (file)
@@ -6,9 +6,8 @@ use narcissus_gpu::{
     create_vulkan_device, Access, Bind, BindGroupLayoutDesc, BindGroupLayoutEntryDesc, BindingType,
     Buffer, BufferDesc, BufferImageCopy, BufferUsageFlags, ClearValue, CompareOp, CullingMode,
     Device, Extent2d, Extent3d, FrontFace, GraphicsPipelineDesc, GraphicsPipelineLayout, Image,
-    ImageAspectFlags, ImageBarrier, ImageDesc, ImageDimension, ImageFormat, ImageLayout,
-    ImageSubresourceLayers, ImageSubresourceRange, ImageUsageFlags, IndexType, LoadOp,
-    MemoryLocation, Offset2d, Offset3d, PolygonMode, RenderingAttachment, RenderingDesc,
+    ImageBarrier, ImageDesc, ImageDimension, ImageFormat, ImageLayout, ImageUsageFlags, IndexType,
+    LoadOp, MemoryLocation, Offset2d, Offset3d, PolygonMode, RenderingAttachment, RenderingDesc,
     SamplerAddressMode, SamplerDesc, SamplerFilter, Scissor, ShaderDesc, ShaderStageFlags, StoreOp,
     ThreadToken, Topology, TypedBind, Viewport,
 };
@@ -469,7 +468,7 @@ pub fn main() {
             device.acquire_swapchain(&frame, main_window, ImageFormat::BGRA8_SRGB);
 
         let frame_start = Instant::now() - start_time;
-        let frame_start = frame_start.as_secs_f32() * 0.01;
+        let frame_start = frame_start.as_secs_f32() * 0.125;
 
         for (i, transform) in shark_transforms.iter_mut().enumerate() {
             let direction = if i & 1 == 0 { 1.0 } else { -1.0 };
index 26205a1914b7914848cb6d5a80ec9b4ae8b65c2b..5b23cbd99bb2b0ed457361ccfe08c7d8016d970f 100644 (file)
@@ -8,7 +8,7 @@ layout(location = 1) in vec3 normal;
 layout(location = 0) out vec4 outColor;
 
 void main() {
-    float NdotL = max(dot(normal, vec3(0.0, 1.0, 0.0)), 0.2f);
+    float NdotL = max(dot(normal, vec3(0.0, 1.0, 0.0)), 0.1f);
     vec3 rgb = texture(sampler2D(tex, texSampler), vec2(texcoord.x, texcoord.y)).rgb;
-    outColor = vec4(rgb, 1.0);
+    outColor = vec4(rgb * NdotL, 1.0);
 }
\ No newline at end of file
index bc78ab3f5ceca86fb25f35dce99dc6edca17fa1c..a297aed4d56b8d95aa8742e01b35bd86ea3a47cb 100644 (file)
Binary files a/narcissus/src/shaders/basic.frag.spv and b/narcissus/src/shaders/basic.frag.spv differ