Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
lray
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Emeric Verschuur
lray
Commits
2d4a43a8
Commit
2d4a43a8
authored
May 30, 2008
by
maesius
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Debugage de la binder grid. Ca marche.
parent
b6cccab6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
91 additions
and
72 deletions
+91
-72
LrBinderRegularGrid.cpp
LrBinderRegularGrid.cpp
+42
-34
LrEntityElementary.cpp
LrEntityElementary.cpp
+2
-2
LrGeometry.cpp
LrGeometry.cpp
+16
-8
LrGeometry.h
LrGeometry.h
+25
-23
LrSceneRayTracing.cpp
LrSceneRayTracing.cpp
+6
-5
No files found.
LrBinderRegularGrid.cpp
View file @
2d4a43a8
...
...
@@ -99,6 +99,14 @@ void LrBinderRegularGrid::initBinder()
if
(
maxCur
.
z
>
max
.
z
)
max
.
z
=
maxCur
.
z
;
}
min
.
x
-=
EPSILON
;
min
.
y
-=
EPSILON
;
min
.
z
-=
EPSILON
;
max
.
x
+=
EPSILON
;
max
.
y
+=
EPSILON
;
max
.
z
+=
EPSILON
;
m_lenBinder
=
LrVector
(
min
,
max
);
...
...
@@ -118,9 +126,8 @@ void LrBinderRegularGrid::initBinder()
for
(
int
i
=
0
;
i
<
nbFragments
;
i
++
)
{
(
*
itEntity
)
->
getMinMax
(
minTMP
,
maxTMP
,
i
,
infoVoxel
.
m_entite
,
infoVoxel
.
m_numFragment
);
/*
minVoxelI
=
(
int
)(((
minTMP
.
x
-
min
.
x
)
/
m_lenBinder
.
x
)
*
m_nbVoxelX
);
minVoxelJ
=
(
int
)(((
minTMP
.
y
-
min
.
y
)
/
m_lenBinder
.
y
)
*
m_nbVoxelY
);
minVoxelK
=
(
int
)(((
minTMP
.
z
-
min
.
z
)
/
m_lenBinder
.
z
)
*
m_nbVoxelZ
);
...
...
@@ -128,11 +135,11 @@ void LrBinderRegularGrid::initBinder()
maxVoxelI
=
(
int
)(((
maxTMP
.
x
-
min
.
x
)
/
m_lenBinder
.
x
)
*
m_nbVoxelX
);
maxVoxelJ
=
(
int
)(((
maxTMP
.
y
-
min
.
y
)
/
m_lenBinder
.
y
)
*
m_nbVoxelY
);
maxVoxelK
=
(
int
)(((
maxTMP
.
z
-
min
.
z
)
/
m_lenBinder
.
z
)
*
m_nbVoxelZ
);
*/
for
(
int
i
=
0
;
i
<
m_nbVoxelX
;
i
++
)
{
for
(
int
j
=
0
;
j
<
m_nbVoxelY
;
j
++
)
{
for
(
int
k
=
0
;
k
<
m_nbVoxelZ
;
k
++
)
{
for
(
int
i
=
minVoxelI
;
i
<=
maxVoxelI
;
i
++
)
{
for
(
int
j
=
minVoxelJ
;
j
<=
maxVoxelJ
;
j
++
)
{
for
(
int
k
=
minVoxelK
;
k
<=
maxVoxelK
;
k
++
)
{
int
numCase
=
(
i
+
m_nbVoxelX
*
(
j
+
k
*
m_nbVoxelY
));
m_tabVoxel
[
numCase
].
push_back
(
infoVoxel
);
...
...
@@ -179,7 +186,7 @@ bool LrBinderRegularGrid::getIntersection(const LrRay &ray, LrHit *hit, Real min
// ### Debut : Intersection en X
if
(
dir
.
x
>
EPSILON
)
{
int
distExitTMP
=
(
int
)((
max
.
x
-
orig
.
x
-
EPSILON
)
/
dir
.
x
)
;
Real
distExitTMP
=
(
max
.
x
-
orig
.
x
-
EPSILON
)
/
dir
.
x
;
if
(
distExitTMP
<
distExit
)
{
distExit
=
distExitTMP
;
...
...
@@ -187,7 +194,7 @@ bool LrBinderRegularGrid::getIntersection(const LrRay &ray, LrHit *hit, Real min
if
(
!
origInBinder
)
{
int
distEntryTMP
=
(
int
)((
min
.
x
-
orig
.
x
+
EPSILON
)
/
dir
.
x
)
;
Real
distEntryTMP
=
(
min
.
x
-
orig
.
x
+
EPSILON
)
/
dir
.
x
;
if
(
distEntryTMP
>
distEntry
)
{
distEntry
=
distEntryTMP
;
...
...
@@ -195,9 +202,9 @@ bool LrBinderRegularGrid::getIntersection(const LrRay &ray, LrHit *hit, Real min
}
}
else
if
(
dir
.
x
<
EPSILON
)
{
}
else
if
(
dir
.
x
<
-
EPSILON
)
{
int
distExitTMP
=
(
int
)((
min
.
x
-
orig
.
x
+
EPSILON
)
/
dir
.
x
)
;
Real
distExitTMP
=
(
min
.
x
-
orig
.
x
+
EPSILON
)
/
dir
.
x
;
if
(
distExitTMP
<
distExit
)
{
distExit
=
distExitTMP
;
...
...
@@ -205,7 +212,7 @@ bool LrBinderRegularGrid::getIntersection(const LrRay &ray, LrHit *hit, Real min
if
(
!
origInBinder
)
{
int
distEntryTMP
=
(
int
)((
max
.
x
-
orig
.
x
-
EPSILON
)
/
dir
.
x
)
;
Real
distEntryTMP
=
(
max
.
x
-
orig
.
x
-
EPSILON
)
/
dir
.
x
;
if
(
distEntryTMP
>
distEntry
)
{
distEntry
=
distEntryTMP
;
...
...
@@ -228,7 +235,7 @@ bool LrBinderRegularGrid::getIntersection(const LrRay &ray, LrHit *hit, Real min
// ### Debut : Intersection en Y
if
(
dir
.
y
>
EPSILON
)
{
int
distExitTMP
=
(
int
)((
max
.
y
-
orig
.
y
-
EPSILON
)
/
dir
.
y
)
;
Real
distExitTMP
=
(
max
.
y
-
orig
.
y
-
EPSILON
)
/
dir
.
y
;
if
(
distExitTMP
<
distExit
)
{
distExit
=
distExitTMP
;
...
...
@@ -236,7 +243,7 @@ bool LrBinderRegularGrid::getIntersection(const LrRay &ray, LrHit *hit, Real min
if
(
!
origInBinder
)
{
int
distEntryTMP
=
(
int
)((
min
.
y
-
orig
.
y
+
EPSILON
)
/
dir
.
y
)
;
Real
distEntryTMP
=
(
min
.
y
-
orig
.
y
+
EPSILON
)
/
dir
.
y
;
if
(
distEntryTMP
>
distEntry
)
{
distEntry
=
distEntryTMP
;
...
...
@@ -244,9 +251,9 @@ bool LrBinderRegularGrid::getIntersection(const LrRay &ray, LrHit *hit, Real min
}
}
else
if
(
dir
.
y
<
EPSILON
)
{
}
else
if
(
dir
.
y
<
-
EPSILON
)
{
int
distExitTMP
=
(
int
)((
min
.
y
-
orig
.
y
+
EPSILON
)
/
dir
.
y
)
;
Real
distExitTMP
=
(
min
.
y
-
orig
.
y
+
EPSILON
)
/
dir
.
y
;
if
(
distExitTMP
<
distExit
)
{
distExit
=
distExitTMP
;
...
...
@@ -254,7 +261,7 @@ bool LrBinderRegularGrid::getIntersection(const LrRay &ray, LrHit *hit, Real min
if
(
!
origInBinder
)
{
int
distEntryTMP
=
(
int
)((
max
.
y
-
orig
.
y
-
EPSILON
)
/
dir
.
y
)
;
Real
distEntryTMP
=
(
max
.
y
-
orig
.
y
-
EPSILON
)
/
dir
.
y
;
if
(
distEntryTMP
>
distEntry
)
{
distEntry
=
distEntryTMP
;
...
...
@@ -274,7 +281,7 @@ bool LrBinderRegularGrid::getIntersection(const LrRay &ray, LrHit *hit, Real min
// ### Debut : Intersection en Z
if
(
dir
.
z
>
EPSILON
)
{
int
distExitTMP
=
(
int
)((
max
.
z
-
orig
.
z
-
EPSILON
)
/
dir
.
z
)
;
Real
distExitTMP
=
(
max
.
z
-
orig
.
z
-
EPSILON
)
/
dir
.
z
;
if
(
distExitTMP
<
distExit
)
{
distExit
=
distExitTMP
;
...
...
@@ -282,7 +289,7 @@ bool LrBinderRegularGrid::getIntersection(const LrRay &ray, LrHit *hit, Real min
if
(
!
origInBinder
)
{
int
distEntryTMP
=
(
int
)((
min
.
z
-
orig
.
z
+
EPSILON
)
/
dir
.
z
)
;
Real
distEntryTMP
=
(
min
.
z
-
orig
.
z
+
EPSILON
)
/
dir
.
z
;
if
(
distEntryTMP
>
distEntry
)
{
distEntry
=
distEntryTMP
;
...
...
@@ -290,9 +297,9 @@ bool LrBinderRegularGrid::getIntersection(const LrRay &ray, LrHit *hit, Real min
}
}
else
if
(
dir
.
z
<
EPSILON
)
{
}
else
if
(
dir
.
z
<
-
EPSILON
)
{
int
distExitTMP
=
(
int
)((
min
.
z
-
orig
.
z
+
EPSILON
)
/
dir
.
z
)
;
Real
distExitTMP
=
(
min
.
z
-
orig
.
z
+
EPSILON
)
/
dir
.
z
;
if
(
distExitTMP
<
distExit
)
{
distExit
=
distExitTMP
;
...
...
@@ -300,7 +307,7 @@ bool LrBinderRegularGrid::getIntersection(const LrRay &ray, LrHit *hit, Real min
if
(
!
origInBinder
)
{
int
distEntryTMP
=
(
int
)((
max
.
z
-
orig
.
z
-
EPSILON
)
/
dir
.
z
)
;
Real
distEntryTMP
=
(
max
.
z
-
orig
.
z
-
EPSILON
)
/
dir
.
z
;
if
(
distEntryTMP
>
distEntry
)
{
distEntry
=
distEntryTMP
;
...
...
@@ -326,8 +333,8 @@ bool LrBinderRegularGrid::getIntersection(const LrRay &ray, LrHit *hit, Real min
pointEntry
=
ray
.
getPoint
(
distEntry
+
EPSILON
);
curVoxelX
=
(
int
)(((
pointEntry
.
x
-
min
.
x
)
/
m_lenBinder
.
x
)
*
m_nbVoxelX
);
curVoxelY
=
(
int
)(((
pointEntry
.
x
-
min
.
x
)
/
m_lenBinder
.
x
)
*
m_nbVoxelX
);
curVoxelZ
=
(
int
)(((
pointEntry
.
x
-
min
.
x
)
/
m_lenBinder
.
x
)
*
m_nbVoxelX
);
curVoxelY
=
(
int
)(((
pointEntry
.
y
-
min
.
y
)
/
m_lenBinder
.
y
)
*
m_nbVoxelY
);
curVoxelZ
=
(
int
)(((
pointEntry
.
z
-
min
.
z
)
/
m_lenBinder
.
z
)
*
m_nbVoxelZ
);
if
(
origInBinder
)
{
minbound
=
2
*
EPSILON
;
...
...
@@ -347,12 +354,12 @@ bool LrBinderRegularGrid::getIntersection(const LrRay &ray, LrHit *hit, Real min
dx
=
m_lenVoxel
.
x
/
dir
.
x
;
Dx
=
(
min
.
x
+
m_lenVoxel
.
x
*
(
curVoxelX
+
1
)
-
orig
.
x
)
/
dir
.
x
;
}
else
if
(
dir
.
x
<
EPSILON
)
{
}
else
if
(
dir
.
x
<
-
EPSILON
)
{
vX
=
-
1
;
incVoxelX
=
-
1
;
dx
=
m_lenVoxel
.
x
/
dir
.
x
;
dx
=
-
m_lenVoxel
.
x
/
dir
.
x
;
Dx
=
(
min
.
x
+
m_lenVoxel
.
x
*
(
curVoxelX
)
-
orig
.
x
)
/
dir
.
x
;
}
else
{
...
...
@@ -370,12 +377,12 @@ bool LrBinderRegularGrid::getIntersection(const LrRay &ray, LrHit *hit, Real min
dy
=
m_lenVoxel
.
y
/
dir
.
y
;
Dy
=
(
min
.
y
+
m_lenVoxel
.
y
*
(
curVoxelY
+
1
)
-
orig
.
y
)
/
dir
.
y
;
}
else
if
(
dir
.
y
<
EPSILON
)
{
}
else
if
(
dir
.
y
<
-
EPSILON
)
{
vY
=
-
1
;
incVoxelY
=
-
m_nbVoxelX
;
dy
=
m_lenVoxel
.
y
/
dir
.
y
;
dy
=
-
m_lenVoxel
.
y
/
dir
.
y
;
Dy
=
(
min
.
y
+
m_lenVoxel
.
y
*
(
curVoxelY
)
-
orig
.
y
)
/
dir
.
y
;
}
else
{
...
...
@@ -394,12 +401,12 @@ bool LrBinderRegularGrid::getIntersection(const LrRay &ray, LrHit *hit, Real min
dz
=
m_lenVoxel
.
z
/
dir
.
z
;
Dz
=
(
min
.
z
+
m_lenVoxel
.
z
*
(
curVoxelZ
+
1
)
-
orig
.
z
)
/
dir
.
z
;
}
else
if
(
dir
.
z
<
EPSILON
)
{
}
else
if
(
dir
.
z
<
-
EPSILON
)
{
vZ
=
-
1
;
incVoxelZ
=
-
(
m_nbVoxelX
*
m_nbVoxelY
);
dz
=
m_lenVoxel
.
z
/
dir
.
z
;
dz
=
-
m_lenVoxel
.
z
/
dir
.
z
;
Dz
=
(
min
.
z
+
m_lenVoxel
.
z
*
(
curVoxelZ
)
-
orig
.
z
)
/
dir
.
z
;
}
else
{
...
...
@@ -437,11 +444,12 @@ bool LrBinderRegularGrid::getIntersection(const LrRay &ray, LrHit *hit, Real min
impact
=
entity
->
getIntersection
(
ray
,
hit
,
numFrag
,
minbound
-
EPSILON
,
maxbound
+
EPSILON
);
intersection
=
intersection
||
impact
;
if
(
hit
!=
NULL
)
{
maxbound
=
hit
->
distance
;
}
else
{
break
;
if
(
impact
)
{
if
(
hit
!=
NULL
)
{
maxbound
=
hit
->
distance
;
}
else
{
break
;
}
}
}
...
...
LrEntityElementary.cpp
View file @
2d4a43a8
...
...
@@ -114,12 +114,12 @@ void LrEntityElementary::getMinMax(LrPoint &min, LrPoint &max) const
m_geometry
->
getMinMax
(
min
,
max
,
m_transf
);
}
void
LrEntityElementary
::
getMinMax
(
LrPoint
&
min
,
LrPoint
&
max
,
int
fragment
,
void
LrEntityElementary
::
getMinMax
(
LrPoint
&
min
,
LrPoint
&
max
,
int
fragment
,
LrEntity
*&
entityLocal
,
int
&
fragmentLocal
)
const
{
fragmentLocal
=
fragment
;
entityLocal
=
(
LrEntity
*
)
this
;
m_geometry
->
getMinMax
(
min
,
max
,
fragment
);
m_geometry
->
getMinMax
(
min
,
max
,
fragment
,
m_transf
);
}
int
LrEntityElementary
::
getNbFragments
()
const
{
...
...
LrGeometry.cpp
View file @
2d4a43a8
...
...
@@ -2,13 +2,13 @@
* @brief GÉOMÉTRIE : Gestion d'une géométrie générique
* @file LrGeometry.cpp
* @date Vendredi 7 mars 2008
* @note
* @note
* @author Josselin Francois
* @author Michael Nauge
* @author Axel Richard
* @author Hervé Souchaud
* @author Emeric Verschuur
*
*
* Ce fichier contient la classe qui gère une géométrie générique.
*/
...
...
@@ -80,7 +80,7 @@ bool LrGeometry::getIntersection(const LrRay &ray, LrHit *hit,
Real
localMaxBound
=
maxBound
;
int
nbFragments
=
getNbFragments
();
bool
ok
=
false
;
for
(
int
i
=
0
;
i
<
nbFragments
;
i
++
)
{
if
(
getIntersection
(
ray
,
hit
,
i
,
matrix
,
matrixInverse
,
matrixInverseTranspose
,
minBound
,
localMaxBound
))
...
...
@@ -91,7 +91,7 @@ bool LrGeometry::getIntersection(const LrRay &ray, LrHit *hit,
localMaxBound
=
hit
->
distance
;
}
}
return
ok
;
}
...
...
@@ -185,19 +185,19 @@ void LrGeometry::getMinMax(LrPoint &min, LrPoint &max) const
// amorce avec min max du premier fragment
getMinMax
(
min
,
max
,
0
);
for
(
int
i
=
1
;
i
<
nbFragments
;
i
++
)
{
LrPoint
lmin
,
lmax
;
getMinMax
(
lmin
,
lmax
,
i
);
if
(
lmin
.
x
<
min
.
x
)
min
.
x
=
lmin
.
x
;
if
(
lmin
.
y
<
min
.
y
)
min
.
y
=
lmin
.
y
;
if
(
lmin
.
z
<
min
.
z
)
min
.
z
=
lmin
.
z
;
if
(
lmax
.
x
>
max
.
x
)
max
.
x
=
lmax
.
x
;
if
(
lmax
.
y
>
max
.
y
)
...
...
@@ -212,6 +212,14 @@ void LrGeometry::getMinMax(LrPoint &min, LrPoint &max, const LrMatrix &transform
getMinMax
(
min
,
max
);
transformMinMax
(
min
,
max
,
transform
);
}
void
LrGeometry
::
getMinMax
(
LrPoint
&
min
,
LrPoint
&
max
,
int
fragment
,
const
LrMatrix
&
transform
)
const
{
getMinMax
(
min
,
max
,
fragment
);
transformMinMax
(
min
,
max
,
transform
);
}
void
LrGeometry
::
xyz2uv
(
const
LrPoint
&
point
,
Real
&
u
,
Real
&
v
)
const
{
...
...
@@ -227,7 +235,7 @@ void LrGeometry::xyz2uv(const LrPoint &point, Real &u, Real &v) const
v
=
(
CP
.
z
+
1.0
)
/
2.0
;
u
=
atan2
(
CP
.
y
,
CP
.
x
)
/
(
2.0
*
M_PI
);
if
(
u
<
0.0
)
u
+=
1.0
;
u
+=
1.0
;
}
void
LrGeometry
::
uv2xyz
(
Real
u
,
Real
v
,
LrPoint
*
point
,
...
...
LrGeometry.h
View file @
2d4a43a8
...
...
@@ -30,43 +30,43 @@ public:
* @brief Constructeur.
*/
LrGeometry
();
/**
* @brief Constructeur par copie.
* @param src Référence d'un objet LrGeometry.
*/
LrGeometry
(
const
LrGeometry
&
src
);
/**
* @brief Destructeur.
*/
virtual
~
LrGeometry
();
/**
* @brief Opérateur d'affectation.
* @param src Géométrie source.
* @return Une référence sur l'objet affecté.
*/
LrGeometry
&
operator
=
(
const
LrGeometry
&
src
);
/**
* @brief Opérateur de test d'égalité.
* @return toujours vrai.
*/
friend
bool
operator
==
(
const
LrGeometry
&
rhs
,
const
LrGeometry
&
lhs
);
/**
* @brief Opérateur de test d'inégalité.
* @return toujours faux.
*/
friend
bool
operator
!=
(
const
LrGeometry
&
rhs
,
const
LrGeometry
&
lhs
);
/**
* @brief Donne le nombre de fragments de la géométrie.
* @return Un entier.
*/
virtual
int
getNbFragments
()
const
=
0
;
/**
* @brief Donne d'intersection entre un rayon et la géométrie.
* @param ray Référence d'un objet LrRay.
...
...
@@ -89,7 +89,7 @@ public:
const
LrMatrix
&
matrixInverse
,
const
LrMatrix
&
matrixInverseTranspose
,
Real
minBound
=
0
,
Real
maxBound
=
INFINITY
)
const
;
/**
* @brief Donne d'intersection entre un rayon et un fragment de la géométrie.
* @param ray Référence d'un objet LrRay.
...
...
@@ -99,15 +99,15 @@ public:
* @param maxBound Distance maximum par rapport à l'origine (défaut : INFINITY).
* @return vrai si il y a une intersection, sinon faux.
*
* Cette méthode calcul l'intersection entre le rayon @a ray et le fragment
* @a fragment la géométrie et stocke le résultat dans la sructure LrHit pointée
* par @a hit si ce dernier n'est pas égal à NULL. On peut également spécifier
* la portion du rayon, à l'aide des paramètres @a minBound @a maxBound ,
* Cette méthode calcul l'intersection entre le rayon @a ray et le fragment
* @a fragment la géométrie et stocke le résultat dans la sructure LrHit pointée
* par @a hit si ce dernier n'est pas égal à NULL. On peut également spécifier
* la portion du rayon, à l'aide des paramètres @a minBound @a maxBound ,
* à prendre en compte pour ce calcul.
*/
virtual
bool
getIntersection
(
const
LrRay
&
ray
,
LrHit
*
hit
,
int
fragment
,
Real
minBound
=
0
,
Real
maxBound
=
INFINITY
)
const
=
0
;
/**
* @brief Donne d'intersection entre un rayon et un fragment de la géométrie.
* @param ray Référence d'un objet LrRay.
...
...
@@ -120,10 +120,10 @@ public:
* @param maxBound Distance maximum par rapport à l'origine (défaut : INFINITY).
* @return vrai si il y a une intersection, sinon faux.
*
* Cette méthode calcul l'intersection entre le rayon @a ray et le fragment
* @a fragment la géométrie et stocke le résultat dans la sructure LrHit pointée
* par @a hit si ce dernier n'est pas égal à NULL. On peut également spécifier
* la portion du rayon, à l'aide des paramètres @a minBound @a maxBound ,
* Cette méthode calcul l'intersection entre le rayon @a ray et le fragment
* @a fragment la géométrie et stocke le résultat dans la sructure LrHit pointée
* par @a hit si ce dernier n'est pas égal à NULL. On peut également spécifier
* la portion du rayon, à l'aide des paramètres @a minBound @a maxBound ,
* à prendre en compte pour ce calcul.
*/
virtual
bool
getIntersection
(
const
LrRay
&
ray
,
LrHit
*
hit
,
int
fragment
,
...
...
@@ -131,7 +131,7 @@ public:
const
LrMatrix
&
matrixInverse
,
const
LrMatrix
&
matrixInverseTranspose
,
Real
minBound
,
Real
maxBound
)
const
;
/**
* @brief Calcul des points min et max de la boîte englobante.
* @param min LrPoint minimum de la boîte.
...
...
@@ -141,7 +141,7 @@ public:
* derrière, à droite" de la géométrie.
*/
virtual
void
getMinMax
(
LrPoint
&
min
,
LrPoint
&
max
)
const
;
/**
* @brief Calcul des points min et max de la boîte englobante.
* @param min LrPoint minimum de la boîte.
...
...
@@ -152,7 +152,7 @@ public:
* derrière, à droite" de la géométrie.
*/
virtual
void
getMinMax
(
LrPoint
&
min
,
LrPoint
&
max
,
int
fragment
)
const
=
0
;
/**
* @brief Calcul des points min et max de la boîte englobante suite à une
* @brief transormation.
...
...
@@ -166,7 +166,9 @@ public:
*/
virtual
void
getMinMax
(
LrPoint
&
min
,
LrPoint
&
max
,
const
LrMatrix
&
transform
)
const
;
virtual
void
getMinMax
(
LrPoint
&
min
,
LrPoint
&
max
,
int
fragment
,
const
LrMatrix
&
transform
)
const
;
protected:
/**
* @brief Conversion de coordonnées absolues en paramétriques.
...
...
@@ -175,7 +177,7 @@ protected:
* @param v Réel v (paramètre out).
*/
virtual
void
xyz2uv
(
const
LrPoint
&
point
,
Real
&
u
,
Real
&
v
)
const
;
/**
* @brief Conversion de coordonnées paramétriques en absolues.
* @param u Réel u.
...
...
@@ -186,7 +188,7 @@ protected:
*/
virtual
void
uv2xyz
(
Real
u
,
Real
v
,
LrPoint
*
point
,
LrVector
*
normal
,
LrVector
*
tangent
)
const
;
private:
};
...
...
LrSceneRayTracing.cpp
View file @
2d4a43a8
...
...
@@ -35,7 +35,7 @@ LrSceneRayTracing::LrSceneRayTracing()
}
// ############################################################################
LrSceneRayTracing
::
LrSceneRayTracing
(
const
LrSceneRayTracing
&
source
)
:
LrScene
(
source
),
...
...
@@ -47,7 +47,7 @@ LrSceneRayTracing::LrSceneRayTracing(const LrSceneRayTracing &source)
}
// ############################################################################
LrSceneRayTracing
::
LrSceneRayTracing
(
const
LrEntityList
&
entities
,
const
LrEntityList
&
lights
,
LrBinder
*
binder
,
...
...
@@ -65,7 +65,7 @@ LrSceneRayTracing::LrSceneRayTracing(const LrEntityList &entities,
}
// ############################################################################
LrSceneRayTracing
::~
LrSceneRayTracing
()
{
}
...
...
@@ -109,13 +109,14 @@ void LrSceneRayTracing::generateImagePart(int lOffset, int lNb)
int
nbRayPerPixel
=
(
coeffAA
*
coeffAA
);
srand
(
time
(
NULL
));
int
q
=
m_image
->
getHeight
()
*
m_image
->
getWidth
()
/
100
;
for
(
int
l
=
lOffset
;
l
<
lOffset
+
lNb
;
l
++
)
{
for
(
int
c
=
0
;
c
<
m_image
->
getWidth
();
c
++
)
{
LrColor
pixel
=
LrColor
::
BLACK
;
...
...
@@ -176,7 +177,7 @@ LrColor LrSceneRayTracing::computeImageRay(const LrRay &ray, int nbRebonds)
LrPoint
tmpOrig
=
LrPoint
::
translate
(
hit
.
point
,
EPSILON
*
hit
.
normal
);
newRay
=
LrRay
(
v_reflect
,
tmpOrig
);
colorReflected
+=
computeImageRay
(
newRay
,
--
nbRebonds
);
colorReflected
=
colorReflected
*
coefSpecular
;
colorReflected
=
colorReflected
*
coefSpecular
;
}
//On recupere la couleur du rayon réfracté
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment