Skip to content
Extraits de code Groupes Projets
Valider 0529c500 rédigé par DBA_3's avatar DBA_3
Parcourir les fichiers

leaks, leaks everywhere

parent 346ea2a2
Branches
Étiquettes
Aucune requête de fusion associée trouvée
Aucun aperçu pour ce type de fichier
......@@ -57,7 +57,7 @@ int main()
std::string filename3 = "ray_tracing_shading.png";
scene.render(width, height, 1080, 1080, nb_shapes, (char *) filename.c_str(),2,false);
scene.render(width, height, 1080, 1080, nb_shapes, (char *) filename2.c_str(),6,false);
scene.render(width, height, 1080, 1080, nb_shapes, (char *) filename3.c_str(),6,true);
scene.render(width, height, 1080, 1080, nb_shapes, (char *) filename3.c_str(),4,true);
std::cout << "Image sauvegardée" << std::endl;
//----------LIBERATION DE LA MEMOIRE----------
......
ray_tracing_reflexion.png

117 ko | W: | H:

ray_tracing_reflexion.png

117 ko | W: | H:

ray_tracing_reflexion.png
ray_tracing_reflexion.png
ray_tracing_reflexion.png
ray_tracing_reflexion.png
  • 2-up
  • Swipe
  • Onion skin
ray_tracing_shading.png

162 ko | W: | H:

ray_tracing_shading.png

161 ko | W: | H:

ray_tracing_shading.png
ray_tracing_shading.png
ray_tracing_shading.png
ray_tracing_shading.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -93,6 +93,7 @@ void Scene::render(int width, int height, int nb_pixel_row, int nb_pixel_col, in
Vector3f N;
for (int i=nb_pixel_col-1; i>=0; i--) //on remplit l'image par le bas à droite
{
for (int j=0; j<nb_pixel_row; j++)
......@@ -181,18 +182,29 @@ void Scene::render(int width, int height, int nb_pixel_row, int nb_pixel_col, in
}
}
}
for (int r=0; r<ref_max;r++)
delete[] ray[r];
}
png_write_row(png_ptr, row);
for (int r=0; r<ref_max;r++)
delete[] ray[r];
}
png_free(png_ptr,row);
png_write_end(png_ptr, NULL);
png_destroy_write_struct(&png_ptr, &info_ptr);
fclose(f);
f=NULL;
}
......@@ -243,6 +255,7 @@ void Scene::reflected_rays(Ray3f **ray, int nb_shapes, int ref_max, float* shin
for(int r=0;r<(ref_max-1);r++)
{
Ray3f current_Ray=Ray3f(Vector3f(0,0,0),Vector3f(0,0,0));
min_dist=1000;
for (int k=0; k<nb_shapes; k++)
{
......@@ -257,13 +270,14 @@ void Scene::reflected_rays(Ray3f **ray, int nb_shapes, int ref_max, float* shin
{
min_dist = hit_dist;
ray[r+1] = new Ray3f(reflected);
current_Ray =Ray3f(reflected);
shine[r] = shapes_[k]->matter().shiness();
}
}
}
ray[r+1] =new Ray3f(current_Ray);
}
}
......
Ce diff est replié.
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter