-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLighthouses.h
More file actions
77 lines (61 loc) · 1.83 KB
/
Copy pathLighthouses.h
File metadata and controls
77 lines (61 loc) · 1.83 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/* 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. PROJECT
#include "Utility.h"
#include "vulkan_device.hpp"
#include "vulkan_ubo.hpp"
#include "Camera.h"
#include "Light.h"
#include "Beam.h"
// 2. LIB
#include <vulkan/vulkan.h>
#define GLM_FORCE_DEPTH_ZERO_TO_ONE
#include <glm/glm.hpp>
using namespace glm;
#include "pugixml/pugixml.hpp"
#ifdef _DEBUG
#pragma comment(lib, "pugixml/Debug/pugixml.lib")
#else
#pragma comment(lib, "pugixml/Release/pugixml.lib")
#endif
// 3. WIN
#include <array>
#include <memory>
#include <random>
#include <ctime>
using namespace std;
#pragma once
enum eLightType { beam = 0, light }; // Flash, Occultation
struct sLighthouse
{
wstring name;
vec3 pos;
float range;
eLightType type;
vector<float> vAngles;
vector<vec3> vColors;
float durationOfTurn;
double angleStart;
bool isInViewFrustum;
Beam * beam;
};
class Lighthouses
{
public:
Lighthouses(shared_ptr<VulkanDevice> vulkanDevice, VkRenderPass renderPass, VkExtent2D extent, const wstring filename);
~Lighthouses();
void LoadFromXML(const wstring filename);
void RenderLights(VkCommandBuffer commandBuffer, uint32_t frame, Camera& camera, bool bLights = false);
void RenderBeams(VkCommandBuffer commandBuffer, uint32_t frame, Camera& camera, bool bLights = false);
void RecreatePipelines(VkRenderPass renderPass, VkExtent2D newExtent);
bool bVisible = true;
private:
vec3 GetSectorColor(sLighthouse& lh, float angleDeg);
shared_ptr<VulkanDevice> mVulkanDevice;
VkRenderPass mRenderPass;
VkExtent2D mExtent;
vector<sLighthouse> mvLighthouses;
unique_ptr<Light> mLight;
};