Add new textures with normalmaps

Now each texture has proper normals
This commit is contained in:
karl 2020-11-18 16:29:28 +01:00
parent 83936f66fb
commit 482aa93cce
30 changed files with 17 additions and 21 deletions

View File

@ -64,9 +64,6 @@ struct Texture {
void addNormalmap(const std::string& path, Settings settings) { void addNormalmap(const std::string& path, Settings settings) {
normal_id = loadTexture(path, settings); normal_id = loadTexture(path, settings);
} }
}; };
#endif //ECSGAME_TEXTURE_H #endif //ECSGAME_TEXTURE_H

View File

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 564 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 853 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

View File

Before

Width:  |  Height:  |  Size: 4.8 MiB

After

Width:  |  Height:  |  Size: 4.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 852 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 412 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

View File

Before

Width:  |  Height:  |  Size: 3.9 MiB

After

Width:  |  Height:  |  Size: 3.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 MiB

View File

@ -118,38 +118,33 @@ int main() {
monkey->assign<Transform>(); monkey->assign<Transform>();
monkey->assign<LODObjMesh>(std::vector<ObjMesh>{ObjMesh("Resources/Monkey.obj",ObjMesh::Settings(0.0, 8.0, 0.4, 0.6)), monkey->assign<LODObjMesh>(std::vector<ObjMesh>{ObjMesh("Resources/Monkey.obj",ObjMesh::Settings(0.0, 8.0, 0.4, 0.6)),
ObjMesh("Resources/MonkeySimple.obj", ObjMesh::Settings(8.0, 100.0, 0.4, 0.6))}); ObjMesh("Resources/MonkeySimple.obj", ObjMesh::Settings(8.0, 100.0, 0.4, 0.6))});
monkey->assign<Texture>("Resources/Marble.jpg", Texture::Settings(true), false); monkey->assign<Texture>("Resources/Marble010_2K_Color.jpg", Texture::Settings(true), false);
monkey->get<Texture>()->addNormalmap("Resources/Marble010_2K_Normal.jpg", Texture::Settings(true));
monkey->assign<SineAnimation>(glm::vec3(0.0, 0.3, 0.0), 0.5); monkey->assign<SineAnimation>(glm::vec3(0.0, 0.3, 0.0), 0.5);
monkey->assign<Material>(0.6, 0.6); monkey->assign<Material>(0.6, 0.6);
monkey->get<Transform>()->set_origin(glm::vec3(0.0f, 2.0f, -6.0f)); monkey->get<Transform>()->set_origin(glm::vec3(0.0f, 2.0f, -6.0f));
Entity *monkey2 = world->create();
monkey2->assign<Transform>();
monkey2->assign<LODObjMesh>(std::vector<ObjMesh>{ObjMesh("Resources/Monkey.obj",ObjMesh::Settings(0.0, 8.0, 0.4, 0.6)),
ObjMesh("Resources/MonkeySimple.obj", ObjMesh::Settings(8.0, 100.0, 0.4, 0.6))});
monkey2->assign<Texture>("Resources/Marble.jpg", Texture::Settings(true), false);
monkey2->assign<SineAnimation>(glm::vec3(0.0, 0.3, 0.0), 0.5);
monkey2->assign<Material>(0.6, 0.6);
monkey2->get<Transform>()->set_origin(glm::vec3(-5.0f, 2.0f, -20.0f));
Entity *wall1 = world->create(); Entity *wall1 = world->create();
wall1->assign<Transform>(); wall1->assign<Transform>();
wall1->assign<ObjMesh>(ObjMesh("Resources/Wall.obj", ObjMesh::Settings())); wall1->assign<ObjMesh>(ObjMesh("Resources/Wall.obj", ObjMesh::Settings()));
wall1->assign<Texture>("Resources/Glass.png", Texture::Settings(true), true); wall1->assign<Texture>("Resources/Facade001_2K_Color.png", Texture::Settings(true), true);
wall1->get<Texture>()->addNormalmap("Resources/Facade001_2K_Normal.jpg", Texture::Settings(true));
wall1->assign<Material>(0.2, 0.8); wall1->assign<Material>(0.2, 0.8);
wall1->get<Transform>()->set_origin(glm::vec3(0.0f, 0.0f, -2.0f)); wall1->get<Transform>()->set_origin(glm::vec3(0.0f, 0.0f, -2.0f));
Entity *wall2 = world->create(); Entity *wall2 = world->create();
wall2->assign<Transform>(); wall2->assign<Transform>();
wall2->assign<ObjMesh>(ObjMesh("Resources/Wall.obj", ObjMesh::Settings())); wall2->assign<ObjMesh>(ObjMesh("Resources/Wall.obj", ObjMesh::Settings()));
wall2->assign<Texture>("Resources/Glass.png", Texture::Settings(true), true); wall2->assign<Texture>("Resources/Facade001_2K_Color.png", Texture::Settings(true), true);
wall2->get<Texture>()->addNormalmap("Resources/Facade001_2K_Normal.jpg", Texture::Settings(true));
wall2->assign<Material>(0.2, 0.8); wall2->assign<Material>(0.2, 0.8);
wall2->get<Transform>()->set_origin(glm::vec3(0.0f, 0.0f, -10.0f)); wall2->get<Transform>()->set_origin(glm::vec3(0.0f, 0.0f, -10.0f));
Entity *wall3 = world->create(); Entity *wall3 = world->create();
wall3->assign<Transform>(); wall3->assign<Transform>();
wall3->assign<ObjMesh>(ObjMesh("Resources/Wall.obj", ObjMesh::Settings())); wall3->assign<ObjMesh>(ObjMesh("Resources/Wall.obj", ObjMesh::Settings()));
wall3->assign<Texture>("Resources/Glass.png", Texture::Settings(true), true); wall3->assign<Texture>("Resources/Facade001_2K_Color.png", Texture::Settings(true), true);
wall3->get<Texture>()->addNormalmap("Resources/Facade001_2K_Normal.jpg", Texture::Settings(true));
wall3->assign<Material>(0.2, 0.8); wall3->assign<Material>(0.2, 0.8);
wall3->get<Transform>()->set_origin(glm::vec3(4.0f, 0.0f, -6.0f)); wall3->get<Transform>()->set_origin(glm::vec3(4.0f, 0.0f, -6.0f));
wall3->get<Transform>()->rotate(90.0, glm::vec3(0.0, 1.0, 0.0)); wall3->get<Transform>()->rotate(90.0, glm::vec3(0.0, 1.0, 0.0));
@ -157,7 +152,8 @@ int main() {
Entity *wall4 = world->create(); Entity *wall4 = world->create();
wall4->assign<Transform>(); wall4->assign<Transform>();
wall4->assign<ObjMesh>(ObjMesh("Resources/Wall.obj", ObjMesh::Settings())); wall4->assign<ObjMesh>(ObjMesh("Resources/Wall.obj", ObjMesh::Settings()));
wall4->assign<Texture>("Resources/Glass.png", Texture::Settings(true), true); wall4->assign<Texture>("Resources/Facade001_2K_Color.png", Texture::Settings(true), true);
wall4->get<Texture>()->addNormalmap("Resources/Facade001_2K_Normal.jpg", Texture::Settings(true));
wall4->assign<Material>(0.2, 0.8); wall4->assign<Material>(0.2, 0.8);
wall4->get<Transform>()->set_origin(glm::vec3(-4.0f, 0.0f, -6.0f)); wall4->get<Transform>()->set_origin(glm::vec3(-4.0f, 0.0f, -6.0f));
wall4->get<Transform>()->rotate(90.0, glm::vec3(0.0, 1.0, 0.0)); wall4->get<Transform>()->rotate(90.0, glm::vec3(0.0, 1.0, 0.0));
@ -165,15 +161,16 @@ int main() {
Entity *ground = world->create(); Entity *ground = world->create();
ground->assign<Transform>(); ground->assign<Transform>();
ground->assign<ObjMesh>(ObjMesh("Resources/Ground.obj", ObjMesh::Settings())); ground->assign<ObjMesh>(ObjMesh("Resources/Ground.obj", ObjMesh::Settings()));
ground->assign<Texture>("Resources/Grass.jpg", Texture::Settings(true), false); ground->assign<Texture>("Resources/Ground003_2K_Color.jpg", Texture::Settings(true), false);
ground->get<Texture>()->addNormalmap("Resources/Grass_Normal.jpg", Texture::Settings(true)); ground->get<Texture>()->addNormalmap("Resources/Ground003_2K_Normal.jpg", Texture::Settings(true));
ground->assign<Material>(1.0, 0.0); ground->assign<Material>(1.0, 0.0);
ground->get<Transform>()->set_origin(glm::vec3(0.0f, 0.0f, 0.0f)); ground->get<Transform>()->set_origin(glm::vec3(0.0f, 0.0f, 0.0f));
Entity *bench = world->create(); Entity *bench = world->create();
bench->assign<Transform>(); bench->assign<Transform>();
bench->assign<ObjMesh>(ObjMesh("Resources/bench.obj", ObjMesh::Settings())); bench->assign<ObjMesh>(ObjMesh("Resources/bench.obj", ObjMesh::Settings()));
bench->assign<Texture>("Resources/Wood.jpg", Texture::Settings(true), false); bench->assign<Texture>("Resources/Wood048_2K_Color.jpg", Texture::Settings(true), false);
bench->get<Texture>()->addNormalmap("Resources/Wood048_2K_Normal.jpg", Texture::Settings(true));
bench->assign<Material>(0.8, 0.2); bench->assign<Material>(0.8, 0.2);
bench->get<Transform>()->set_origin(glm::vec3(8.0f, 0.0f, 0.0f)); bench->get<Transform>()->set_origin(glm::vec3(8.0f, 0.0f, 0.0f));
bench->get<Transform>()->rotate(-90.0, glm::vec3(0.0, 1.0, 0.0)); bench->get<Transform>()->rotate(-90.0, glm::vec3(0.0, 1.0, 0.0));
@ -181,7 +178,8 @@ int main() {
Entity *ring = world->create(); Entity *ring = world->create();
ring->assign<Transform>(); ring->assign<Transform>();
ring->assign<ObjMesh>(ObjMesh("Resources/ring.obj", ObjMesh::Settings())); ring->assign<ObjMesh>(ObjMesh("Resources/ring.obj", ObjMesh::Settings()));
ring->assign<Texture>("Resources/Gold.jpg", Texture::Settings(true), false); ring->assign<Texture>("Resources/Metal007_2K_Color.jpg", Texture::Settings(true), false);
ring->get<Texture>()->addNormalmap("Resources/Metal007_2K_Normal.jpg", Texture::Settings(true));
ring->assign<Material>(0.1, 0.9); ring->assign<Material>(0.1, 0.9);
ring->get<Transform>()->set_origin(glm::vec3(-5.0f, 2.0f, 0.0f)); ring->get<Transform>()->set_origin(glm::vec3(-5.0f, 2.0f, 0.0f));
@ -206,6 +204,7 @@ int main() {
renderSystem->render(world, defaultShader, shadowShader, debugShader); renderSystem->render(world, defaultShader, shadowShader, debugShader);
ring->get<Transform>()->rotate(delta * 100.0, glm::vec3(0.0, 1.0, 0.0)); ring->get<Transform>()->rotate(delta * 100.0, glm::vec3(0.0, 1.0, 0.0));
sun->get<DirectionalLight>()->direction = glm::normalize(glm::vec3(glm::rotate(glm::mat4(1), (float)elapsed_time, glm::vec3(0.0, 1.0, 0.0)) * glm::vec4(1.0, 1.0, 1.0, 0.0)));
/* Swap front and back buffers */ /* Swap front and back buffers */
glfwSwapBuffers(window); glfwSwapBuffers(window);