X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fmaterials%2Fpbrmaterial.h;h=18719bd44e98f8616f2fb7e2e85aac79d2baccda;hp=7c0d545936db21b5464c20bf60512f3566b94ae2;hb=HEAD;hpb=e05c77d2e3582a6962f42dcec0fc5f7845ff448d diff --git a/source/materials/pbrmaterial.h b/source/materials/pbrmaterial.h index 7c0d5459..e96236d2 100644 --- a/source/materials/pbrmaterial.h +++ b/source/materials/pbrmaterial.h @@ -8,6 +8,15 @@ 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: @@ -17,7 +26,6 @@ public: static ActionMap shared_actions; public: - Loader(PbrMaterial &); Loader(PbrMaterial &, Collection &); private: @@ -26,32 +34,33 @@ public: private: Property base_color; + Property tint; Property normal; Property metalness; Property roughness; Property occlusion; Property emission; 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 *); + void set_tint(const Color &); void set_normal_map(const Texture *); void set_metalness(float); void set_metalness_map(const Texture *);