Skip to content
Extraits de code Groupes Projets
Valider ec017656 rédigé par Lénaïc DURAND's avatar Lénaïc DURAND
Parcourir les fichiers

0 erreurs wsh

parent 1f90e5a7
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
2.png

118 ko | W: | H:

2.png

121 ko | W: | H:

2.png
2.png
2.png
2.png
  • 2-up
  • Swipe
  • Onion skin
3.png

121 ko

Aucun aperçu pour ce type de fichier
...@@ -226,7 +226,7 @@ void Scene::render(int width, int height, int nb_pixel_row, int nb_pixel_col, in ...@@ -226,7 +226,7 @@ void Scene::render(int width, int height, int nb_pixel_row, int nb_pixel_col, in
float min_dist; float min_dist;
float hit_dist; float hit_dist;
int ref_max=4; int ref_max = 6;
Ray3f *ray[ref_max]; Ray3f *ray[ref_max];
float shine[ref_max-1]; float shine[ref_max-1];
float coef[ref_max-1]; float coef[ref_max-1];
...@@ -240,7 +240,7 @@ void Scene::render(int width, int height, int nb_pixel_row, int nb_pixel_col, in ...@@ -240,7 +240,7 @@ void Scene::render(int width, int height, int nb_pixel_row, int nb_pixel_col, in
Ray3f camera_to_grid(camera_.position(), Pij-camera_.position()); Ray3f camera_to_grid(camera_.position(), Pij-camera_.position());
ray[0]=new Ray3f(camera_to_grid); ray[0]=new Ray3f(camera_to_grid);
nb_reflected(ray, nb_shapes, ref_max, shine); reflected_rays(ray, nb_shapes, ref_max, shine);
coeff(shine, coef, ref_max); coeff(shine, coef, ref_max);
row[3*(nb_pixel_row-1-j)] = 0; row[3*(nb_pixel_row-1-j)] = 0;
...@@ -303,7 +303,6 @@ void Scene::render(int width, int height, int nb_pixel_row, int nb_pixel_col, in ...@@ -303,7 +303,6 @@ void Scene::render(int width, int height, int nb_pixel_row, int nb_pixel_col, in
row[3*(nb_pixel_row-1-j)] = row[3*(nb_pixel_row-1-j)] + coef[r]*fmin(shapes_[k]->matter().r() * intensity, 255.); row[3*(nb_pixel_row-1-j)] = row[3*(nb_pixel_row-1-j)] + coef[r]*fmin(shapes_[k]->matter().r() * intensity, 255.);
row[3*(nb_pixel_row-1-j) + 1] = row[3*(nb_pixel_row-1-j) + 1] + coef[r]*fmin(shapes_[k]->matter().g() * intensity, 255.); row[3*(nb_pixel_row-1-j) + 1] = row[3*(nb_pixel_row-1-j) + 1] + coef[r]*fmin(shapes_[k]->matter().g() * intensity, 255.);
row[3*(nb_pixel_row-1-j) + 2] = row[3*(nb_pixel_row-1-j) + 2] + coef[r]*fmin(shapes_[k]->matter().b() * intensity, 255.); row[3*(nb_pixel_row-1-j) + 2] = row[3*(nb_pixel_row-1-j) + 2] + coef[r]*fmin(shapes_[k]->matter().b() * intensity, 255.);
} }
} }
} }
...@@ -361,7 +360,7 @@ ray doit contenir le rayon camera Pij initialement ...@@ -361,7 +360,7 @@ ray doit contenir le rayon camera Pij initialement
à la fin on rajoute à ray toutes les reflexions et à shines à la fin on rajoute à ray toutes les reflexions et à shines
les coeff des couleurs càd les coeff des couleurs càd
coef={(1-a1) , a1*(1-a2) , a1*a2*(1-a3) ...}*/ coef={(1-a1) , a1*(1-a2) , a1*a2*(1-a3) ...}*/
int Scene::nb_reflected(Ray3f **ray, int nb_shapes, int ref_max, float* shine) void Scene::reflected_rays(Ray3f **ray, int nb_shapes, int ref_max, float* shine)
{ {
bool vide=false; bool vide=false;
......
...@@ -34,7 +34,7 @@ class Scene ...@@ -34,7 +34,7 @@ class Scene
void render(int width, int height, int nb_pixel_row, int nb_pixel_col, int nb_shapes, char* filename); void render(int width, int height, int nb_pixel_row, int nb_pixel_col, int nb_shapes, char* filename);
int closer(int nb_shapes, Ray3f start); int closer(int nb_shapes, Ray3f start);
int nb_reflected(Ray3f **ray, int nb_shapes, int ref_max, float* shine); void reflected_rays(Ray3f **ray, int nb_shapes, int ref_max, float* shine);
void coeff(float* shine, float* coef, int ref_max); void coeff(float* shine, float* coef, int ref_max);
}; };
......
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