virtual const Tag *get_texture_tags() const = 0;
virtual const Texture *get_texture(Tag) const = 0;
- const Sampler *get_sampler() const { return sampler; }
+ virtual const Sampler *get_sampler(Tag) const { return sampler; }
void set_debug_name(const std::string &);
};
PbrMaterial::PbrMaterial():
- fresnel_lookup(get_or_create_fresnel_lookup())
+ fresnel_lookup(get_or_create_fresnel_lookup()),
+ fresnel_sampler(Resources::get_global().get<Sampler>("_linear_clamp.samp"))
{
set_base_color(0.8f);
set_metalness(0.0f);
return 0;
}
+const Sampler *PbrMaterial::get_sampler(Tag tag) const
+{
+ if(tag==texture_tags[6])
+ return &fresnel_sampler;
+ else
+ return sampler;
+}
+
void PbrMaterial::set_base_color(const Color &color)
{
base_color.value = color;
Property<float> occlusion;
Property<Color> emission;
const Texture2D &fresnel_lookup;
+ const Sampler &fresnel_sampler;
static const Tag texture_tags[];
public:
virtual const Tag *get_texture_tags() const { return texture_tags; }
virtual const Texture *get_texture(Tag) const;
+ virtual const Sampler *get_sampler(Tag) const;
void set_base_color(const Color &);
void set_base_color_map(const Texture *);
{
const Tag *material_texture_tags = material->get_texture_tags();
for(const Tag *tag=material_texture_tags; tag->id; ++tag)
- set_texture(*tag, material->get_texture(*tag), material->get_sampler());
+ set_texture(*tag, material->get_texture(*tag), material->get_sampler(*tag));
}
void RenderPass::maybe_create_material_shader()