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 applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef GRAPHICS_GSHADOWMAP_H_
18#define GRAPHICS_GSHADOWMAP_H_
19
20#include "gRenderObject.h"
21#include "gFbo.h"
22#include "gLight.h"
23#include "gCamera.h"
24
25
26class gShadowMap : public gRenderObject {
27public:
29 virtual ~gShadowMap();
30
31 void allocate(gLight* light, gCamera* camera, int width = 4096, int height = 4096);
32 bool isAllocated() const;
33 int getWidth() const;
34 int getHeight() const;
35
36 void update();
37
38 void setLight(gLight* light);
39 void setCamera(gCamera* camera);
40 gLight* getLight() const;
42
43 void activate();
44 void deactivate();
45 bool isActivated() const;
46
47 void enable();
48 void disable();
49 bool isEnabled() const;
50
51 void setLightProjection(glm::mat4 lightProjection);
52 void setLightProjection(float leftx, float rightx, float fronty, float backy, float nearz, float farz);
53 void setLightView(glm::mat4 lightView);
54 glm::mat4 getLightProjection() const;
55 glm::mat4 getLightView() const;
56 glm::mat4 getLightMatrix() const;
57
59
60
61private:
62 bool isallocated, isactivated, isenabled;
63 gLight* light;
64 gCamera* camera;
65 glm::mat4 lightprojection, lightview, lightmatrix;
66 glm::vec3 lightposition;
67 gFbo depthfbo;
68 int width, height;
69 int shadowmaptextureslot;
70 bool updateshadows;
71};
72
73#endif /* GRAPHICS_GSHADOWMAP_H_ */
Definition gCamera.h:19
Definition gFbo.h:15
Definition gLight.h:22
Definition gRenderObject.h:25
Definition gShadowMap.h:26
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()
glm::mat4 getLightProjection() const
bool isEnabled() const
void setCamera(gCamera *camera)
void update()
virtual ~gShadowMap()
glm::mat4 getLightView() const
gFbo & getDepthFbo()
int getWidth() const