Skip to content
Snippets Groups Projects
Commit 501f94f0 authored by Yoel's avatar Yoel
Browse files

Reflective Refactor

parent 90d47f0b
No related branches found
No related tags found
No related merge requests found
......@@ -11,20 +11,20 @@ ReflectiveMaterial::ReflectiveMaterial(
const std::shared_ptr<util::Sampler>& albedo_texture,
const std::shared_ptr<util::Sampler>& emission_texture, float clearness)
: albedo_texture(albedo_texture),
emission_texture(emission_texture),
emission_profile({emission_texture}),
clearness(clearness) {
}
ReflectiveMaterial::ReflectiveMaterial(
const std::shared_ptr<util::Sampler>& albedo_texture, float clearness)
: albedo_texture(albedo_texture),
emission_texture(
std::make_shared<Constant>(Constant(util::Vec3(0, 0, 0)))),
emission_profile(
{std::make_shared<Constant>(Constant(util::Vec3(0, 0, 0)))}),
clearness(clearness) {
}
ReflectiveMaterial::ReflectiveMaterial(const util::Vec3& color, float clearness)
: albedo_texture(std::make_shared<Constant>(Constant(color))),
emission_texture(
std::make_shared<Constant>(Constant(util::Vec3(0, 0, 0)))),
emission_profile(
{std::make_shared<Constant>(Constant(util::Vec3(0, 0, 0)))}),
clearness(clearness) {
}
util::Vec3 ReflectiveMaterial::albedo(const std::pair<float, float>& uv) const {
......@@ -32,7 +32,7 @@ util::Vec3 ReflectiveMaterial::albedo(const std::pair<float, float>& uv) const {
}
util::Vec3 ReflectiveMaterial::emission(
const std::pair<float, float>& uv) const {
return emission_texture->color(uv.first, uv.second);
return emission_profile.color(uv.first, uv.second);
}
util::Vec3 ReflectiveMaterial::scattered_d(const util::Vec3& d,
const util::Vec3& n) const {
......
#pragma once
#include "../tools/EmissionProfile.h"
#include "Material.h"
namespace material {
......@@ -24,7 +25,7 @@ class ReflectiveMaterial : public Material {
private:
std::shared_ptr<util::Sampler> albedo_texture;
std::shared_ptr<util::Sampler> emission_texture;
util::EmissionProfile emission_profile;
float clearness;
};
} // namespace material
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment