@@ -100,7 +100,7 @@ namespace rev {
100
100
101
101
// UI pipeline layout
102
102
vk::PushConstantRange camerasPushRange (
103
- vk::ShaderStageFlagBits::eVertex,
103
+ vk::ShaderStageFlagBits::eVertex | vk::ShaderStageFlagBits::eFragment ,
104
104
0 , sizeof (CameraPushConstants));
105
105
106
106
vk::PipelineLayoutCreateInfo layoutInfo ({},
@@ -135,6 +135,10 @@ namespace rev {
135
135
createCamera ();
136
136
m_sceneRoot->init ();
137
137
138
+ m_cameraPushC.ambiendColor = Vec4f (0 .2f , 0 .2f , 0 .4f );
139
+ m_cameraPushC.lightColor = Vec4f (1 .f , 1 .f , 1 .f );
140
+ m_cameraPushC.lightDir = normalize (Vec4f (1 .f , 1 .f , 1 .f , 0 .f ));
141
+
138
142
/*
139
143
// Default scene light
140
144
{
@@ -391,7 +395,7 @@ namespace rev {
391
395
}
392
396
393
397
// Clear
394
- auto clearColor = vk::ClearColorValue (std::array<float ,4 >{ m_bgColor, m_bgColor, m_bgColor , 1 .f });
398
+ auto clearColor = vk::ClearColorValue (std::array<float ,4 >{ m_cameraPushC. ambiendColor . x (), m_cameraPushC. ambiendColor . y (), m_cameraPushC. ambiendColor . z () , 1 .f });
395
399
396
400
auto swapchainImage = renderContext ().swapchainAquireNextImage (m_imageAvailableSemaphore, cmd);
397
401
@@ -444,7 +448,12 @@ namespace rev {
444
448
float aspect = viewport.width / viewport.height ;
445
449
m_cameraPushC.proj = mFlybyCam ->projection (aspect);// .transpose();
446
450
m_cameraPushC.view = mFlybyCam ->view ();// .transpose();
447
- cmd.pushConstants <CameraPushConstants>(m_gbufferPipelineLayout, vk::ShaderStageFlagBits::eVertex, 0 , m_cameraPushC);
451
+
452
+ cmd.pushConstants <CameraPushConstants>(
453
+ m_gbufferPipelineLayout,
454
+ vk::ShaderStageFlagBits::eVertex | vk::ShaderStageFlagBits::eFragment,
455
+ 0 ,
456
+ m_cameraPushC);
448
457
449
458
// Draw all instances in a single batch
450
459
m_rasterData.bindBuffers (cmd);
@@ -553,6 +562,8 @@ namespace rev {
553
562
{
554
563
ImGui::Text (" %s" , " Sample text" );
555
564
ImGui::SliderFloat (" Background" , &m_bgColor, 0 .f , 1 .f );
565
+ ImGui::ColorPicker3 (" Ambient Color" , reinterpret_cast <float *>(&m_cameraPushC.ambiendColor ));
566
+ ImGui::ColorPicker3 (" Light Color" , reinterpret_cast <float *>(&m_cameraPushC.lightColor ));
556
567
}
557
568
ImGui::End ();
558
569
0 commit comments