[Bf-blender-cvs] [8471b71] temp_display_optimization: WIP editmode colors

Antony Riakiotakis noreply at git.blender.org
Fri Oct 16 10:49:00 CEST 2015


Commit: 8471b7145ac94a442c923fba9e9343f771ceb03c
Author: Antony Riakiotakis
Date:   Thu Jul 30 12:41:31 2015 +0200
Branches: temp_display_optimization
https://developer.blender.org/rB8471b7145ac94a442c923fba9e9343f771ceb03c

WIP editmode colors

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

M	source/blender/gpu/GPU_buffers.h
M	source/blender/gpu/intern/gpu_buffers.c

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

diff --git a/source/blender/gpu/GPU_buffers.h b/source/blender/gpu/GPU_buffers.h
index f74f118..911e71a 100644
--- a/source/blender/gpu/GPU_buffers.h
+++ b/source/blender/gpu/GPU_buffers.h
@@ -101,6 +101,8 @@ typedef struct GPUDrawObject {
 	GPUBuffer *uvedges;
 	GPUBuffer *triangles; /* triangle index buffer */
 
+	GPUBuffer *editfacecolors; /* colors for edit mode */
+
 	/* for each original vertex, the list of related points */
 	struct GPUVertPointLink *vert_points;
 
@@ -174,7 +176,9 @@ typedef enum {
 	GPU_BUFFER_UV_TEXPAINT,
 	GPU_BUFFER_EDGE,
 	GPU_BUFFER_UVEDGE,
-	GPU_BUFFER_TRIANGLES
+	GPU_BUFFER_TRIANGLES,
+
+	GPU_BUFFER_EDITFACE_COLORS,
 } GPUBufferType;
 
 typedef enum {
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index 11697c5..5c86643 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -96,6 +96,8 @@ const GPUBufferTypeSettings gpu_buffer_type_settings[] = {
     {GL_ELEMENT_ARRAY_BUFFER_ARB, 1},
     /* fast triangles */
     {GL_ELEMENT_ARRAY_BUFFER_ARB, 1},
+    /* editface colors */
+    {GL_ARRAY_BUFFER_ARB, 4},
 };
 
 #define MAX_GPU_ATTRIB_DATA 32
@@ -498,6 +500,7 @@ void GPU_drawobject_free(DerivedMesh *dm)
 	GPU_buffer_free(gdo->edges);
 	GPU_buffer_free(gdo->uvedges);
 	GPU_buffer_free(gdo->triangles);
+	GPU_buffer_free(gdo->editfacecolors);
 
 	MEM_freeN(gdo);
 	dm->drawObject = NULL;
@@ -629,6 +632,8 @@ static GPUBuffer **gpu_drawobject_buffer_from_type(GPUDrawObject *gdo, GPUBuffer
 			return &gdo->uvedges;
 		case GPU_BUFFER_TRIANGLES:
 			return &gdo->triangles;
+		case GPU_BUFFER_EDITFACE_COLORS:
+			return &gdo->editfacecolors;
 		default:
 			return NULL;
 	}
@@ -644,6 +649,8 @@ static size_t gpu_buffer_size_from_type(DerivedMesh *dm, GPUBufferType type)
 			return sizeof(short) * gpu_buffer_type_settings[type].num_components * dm->drawObject->tot_loop_verts;
 		case GPU_BUFFER_COLOR:
 			return sizeof(char) * gpu_buffer_type_settings[type].num_components * dm->drawObject->tot_loop_verts;
+		case GPU_BUFFER_EDITFACE_COLORS:
+			return sizeof(char) * gpu_buffer_type_settings[type].num_components * dm->drawObject->tot_loop_verts;
 		case GPU_BUFFER_UV:
 			return sizeof(float) * gpu_buffer_type_settings[type].num_components * dm->drawObject->tot_loop_verts;
 		case GPU_BUFFER_UV_TEXPAINT:




More information about the Bf-blender-cvs mailing list