WIP: bugfixing

This commit is contained in:
2022-04-24 09:57:52 +03:00
parent a0deddb660
commit f9b82f4397
8 changed files with 59 additions and 47 deletions
+21 -18
View File
@@ -25,14 +25,14 @@ int main() {
acidrain::texture_generator tg(256, 256);
tg.brick(0, 50, 20, 4, glm::vec4(1), glm::vec4(0));
shared_ptr<mesh> affectedSphere = mesh_generator::sphere(50, 50);
map_transform(affectedSphere, tg, 0, 0, 0.2f);
calculate_normals(*affectedSphere.get());
shared_ptr<mesh> affectedSphere = mesh_generator::sphere(10, 10);
// map_transform(affectedSphere, tg, 0, 0, 1.2f);
// calculate_normals(*affectedSphere.get());
affectedSphere = mesh_generator::cog(0.2, 0.5, 50, 4, 0.1, 0.2, 0.2, 0.1);
// affectedSphere = mesh_generator::cog(0.2, 0.5, 50, 4, 0.1, 0.2, 0.2, 0.1);
demo_data::meshes.push_back(affectedSphere);
demo_data::meshes.push_back(mesh_generator::sphere(50, 50));
demo_data::meshes.push_back(mesh_generator::sphere(3, 3));
demo_data::meshes.push_back(mesh_generator::grid(30, 30));
demo_data::meshes.push_back(mesh_generator::cube());
@@ -45,11 +45,14 @@ int main() {
mat->cast_shadows = true;
auto *textureGenerator1 = new texture_generator(256, 256);
mat->textures[texture_role::diffuse] = textureGenerator1->checker_board(0, 20,
colour(1, 1, 1, 1),
colour(0, 0.5, 0.2, 1)).get_texture(0);
// mat->textures[texture_role::diffuse] = textureGenerator1->brick(0, 50, 20, 4, colour(0.3, 0.1, 0, 1),
// colour(1, 0.3, 0, 1)).get_texture(0);
// mat->textures[texture_role::diffuse] = textureGenerator1->checker_board(0, 20,
// colour(1, 1, 1, 1),
// colour(0, 0.5, 0.2, 1)).get_texture(0);
mat->textures[texture_role::diffuse] = textureGenerator1->brick(0,
50, 20,
4,
colour(0.3, 0.1, 0, 1),
colour(1, 0.3, 0, 1)).get_texture(0);
demo_data::materials.push_back(mat);
@@ -108,50 +111,50 @@ int main() {
auto *scene1 = new scene();
demoPartScene.scene_ = shared_ptr<scene>(scene1);
auto smallSphere = std::make_shared<mesh_node>();
auto smallSphere = std::make_shared<mesh_node>("small sphere");
smallSphere->mesh_ = demo_data::meshes[1];
smallSphere->material_ = demo_data::materials[0];
smallSphere->position = glm::vec3(0, 0, 0);
smallSphere->scale = glm::vec3(0.5);
// meshNode->rotation = glm::angleAxis(2.25f , glm::vec3(1.0f, 0.0f, 0.0f));
auto ground_plane = std::make_shared<mesh_node>();
auto ground_plane = std::make_shared<mesh_node>("ground_plane");
ground_plane->mesh_ = demo_data::meshes[2];
ground_plane->material_ = demo_data::materials[1];
ground_plane->position = glm::vec3(0, 0, 0);
ground_plane->scale = glm::vec3(10);
ground_plane->rotation = glm::angleAxis(3.141529f / 2.0f, glm::vec3(1.0f, 0.0f, 0.0f));
auto black_plane = std::make_shared<mesh_node>();
auto black_plane = std::make_shared<mesh_node>("back plane");
black_plane->mesh_ = demo_data::meshes[2];
black_plane->material_ = demo_data::materials[1];
black_plane->position = glm::vec3(0, 5, -5);
black_plane->scale = glm::vec3(10);
black_plane->rotation = angleAxis(3.141529f, glm::vec3(1.0f, 0.0f, 0.0f));
auto left_plane = std::make_shared<mesh_node>();
auto left_plane = std::make_shared<mesh_node>("left plane");
left_plane->mesh_ = demo_data::meshes[2];
left_plane->material_ = demo_data::materials[1];
left_plane->position = glm::vec3(-5, 5, 0);
left_plane->scale = glm::vec3(10);
left_plane->rotation = angleAxis(-3.141529f / 2.0f, glm::vec3(0.0f, 1.0f, 0.0f));
auto right_plane = std::make_shared<mesh_node>();
auto right_plane = std::make_shared<mesh_node>("right plane");
right_plane->mesh_ = demo_data::meshes[2];
right_plane->material_ = demo_data::materials[1];
right_plane->position = glm::vec3(5, 5, 0);
right_plane->scale = glm::vec3(10);
right_plane->rotation = angleAxis(3.141529f / 2.0f, glm::vec3(0.0f, 1.0f, 0.0f));
auto bigSphere = make_shared<mesh_node>();
auto bigSphere = make_shared<mesh_node>("big sphere");
bigSphere->mesh_ = demo_data::meshes[0];
bigSphere->material_ = demo_data::materials[4];
bigSphere->material_ = demo_data::materials[1];
bigSphere->position = glm::vec3(-2, 2, 0);
bigSphere->scale = glm::vec3(0.8);
bigSphere->rotation = glm::angleAxis(3.141529f / 2.0f, glm::vec3(1.0f, 0.0f, 0.0f));
auto lightMeshNode = std::make_shared<mesh_node>();
auto lightMeshNode = std::make_shared<mesh_node>("light mesh");
lightMeshNode->mesh_ = demo_data::meshes[0];
lightMeshNode->material_ = demo_data::materials[3];
lightMeshNode->position = glm::vec3(1, 2, 1);