earth_texture works

This commit is contained in:
Wojtek 2024-01-22 19:39:58 +01:00
parent 67fa38035c
commit 6e7c437aa8
3 changed files with 10 additions and 3 deletions

View File

@ -23,7 +23,7 @@ out vec3 spotlightDirTS;
void main()
{
TexCoords = vertexTexCoord;
TexCoords = vertexTexCoord * -1;
worldPos = (modelMatrix* vec4(vertexPosition,1)).xyz;
vecNormal = (modelMatrix* vec4(vertexNormal,0)).xyz;

View File

@ -41,6 +41,7 @@ namespace texture {
GLuint cubemapTexture;
GLuint spaceshipTexture;
GLuint spriteTexture;
GLuint earthTexture;
}
void createGalaxy(glm::vec3 galaxyPosition);
@ -121,12 +122,13 @@ void renderScene(GLFWwindow* window)
spaceship->renderBullets(glfwGetTime(), program);
drawObjectPBR(models::sphereContext,
glm::translate(pointlightPos) * glm::scale(glm::vec3(0.1)) * glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(4.f, 0, 0)) * glm::eulerAngleY(time) * glm::translate(glm::vec3(1.f, 0, 0)) * glm::scale(glm::vec3(0.1f)),
glm::vec3(0.5, 0.5, 0.5), 0.7, 0.0, program);
//Core::SetActiveTexture(texture::spaceshipTexture, "textureSampler", programTex, 0);
Core::SetActiveTexture(texture::spaceshipTexture, "textureSampler", programTex, 0);
glUseProgram(programTex);
drawObjectPBRTexture(models::spaceshipContext,
spaceship->calculateModelMatrix(),
@ -134,6 +136,9 @@ void renderScene(GLFWwindow* window)
spaceship->roughness, spaceship->metallic, programTex
);
Core::SetActiveTexture(texture::earthTexture, "textureSampler", programTex, 0);
drawObjectPBRTexture(models::sphereContext, glm::translate(pointlightPos) * glm::scale(glm::vec3(1)) * glm::eulerAngleY(time / 3) * glm::translate(glm::vec3(10.f, 0, 0)) * glm::scale(glm::vec3(0.3f)), texture::earthTexture, 0.3, 0.0, programTex);
glUseProgram(programSprite);
for (const auto& enemy : enemies) {
if (enemy->isAlive()) {
@ -239,6 +244,8 @@ void init(GLFWwindow* window)
texture::cubemapTexture = Core::LoadCubemap(cubeFaces);
texture::spaceshipTexture = Core::LoadTexture("./textures/spaceship/Material.001_Base_color.jpg");
texture::earthTexture = Core::LoadTexture("./textures/spaceship/earth_daymap.jpg");
//texture::spaceshipTexture = Core::LoadTexture("./textures/spaceship/541.jpg");
spaceship->createParticles();

Binary file not shown.

After

Width:  |  Height:  |  Size: 452 KiB