-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLight.h
More file actions
63 lines (48 loc) · 1.63 KB
/
Light.h
File metadata and controls
63 lines (48 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/* SimShip by Edouard Halbert
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License
http://creativecommons.org/licenses/by-nc-nd/4.0/ */
#pragma once
// 1. PROJET
#include "Utility.h"
#include "vulkan_device.hpp"
#include "vulkan_ubo.hpp"
#include "Camera.h"
// 2. LIB
#include <vulkan/vulkan.h>
#define GLM_FORCE_DEPTH_ZERO_TO_ONE
#include <glm/glm.hpp>
using namespace glm;
// 3. WIN
#include <array>
#include <memory>
using namespace std;
class Light
{
public:
Light(shared_ptr<VulkanDevice> vulkanDevice, VkRenderPass renderPass, VkExtent2D extent);
~Light();
// Called once per frame for each navigation light
void Render(VkCommandBuffer cmd, Camera& camera, vec3 lightPosition, vec3 lightColor, float lightIntensity = 1.0f, float starIntensity = 0.1f);
void Render(VkCommandBuffer cmd, Camera& camera, mat4 model, vec3 lightColor, float lightIntensity, float starIntensity);
void RecreatePipelines(VkRenderPass renderPass, VkExtent2D newExtent);
private:
struct sLightPushConstants
{
mat4 model;
mat4 view;
mat4 proj;
vec3 lightColor;
float lightIntensity;
float starIntensity;
float pad[3];
};
struct sVertexLight
{
vec2 position; // location 0
};
void CreateGeometry();
void CreatePipeline(VkRenderPass renderPass, VkExtent2D extent);
shared_ptr<VulkanDevice> mVulkanDevice;
sPipeline_x mPipeline;
unique_ptr<VulkanUBO> mVertexBuffer;
};