This commit is contained in:
Kacper 2024-01-14 23:12:02 +01:00
parent 50d6283291
commit ecb3a1884b
2 changed files with 5 additions and 5 deletions

View File

@ -16,8 +16,8 @@ void main()
{
vec3 lightDir = normalize(lightPos - worldPos);
vec3 normal = normalize(vecNormal);
float diffuse = max(0, dot(normal, lightDir));
//float diffuse = max(0, dot(normal, lightDir));
vec4 textureColor = texture2D(colorTexture, vtc);
outColor = vec4(vec3(textureColor) * min(1, AMBIENT + diffuse), 1.0) * 2.0;
outColor = vec4(vec3(textureColor) * 1.5, 1.0);
}

View File

@ -143,7 +143,7 @@ void drawObjectTexture(Core::RenderContext& context, glm::mat4 modelMatrix, GLui
void drawSun(Core::RenderContext& context, glm::mat4 modelMatrix, GLuint texture) {
glUseProgram(programSun);
Core::SetActiveTexture(texture, "colorTexture", programSun, 3);
Core::SetActiveTexture(texture, "colorTexture", programSun, 0);
glm::mat4 viewProjectionMatrix = createPerspectiveMatrix() * createCameraMatrix();
glm::mat4 transformation = viewProjectionMatrix * modelMatrix;
glUniformMatrix4fv(glGetUniformLocation(programSun, "transformation"), 1, GL_FALSE, (float*)&transformation);
@ -223,7 +223,7 @@ void renderScene(GLFWwindow* window)
//glUseProgram(0);
glm::mat4 sunScale = glm::scale(glm::vec3(0.04f));
glm::mat4 sunTranslate = glm::translate(glm::vec3(sunPosition.x, sunPosition.y, sunPosition.z));
glm::mat4 sunTranslate = glm::translate(sunPosition);
drawSun(sphereContext, sunTranslate * sunScale, texture::sun);
@ -231,7 +231,7 @@ void renderScene(GLFWwindow* window)
glm::mat4 planetRotate = glm::rotate(time * 0.0416f, glm::vec3(0, 1, 0)); // 1 godzina mija w 1 sekundę, obrót z zachodu na wschód
glm::mat4 planetTranslate = glm::translate(glm::vec3(0, 0, 0)); // zostaje na domyślnej pozycji
drawObjectTexture(sphereContext, planetRotate * planetTranslate * planetScale, texture::earth);
drawObjectTexture(sphereContext, planetTranslate * planetRotate * planetScale, texture::earth);
glfwSwapBuffers(window);
}