X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fmaterials%2Fpbrmaterial.cpp;h=b153a2cbeb32b890aec9cb9219725d73fd18f92a;hb=5593d59bfe30fd7eecc55bc3580d87fcb91f0248;hp=e01bbb9d5f0043463a6d38a987f04758a2c95022;hpb=c8520aa336e92f2eaf9a38c3430c608520a90324;p=libs%2Fgl.git diff --git a/source/materials/pbrmaterial.cpp b/source/materials/pbrmaterial.cpp index e01bbb9d..b153a2cb 100644 --- a/source/materials/pbrmaterial.cpp +++ b/source/materials/pbrmaterial.cpp @@ -55,16 +55,18 @@ const Texture2D &PbrMaterial::get_or_create_fresnel_lookup() Framebuffer fresnel_lookup_fbo((COLOR_ATTACHMENT,RG8)); fresnel_lookup_fbo.attach(COLOR_ATTACHMENT, *fresnel_lookup); Renderer renderer; + renderer.begin(); renderer.set_framebuffer(&fresnel_lookup_fbo); renderer.set_shader_program(&shprog, &shdata); mesh.draw(renderer); + renderer.end(); return *fresnel_lookup; } void PbrMaterial::fill_program_info(string &module_name, map &spec_values) const { - module_name = "cooktorrance.glsl"; + module_name = "pbr_material.glsl"; spec_values["use_base_color_map"] = (base_color.texture!=0); spec_values["use_normal_map"] = (normal.texture!=0); spec_values["use_metalness_map"] = (metalness.texture!=0); @@ -114,6 +116,12 @@ void PbrMaterial::set_base_color_map(const Texture *tex) base_color.texture = tex; } +void PbrMaterial::set_tint(const Color &color) +{ + tint.value = color; + shdata.uniform("pbr_material.tint", color); +} + void PbrMaterial::set_normal_map(const Texture *tex) { normal.texture = tex; @@ -175,6 +183,7 @@ void PbrMaterial::Loader::init_actions() add_property("roughness", &PbrMaterial::set_roughness, &PbrMaterial::set_roughness_map); add_property("occlusion", &PbrMaterial::set_occlusion_map); add_property("emission", &PbrMaterial::set_emission, &PbrMaterial::set_emission_map, false); + add_property("tint", &PbrMaterial::set_tint, 0, true); } } // namespace GL