Commit: 2165c0ce8fce2bbd1001816482c642ea5a4ccca4
Author: Antonio Vazquez
Date: Sat Apr 22 18:28:42 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rB2165c0ce8fce2bbd1001816482c642ea5a4ccca4
Merge branch 'blender2.8' into greasepencil-object
===================================================================
===================================================================
diff --cc source/blender/draw/intern/draw_cache.c
index 74135156ee0,259d066d4f4..20cd8c1014b
--- a/source/blender/draw/intern/draw_cache.c
+++ b/source/blender/draw/intern/draw_cache.c
@@@ -449,61 -446,37 +448,83 @@@ Batch *DRW_cache_screenspace_circle_get
#undef CIRCLE_RESOL
}
-/** \} */
+/* Grease Pencil object */
+Batch *DRW_cache_gpencil_axes_get(void)
+{
+ if (!SHC.drw_gpencil_axes) {
+ int axis;
+ float v1[3] = { 0.0f, 0.0f, 0.0f };
+ float v2[3] = { 0.0f, 0.0f, 0.0f };
-/* -------------------------------------------------------------------- */
+ /* cube data */
+ const GLfloat verts[8][3] = {
+ { -0.25f, -0.25f, -0.25f },
+ { -0.25f, -0.25f, 0.25f },
+ { -0.25f, 0.25f, -0.25f },
+ { -0.25f, 0.25f, 0.25f },
+ { 0.25f, -0.25f, -0.25f },
+ { 0.25f, -0.25f, 0.25f },
+ { 0.25f, 0.25f, -0.25f },
+ { 0.25f, 0.25f, 0.25f }
+ };
+
+ const GLubyte indices[24] = { 0, 1, 1, 3, 3, 2, 2, 0, 0, 4, 4,
5, 5, 7, 7, 6, 6, 4, 1, 5, 3, 7, 2, 6 };
+
+ /* Position Only 3D format */
+ static VertexFormat format = { 0 };
+ static unsigned pos_id;
+ if (format.attrib_ct == 0) {
+ pos_id = VertexFormat_add_attrib(&format, "pos",
COMP_F32, 3, KEEP_FLOAT);
+ }
+
+ VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
+ VertexBuffer_allocate_data(vbo, 30);
+
+ /* draw axis */
+ for (axis = 0; axis < 3; axis++) {
+ v1[axis] = 1.0f;
+ v2[axis] = -1.0f;
+
+ VertexBuffer_set_attrib(vbo, pos_id, axis * 2, v1);
+ VertexBuffer_set_attrib(vbo, pos_id, axis * 2 + 1, v2);
+
+ /* reset v1 & v2 to zero for next axis */
+ v1[axis] = v2[axis] = 0.0f;
+ }
+
+ /* draw cube */
+ for (int i = 0; i < 24; ++i) {
+ VertexBuffer_set_attrib(vbo, pos_id, i + 6,
verts[indices[i]]);
+ }
- SHC.drw_gpencil_axes = Batch_create(PRIM_LINES, vbo, NULL);
+ /** \name Common Object API
+ * \{ */
+
+ Batch *DRW_cache_object_surface_get(Object *ob)
+ {
+ switch (ob->type) {
+ case OB_MESH:
+ return DRW_cache_mesh_surface_get(ob);
+ case OB_CURVE:
+ return DRW_cache_curve_surface_get(ob);
+ case OB_SURF:
+ return DRW_cache_surf_surface_get(ob);
+ case OB_FONT:
+ return DRW_cache_text_surface_get(ob);
+ default:
+ return NULL;
}
- return SHC.drw_gpencil_axes;
}
+ /** \} */
+
+
+ /* -------------------------------------------------------------------- */
+
+ /** \name Empties
+ * \{ */
+
+/* Empties */
Batch *DRW_cache_plain_axes_get(void)
{
if (!SHC.drw_plain_axes) {
diff --cc source/blender/draw/intern/draw_manager.c
index 2edddefe888,9f7729e0fd8..f0ba2b26a75
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@@ -1942,8 -1929,29 +1931,30 @@@ void DRW_engines_register(void
DRW_engine_register(&draw_engine_particle_type);
DRW_engine_register(&draw_engine_pose_type);
DRW_engine_register(&draw_engine_sculpt_type);
+ DRW_engine_register(&draw_engine_gpencil_type);
#endif
+
+ /* setup callbacks */
+ {
+ /* BKE: curve.c */
+ extern void *BKE_curve_batch_cache_dirty_cb;
+ extern void *BKE_curve_batch_cache_free_cb;
+ /* BKE: mesh.c */
+ extern void *BKE_mesh_batch_cache_dirty_cb;
+ extern void *BKE_mesh_batch_cache_free_cb;
+ /* BKE: lattice.c */
+ extern void *BKE_lattice_batch_cache_dirty_cb;
+ extern void *BKE_lattice_batch_cache_free_cb;
+
+ BKE_curve_batch_cache_dirty_cb = DRW_curve_batch_cache_dirty;
+ BKE_curve_batch_cache_free_cb = DRW_curve_batch_cache_free;
+
+ BKE_mesh_batch_cache_dirty_cb = DRW_mesh_batch_cache_dirty;
+ BKE_mesh_batch_cache_free_cb = DRW_mesh_batch_cache_free;
+
+ BKE_lattice_batch_cache_dirty_cb =
DRW_lattice_batch_cache_dirty;
+ BKE_lattice_batch_cache_free_cb = DRW_lattice_batch_cache_free;
+ }
}
extern struct GPUUniformBuffer *globals_ubo; /* draw_common.c */
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs