stuff
This commit is contained in:
parent
dc5654ba9a
commit
3ffed086b1
7 changed files with 54 additions and 9 deletions
|
|
@ -4,10 +4,14 @@
|
|||
#include <engine/Backend/Model.h>
|
||||
|
||||
#include <glad/glad.h>
|
||||
#include <glfw/include/GLFW/glfw3.h>
|
||||
#include <optional>
|
||||
#include <iostream>
|
||||
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
|
||||
#include "engine/Backend/Backend.h"
|
||||
|
||||
namespace game
|
||||
{
|
||||
const int SCREEN_WIDTH = 1366;
|
||||
|
|
@ -26,9 +30,19 @@ namespace game
|
|||
shader.emplace("assets/shaders/basicVertex.vert", "assets/shaders/basicFragment.frag");
|
||||
shader->Use();
|
||||
|
||||
shader->setInt("ourTexture", 0);
|
||||
shader->setInt("material.diffuse", 0);
|
||||
shader->setInt("material.specular", 1);
|
||||
|
||||
shader->setInt("numberOfPointLights", 1);
|
||||
shader->setInt("numberOfSpotLights", 1);
|
||||
|
||||
camera.emplace(glm::vec3(0.0f, 0.0f, 0.0f));
|
||||
model.emplace("assets/models/sponza/Sponza.gltf");
|
||||
|
||||
glfwSetInputMode(engine::Backend::getWindow(), GLFW_CURSOR, GLFW_CURSOR_DISABLED);
|
||||
glfwSetInputMode(engine::Backend::getWindow(), GLFW_RAW_MOUSE_MOTION, GLFW_TRUE);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -40,6 +54,32 @@ namespace game
|
|||
shader->Use();
|
||||
|
||||
camera->Update(shader.value(), SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
|
||||
shader->setFloat("material.shininess", 32.0f);
|
||||
|
||||
shader->setVec3("dirLight.direction", -0.2f, -1.0f, -0.3f);
|
||||
shader->setVec3("dirLight.ambient", 0.05f, 0.05f, 0.05f);
|
||||
shader->setVec3("dirLight.diffuse", 0.8f, 0.8f, 0.8f);
|
||||
shader->setVec3("dirLight.specular", 0.8f, 0.8f, 0.8f);
|
||||
|
||||
shader->setVec3("pointLights[0].position", -1.88f, 8.45f, -0.98f);
|
||||
shader->setVec3("pointLights[0].ambient", 0.05f, 0.05f, 0.05f);
|
||||
shader->setVec3("pointLights[0].diffuse", 1.0f, 0.7f, 0.4f);
|
||||
shader->setVec3("pointLights[0].specular", 1.0f, 1.0f, 1.0f);
|
||||
shader->setFloat("pointLights[0].constant", 1.0f);
|
||||
shader->setFloat("pointLights[0].linear", 0.09f);
|
||||
shader->setFloat("pointLights[0].quadratic", 0.032f);
|
||||
|
||||
shader->setVec3("spotLights[0].position", camera->position);
|
||||
shader->setVec3("spotLights[0].direction", camera->front);
|
||||
shader->setVec3("spotLights[0].ambient", 0.0f, 0.0f, 0.0f);
|
||||
shader->setVec3("spotLights[0].diffuse", 1.0f, 1.0f, 1.0f);
|
||||
shader->setVec3("spotLights[0].specular", 1.0f, 1.0f, 1.0f);
|
||||
shader->setFloat("spotLights[0].constant", 1.0f);
|
||||
shader->setFloat("spotLights[0].linear", 0.09f);
|
||||
shader->setFloat("spotLights[0].quadratic", 0.032f);
|
||||
shader->setFloat("spotLights[0].cutOff", glm::cos(glm::radians(12.5f)));
|
||||
shader->setFloat("spotLights[0].outerCutOff", glm::cos(glm::radians(15.0f)));
|
||||
}
|
||||
|
||||
void Render()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue