[Bf-blender-cvs] [3926ec6aa1b] blender2.8: Studiolight: Segment when using float based matcaps

Jeroen Bakker noreply at git.blender.org
Fri Jun 8 12:11:55 CEST 2018


Commit: 3926ec6aa1bc6981fc7e2e07a94b1d92d8518111
Author: Jeroen Bakker
Date:   Fri Jun 8 12:10:29 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB3926ec6aa1bc6981fc7e2e07a94b1d92d8518111

Studiolight: Segment when using float based matcaps

===================================================================

M	source/blender/blenkernel/intern/studiolight.c

===================================================================

diff --git a/source/blender/blenkernel/intern/studiolight.c b/source/blender/blenkernel/intern/studiolight.c
index da3cc97c43f..e4b49656907 100644
--- a/source/blender/blenkernel/intern/studiolight.c
+++ b/source/blender/blenkernel/intern/studiolight.c
@@ -584,15 +584,19 @@ static uint *studiolight_matcap_preview(StudioLight *sl, int icon_size)
 	BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_EXTERNAL_IMAGE_LOADED);
 
 	uint *rect = MEM_mallocN(icon_size * icon_size * sizeof(uint), __func__);
+	const uint alphamask = 0xff000000;
+	float color[4];
+	float fx, fy;
 	int offset = 0;
 	ImBuf *ibuf = sl->equirectangular_radiance_buffer;
 	for (int y = 0; y < icon_size; y++) {
 		for (int x = 0; x < icon_size; x++) {
-			uint pixelresult = 0x0;
-			float fx = x * ibuf->x / icon_size;
-			float fy = y * ibuf->y / icon_size;
-			nearest_interpolation_color(ibuf, (uchar *)&pixelresult, NULL, fx, fy);
-			rect[offset++] = pixelresult;
+			fx = x * ibuf->x / icon_size;
+			fy = y * ibuf->y / icon_size;
+			nearest_interpolation_color(ibuf, NULL, color, fx, fy);
+			rect[offset++] = rgb_to_cpack(linearrgb_to_srgb(color[0]),
+			                              linearrgb_to_srgb(color[1]),
+			                              linearrgb_to_srgb(color[2])) | alphamask;
 		}
 	}
 	return rect;
@@ -834,4 +838,4 @@ void BKE_studiolight_refresh(void)
 {
 	BKE_studiolight_free();
 	BKE_studiolight_init();
-}
\ No newline at end of file
+}



More information about the Bf-blender-cvs mailing list