Added basic shadows to point lights; Better than directional shadows
This commit is contained in:
1 parent
4b14362a04
commit
1a8320feab
21 files changed
+250
-71
No files matched your search
@@ -145,7 +145,7 @@ namespace nf {
|
||||
}
|
||||
|
||||
bool Application::isKeyHeld(unsigned int code) {
|
||||
if (code > 7 && code < 164)
|
||||
if (code > 7 && code < 164 && GetForegroundWindow() == m_window)
|
||||
return GetKeyState(code) & 0x8000;
|
||||
return false;
|
||||
}
|
||||
@@ -328,6 +328,7 @@ namespace nf {
|
||||
m_currentState = m_states[m_nextState];
|
||||
m_currentState->setup(this);
|
||||
m_currentState->onEnter();
|
||||
m_currentState->setRunning();
|
||||
m_renderer->setFade(true, false, false);
|
||||
m_stateChange = false;
|
||||
once = true;
|
||||
@@ -364,12 +365,12 @@ namespace nf {
|
||||
return MNC_CLOSE << 16;
|
||||
}
|
||||
case WM_KEYDOWN: {
|
||||
if (wParam < 164 && !(lParam & (1 << 30)))
|
||||
if (wParam < 164 && !(lParam & (1 << 30)) && GetFocus() == hWnd)
|
||||
app->m_keysPressed[wParam] = true;
|
||||
return 0;
|
||||
}
|
||||
case WM_KEYUP: {
|
||||
if (wParam < 164)
|
||||
if (wParam < 164 && GetFocus() == hWnd)
|
||||
app->m_keysPressed[wParam] = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -230,8 +230,10 @@ namespace nf {
|
||||
}
|
||||
}
|
||||
|
||||
if (packName != "base.nfpack")
|
||||
Application::getApp()->getCurrentState()->m_nfObjects.push_back(this);
|
||||
if (packName != "base.nfpack") {
|
||||
if (!Application::getApp()->getCurrentState()->isRunning())
|
||||
Application::getApp()->getCurrentState()->m_nfObjects.push_back(this);
|
||||
}
|
||||
}
|
||||
|
||||
Asset* AssetPack::operator[](const char* in) {
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
namespace nf {
|
||||
Gamestate::Gamestate() :
|
||||
app(nullptr),
|
||||
camera(nullptr)
|
||||
camera(nullptr),
|
||||
m_running(false)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -14,12 +15,21 @@ namespace nf {
|
||||
void Gamestate::setup(Application* app) {
|
||||
this->app = app;
|
||||
camera = new Camera(this->app);
|
||||
m_running = false;
|
||||
}
|
||||
|
||||
void Gamestate::onEnter() {
|
||||
|
||||
}
|
||||
|
||||
bool Gamestate::isRunning() {
|
||||
return m_running;
|
||||
}
|
||||
|
||||
void Gamestate::setRunning() {
|
||||
m_running = true;
|
||||
}
|
||||
|
||||
void Gamestate::update(double deltaTime) {
|
||||
|
||||
}
|
||||
|
||||
@@ -57,7 +57,8 @@ namespace nf {
|
||||
m_vao->push<float>(2);
|
||||
m_vao->finishBufferLayout();
|
||||
|
||||
Application::getApp()->getCurrentState()->m_nfObjects.push_back(this);
|
||||
if (!Application::getApp()->getCurrentState()->isRunning())
|
||||
Application::getApp()->getCurrentState()->m_nfObjects.push_back(this);
|
||||
}
|
||||
|
||||
const char* Button::identity() {
|
||||
@@ -131,6 +132,6 @@ namespace nf {
|
||||
}
|
||||
|
||||
Button::~Button() {
|
||||
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
@@ -114,7 +114,8 @@ namespace nf {
|
||||
m_vao->push<float>(3);
|
||||
m_vao->finishBufferLayout();
|
||||
|
||||
Application::getApp()->getCurrentState()->m_nfObjects.push_back(this);
|
||||
if (!Application::getApp()->getCurrentState()->isRunning())
|
||||
Application::getApp()->getCurrentState()->m_nfObjects.push_back(this);
|
||||
}
|
||||
|
||||
bool Cubemap::isConstructed() {
|
||||
@@ -140,6 +141,6 @@ namespace nf {
|
||||
}
|
||||
|
||||
Cubemap::~Cubemap() {
|
||||
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,8 @@ namespace nf {
|
||||
model->loadedModel = m_model;
|
||||
}
|
||||
|
||||
Application::getApp()->getCurrentState()->m_nfObjects.push_back(this);
|
||||
if (!Application::getApp()->getCurrentState()->isRunning())
|
||||
Application::getApp()->getCurrentState()->m_nfObjects.push_back(this);
|
||||
}
|
||||
|
||||
bool Entity::isConstructed() {
|
||||
@@ -88,7 +89,7 @@ namespace nf {
|
||||
|
||||
void Entity::destroy() {
|
||||
m_constructed = false;
|
||||
if(m_model && !m_model->isBaseAsset())
|
||||
if (m_model && !m_model->isBaseAsset())
|
||||
delete m_model;
|
||||
m_model = nullptr;
|
||||
m_position = Vec3(0.0);
|
||||
@@ -97,6 +98,6 @@ namespace nf {
|
||||
}
|
||||
|
||||
Entity::~Entity() {
|
||||
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,8 @@ namespace nf {
|
||||
m_type = type;
|
||||
m_strength = (float)strength;
|
||||
|
||||
Application::getApp()->getCurrentState()->m_nfObjects.push_back(this);
|
||||
if (!Application::getApp()->getCurrentState()->isRunning())
|
||||
Application::getApp()->getCurrentState()->m_nfObjects.push_back(this);
|
||||
}
|
||||
|
||||
bool Light::isConstructed() {
|
||||
@@ -88,6 +89,6 @@ namespace nf {
|
||||
}
|
||||
|
||||
Light::~Light() {
|
||||
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
@@ -68,7 +68,8 @@ namespace nf {
|
||||
m_string = "Loading...";
|
||||
}
|
||||
else {
|
||||
Application::getApp()->getCurrentState()->m_nfObjects.push_back(this);
|
||||
if (!Application::getApp()->getCurrentState()->isRunning())
|
||||
Application::getApp()->getCurrentState()->m_nfObjects.push_back(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +96,7 @@ namespace nf {
|
||||
void Text::render(Shader* shader, unsigned int windowWidth, unsigned int windowHeight, bool onButton, float buttonWidth, float buttonHeight, const Vec2& buttonPos) {
|
||||
float scale = windowWidth / 4000.0f;
|
||||
if (onButton)
|
||||
scale *= buttonHeight / 100.0f;
|
||||
scale *= buttonWidth / 400.0f;
|
||||
float currX = (float)m_position.x * windowWidth, currY = (float)m_position.y * windowHeight;
|
||||
std::string::const_iterator si;
|
||||
if (m_centeredX || m_centeredY) {
|
||||
@@ -177,6 +178,6 @@ namespace nf {
|
||||
}
|
||||
|
||||
Text::~Text() {
|
||||
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
@@ -47,7 +47,8 @@ namespace nf {
|
||||
m_vao->push<float>(2);
|
||||
m_vao->finishBufferLayout();
|
||||
|
||||
Application::getApp()->getCurrentState()->m_nfObjects.push_back(this);
|
||||
if (!Application::getApp()->getCurrentState()->isRunning())
|
||||
Application::getApp()->getCurrentState()->m_nfObjects.push_back(this);
|
||||
}
|
||||
|
||||
const char* UITexture::identity() {
|
||||
@@ -100,6 +101,6 @@ namespace nf {
|
||||
}
|
||||
|
||||
UITexture::~UITexture() {
|
||||
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,8 @@
|
||||
namespace nf {
|
||||
Renderer::Renderer(Application* app) :
|
||||
m_shadowMapFBO(0),
|
||||
m_directionalDepthTexSize(0),
|
||||
m_pointDepthTexSize(0),
|
||||
m_cubemap(nullptr),
|
||||
m_fadeIn(false),
|
||||
m_fadeOut(false),
|
||||
@@ -71,6 +73,8 @@ namespace nf {
|
||||
|
||||
loadBaseAssets();
|
||||
|
||||
m_directionalDepthTexSize = 4096;
|
||||
m_pointDepthTexSize = 1024;
|
||||
createShadowMap();
|
||||
|
||||
if (!m_app->isCustomWindowIcon()) {
|
||||
@@ -176,7 +180,7 @@ namespace nf {
|
||||
currLightsDrawn = lightsRemaining;
|
||||
lightsRemaining -= currLightsDrawn;
|
||||
currLight += (int)currLightsDrawn;
|
||||
m_entityShader->setUniform("numberOfLights", (int)currLightsDrawn + 1);
|
||||
m_entityShader->setUniform("numberOfLights", (int)currLightsDrawn);
|
||||
for (unsigned int j = 0; j < currLightsDrawn; j++) {
|
||||
m_lights[j + (unsigned int)currLight]->bind(m_entityShader, j);
|
||||
}
|
||||
@@ -269,35 +273,78 @@ namespace nf {
|
||||
}
|
||||
|
||||
void Renderer::renderShadowMaps(unsigned int startingLight, unsigned int count) {
|
||||
glViewport(0, 0, 4096, 4096);
|
||||
float nearP = 0.1f, farP = 500.0f;
|
||||
glm::mat4 lightProj = glm::ortho(-50.0f, 50.0f, -50.0f, 50.0f, nearP, farP);
|
||||
float nearP = 0.1f, farP = 400.0f;
|
||||
glm::mat4 directionalLightProj = glm::ortho(-50.0f, 50.0f, -50.0f, 50.0f, nearP, farP);
|
||||
glm::mat4 pointLightProj = glm::perspective(glm::radians(90.0f), 1.0f, nearP, farP);
|
||||
glm::mat4 lightView;
|
||||
glm::mat4 lightSpaceMat;
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, m_shadowMapFBO);
|
||||
for (unsigned int i = 0; i < count; i++) {
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, m_shadowMaps[i], 0);
|
||||
glDrawBuffer(GL_NONE);
|
||||
glReadBuffer(GL_NONE);
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
Vec3 posTemp = m_lights[startingLight + i]->getPosition();
|
||||
glm::vec3 posTemp2(posTemp.x, posTemp.y, posTemp.z);
|
||||
lightView = glm::lookAt(posTemp2, glm::vec3(0.0), glm::vec3(0.0, 1.0, 0.0));
|
||||
lightSpaceMat = lightProj * lightView;
|
||||
m_directionalShadowShader->setUniform("lightSpace", lightSpaceMat);
|
||||
std::string stringPos = "lightSpaceMat[";
|
||||
stringPos += std::to_string(i);
|
||||
stringPos += "]";
|
||||
m_entityShader->setUniform(stringPos, lightSpaceMat);
|
||||
for (Entity* curr : m_lGame) {
|
||||
curr->render(m_directionalShadowShader, true);
|
||||
Light::Type type = m_lights[i]->getType();
|
||||
unsigned int tex = type == Light::Type::DIRECTIONAL ? m_directionalShadowMaps[i] : m_pointShadowMaps[i];
|
||||
switch (type) {
|
||||
case Light::Type::DIRECTIONAL: {
|
||||
glViewport(0, 0, m_directionalDepthTexSize, m_directionalDepthTexSize);
|
||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, tex, 0);
|
||||
glDrawBuffer(GL_NONE);
|
||||
glReadBuffer(GL_NONE);
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
Vec3 posTemp = m_lights[startingLight + i]->getPosition();
|
||||
glm::vec3 lightPos(posTemp.x, posTemp.y, posTemp.z);
|
||||
lightView = glm::lookAt(lightPos, glm::vec3(0.0), glm::vec3(0.0, 1.0, 0.0));
|
||||
lightSpaceMat = directionalLightProj * lightView;
|
||||
m_directionalShadowShader->setUniform("lightSpace", lightSpaceMat);
|
||||
std::string stringPos = "lightSpaceMat[";
|
||||
stringPos += std::to_string(i);
|
||||
stringPos += "]";
|
||||
m_entityShader->setUniform(stringPos, lightSpaceMat);
|
||||
for (Entity* curr : m_lGame) {
|
||||
curr->render(m_directionalShadowShader, true);
|
||||
}
|
||||
stringPos = "light[";
|
||||
stringPos += std::to_string(i);
|
||||
stringPos += "].directionalDepthTex";
|
||||
glActiveTexture(GL_TEXTURE3 + i);
|
||||
glBindTexture(GL_TEXTURE_2D, tex);
|
||||
m_entityShader->setUniform(stringPos, 3 + (int)i);
|
||||
break;
|
||||
}
|
||||
case Light::Type::POINT: {
|
||||
glViewport(0, 0, m_pointDepthTexSize, m_pointDepthTexSize);
|
||||
glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, tex, 0);
|
||||
glDrawBuffer(GL_NONE);
|
||||
glReadBuffer(GL_NONE);
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
Vec3 posTemp = m_lights[startingLight + i]->getPosition();
|
||||
glm::vec3 lightPos(posTemp.x, posTemp.y, posTemp.z);
|
||||
std::vector<glm::mat4> lightSpaceMats;
|
||||
lightSpaceMats.push_back(pointLightProj * glm::lookAt(lightPos, lightPos + glm::vec3(1.0, 0.0, 0.0), glm::vec3(0.0, -1.0, 0.0)));
|
||||
lightSpaceMats.push_back(pointLightProj * glm::lookAt(lightPos, lightPos + glm::vec3(-1.0, 0.0, 0.0), glm::vec3(0.0, -1.0, 0.0)));
|
||||
lightSpaceMats.push_back(pointLightProj * glm::lookAt(lightPos, lightPos + glm::vec3(0.0, 1.0, 0.0), glm::vec3(0.0, 0.0, 1.0)));
|
||||
lightSpaceMats.push_back(pointLightProj * glm::lookAt(lightPos, lightPos + glm::vec3(0.0, -1.0, 0.0), glm::vec3(0.0, 0.0, -1.0)));
|
||||
lightSpaceMats.push_back(pointLightProj * glm::lookAt(lightPos, lightPos + glm::vec3(0.0, 0.0, 1.0), glm::vec3(0.0, -1.0, 0.0)));
|
||||
lightSpaceMats.push_back(pointLightProj * glm::lookAt(lightPos, lightPos + glm::vec3(0.0, 0.0, -1.0), glm::vec3(0.0, -1.0, 0.0)));
|
||||
for (int j = 0; j < 6; j++) {
|
||||
std::string stringPos = "lightSpaceMat[";
|
||||
stringPos += std::to_string(j);
|
||||
stringPos += "]";
|
||||
m_pointShadowShader->setUniform(stringPos, lightSpaceMats[j]);
|
||||
}
|
||||
m_pointShadowShader->setUniform("farPlane", farP);
|
||||
m_pointShadowShader->setUniform("lightPos", lightPos);
|
||||
for (Entity* curr : m_lGame) {
|
||||
curr->render(m_pointShadowShader, true);
|
||||
}
|
||||
std::string stringPos = "light[";
|
||||
stringPos += std::to_string(i);
|
||||
stringPos += "].pointDepthTex";
|
||||
glActiveTexture(GL_TEXTURE3 + i);
|
||||
glBindTexture(GL_TEXTURE_CUBE_MAP, tex);
|
||||
m_entityShader->setUniform(stringPos, 3 + (int)i);
|
||||
m_entityShader->setUniform("farPlane", farP);
|
||||
break;
|
||||
}
|
||||
}
|
||||
stringPos = "light[";
|
||||
stringPos += std::to_string(i);
|
||||
stringPos += "].depthTex";
|
||||
glActiveTexture(GL_TEXTURE3 + i);
|
||||
glBindTexture(GL_TEXTURE_2D, m_shadowMaps[i]);
|
||||
m_entityShader->setUniform(stringPos, 3 + (int)i);
|
||||
}
|
||||
m_entityShader->setUniform("numMats", (int)count);
|
||||
}
|
||||
@@ -322,6 +369,10 @@ namespace nf {
|
||||
const char* directionalShadowVertex = m_baseAP["directionalShadowVertex.shader"]->data;
|
||||
const char* directionalShadowFragment = m_baseAP["directionalShadowFragment.shader"]->data;
|
||||
m_directionalShadowShader = new Shader(directionalShadowVertex, directionalShadowFragment);
|
||||
const char* pointShadowVertex = m_baseAP["pointShadowVertex.shader"]->data;
|
||||
const char* pointShadowGeometry = m_baseAP["pointShadowGeometry.shader"]->data;
|
||||
const char* pointShadowFragment = m_baseAP["pointShadowFragment.shader"]->data;
|
||||
m_pointShadowShader = new Shader(pointShadowVertex, pointShadowFragment, pointShadowGeometry);
|
||||
|
||||
BaseAssets::cube = (AModel*)m_baseAP["cube.obj"];
|
||||
BaseAssets::plane = (AModel*)m_baseAP["plane.obj"];
|
||||
@@ -340,17 +391,28 @@ namespace nf {
|
||||
glGenFramebuffers(1, &m_shadowMapFBO);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, m_shadowMapFBO);
|
||||
for (unsigned int i = 0; i < m_texSlots; i++) {
|
||||
unsigned int depthMap;
|
||||
glGenTextures(1, &depthMap);
|
||||
glBindTexture(GL_TEXTURE_2D, depthMap);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, 4096, 4096, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL);
|
||||
unsigned int directionalDepthMap, pointDepthMap;
|
||||
glGenTextures(1, &directionalDepthMap);
|
||||
glGenTextures(1, &pointDepthMap);
|
||||
glBindTexture(GL_TEXTURE_2D, directionalDepthMap);
|
||||
glTexStorage2D(GL_TEXTURE_2D, 1, GL_DEPTH_COMPONENT24, m_directionalDepthTexSize, m_directionalDepthTexSize);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
|
||||
float borderColor[] = { 1.0f, 1.0f, 1.0f, 1.0f };
|
||||
glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor);
|
||||
m_shadowMaps.push_back(depthMap);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
glBindTexture(GL_TEXTURE_CUBE_MAP, pointDepthMap);
|
||||
glTexStorage2D(GL_TEXTURE_CUBE_MAP, 1, GL_DEPTH_COMPONENT24, m_pointDepthTexSize, m_pointDepthTexSize);
|
||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
|
||||
glBindTexture(GL_TEXTURE_CUBE_MAP, 0);
|
||||
m_directionalShadowMaps.push_back(directionalDepthMap);
|
||||
m_pointShadowMaps.push_back(pointDepthMap);
|
||||
}
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
}
|
||||
|
||||
@@ -5,16 +5,30 @@
|
||||
#include "Utility.h"
|
||||
|
||||
namespace nf {
|
||||
Shader::Shader(const char* vertexSource, const char* fragmentSource) {
|
||||
Shader::Shader(const char* vertexSource, const char* fragmentSource, const char* geometrySource) {
|
||||
m_id = glCreateProgram();
|
||||
unsigned int vs = glCreateShader(GL_VERTEX_SHADER);
|
||||
unsigned int fs = glCreateShader(GL_FRAGMENT_SHADER);
|
||||
unsigned int gs = 0;
|
||||
glShaderSource(vs, 1, &vertexSource, nullptr);
|
||||
glShaderSource(fs, 1, &fragmentSource, nullptr);
|
||||
glCompileShader(vs);
|
||||
glCompileShader(fs);
|
||||
for (int i = 0; i < 2; i++) {
|
||||
unsigned int curr = (i == 0 ? vs : fs);
|
||||
if (geometrySource) {
|
||||
gs = glCreateShader(GL_GEOMETRY_SHADER);
|
||||
glShaderSource(gs, 1, &geometrySource, nullptr);
|
||||
glCompileShader(gs);
|
||||
}
|
||||
for (int i = 0; i < 3; i++) {
|
||||
unsigned int curr;
|
||||
if (i == 0)
|
||||
curr = vs;
|
||||
else if (i == 1)
|
||||
curr = fs;
|
||||
else if (i == 2)
|
||||
curr = gs;
|
||||
if (curr == 0)
|
||||
break;
|
||||
int result;
|
||||
glGetShaderiv(curr, GL_COMPILE_STATUS, &result);
|
||||
if (result != GL_TRUE) {
|
||||
@@ -28,6 +42,7 @@ namespace nf {
|
||||
}
|
||||
glAttachShader(m_id, vs);
|
||||
glAttachShader(m_id, fs);
|
||||
if (gs) glAttachShader(m_id, gs);
|
||||
glLinkProgram(m_id);
|
||||
glValidateProgram(m_id);
|
||||
int result;
|
||||
@@ -39,8 +54,14 @@ namespace nf {
|
||||
glGetProgramInfoLog(m_id, length, &length, message);
|
||||
Error("OpenGL Error: " + (std::string)message);
|
||||
}
|
||||
glDetachShader(m_id, vs);
|
||||
glDetachShader(m_id, fs);
|
||||
glDeleteShader(vs);
|
||||
glDeleteShader(fs);
|
||||
if (gs) {
|
||||
glDetachShader(m_id, gs);
|
||||
glDeleteShader(gs);
|
||||
}
|
||||
}
|
||||
|
||||
void Shader::bind() {
|
||||
|
||||
@@ -17,6 +17,8 @@ namespace nf {
|
||||
void setup(Application* app);
|
||||
|
||||
virtual void onEnter();
|
||||
bool isRunning();
|
||||
void setRunning();
|
||||
|
||||
virtual void update(double deltaTime);
|
||||
Camera* getCamera();
|
||||
@@ -29,5 +31,6 @@ namespace nf {
|
||||
protected:
|
||||
Application* app;
|
||||
Camera* camera;
|
||||
bool m_running;
|
||||
};
|
||||
}
|
||||
@@ -52,7 +52,10 @@ namespace nf {
|
||||
AssetPack m_baseAP;
|
||||
|
||||
unsigned int m_shadowMapFBO;
|
||||
std::vector<unsigned int> m_shadowMaps;
|
||||
int m_directionalDepthTexSize;
|
||||
int m_pointDepthTexSize;
|
||||
std::vector<unsigned int> m_directionalShadowMaps;
|
||||
std::vector<unsigned int> m_pointShadowMaps;
|
||||
unsigned int m_texSlots;
|
||||
|
||||
std::vector<Light*> m_lights;
|
||||
@@ -65,6 +68,7 @@ namespace nf {
|
||||
Shader* m_cubemapShader;
|
||||
Shader* m_fadeShader;
|
||||
Shader* m_directionalShadowShader;
|
||||
Shader* m_pointShadowShader;
|
||||
|
||||
bool m_fadeIn, m_fadeOut;
|
||||
bool m_fadeNoText;
|
||||
|
||||
@@ -45,7 +45,10 @@ namespace nf {
|
||||
AssetPack m_baseAP;
|
||||
|
||||
unsigned int m_shadowMapFBO;
|
||||
std::vector<unsigned int> m_shadowMaps;
|
||||
int m_directionalDepthTexSize;
|
||||
int m_pointDepthTexSize;
|
||||
std::vector<unsigned int> m_directionalShadowMaps;
|
||||
std::vector<unsigned int> m_pointShadowMaps;
|
||||
unsigned int m_texSlots;
|
||||
|
||||
std::vector<Light*> m_lights;
|
||||
@@ -58,6 +61,7 @@ namespace nf {
|
||||
Shader* m_cubemapShader;
|
||||
Shader* m_fadeShader;
|
||||
Shader* m_directionalShadowShader;
|
||||
Shader* m_pointShadowShader;
|
||||
|
||||
bool m_fadeIn, m_fadeOut;
|
||||
bool m_fadeNoText;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
namespace nf {
|
||||
class Shader {
|
||||
public:
|
||||
Shader(const char* vertexSource, const char* fragmentSource);
|
||||
Shader(const char* vertexSource, const char* fragmentSource, const char* geometrySource = nullptr);
|
||||
|
||||
void bind();
|
||||
void setUniform(const std::string& name, glm::mat4& data);
|
||||
|
||||
Reference in new issue
Block a user