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
89c69241
Commit
89c69241
authored
3 years ago
by
Yoel
Browse files
Options
Downloads
Patches
Plain Diff
ReflectiveMateiral renamed for faster compiling
parent
bf770bc9
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/material/ReflectiveMaterialcpp
+10
-5
10 additions, 5 deletions
RayTracer/material/ReflectiveMaterialcpp
RayTracer/material/ReflectiveMaterialh
+3
-3
3 additions, 3 deletions
RayTracer/material/ReflectiveMaterialh
with
13 additions
and
8 deletions
RayTracer/material/ReflectiveMaterial
.
cpp
→
RayTracer/material/ReflectiveMaterialcpp
+
10
−
5
View file @
89c69241
...
...
@@ -34,16 +34,21 @@ util::Vec3 ReflectiveMaterial::emission(
const std::pair<float, float>& uv) const {
return emission_profile.color(uv.first, uv.second);
}
util
::
Vec3
ReflectiveMaterial
::
scattered_d
(
const
util
::
Vec3
&
d
,
std::optional<
util::Vec3
>
ReflectiveMaterial::scattered_d(const util::Vec3& d,
const util::Vec3& n) const {
util
::
Vec3
rand
=
util
::
rand_vec3_in_circle
(
clearness
);
util
::
Vec3
reflected
=
reflection
(
d
,
n
);
return
reflected
+
rand
;
if (util::dot(d, n) > 0) {
util::Vec3 rand = util::rand_vec3_in_circle(clearness);
util::Vec3 reflected = reflection(d, n);
return std::make_optional(reflected + rand);
} else
return std::nullopt;
}
/*
bool ReflectiveMaterial::scatter(const util::Vec3& d,
const util::Vec3& n) const {
return
util
::
dot
(
d
,
n
)
>
0
;
return util::dot(d, n) > 0;
}
*/
float ReflectiveMaterial::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/material/ReflectiveMaterial
.
h
→
RayTracer/material/ReflectiveMaterialh
+
3
−
3
View file @
89c69241
...
...
@@ -15,9 +15,9 @@ class ReflectiveMaterial : public Material {
util::Vec3 albedo(const std::pair<float, float>& uv) const override;
util::Vec3 emission(const std::pair<float, float>& uv) const override;
util
::
Vec3
scattered_d
(
const
util
::
Vec3
&
d
,
const
util
::
Vec3
&
n
)
const
override
;
bool
scatter
(
const
util
::
Vec3
&
d
,
const
util
::
Vec3
&
n
)
const
override
;
std::optional<
util::Vec3
>
scattered_d(const util::Vec3& d,
const util::Vec3& n) const override;
//
bool scatter(const util::Vec3& d, const util::Vec3& n) const override;
float calculateLightMultiplier(const util::Vec3& d_in,
const util::Vec3& d_out,
...
...
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