Skip to content
Snippets Groups Projects
Verified Commit 60166469 authored by Tobias Frisch's avatar Tobias Frisch
Browse files

Update first_scene project

parent 97b0e701
No related branches found
No related tags found
No related merge requests found
...@@ -4,12 +4,28 @@ ...@@ -4,12 +4,28 @@
layout(location = 0) in vec3 passNormal; layout(location = 0) in vec3 passNormal;
layout(location = 1) in vec2 passUV; layout(location = 1) in vec2 passUV;
layout(location = 0) out vec3 outColor; layout(location = 0) out vec4 outColor;
layout(set=0, binding=0) uniform texture2D meshTexture; layout(set=0, binding=0) uniform texture2D meshTexture;
layout(set=0, binding=1) uniform sampler textureSampler; layout(set=0, binding=1) uniform sampler textureSampler;
void main() { void main() {
outColor = texture(sampler2D(meshTexture, textureSampler), passUV).rgb; vec3 lightDirection = normalize(vec3(0.1f, -0.9f, 0.1f));
//outColor = passNormal * 0.5 + 0.5;
float ambient = 0.35f;
float diffuse = max(0.0f, -dot(passNormal, lightDirection));
float specular = pow(diffuse, 6.0f);
float brightness = sqrt(
(ambient + diffuse + specular) /
(2.0f + ambient)
);
vec4 color = texture(sampler2D(meshTexture, textureSampler), passUV);
if (color.a <= 0.0f) {
discard;
}
outColor = vec4(color.rgb * brightness, color.a);
} }
\ No newline at end of file
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include <GLFW/glfw3.h> #include <GLFW/glfw3.h>
#include <vkcv/camera/CameraManager.hpp> #include <vkcv/camera/CameraManager.hpp>
#include <vkcv/gui/GUI.hpp> #include <vkcv/gui/GUI.hpp>
#include <chrono>
#include <vkcv/asset/asset_loader.hpp> #include <vkcv/asset/asset_loader.hpp>
#include <vkcv/shader/GLSLCompiler.hpp> #include <vkcv/shader/GLSLCompiler.hpp>
#include <vkcv/scene/Scene.hpp> #include <vkcv/scene/Scene.hpp>
...@@ -18,12 +17,6 @@ int main(int argc, const char** argv) { ...@@ -18,12 +17,6 @@ int main(int argc, const char** argv) {
vkcv::Features features; vkcv::Features features;
features.requireExtension(VK_KHR_SWAPCHAIN_EXTENSION_NAME); features.requireExtension(VK_KHR_SWAPCHAIN_EXTENSION_NAME);
features.requireExtensionFeature<vk::PhysicalDeviceDescriptorIndexingFeatures>(
VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME,
[](vk::PhysicalDeviceDescriptorIndexingFeatures& features) {
features.setDescriptorBindingPartiallyBound(true);
}
);
vkcv::Core core = vkcv::Core::create( vkcv::Core core = vkcv::Core::create(
applicationName, applicationName,
...@@ -31,6 +24,7 @@ int main(int argc, const char** argv) { ...@@ -31,6 +24,7 @@ int main(int argc, const char** argv) {
{vk::QueueFlagBits::eTransfer, vk::QueueFlagBits::eGraphics, vk::QueueFlagBits::eCompute}, {vk::QueueFlagBits::eTransfer, vk::QueueFlagBits::eGraphics, vk::QueueFlagBits::eCompute},
features features
); );
vkcv::WindowHandle windowHandle = core.createWindow(applicationName, windowWidth, windowHeight, true); vkcv::WindowHandle windowHandle = core.createWindow(applicationName, windowWidth, windowHeight, true);
vkcv::Window& window = core.getWindow(windowHandle); vkcv::Window& window = core.getWindow(windowHandle);
vkcv::camera::CameraManager cameraManager(window); vkcv::camera::CameraManager cameraManager(window);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment