[Bf-blender-cvs] [cd813bae2b6] greasepencil-object: Rename functions and structs to new Gawain naming

Antonio Vazquez noreply at git.blender.org
Wed Jun 21 22:12:10 CEST 2017


Commit: cd813bae2b61fe3d5affd69f861e013c9bc28a53
Author: Antonio Vazquez
Date:   Wed Jun 21 21:00:07 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rBcd813bae2b61fe3d5affd69f861e013c9bc28a53

Rename functions and structs  to new Gawain naming

As this branch is not the current blender2.8, these renaming was missing in grease pencil new code.

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

M	source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
M	source/blender/draw/engines/gpencil/gpencil_engine.c
M	source/blender/draw/engines/gpencil/gpencil_engine.h
M	source/blender/draw/engines/gpencil/gpencil_geom.c
M	source/blender/draw/intern/draw_cache.c
M	source/blender/draw/intern/draw_cache.h
M	source/blender/editors/gpencil/drawgpencil.c

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

diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
index c1d6086a186..4728267fd4f 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -109,9 +109,9 @@ static void gpencil_batch_cache_resize(bGPdata *gpd, int slots)
 {
 	GpencilBatchCache *cache = gpd->batch_cache;
 	cache->cache_size = slots;
-	cache->batch_stroke = MEM_recallocN(cache->batch_stroke, sizeof(struct Batch) * slots);
-	cache->batch_fill = MEM_recallocN(cache->batch_fill, sizeof(struct Batch) * slots);
-	cache->batch_edit = MEM_recallocN(cache->batch_edit, sizeof(struct Batch) * slots);
+	cache->batch_stroke = MEM_recallocN(cache->batch_stroke, sizeof(struct Gwn_Batch) * slots);
+	cache->batch_fill = MEM_recallocN(cache->batch_fill, sizeof(struct Gwn_Batch) * slots);
+	cache->batch_edit = MEM_recallocN(cache->batch_edit, sizeof(struct Gwn_Batch) * slots);
 }
 
 /* check size and increase if no free slots */
@@ -142,9 +142,9 @@ static void gpencil_batch_cache_init(bGPdata *gpd, int cfra)
 	}
 
 	cache->cache_size = GPENCIL_MIN_BATCH_SLOTS_CHUNK;
-	cache->batch_stroke = MEM_callocN(sizeof(struct Batch) * cache->cache_size, "Gpencil_Batch_Stroke");
-	cache->batch_fill = MEM_callocN(sizeof(struct Batch) * cache->cache_size, "Gpencil_Batch_Fill");
-	cache->batch_edit = MEM_callocN(sizeof(struct Batch) * cache->cache_size, "Gpencil_Batch_Edit");
+	cache->batch_stroke = MEM_callocN(sizeof(struct Gwn_Batch) * cache->cache_size, "Gpencil_Batch_Stroke");
+	cache->batch_fill = MEM_callocN(sizeof(struct Gwn_Batch) * cache->cache_size, "Gpencil_Batch_Fill");
+	cache->batch_edit = MEM_callocN(sizeof(struct Gwn_Batch) * cache->cache_size, "Gpencil_Batch_Edit");
 
 	cache->is_editmode = gpd->flag & (GP_DATA_STROKE_EDITMODE | GP_DATA_STROKE_SCULPTMODE);
 	gpd->flag &= ~GP_DATA_CACHE_IS_DIRTY;
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 1c0512f88ae..b8c6410a2df 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -153,7 +153,7 @@ static void GPENCIL_cache_init(void *vedata)
 		stl->g_data->shgrps_drawing_fill = DRW_gpencil_shgroup_drawing_fill_create(psl->drawing_pass, e_data.gpencil_drawing_fill_sh);
 
 		/* we need a full screen pass to combine the result of zdepth */
-		struct Batch *quad = DRW_cache_fullscreen_quad_get();
+		struct Gwn_Batch *quad = DRW_cache_fullscreen_quad_get();
 
 		psl->mix_pass = DRW_pass_create("GPencil Mix Pass", DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS);
 		DRWShadingGroup *mix_shgrp = DRW_shgroup_create(e_data.gpencil_fullscreen_sh, psl->mix_pass);
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h b/source/blender/draw/engines/gpencil/gpencil_engine.h
index a23b3854cde..f1408e52483 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.h
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.h
@@ -114,20 +114,20 @@ typedef struct GPENCIL_e_data {
 	struct GPUTexture *temp_fbcolor_color_tx;
 } GPENCIL_e_data; /* Engine data */
 
-/* Batch Cache */
+/* Gwn_Batch Cache */
 typedef struct GpencilBatchCache {
 	
 	/* For normal strokes, a variable number of batch can be needed depending of number of strokes.
 	   It could use the stroke number as total size, but when activate the onion skining, the number
 	   can change, so the size is changed dinamically.
 	 */
-	Batch **batch_stroke;
-	Batch **batch_fill;
-	Batch **batch_edit;
+	Gwn_Batch **batch_stroke;
+	Gwn_Batch **batch_fill;
+	Gwn_Batch **batch_edit;
 
 	/* for buffer only one batch is nedeed because the drawing is only of one stroke */
-	Batch *batch_buffer_stroke;
-	Batch *batch_buffer_fill;
+	Gwn_Batch *batch_buffer_stroke;
+	Gwn_Batch *batch_buffer_fill;
 
 	/* settings to determine if cache is invalid */
 	bool is_dirty;
@@ -146,13 +146,13 @@ struct DRWShadingGroup *DRW_gpencil_shgroup_drawing_fill_create(struct DRWPass *
 
 void DRW_gpencil_populate_datablock(struct GPENCIL_e_data *e_data, void *vedata, struct Scene *scene, struct Object *ob, struct ToolSettings *ts, struct bGPdata *gpd);
 
-struct Batch *DRW_gpencil_get_point_geom(struct bGPDspoint *pt, short thickness, const float ink[4]);
-struct Batch *DRW_gpencil_get_stroke_geom(struct bGPDframe *gpf, struct bGPDstroke *gps, short thickness, const float ink[4]);
-struct Batch *DRW_gpencil_get_fill_geom(struct bGPDstroke *gps, const float color[4]);
-struct Batch *DRW_gpencil_get_edit_geom(struct bGPDstroke *gps, float alpha, short dflag);
-struct Batch *DRW_gpencil_get_buffer_stroke_geom(struct bGPdata *gpd, float matrix[4][4], short thickness);
-struct Batch *DRW_gpencil_get_buffer_fill_geom(const struct tGPspoint *points, int totpoints, float ink[4]);
-struct Batch *DRW_gpencil_get_buffer_point_geom(struct bGPdata *gpd, short thickness);
+struct Gwn_Batch *DRW_gpencil_get_point_geom(struct bGPDspoint *pt, short thickness, const float ink[4]);
+struct Gwn_Batch *DRW_gpencil_get_stroke_geom(struct bGPDframe *gpf, struct bGPDstroke *gps, short thickness, const float ink[4]);
+struct Gwn_Batch *DRW_gpencil_get_fill_geom(struct bGPDstroke *gps, const float color[4]);
+struct Gwn_Batch *DRW_gpencil_get_edit_geom(struct bGPDstroke *gps, float alpha, short dflag);
+struct Gwn_Batch *DRW_gpencil_get_buffer_stroke_geom(struct bGPdata *gpd, float matrix[4][4], short thickness);
+struct Gwn_Batch *DRW_gpencil_get_buffer_fill_geom(const struct tGPspoint *points, int totpoints, float ink[4]);
+struct Gwn_Batch *DRW_gpencil_get_buffer_point_geom(struct bGPdata *gpd, short thickness);
 
 void gpencil_batch_cache_clear(struct bGPdata *gpd);
 
diff --git a/source/blender/draw/engines/gpencil/gpencil_geom.c b/source/blender/draw/engines/gpencil/gpencil_geom.c
index 2f12843a6c6..423f0cf4367 100644
--- a/source/blender/draw/engines/gpencil/gpencil_geom.c
+++ b/source/blender/draw/engines/gpencil/gpencil_geom.c
@@ -50,7 +50,7 @@
 #include "gpencil_engine.h"
 
 /* set stroke point to vbo */
-static void gpencil_set_stroke_point(VertexBuffer *vbo, float matrix[4][4], const bGPDspoint *pt, int idx,
+static void gpencil_set_stroke_point(Gwn_VertBuf *vbo, float matrix[4][4], const bGPDspoint *pt, int idx,
 						    unsigned int pos_id, unsigned int color_id,
 							unsigned int thickness_id, short thickness,
 	                        const float ink[4])
@@ -61,62 +61,62 @@ static void gpencil_set_stroke_point(VertexBuffer *vbo, float matrix[4][4], cons
 	CLAMP(alpha, GPENCIL_STRENGTH_MIN, 1.0f);
 	float col[4];
 	ARRAY_SET_ITEMS(col, ink[0], ink[1], ink[2], alpha);
-	VertexBuffer_set_attrib(vbo, color_id, idx, col);
+	GWN_vertbuf_attr_set(vbo, color_id, idx, col);
 
 	/* the thickness of the stroke must be affected by zoom, so a pixel scale is calculated */
 	mul_v3_m4v3(viewfpt, matrix, &pt->x);
 	float thick = max_ff(pt->pressure * thickness, 1.0f);
-	VertexBuffer_set_attrib(vbo, thickness_id, idx, &thick);
+	GWN_vertbuf_attr_set(vbo, thickness_id, idx, &thick);
 	
-	VertexBuffer_set_attrib(vbo, pos_id, idx, &pt->x);
+	GWN_vertbuf_attr_set(vbo, pos_id, idx, &pt->x);
 }
 
 /* create batch geometry data for one point stroke shader */
-Batch *DRW_gpencil_get_point_geom(bGPDspoint *pt, short thickness, const float ink[4])
+Gwn_Batch *DRW_gpencil_get_point_geom(bGPDspoint *pt, short thickness, const float ink[4])
 {
-	static VertexFormat format = { 0 };
+	static Gwn_VertFormat format = { 0 };
 	static unsigned int pos_id, color_id, size_id;
 	if (format.attrib_ct == 0) {
-		pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
-		color_id = VertexFormat_add_attrib(&format, "color", COMP_F32, 4, KEEP_FLOAT);
-		size_id = VertexFormat_add_attrib(&format, "size", COMP_F32, 1, KEEP_FLOAT);
+		pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+		color_id = GWN_vertformat_attr_add(&format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT);
+		size_id = GWN_vertformat_attr_add(&format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT);
 	}
 
-	VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
-	VertexBuffer_allocate_data(vbo, 1);
+	Gwn_VertBuf *vbo =  GWN_vertbuf_create_with_format(&format);
+	GWN_vertbuf_data_alloc(vbo, 1);
 
 	float alpha = ink[3] * pt->strength;
 	CLAMP(alpha, GPENCIL_STRENGTH_MIN, 1.0f);
 	float col[4];
 	ARRAY_SET_ITEMS(col, ink[0], ink[1], ink[2], alpha);
-	VertexBuffer_set_attrib(vbo, color_id, 0, col);
+	GWN_vertbuf_attr_set(vbo, color_id, 0, col);
 
 	float thick = max_ff(pt->pressure * thickness, 1.0f);
-	VertexBuffer_set_attrib(vbo, size_id, 0, &thick);
+	GWN_vertbuf_attr_set(vbo, size_id, 0, &thick);
 
-	VertexBuffer_set_attrib(vbo, pos_id, 0, &pt->x);
+	GWN_vertbuf_attr_set(vbo, pos_id, 0, &pt->x);
 
-	return Batch_create(PRIM_POINTS, vbo, NULL);
+	return GWN_batch_create(GWN_PRIM_POINTS, vbo, NULL);
 }
 
 /* create batch geometry data for stroke shader */
-Batch *DRW_gpencil_get_stroke_geom(bGPDframe *gpf, bGPDstroke *gps, short thickness, const float ink[4])
+Gwn_Batch *DRW_gpencil_get_stroke_geom(bGPDframe *gpf, bGPDstroke *gps, short thickness, const float ink[4])
 {
 	bGPDspoint *points = gps->points;
 	int totpoints = gps->totpoints;
 	/* if cyclic needs more vertex */
 	int cyclic_add = (gps->flag & GP_STROKE_CYCLIC) ? 2 : 0;
 
-	static VertexFormat format = { 0 };
+	static Gwn_VertFormat format = { 0 };
 	static unsigned int pos_id, color_id, thickness_id;
 	if (format.attrib_ct == 0) {
-		pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
-		color_id = VertexFormat_add_attrib(&format, "color", COMP_F32, 4, KEEP_FLOAT);
-		thickness_id = VertexFormat_add_attrib(&format, "thickness", COMP_F32, 1, KEEP_FLOAT);
+		pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+		color_id = GWN_vertformat_attr_add(&format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT);
+		thickness_id = GWN_vertformat_attr_add(&format, "thickness", GWN_COMP_F32, 1, GWN_FETCH_FLOAT);
 	}
 
-	VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
-	VertexBuffer_allocat

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list