Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
No results found
Show changes
Commits on Source (2)
......@@ -26,7 +26,7 @@
"animation": {
"step": 10
},
"base_path": "C:\\Users\\Wiktor\\source\\repos\\CUDABADAM\\CUDABADAM\\",
"base_path": "C:\\projekt_badawczy\\config\\test\\",
"paths": {
"result_name": "zderzenie_kul_prosto",
"result_path": "animacja\\",
......@@ -35,8 +35,8 @@
"snow_objects_paths": [ "", "" ],
"snow_objects_names": [ "kule_obok_kula1.obj", "kule_obok_kula2.obj" ],
"snow_block_velocities": [
[ 0, -10, 0 ],
[ 0, 10, 0 ]
[ 0, 10, 0 ],
[ 0, -10, 0 ]
],
"snow_block_rotation": [
[ 0, 0, 0 ],
......
This diff is collapsed.
......@@ -128,11 +128,11 @@ void LoadConfiguration(const std::string& configFilePath, MaterialProperties& ma
// Wczytaj prędkości ruchu postępowego
//for (const auto& velocity : config["simulation"]["snow_block_velocities"]) {
// simProps.snow_block_velocities.emplace_back(Vector(velocity[0], velocity[1], velocity[2]));
// }
// simProps.snow_block_velocities.emplace_back(Vector(velocity[0], velocity[1], velocity[2]));
//}
// Wczytaj prędkości obrotowe
// for (const auto& rotation : config["simulation"]["snow_block_rotation"]) {
//for (const auto& rotation : config["simulation"]["snow_block_rotation"]) {
// simProps.snow_block_rotation.emplace_back(Vector(rotation[0], rotation[1], rotation[2]));
//}
......@@ -161,13 +161,18 @@ void LoadConfiguration(const std::string& configFilePath, MaterialProperties& ma
pathProps.snow_objects_paths = config["paths"]["snow_objects_paths"].get<std::vector<std::string>>();
pathProps.snow_objects_names = config["paths"]["snow_objects_names"].get<std::vector<std::string>>();
pathProps.snow_block_velocities = config["paths"]["snow_block_velocities"];
pathProps.snow_block_rotation = config["paths"]["snow_block_rotation"];
for (int i = 0; i < pathProps.snow_objects_paths.size(); i++) { // zeby utrzymac konwencje z pathProps.result_path
pathProps.snow_objects_paths[i] = pathProps.base_path + pathProps.snow_objects_paths[i];
}
for (const auto& vec : config["paths"]["snow_block_velocities"]) {
pathProps.snow_block_velocities.emplace_back(vec[0], vec[1], vec[2]);
}
for (const auto& vec : config["paths"]["snow_block_rotation"]) {
pathProps.snow_block_rotation.emplace_back(vec[0], vec[1], vec[2]);
}
}
__device__ float device_MCE;
......@@ -1855,7 +1860,6 @@ int main() {
// jednostka to radiany na sekunde
// przy wczytywaniu mozna dac np. obroty na sekunde, ale wtedy trzeba przeliczyc na radiany na sekunde
std::vector<Vector> snow_block_rotation;
for (int i = 0; i < pathProps.snow_block_rotation.size(); i++) {
snow_block_rotation.push_back(pathProps.snow_block_rotation[i]);
}
......@@ -1930,6 +1934,8 @@ int main() {
SDF_grid[i].dist_vec = Vector::Zero();
}
for (int sdf_i = 0; sdf_i < SDF_grid.size(); sdf_i++) {
for (int sdf_j = 0; sdf_j < snow_block_meshes[i].triangles.size(); sdf_j++) {
// szukamy minimum dla danego i
......@@ -1968,6 +1974,7 @@ int main() {
j_particles++;
}
}
}
size_t n_particles = Particles.size();
......@@ -2136,8 +2143,8 @@ int main() {
////glTranslatef(-0.5f, -0.5f, -0.5); // to co wyzej
update_MC_Grid_Cell_Values(Grid, MC_Grid, MC_n_x_grid, MC_n_y_grid, MC_n_z_grid);
cudaError_t cudaStatus = polygoniseWithCuda(MC_Grid.data(), triangles, MC_n_grid_nodes, gridProps.isolevel, &totalTriangles);
//update_MC_Grid_Cell_Values(Grid, MC_Grid, MC_n_x_grid, MC_n_y_grid, MC_n_z_grid);
//cudaError_t cudaStatus = polygoniseWithCuda(MC_Grid.data(), triangles, MC_n_grid_nodes, gridProps.isolevel, &totalTriangles);
//renderTriangles(triangles, totalTriangles);
......@@ -2150,36 +2157,20 @@ int main() {
// renderOBJ(snow_block_meshes[i]);
//}
// zresetowanie wartosci do obracania kamery, pewnie mozna znalezc na nie lepsze miejsce
// pozniej zamkne wszystko z renderowania w jedna funkcje, resetowanie tez moze tam dam
//n_x = 0;
//n_y = 0;
//n_z = 0;
//alpha_camera = 0.0;
//glfwSwapBuffers(window); // Zamiana buforów w oknie
//glfwPollEvents(); // Sprawdzenie zdarzeń (np. naciśnięcia klawiszy)
//update_MC_Grid_Cell_Values(Grid, MC_Grid, MC_n_x_grid, MC_n_y_grid, MC_n_z_grid);
update_MC_Grid_Cell_Values(Grid, MC_Grid, MC_n_x_grid, MC_n_y_grid, MC_n_z_grid);
//// Polygonise
//cudaError_t cudaStatus_anim = polygoniseWithCuda(MC_Grid.data(), triangles, MC_n_grid_nodes, isolevel, &totalTriangles);
//if (cudaStatus_anim != cudaSuccess) {
// fprintf(stderr, "polygoniseWithCuda failed!");
// return 1;
//}
// Polygonise
cudaError_t cudaStatus_anim = polygoniseWithCuda(MC_Grid.data(), triangles, MC_n_grid_nodes, gridProps.isolevel, &totalTriangles);
if (cudaStatus_anim != cudaSuccess) {
fprintf(stderr, "polygoniseWithCuda failed!");
return 1;
}
// Saving triangles to obj file
// mozna by dodac wiodace zera
std::cout << pathProps.result_path << "\n";
std::string filename = pathProps.result_path + pathProps.result_name + std::to_string(frame) + ".obj";
///std::string filename = result_path + pathProps.result_name + std::to_string(frame) + ".obj";
std::ofstream outFile(filename);
if (!outFile.is_open()) {
......