X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fmaterials%2Fpbrmaterial.h;h=18719bd44e98f8616f2fb7e2e85aac79d2baccda;hb=190a7e11237351f6b730c28f7b16f183e8adc69c;hp=00e5e1babc64ded6c83b1ff894f0f5a78a0e672b;hpb=6f39983060a27634c012f66c82fea0d09fea9774;p=libs%2Fgl.git diff --git a/source/materials/pbrmaterial.h b/source/materials/pbrmaterial.h index 00e5e1ba..18719bd4 100644 --- a/source/materials/pbrmaterial.h +++ b/source/materials/pbrmaterial.h @@ -6,6 +6,17 @@ namespace Msp { namespace GL { +class Texture2D; + +/** +A physically-based material using the Cook-Torrance BRDF. + +The material is characterized by base color, metalness and roughness. Fully +metallic materials have no diffuse reflection and their specular reflection is +tinted by the base color. For fully dielectric materials base color determines +the color of the diffuse reflection; specular reflection is untinted. +Roughness affects how blurry specular reflections are. +*/ class PbrMaterial: public Material { public: @@ -15,7 +26,6 @@ public: static ActionMap shared_actions; public: - Loader(PbrMaterial &); Loader(PbrMaterial &, Collection &); private: @@ -29,21 +39,24 @@ private: Property roughness; Property occlusion; Property emission; - bool receive_shadows; + const Texture2D &fresnel_lookup; + const Sampler &fresnel_sampler; static const Tag texture_tags[]; public: PbrMaterial(); +private: + static const Texture2D &get_or_create_fresnel_lookup(); + protected: virtual void fill_program_info(std::string &, std::map &) const; public: - DEPRECATED virtual void attach_textures_to(Texturing &, ProgramData &) const; - 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 *); @@ -55,7 +68,6 @@ public: void set_occlusion_map(const Texture *); void set_emission(const Color &); void set_emission_map(const Texture *); - void set_receive_shadows(bool); }; } // namespace GL