Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
P
PAP_ray_tracing
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Wiki externe
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Déploiement
Releases
Registre de conteneurs
Registre de modèles
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté GitLab
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Yacine ACHEROUFKEBIR
PAP_ray_tracing
Validations
b213a1a4
Valider
b213a1a4
rédigé
Il y a 5 ans
par
Lénaïc DURAND
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
début render
parent
22135f25
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
5
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
5 fichiers modifiés
0.png
+0
-0
0 ajout, 0 suppression
0.png
main
+0
-0
0 ajout, 0 suppression
main
main.cpp
+1
-1
1 ajout, 1 suppression
main.cpp
quad.cpp
+9
-10
9 ajouts, 10 suppressions
quad.cpp
scene.cpp
+13
-3
13 ajouts, 3 suppressions
scene.cpp
avec
23 ajouts
et
14 suppressions
0.png
+
0
−
0
Voir le fichier remplacé @
22135f25
Voir le fichier @
b213a1a4
9,66 ko
|
W:
|
H:
8 ko
|
W:
|
H:
2-up
Swipe
Onion skin
Ce diff est replié.
Cliquez pour l'agrandir.
main
+
0
−
0
Voir le fichier @
b213a1a4
Aucun aperçu pour ce type de fichier
Ce diff est replié.
Cliquez pour l'agrandir.
main.cpp
+
1
−
1
Voir le fichier @
b213a1a4
...
...
@@ -170,7 +170,7 @@ int main()
shapes
[
5
]
=
new
Quad
(
red
,
Vector3f
(
50
,
50
,
50
),
5
,
5
,
5
);
//cube
shapes
[
6
]
=
new
Sphere
(
blue
,
Vector3f
(
3
/
4
*
width
,
20
,
depth
/
2
),
40
);
//sphere
Camera
camera
(
Vector3f
(
width
/
2
,
height
/
2
,
-
1
),
Vector3f
(
0
,
0
,
1
));
//on met la caméra un peu en recul
Camera
camera
(
Vector3f
(
width
/
2
,
height
/
2
,
-
30
),
Vector3f
(
0
,
0
,
1
));
//on met la caméra un peu en recul
Ray3f
source
(
Vector3f
(
width
/
2
,
height
,
depth
/
2
),
Vector3f
(
0
,
-
1
,
0
));
//lumière au plafonc
Scene
scene
(
camera
,
shapes
,
source
);
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
quad.cpp
+
9
−
10
Voir le fichier @
b213a1a4
#include
"quad.h"
#include
<iostream>
//
#include <iostream>
...
...
@@ -131,7 +131,6 @@ Ray3f Quad::reflect(const Ray3f ray) const
float
Z
=
ray
.
origin
().
z
();
//Calculs des coordonnées d'intersection avec les faces et vérification
float
t
,
x
,
y
,
z
;
...
...
@@ -141,14 +140,14 @@ Ray3f Quad::reflect(const Ray3f ray) const
Vector3f
I
=
ray
.
direction
();
std
::
cout
<<
"a="
<<
a
<<
std
::
endl
;
std
::
cout
<<
"b="
<<
a
<<
std
::
endl
;
std
::
cout
<<
"c="
<<
a
<<
std
::
endl
;
//
std::cout << "a=" <<a << std::endl;
//
std::cout << "b=" <<a << std::endl;
//
std::cout << "c=" <<a << std::endl;
//Face 1 et 4
if
(
a
!=
0
)
{
std
::
cout
<<
"a!=0 face 1 ou 4"
<<
std
::
endl
;
//
std::cout << "a!=0 face 1 ou 4" << std::endl;
t
=
(
x1
-
X
)
/
a
;
//x = x1;
y
=
Y
+
b
*
t
;
...
...
@@ -177,7 +176,7 @@ Ray3f Quad::reflect(const Ray3f ray) const
//Face 2
if
(
b
!=
0
)
{
std
::
cout
<<
"b!=0 face 2"
<<
std
::
endl
;
//
std::cout << "b!=0 face 2" << std::endl;
t
=
(
y2
-
Y
)
/
b
;
x
=
X
+
a
*
t
;
...
...
@@ -199,7 +198,7 @@ Ray3f Quad::reflect(const Ray3f ray) const
//Face 3
if
(
c
!=
0
)
{
std
::
cout
<<
"c!=0 face 3"
<<
std
::
endl
;
//
std::cout << "c!=0 face 3" << std::endl;
t
=
(
z3
-
Z
)
/
c
;
x
=
X
+
a
*
t
;
y
=
Y
+
b
*
t
;
...
...
@@ -221,7 +220,7 @@ Ray3f Quad::reflect(const Ray3f ray) const
//Face 5
if
(
b
!=
0
)
{
std
::
cout
<<
"b!=0 face 5"
<<
std
::
endl
;
//
std::cout << "b!=0 face 5" << std::endl;
t
=
(
y5
-
Y
)
/
b
;
x
=
X
+
a
*
t
;
//y = y5;
...
...
@@ -239,7 +238,7 @@ Ray3f Quad::reflect(const Ray3f ray) const
//Face 6
if
(
c
!=
0
)
{
std
::
cout
<<
"c!=0 face 6"
<<
std
::
endl
;
//
std::cout << "c!=0 face 6" << std::endl;
t
=
(
z6
-
Z
)
/
c
;
x
=
X
+
a
*
t
;
y
=
Y
+
b
*
t
;
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
scene.cpp
+
13
−
3
Voir le fichier @
b213a1a4
...
...
@@ -87,10 +87,14 @@ void Scene::render(int width, int height, int nb_pixel_row, int nb_pixel_col, in
float
pw
=
width
/
nb_pixel_row
;
float
ph
=
height
/
nb_pixel_col
;
float
min_dist
;
float
hit_dist
;
for
(
int
i
=
0
;
i
<
nb_pixel_row
;
i
++
)
{
for
(
int
j
=
0
;
j
<
nb_pixel_col
;
j
++
)
{
min_dist
=
1000
;
Vector3f
Pij
(
i
*
pw
,
j
*
ph
,
0
);
//point de la grille par laquelle on regarde
Ray3f
camera_to_grid
(
camera_
.
position
(),
Pij
-
camera_
.
position
());
...
...
@@ -102,12 +106,18 @@ void Scene::render(int width, int height, int nb_pixel_row, int nb_pixel_col, in
{
if
(
shapes_
[
k
]
->
is_hit
(
camera_to_grid
))
{
hit_dist
=
dist
(
shapes_
[
k
]
->
reflect
(
camera_to_grid
).
origin
()
,
camera_
.
position
());
//printf("hit_dist : %f\n", hit_dist);
if
(
hit_dist
<
min_dist
)
{
min_dist
=
hit_dist
;
row
[
3
*
i
]
=
shapes_
[
k
]
->
matter
().
r
();
row
[
3
*
i
+
1
]
=
shapes_
[
k
]
->
matter
().
g
();
row
[
3
*
i
+
2
]
=
shapes_
[
k
]
->
matter
().
b
();
}
}
}
}
png_write_row
(
png_ptr
,
row
);
}
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter