Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CppRaytracer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Yoel
CppRaytracer
Commits
2e0197bf
Commit
2e0197bf
authored
4 years ago
by
Yoel
Browse files
Options
Downloads
Patches
Plain Diff
Added texels to SurfacePoints
parent
13829265
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
RayTracer/tools/SurfacePoint.cpp
+7
-3
7 additions, 3 deletions
RayTracer/tools/SurfacePoint.cpp
RayTracer/tools/SurfacePoint.h
+5
-3
5 additions, 3 deletions
RayTracer/tools/SurfacePoint.h
with
12 additions
and
6 deletions
RayTracer/tools/SurfacePoint.cpp
+
7
−
3
View file @
2e0197bf
...
...
@@ -6,18 +6,19 @@
namespace
util
{
SurfacePoint
::
SurfacePoint
(
const
util
::
Vec3
&
point
,
const
util
::
Vec3
&
n
,
const
std
::
pair
<
float
,
float
>&
uv
,
const
std
::
shared_ptr
<
material
::
Material
>&
material
)
:
x
(
point
),
n
(
n
),
material
(
material
)
{
:
x
(
point
),
n
(
n
),
uv
(
uv
),
material
(
material
)
{
}
cam
::
Ray
SurfacePoint
::
scattered_ray
(
const
cam
::
Ray
&
inc_ray
)
const
{
return
cam
::
Ray
(
x
,
material
->
scattered_d
(
inc_ray
.
d
,
n
),
cam
::
epsilon
,
inc_ray
.
tmax
,
true
);
}
util
::
Vec3
SurfacePoint
::
albedo
()
const
{
return
material
->
albedo
(
0
,
0
);
return
material
->
albedo
(
uv
);
}
util
::
Vec3
SurfacePoint
::
emission
()
const
{
return
material
->
emission
(
0
,
0
);
return
material
->
emission
(
uv
);
}
bool
SurfacePoint
::
scatter
(
const
util
::
Vec3
&
d
,
const
util
::
Vec3
&
n
)
const
{
return
material
->
scatter
(
d
,
n
);
...
...
@@ -28,6 +29,9 @@ util::Vec3 SurfacePoint::point() const {
util
::
Vec3
SurfacePoint
::
normal
()
const
{
return
n
;
}
std
::
pair
<
float
,
float
>
SurfacePoint
::
texel
()
const
{
return
uv
;
}
float
SurfacePoint
::
calculateLightMultiplier
(
const
util
::
Vec3
&
d_in
,
const
util
::
Vec3
&
d_out
,
const
util
::
Vec3
&
n
)
const
{
...
...
This diff is collapsed.
Click to expand it.
RayTracer/tools/SurfacePoint.h
+
5
−
3
View file @
2e0197bf
...
...
@@ -7,23 +7,25 @@ namespace util {
class
SurfacePoint
{
public:
SurfacePoint
(
const
util
::
Vec3
&
point
,
const
util
::
Vec3
&
n
,
const
std
::
pair
<
float
,
float
>&
uv
,
const
std
::
shared_ptr
<
material
::
Material
>&
material
);
cam
::
Ray
scattered_ray
(
const
cam
::
Ray
&
inc_ray
)
const
;
util
::
Vec3
albedo
()
const
;
// TODO TexelPos
util
::
Vec3
emission
()
const
;
// TODO TexelPos
util
::
Vec3
albedo
()
const
;
util
::
Vec3
emission
()
const
;
bool
scatter
(
const
util
::
Vec3
&
d
,
const
util
::
Vec3
&
n
)
const
;
util
::
Vec3
point
()
const
;
util
::
Vec3
normal
()
const
;
std
::
pair
<
float
,
float
>
texel
()
const
;
float
calculateLightMultiplier
(
const
util
::
Vec3
&
d_in
,
const
util
::
Vec3
&
d_out
,
const
util
::
Vec3
&
n
)
const
;
// Attributes
// TODO TexelPos
std
::
shared_ptr
<
material
::
Material
>
material
;
private:
util
::
Vec3
x
,
n
;
std
::
pair
<
float
,
float
>
uv
;
};
}
// namespace util
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment