[Bf-blender-cvs] [01a62515cb2] blender2.8: DRW: Add "hardcoded" stipples for sun ray display.

Clément Foucault noreply at git.blender.org
Mon Jan 29 22:23:22 CET 2018


Commit: 01a62515cb2be0c7c0b13c2fcd8332509ad6a3df
Author: Clément Foucault
Date:   Mon Jan 22 16:14:12 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB01a62515cb2be0c7c0b13c2fcd8332509ad6a3df

DRW: Add "hardcoded" stipples for sun ray display.

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

M	source/blender/draw/intern/draw_cache.c

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

diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c
index c759a29ee0c..3b4180c0375 100644
--- a/source/blender/draw/intern/draw_cache.c
+++ b/source/blender/draw/intern/draw_cache.c
@@ -1068,7 +1068,7 @@ Gwn_Batch *DRW_cache_lamp_sunrays_get(void)
 	if (!SHC.drw_lamp_sunrays) {
 		float v[2], v1[2], v2[2];
 
-		/* Position Only 3D format */
+		/* Position Only 2D format */
 		static Gwn_VertFormat format = { 0 };
 		static struct { uint pos; } attr_id;
 		if (format.attrib_ct == 0) {
@@ -1076,17 +1076,21 @@ Gwn_Batch *DRW_cache_lamp_sunrays_get(void)
 		}
 
 		Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
-		GWN_vertbuf_data_alloc(vbo, 16);
+		GWN_vertbuf_data_alloc(vbo, 32);
 
 		for (int a = 0; a < 8; a++) {
 			v[0] = sinf((2.0f * M_PI * a) / 8.0f);
 			v[1] = cosf((2.0f * M_PI * a) / 8.0f);
 
-			mul_v2_v2fl(v1, v, 1.2f);
-			mul_v2_v2fl(v2, v, 2.5f);
+			mul_v2_v2fl(v1, v, 1.6f);
+			mul_v2_v2fl(v2, v, 1.9f);
+			GWN_vertbuf_attr_set(vbo, attr_id.pos, a * 4, v1);
+			GWN_vertbuf_attr_set(vbo, attr_id.pos, a * 4 + 1, v2);
 
-			GWN_vertbuf_attr_set(vbo, attr_id.pos, a * 2, v1);
-			GWN_vertbuf_attr_set(vbo, attr_id.pos, a * 2 + 1, v2);
+			mul_v2_v2fl(v1, v, 2.2f);
+			mul_v2_v2fl(v2, v, 2.5f);
+			GWN_vertbuf_attr_set(vbo, attr_id.pos, a * 4 + 2, v1);
+			GWN_vertbuf_attr_set(vbo, attr_id.pos, a * 4 + 3, v2);
 		}
 
 		SHC.drw_lamp_sunrays = GWN_batch_create_ex(GWN_PRIM_LINES, vbo, NULL, GWN_BATCH_OWNS_VBO);



More information about the Bf-blender-cvs mailing list