From 2a1575c5cce111d6d3ee938f04ad2ca9e040c0cc Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sat, 3 Nov 2018 20:36:05 -0400 Subject: [PATCH] Readability changes --- src/dofpass.cpp | 4 +++- src/main.cpp | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/dofpass.cpp b/src/dofpass.cpp index f848093..966af4a 100644 --- a/src/dofpass.cpp +++ b/src/dofpass.cpp @@ -319,8 +319,10 @@ void DoFPass::createPipeline() { } void DoFPass::createBokehImage() { - int width, height, channels; + int width = 0, height = 0, channels = 0; stbi_uc* pixels = stbi_load("data/bokeh.png", &width, &height, &channels, STBI_rgb_alpha); + if(pixels == nullptr) + return; // haha what VkImageCreateInfo imageCreateInfo = {}; imageCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO; diff --git a/src/main.cpp b/src/main.cpp index 20a66fa..d639619 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -152,7 +152,7 @@ Cinematic* loadCinematic(const char* path) { nlohmann::json json; file >> json; - Cinematic* cinematic = new Cinematic(); + auto cinematic = new Cinematic(); for(auto shotObject : json["shots"]) { Shot* shot = new Shot(); shot->start = shotObject["start"]; @@ -166,7 +166,7 @@ Cinematic* loadCinematic(const char* path) { } for(auto animationObject : shotObject["animations"]) { - Animation* animation = new Animation(); + auto animation = new Animation(); for(auto mesh : shot->meshes) { if(mesh->name == animationObject["target"]) animation->target = mesh;