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
07504f40
Commit
07504f40
authored
4 years ago
by
Yoel
Browse files
Options
Downloads
Patches
Plain Diff
New class SurfacePoint
parent
70efd9cb
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
+31
-0
31 additions, 0 deletions
RayTracer/tools/SurfacePoint.cpp
RayTracer/tools/SurfacePoint.h
+26
-0
26 additions, 0 deletions
RayTracer/tools/SurfacePoint.h
with
57 additions
and
0 deletions
RayTracer/tools/SurfacePoint.cpp
0 → 100644
+
31
−
0
View file @
07504f40
#include
"SurfacePoint.h"
#include
<limits>
#include
"../camera/Ray.h"
namespace
util
{
SurfacePoint
::
SurfacePoint
(
const
util
::
Vec3
&
point
,
const
util
::
Vec3
&
n
,
const
std
::
shared_ptr
<
material
::
Material
>&
material
)
:
x
(
point
),
n
(
n
),
material
(
material
)
{
}
cam
::
Ray
SurfacePoint
::
scattered_ray
(
const
cam
::
Ray
&
inc_ray
)
const
{
return
cam
::
Ray
(
x
,
material
->
scattered_d
(
inc_ray
.
d
,
n
),
std
::
numeric_limits
<
float
>::
epsilon
(),
inc_ray
.
tmax
,
true
);
}
util
::
Vec3
SurfacePoint
::
albedo
()
const
{
return
material
->
albedo
(
0
,
0
);
}
util
::
Vec3
SurfacePoint
::
emission
()
const
{
return
material
->
emission
(
0
,
0
);
}
bool
SurfacePoint
::
scatter
()
const
{
return
material
->
scatter
();
}
util
::
Vec3
SurfacePoint
::
point
()
const
{
return
x
;
}
util
::
Vec3
SurfacePoint
::
normal
()
const
{
return
n
;
}
}
// namespace util
\ No newline at end of file
This diff is collapsed.
Click to expand it.
RayTracer/tools/SurfacePoint.h
0 → 100644
+
26
−
0
View file @
07504f40
#pragma once
#include
"../camera/Ray.h"
#include
"../material/Material.h"
namespace
util
{
class
SurfacePoint
{
public:
SurfacePoint
(
const
util
::
Vec3
&
point
,
const
util
::
Vec3
&
n
,
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
bool
scatter
()
const
;
util
::
Vec3
point
()
const
;
util
::
Vec3
normal
()
const
;
// Attributes
// TODO TexelPos
std
::
shared_ptr
<
material
::
Material
>
material
;
private:
util
::
Vec3
x
,
n
;
};
}
// 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