GlistEngine
Loading...
Searching...
No Matches
gShadowMap.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016 Nitra Games Ltd.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by me.
11 */
12
13#ifndef GRAPHICS_GSHADOWMAP_H_
14#define GRAPHICS_GSHADOWMAP_H_
15
16#include "gRenderObject.h"
17#include "gFbo.h"
18#include "gLight.h"
19#include "gCamera.h"
20#include <vector>
21
22class gShadowMap : public gRenderObject {
23public:
25 virtual ~gShadowMap();
26
27 void allocate(gLight* light, gCamera* camera, int width = 4096, int height = 4096);
28 bool isAllocated() const;
29 int getWidth() const;
30 int getHeight() const;
31
32 void update();
33
34 void setLight(gLight* light);
35 void setCamera(gCamera* camera);
36 gLight* getLight() const;
38
39 void activate();
40 void deactivate();
41 bool isActivated() const;
42
43 void enable();
44 void disable();
45 bool isEnabled() const;
46
47 void setLightProjection(glm::mat4 lightProjection);
48 void setLightProjection(float leftx, float rightx, float fronty, float backy, float nearz, float farz);
49 void setLightView(glm::mat4 lightView);
50 glm::mat4 getLightProjection() const;
51 glm::mat4 getLightView() const;
52 glm::mat4 getLightMatrix() const;
53
55
56 unsigned int getVulkanDepthTextureId() const;
57 void bindVulkanShadowMap(int slot = 1);
58
59private:
60 bool isallocated, isactivated, isenabled;
61 gLight* light;
62 gCamera* camera;
63 glm::mat4 lightprojection, lightview, lightmatrix;
64 glm::vec3 lightposition;
65 gFbo depthfbo;
66 int width, height;
67 int shadowmaptextureslot;
68 bool updateshadows;
69
70 unsigned int vkdepthtextureid;
71 void allocateVulkanResources();
72 void releaseVulkanResources();
73};
74
75#endif /* GRAPHICS_GSHADOWMAP_H_ */
Definition gCamera.h:18
Definition gFbo.h:15
Definition gLight.h:22
gLight * getLight() const
glm::mat4 getLightMatrix() const
int getHeight() const
void allocate(gLight *light, gCamera *camera, int width=4096, int height=4096)
gCamera * getCamera() const
void deactivate()
bool isActivated() const
void setLight(gLight *light)
void setLightProjection(float leftx, float rightx, float fronty, float backy, float nearz, float farz)
void enable()
void activate()
bool isAllocated() const
void setLightProjection(glm::mat4 lightProjection)
void setLightView(glm::mat4 lightView)
void disable()
void bindVulkanShadowMap(int slot=1)
glm::mat4 getLightProjection() const
bool isEnabled() const
void setCamera(gCamera *camera)
void update()
virtual ~gShadowMap()
glm::mat4 getLightView() const
gFbo & getDepthFbo()
unsigned int getVulkanDepthTextureId() const
int getWidth() const