From: Mikko Rasa Date: Sat, 24 Apr 2021 19:44:34 +0000 (+0300) Subject: Cosmetic fixes X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=55e3f2d494d939280a4ea48676fd17ca2342b457;p=libs%2Fgl.git Cosmetic fixes --- diff --git a/blender/io_mspgl/export_material.py b/blender/io_mspgl/export_material.py index 97bb8e9e..e3014f3c 100644 --- a/blender/io_mspgl/export_material.py +++ b/blender/io_mspgl/export_material.py @@ -1,6 +1,7 @@ import os def create_technique_resource(material, resources): + # This operates on a Blender material, not a custom object from .datafile import Resource, Statement tech_res = Resource(material.name+".tech", "technique") diff --git a/shaderlib/cooktorrance.glsl b/shaderlib/cooktorrance.glsl index 4315b9ec..2a03e2c5 100644 --- a/shaderlib/cooktorrance.glsl +++ b/shaderlib/cooktorrance.glsl @@ -127,8 +127,8 @@ vec3 cooktorrance_one_light_direct(vec3 normal, vec3 look, vec3 light, vec3 ligh vec3 k_spec = fresnel_schlick(halfway, light, base_color, metalness); vec3 k_diff = (1.0-k_spec)*(1.0-metalness); - float denom = max(4.0*max(dot(normal, -look), 0.0)*max(dot(normal, light), 0.0), 0.001); - return max(dot(normal, light), 0.0)*light_color*(k_diff*lambert_diffuse(base_color)+k_spec*ndist*geom/denom); + float spec_denom = max(4.0*max(dot(normal, -look), 0.0)*max(dot(normal, light), 0.0), 0.001); + return max(dot(normal, light), 0.0)*light_color*(k_diff*lambert_diffuse(base_color)+k_spec*ndist*geom/spec_denom); } vec3 cooktorrance_lighting(vec3 normal, vec3 look, vec3 base_color, float metalness, float roughness) diff --git a/source/effects/colorcurve.cpp b/source/effects/colorcurve.cpp index 130fa8df..9e242d19 100644 --- a/source/effects/colorcurve.cpp +++ b/source/effects/colorcurve.cpp @@ -34,6 +34,7 @@ void ColorCurve::set_brightness_response(float b) { if(b<=0 || b>1) throw invalid_argument("ColorCurve::set_brightness_response"); + // Calculate an offset value to obtain a derivative of 1 at zero intensity. float t = (b<1 ? pow(b, 1/(1-b)) : 0.0f); shdata.uniform("brightness_response", b, t, pow(t, b)); } diff --git a/source/effects/colorcurve.h b/source/effects/colorcurve.h index e34834aa..ee19a56f 100644 --- a/source/effects/colorcurve.h +++ b/source/effects/colorcurve.h @@ -58,7 +58,9 @@ public: image, negative values darken it. Zero is neutral. */ void set_exposure_adjust(float); - /** Sets the exponent of the */ + /** Sets the exponent of the brightness response curve. It must be greater + than zero and at most one. A value of one gives a linear response; closer + to zero results in a more gentle curve. */ void set_brightness_response(float); /** Sets the gamma value used for mapping output colors. Allowed range is diff --git a/source/effects/environmentmap.h b/source/effects/environmentmap.h index 56c76c45..ff3d6c42 100644 --- a/source/effects/environmentmap.h +++ b/source/effects/environmentmap.h @@ -48,7 +48,12 @@ public: EnvironmentMap(Resources &, unsigned size, Renderable &rend, Renderable &env); void set_depth_clip(float, float); + + /** Sets the interval in frames between environment map updates. A value of + 0 means an update is only done when manually requested. */ void set_update_interval(unsigned); + + /** Request that the environment map is updated on the next frame. */ void queue_update(); virtual void setup_frame(Renderer &); diff --git a/source/glsl/spirv.cpp b/source/glsl/spirv.cpp index 6ef58e90..036446f5 100644 --- a/source/glsl/spirv.cpp +++ b/source/glsl/spirv.cpp @@ -1177,7 +1177,7 @@ void SpirVGenerator::visit_constructor(FunctionCall &call, const vector &arg Id zero_id = get_constant_id(get_id(elem), 0.0f); for(unsigned i=0; i