diff options
Diffstat (limited to 'source/blender/draw/intern')
-rw-r--r-- | source/blender/draw/intern/draw_cache.c | 106 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_cache.h | 10 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_cache_impl.h | 16 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_cache_impl_curve.cc | 288 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_cache_impl_displist.c | 505 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_common.c | 249 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_common_shader_shared.h | 402 |
7 files changed, 360 insertions, 1216 deletions
diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c index 1c2a580e26d..5fa0b4fc26a 100644 --- a/source/blender/draw/intern/draw_cache.c +++ b/source/blender/draw/intern/draw_cache.c @@ -817,7 +817,7 @@ GPUBatch *DRW_cache_object_edge_detection_get(Object *ob, bool *r_is_manifold) case OB_CURVES_LEGACY: return NULL; case OB_SURF: - return DRW_cache_surf_edge_detection_get(ob, r_is_manifold); + return NULL; case OB_FONT: return NULL; case OB_MBALL: @@ -841,7 +841,7 @@ GPUBatch *DRW_cache_object_face_wireframe_get(Object *ob) case OB_CURVES_LEGACY: return NULL; case OB_SURF: - return DRW_cache_surf_face_wireframe_get(ob); + return NULL; case OB_FONT: return NULL; case OB_MBALL: @@ -868,7 +868,7 @@ GPUBatch *DRW_cache_object_loose_edges_get(struct Object *ob) case OB_CURVES_LEGACY: return NULL; case OB_SURF: - return DRW_cache_surf_loose_edges_get(ob); + return NULL; case OB_FONT: return NULL; case OB_MBALL: @@ -892,7 +892,7 @@ GPUBatch *DRW_cache_object_surface_get(Object *ob) case OB_CURVES_LEGACY: return NULL; case OB_SURF: - return DRW_cache_surf_surface_get(ob); + return NULL; case OB_FONT: return NULL; case OB_MBALL: @@ -919,7 +919,7 @@ GPUVertBuf *DRW_cache_object_pos_vertbuf_get(Object *ob) case OB_CURVES_LEGACY: case OB_SURF: case OB_FONT: - return DRW_curve_batch_cache_pos_vertbuf_get(ob->data); + return NULL; case OB_MBALL: return DRW_mball_batch_cache_pos_vertbuf_get(ob); case OB_CURVES: @@ -976,7 +976,7 @@ GPUBatch **DRW_cache_object_surface_material_get(struct Object *ob, case OB_CURVES_LEGACY: return NULL; case OB_SURF: - return DRW_cache_surf_surface_shaded_get(ob, gpumat_array, gpumat_array_len); + return NULL; case OB_FONT: return NULL; case OB_MBALL: @@ -3003,87 +3003,13 @@ GPUBatch *DRW_cache_text_edge_wire_get(Object *ob) /** \name Surface * \{ */ -GPUBatch *DRW_cache_surf_surface_get(Object *ob) -{ - BLI_assert(ob->type == OB_SURF); - - struct Curve *cu = ob->data; - struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh_no_subsurf(ob); - if (mesh_eval != NULL) { - return DRW_mesh_batch_cache_get_surface(mesh_eval); - } - - return DRW_curve_batch_cache_get_triangles_with_normals(cu); -} - GPUBatch *DRW_cache_surf_edge_wire_get(Object *ob) { BLI_assert(ob->type == OB_SURF); - struct Curve *cu = ob->data; - struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh_no_subsurf(ob); - if (mesh_eval != NULL) { - return DRW_mesh_batch_cache_get_loose_edges(mesh_eval); - } - return DRW_curve_batch_cache_get_wire_edge(cu); } -GPUBatch *DRW_cache_surf_face_wireframe_get(Object *ob) -{ - BLI_assert(ob->type == OB_SURF); - - struct Curve *cu = ob->data; - struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh_no_subsurf(ob); - if (mesh_eval != NULL) { - return DRW_mesh_batch_cache_get_wireframes_face(mesh_eval); - } - - return DRW_curve_batch_cache_get_wireframes_face(cu); -} - -GPUBatch *DRW_cache_surf_edge_detection_get(Object *ob, bool *r_is_manifold) -{ - BLI_assert(ob->type == OB_SURF); - struct Curve *cu = ob->data; - struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh_no_subsurf(ob); - if (mesh_eval != NULL) { - return DRW_mesh_batch_cache_get_edge_detection(mesh_eval, r_is_manifold); - } - - return DRW_curve_batch_cache_get_edge_detection(cu, r_is_manifold); -} - -GPUBatch *DRW_cache_surf_loose_edges_get(Object *ob) -{ - BLI_assert(ob->type == OB_SURF); - - struct Curve *cu = ob->data; - struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh_no_subsurf(ob); - if (mesh_eval != NULL) { - return DRW_mesh_batch_cache_get_loose_edges(mesh_eval); - } - - /* TODO */ - UNUSED_VARS(cu); - return NULL; -} - -GPUBatch **DRW_cache_surf_surface_shaded_get(Object *ob, - struct GPUMaterial **gpumat_array, - uint gpumat_array_len) -{ - BLI_assert(ob->type == OB_SURF); - - struct Curve *cu = ob->data; - struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh_no_subsurf(ob); - if (mesh_eval != NULL) { - return DRW_mesh_batch_cache_get_surface_shaded(ob, mesh_eval, gpumat_array, gpumat_array_len); - } - - return DRW_curve_batch_cache_get_surface_shaded(cu, gpumat_array, gpumat_array_len); -} - /** \} */ /* -------------------------------------------------------------------- */ @@ -3369,19 +3295,13 @@ GPUBatch *DRW_cache_cursor_get(bool crosshair_lines) void drw_batch_cache_validate(Object *ob) { - struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh_no_subsurf(ob); switch (ob->type) { case OB_MESH: DRW_mesh_batch_cache_validate(ob, (Mesh *)ob->data); break; case OB_CURVES_LEGACY: case OB_FONT: - DRW_curve_batch_cache_validate((Curve *)ob->data); - break; case OB_SURF: - if (mesh_eval != NULL) { - DRW_mesh_batch_cache_validate(ob, mesh_eval); - } DRW_curve_batch_cache_validate((Curve *)ob->data); break; case OB_MBALL: @@ -3418,7 +3338,6 @@ void drw_batch_cache_generate_requested(Object *ob) DRW_object_use_hide_faces(ob)) || ((mode == CTX_MODE_EDIT_MESH) && DRW_object_is_in_edit_mode(ob)))); - struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh_no_subsurf(ob); switch (ob->type) { case OB_MESH: DRW_mesh_batch_cache_create_requested( @@ -3426,13 +3345,7 @@ void drw_batch_cache_generate_requested(Object *ob) break; case OB_CURVES_LEGACY: case OB_FONT: - DRW_curve_batch_cache_create_requested(ob, scene); - break; case OB_SURF: - if (mesh_eval) { - DRW_mesh_batch_cache_create_requested( - DST.task_graph, ob, mesh_eval, scene, is_paint_mode, use_hide); - } DRW_curve_batch_cache_create_requested(ob, scene); break; /* TODO: all cases. */ @@ -3468,17 +3381,10 @@ void drw_batch_cache_generate_requested_delayed(Object *ob) void DRW_batch_cache_free_old(Object *ob, int ctime) { - struct Mesh *mesh_eval = BKE_object_get_evaluated_mesh_no_subsurf(ob); - switch (ob->type) { case OB_MESH: DRW_mesh_batch_cache_free_old((Mesh *)ob->data, ctime); break; - case OB_SURF: - if (mesh_eval) { - DRW_mesh_batch_cache_free_old(mesh_eval, ctime); - } - break; /* TODO: all cases. */ default: break; diff --git a/source/blender/draw/intern/draw_cache.h b/source/blender/draw/intern/draw_cache.h index 56342440bf3..9af8ba38658 100644 --- a/source/blender/draw/intern/draw_cache.h +++ b/source/blender/draw/intern/draw_cache.h @@ -186,17 +186,7 @@ struct GPUBatch *DRW_cache_text_edge_wire_get(struct Object *ob); /* Surface */ -struct GPUBatch *DRW_cache_surf_surface_get(struct Object *ob); struct GPUBatch *DRW_cache_surf_edge_wire_get(struct Object *ob); -struct GPUBatch *DRW_cache_surf_loose_edges_get(struct Object *ob); - -/* Return list of batches */ - -struct GPUBatch **DRW_cache_surf_surface_shaded_get(struct Object *ob, - struct GPUMaterial **gpumat_array, - uint gpumat_array_len); -struct GPUBatch *DRW_cache_surf_face_wireframe_get(struct Object *ob); -struct GPUBatch *DRW_cache_surf_edge_detection_get(struct Object *ob, bool *r_is_manifold); /* Lattice */ diff --git a/source/blender/draw/intern/draw_cache_impl.h b/source/blender/draw/intern/draw_cache_impl.h index d262d1a5d4d..e728d8614de 100644 --- a/source/blender/draw/intern/draw_cache_impl.h +++ b/source/blender/draw/intern/draw_cache_impl.h @@ -104,16 +104,9 @@ int DRW_curve_material_count_get(struct Curve *cu); struct GPUBatch *DRW_curve_batch_cache_get_wire_edge(struct Curve *cu); struct GPUBatch *DRW_curve_batch_cache_get_normal_edge(struct Curve *cu); -struct GPUBatch *DRW_curve_batch_cache_get_edge_detection(struct Curve *cu, bool *r_is_manifold); struct GPUBatch *DRW_curve_batch_cache_get_edit_edges(struct Curve *cu); struct GPUBatch *DRW_curve_batch_cache_get_edit_verts(struct Curve *cu); -struct GPUBatch *DRW_curve_batch_cache_get_triangles_with_normals(struct Curve *cu); -struct GPUBatch **DRW_curve_batch_cache_get_surface_shaded(struct Curve *cu, - struct GPUMaterial **gpumat_array, - uint gpumat_array_len); -struct GPUBatch *DRW_curve_batch_cache_get_wireframes_face(struct Curve *cu); - /** \} */ /* -------------------------------------------------------------------- */ @@ -141,16 +134,8 @@ void DRW_displist_vertbuf_create_pos_and_nor(struct ListBase *lb, struct GPUVertBuf *vbo, const struct Scene *scene); void DRW_displist_vertbuf_create_wiredata(struct ListBase *lb, struct GPUVertBuf *vbo); -void DRW_displist_vertbuf_create_loop_pos_and_nor_and_uv_and_tan(struct ListBase *lb, - struct GPUVertBuf *vbo_pos_nor, - struct GPUVertBuf *vbo_uv, - struct GPUVertBuf *vbo_tan, - const struct Scene *scene); void DRW_displist_indexbuf_create_lines_in_order(struct ListBase *lb, struct GPUIndexBuf *ibo); void DRW_displist_indexbuf_create_triangles_in_order(struct ListBase *lb, struct GPUIndexBuf *ibo); -void DRW_displist_indexbuf_create_triangles_loop_split_by_material(struct ListBase *lb, - struct GPUIndexBuf **ibo_mat, - uint mat_len); void DRW_displist_indexbuf_create_edges_adjacency_lines(struct ListBase *lb, struct GPUIndexBuf *ibo, bool *r_is_manifold); @@ -309,7 +294,6 @@ struct GPUBatch *DRW_mesh_batch_cache_get_edit_mesh_analysis(struct Mesh *me); * \{ */ struct GPUVertBuf *DRW_mesh_batch_cache_pos_vertbuf_get(struct Mesh *me); -struct GPUVertBuf *DRW_curve_batch_cache_pos_vertbuf_get(struct Curve *cu); struct GPUVertBuf *DRW_mball_batch_cache_pos_vertbuf_get(struct Object *ob); int DRW_mesh_material_count_get(const struct Object *object, const struct Mesh *me); diff --git a/source/blender/draw/intern/draw_cache_impl_curve.cc b/source/blender/draw/intern/draw_cache_impl_curve.cc index 6a3d3fa5e9e..7b8f34b999c 100644 --- a/source/blender/draw/intern/draw_cache_impl_curve.cc +++ b/source/blender/draw/intern/draw_cache_impl_curve.cc @@ -19,9 +19,9 @@ #include "DNA_curve_types.h" #include "BKE_curve.h" +#include "BKE_curves.hh" #include "BKE_displist.h" #include "BKE_geometry_set.hh" -#include "BKE_spline.hh" #include "BKE_vfont.h" #include "GPU_batch.h" @@ -96,18 +96,19 @@ static void curve_render_overlay_verts_edges_len_get(ListBase *lb, } } -static void curve_eval_render_wire_verts_edges_len_get(const CurveEval &curve_eval, +static void curve_eval_render_wire_verts_edges_len_get(const blender::bke::CurvesGeometry &curves, int *r_curve_len, int *r_vert_len, int *r_edge_len) { - Span<SplinePtr> splines = curve_eval.splines(); - *r_curve_len = splines.size(); - *r_vert_len = 0; + *r_curve_len = curves.curves_num(); + *r_vert_len = curves.evaluated_points_num(); + *r_edge_len = 0; - for (const SplinePtr &spline : splines) { - *r_vert_len += spline->evaluated_points_size(); - *r_edge_len += spline->evaluated_edges_size(); + const blender::VArray<bool> cyclic = curves.cyclic(); + for (const int i : curves.curves_range()) { + const IndexRange points = curves.evaluated_points_for_curve(i); + *r_edge_len += blender::bke::curves::curve_segment_size(points.size(), cyclic[i]); } } @@ -165,7 +166,7 @@ struct CurveRenderData { CurveCache *ob_curve_cache; /* Owned by the evaluated object's geometry set (#geometry_set_eval). */ - const CurveEval *curve_eval; + const Curves *curve_eval; /* borrow from 'Curve' */ ListBase *nurbs; @@ -209,10 +210,11 @@ static CurveRenderData *curve_render_data_create(Curve *cu, if (types & CU_DATATYPE_WIRE) { if (rdata->curve_eval != nullptr) { - curve_eval_render_wire_verts_edges_len_get(*rdata->curve_eval, - &rdata->wire.curve_len, - &rdata->wire.vert_len, - &rdata->wire.edge_len); + curve_eval_render_wire_verts_edges_len_get( + blender::bke::CurvesGeometry::wrap(rdata->curve_eval->geometry), + &rdata->wire.curve_len, + &rdata->wire.vert_len, + &rdata->wire.edge_len); } } @@ -288,107 +290,39 @@ static int curve_render_data_normal_len_get(const CurveRenderData *rdata) return rdata->normal.len; } -static void curve_cd_calc_used_gpu_layers(CustomDataMask *cd_layers, - struct GPUMaterial **gpumat_array, - int gpumat_array_len) -{ - for (int i = 0; i < gpumat_array_len; i++) { - struct GPUMaterial *gpumat = gpumat_array[i]; - if (gpumat == nullptr) { - continue; - } - - ListBase gpu_attrs = GPU_material_attributes(gpumat); - LISTBASE_FOREACH (GPUMaterialAttribute *, gpu_attr, &gpu_attrs) { - const char *name = gpu_attr->name; - int type = gpu_attr->type; - - /* Curves cannot have named layers. - * NOTE: We could relax this assumption later. */ - if (name[0] != '\0') { - continue; - } - - if (type == CD_AUTO_FROM_NAME) { - type = CD_MTFACE; - } - - switch (type) { - case CD_MTFACE: - *cd_layers |= CD_MASK_MLOOPUV; - break; - case CD_TANGENT: - *cd_layers |= CD_MASK_TANGENT; - break; - case CD_MCOL: - /* Curve object don't have Color data. */ - break; - case CD_ORCO: - *cd_layers |= CD_MASK_ORCO; - break; - case CD_HAIRLENGTH: - *cd_layers |= CD_MASK_HAIRLENGTH; - break; - } - } - } -} - /* ---------------------------------------------------------------------- */ /* Curve GPUBatch Cache */ struct CurveBatchCache { struct { - GPUVertBuf *pos_nor; - GPUVertBuf *edge_fac; GPUVertBuf *curves_pos; - - GPUVertBuf *loop_pos_nor; - GPUVertBuf *loop_uv; - GPUVertBuf *loop_tan; } ordered; struct { - /* Curve points. Aligned with ordered.pos_nor */ GPUVertBuf *curves_nor; - GPUVertBuf *curves_weight; /* TODO. */ /* Edit points (beztriples and bpoints) */ GPUVertBuf *pos; GPUVertBuf *data; } edit; struct { - GPUIndexBuf *surfaces_tris; - GPUIndexBuf *surfaces_lines; GPUIndexBuf *curves_lines; - GPUIndexBuf *edges_adj_lines; /* Edit mode */ GPUIndexBuf *edit_verts; GPUIndexBuf *edit_lines; } ibo; struct { - GPUBatch *surfaces; - GPUBatch *surfaces_edges; GPUBatch *curves; /* control handles and vertices */ GPUBatch *edit_edges; GPUBatch *edit_verts; GPUBatch *edit_normals; - GPUBatch *edge_detection; } batch; - GPUIndexBuf **surf_per_mat_tris; - GPUBatch **surf_per_mat; - int mat_len; - CustomDataMask cd_used, cd_needed; - /* settings to determine if cache is invalid */ bool is_dirty; bool is_editmode; - - /* Valid only if edge_detection is up to date. */ - bool is_manifold; }; /* GPUBatch cache management. */ @@ -401,10 +335,6 @@ static bool curve_batch_cache_valid(Curve *cu) return false; } - if (cache->mat_len != DRW_curve_material_count_get(cu)) { - return false; - } - if (cache->is_dirty) { return false; } @@ -445,13 +375,6 @@ static void curve_batch_cache_init(Curve *cu) } #endif - cache->cd_used = 0; - cache->mat_len = DRW_curve_material_count_get(cu); - cache->surf_per_mat_tris = (GPUIndexBuf **)MEM_callocN( - sizeof(*cache->surf_per_mat_tris) * cache->mat_len, __func__); - cache->surf_per_mat = (GPUBatch **)MEM_callocN(sizeof(*cache->surf_per_mat) * cache->mat_len, - __func__); - cache->is_editmode = (cu->editnurb != nullptr) || (cu->editfont != nullptr); cache->is_dirty = false; @@ -514,15 +437,6 @@ static void curve_batch_cache_clear(Curve *cu) GPUBatch **batch = (GPUBatch **)&cache->batch; GPU_BATCH_DISCARD_SAFE(batch[i]); } - - for (int i = 0; i < cache->mat_len; i++) { - GPU_INDEXBUF_DISCARD_SAFE(cache->surf_per_mat_tris[i]); - GPU_BATCH_DISCARD_SAFE(cache->surf_per_mat[i]); - } - MEM_SAFE_FREE(cache->surf_per_mat_tris); - MEM_SAFE_FREE(cache->surf_per_mat); - cache->mat_len = 0; - cache->cd_used = 0; } void DRW_curve_batch_cache_free(Curve *cu) @@ -554,18 +468,10 @@ static void curve_create_curves_pos(CurveRenderData *rdata, GPUVertBuf *vbo_curv GPU_vertbuf_init_with_format(vbo_curves_pos, &format); GPU_vertbuf_data_alloc(vbo_curves_pos, vert_len); - const CurveEval &curve_eval = *rdata->curve_eval; - Span<SplinePtr> splines = curve_eval.splines(); - Array<int> offsets = curve_eval.evaluated_point_offsets(); - BLI_assert(offsets.last() == vert_len); - - for (const int i_spline : splines.index_range()) { - Span<float3> positions = splines[i_spline]->evaluated_positions(); - for (const int i_point : positions.index_range()) { - GPU_vertbuf_attr_set( - vbo_curves_pos, attr_id.pos, offsets[i_spline] + i_point, positions[i_point]); - } - } + const blender::bke::CurvesGeometry &curves = blender::bke::CurvesGeometry::wrap( + rdata->curve_eval->geometry); + const Span<float3> positions = curves.evaluated_positions(); + GPU_vertbuf_attr_fill(vbo_curves_pos, attr_id.pos, positions.data()); } static void curve_create_curves_lines(CurveRenderData *rdata, GPUIndexBuf *ibo_curve_lines) @@ -583,18 +489,16 @@ static void curve_create_curves_lines(CurveRenderData *rdata, GPUIndexBuf *ibo_c GPUIndexBufBuilder elb; GPU_indexbuf_init_ex(&elb, GPU_PRIM_LINE_STRIP, index_len, vert_len); - const CurveEval &curve_eval = *rdata->curve_eval; - Span<SplinePtr> splines = curve_eval.splines(); - Array<int> offsets = curve_eval.evaluated_point_offsets(); - BLI_assert(offsets.last() == vert_len); - - for (const int i_spline : splines.index_range()) { - const int eval_size = splines[i_spline]->evaluated_points_size(); - if (splines[i_spline]->is_cyclic() && splines[i_spline]->evaluated_edges_size() > 1) { - GPU_indexbuf_add_generic_vert(&elb, offsets[i_spline] + eval_size - 1); + const blender::bke::CurvesGeometry &curves = blender::bke::CurvesGeometry::wrap( + rdata->curve_eval->geometry); + const blender::VArray<bool> cyclic = curves.cyclic(); + for (const int i : curves.curves_range()) { + const IndexRange points = curves.evaluated_points_for_curve(i); + if (cyclic[i] && points.size() > 1) { + GPU_indexbuf_add_generic_vert(&elb, points.last()); } - for (const int i_point : IndexRange(eval_size)) { - GPU_indexbuf_add_generic_vert(&elb, offsets[i_spline] + i_point); + for (const int i_point : points) { + GPU_indexbuf_add_generic_vert(&elb, i_point); } GPU_indexbuf_add_primitive_restart(&elb); } @@ -883,55 +787,6 @@ GPUBatch *DRW_curve_batch_cache_get_edit_verts(Curve *cu) return DRW_batch_request(&cache->batch.edit_verts); } -GPUBatch *DRW_curve_batch_cache_get_triangles_with_normals(struct Curve *cu) -{ - CurveBatchCache *cache = curve_batch_cache_get(cu); - return DRW_batch_request(&cache->batch.surfaces); -} - -GPUBatch **DRW_curve_batch_cache_get_surface_shaded(struct Curve *cu, - struct GPUMaterial **gpumat_array, - uint gpumat_array_len) -{ - CurveBatchCache *cache = curve_batch_cache_get(cu); - - BLI_assert(gpumat_array_len == cache->mat_len); - - curve_cd_calc_used_gpu_layers(&cache->cd_needed, gpumat_array, gpumat_array_len); - - for (int i = 0; i < cache->mat_len; i++) { - DRW_batch_request(&cache->surf_per_mat[i]); - } - return cache->surf_per_mat; -} - -GPUVertBuf *DRW_curve_batch_cache_pos_vertbuf_get(struct Curve *cu) -{ - CurveBatchCache *cache = curve_batch_cache_get(cu); - /* Request surface to trigger the vbo filling. Otherwise it may do nothing. */ - DRW_batch_request(&cache->batch.surfaces); - - DRW_vbo_request(nullptr, &cache->ordered.loop_pos_nor); - return cache->ordered.loop_pos_nor; -} - -GPUBatch *DRW_curve_batch_cache_get_wireframes_face(Curve *cu) -{ - CurveBatchCache *cache = curve_batch_cache_get(cu); - return DRW_batch_request(&cache->batch.surfaces_edges); -} - -GPUBatch *DRW_curve_batch_cache_get_edge_detection(Curve *cu, bool *r_is_manifold) -{ - CurveBatchCache *cache = curve_batch_cache_get(cu); - /* Even if is_manifold is not correct (not updated), - * the default (not manifold) is just the worst case. */ - if (r_is_manifold) { - *r_is_manifold = cache->is_manifold; - } - return DRW_batch_request(&cache->batch.edge_detection); -} - int DRW_curve_material_count_get(Curve *cu) { return max_ii(1, cu->totcol); @@ -950,36 +805,11 @@ void DRW_curve_batch_cache_create_requested(Object *ob, const struct Scene *scen Curve *cu = (Curve *)ob->data; CurveBatchCache *cache = curve_batch_cache_get(cu); - /* Verify that all surface batches have needed attribute layers. */ - /* TODO(fclem): We could be a bit smarter here and only do it per material. */ - if ((cache->cd_used & cache->cd_needed) != cache->cd_needed) { - for (int i = 0; i < cache->mat_len; i++) { - /* We can't discard batches at this point as they have been - * referenced for drawing. Just clear them in place. */ - GPU_BATCH_CLEAR_SAFE(cache->surf_per_mat[i]); - } - - cache->cd_used |= cache->cd_needed; - cache->cd_needed = 0; - } - /* Init batches and request VBOs & IBOs */ - if (DRW_batch_requested(cache->batch.surfaces, GPU_PRIM_TRIS)) { - DRW_vbo_request(cache->batch.surfaces, &cache->ordered.loop_pos_nor); - } - if (DRW_batch_requested(cache->batch.surfaces_edges, GPU_PRIM_LINES)) { - DRW_ibo_request(cache->batch.surfaces_edges, &cache->ibo.surfaces_lines); - DRW_vbo_request(cache->batch.surfaces_edges, &cache->ordered.pos_nor); - DRW_vbo_request(cache->batch.surfaces_edges, &cache->ordered.edge_fac); - } if (DRW_batch_requested(cache->batch.curves, GPU_PRIM_LINE_STRIP)) { DRW_ibo_request(cache->batch.curves, &cache->ibo.curves_lines); DRW_vbo_request(cache->batch.curves, &cache->ordered.curves_pos); } - if (DRW_batch_requested(cache->batch.edge_detection, GPU_PRIM_LINES_ADJ)) { - DRW_ibo_request(cache->batch.edge_detection, &cache->ibo.edges_adj_lines); - DRW_vbo_request(cache->batch.edge_detection, &cache->ordered.pos_nor); - } /* Edit mode */ if (DRW_batch_requested(cache->batch.edit_edges, GPU_PRIM_LINES)) { @@ -995,20 +825,6 @@ void DRW_curve_batch_cache_create_requested(Object *ob, const struct Scene *scen if (DRW_batch_requested(cache->batch.edit_normals, GPU_PRIM_LINES)) { DRW_vbo_request(cache->batch.edit_normals, &cache->edit.curves_nor); } - for (int i = 0; i < cache->mat_len; i++) { - if (DRW_batch_requested(cache->surf_per_mat[i], GPU_PRIM_TRIS)) { - if (cache->mat_len > 1) { - DRW_ibo_request(cache->surf_per_mat[i], &cache->surf_per_mat_tris[i]); - } - if (cache->cd_used & CD_MASK_MLOOPUV) { - DRW_vbo_request(cache->surf_per_mat[i], &cache->ordered.loop_uv); - } - if (cache->cd_used & CD_MASK_TANGENT) { - DRW_vbo_request(cache->surf_per_mat[i], &cache->ordered.loop_tan); - } - DRW_vbo_request(cache->surf_per_mat[i], &cache->ordered.loop_pos_nor); - } - } #ifdef DRW_DEBUG_MESH_CACHE_REQUEST printf("-- %s %s --\n", __func__, ob->id.name + 2); @@ -1016,76 +832,28 @@ void DRW_curve_batch_cache_create_requested(Object *ob, const struct Scene *scen /* Generate MeshRenderData flags */ int mr_flag = 0; - DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_flag, cache->ordered.pos_nor, CU_DATATYPE_SURFACE); - DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_flag, cache->ordered.edge_fac, CU_DATATYPE_SURFACE); DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_flag, cache->ordered.curves_pos, CU_DATATYPE_WIRE); - DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_flag, cache->ordered.loop_pos_nor, CU_DATATYPE_SURFACE); - DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_flag, cache->ordered.loop_uv, CU_DATATYPE_SURFACE); - DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_flag, cache->ordered.loop_tan, CU_DATATYPE_SURFACE); - DRW_ADD_FLAG_FROM_IBO_REQUEST(mr_flag, cache->ibo.surfaces_tris, CU_DATATYPE_SURFACE); - DRW_ADD_FLAG_FROM_IBO_REQUEST(mr_flag, cache->ibo.surfaces_lines, CU_DATATYPE_SURFACE); DRW_ADD_FLAG_FROM_IBO_REQUEST(mr_flag, cache->ibo.curves_lines, CU_DATATYPE_WIRE); - DRW_ADD_FLAG_FROM_IBO_REQUEST(mr_flag, cache->ibo.edges_adj_lines, CU_DATATYPE_SURFACE); DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_flag, cache->edit.pos, CU_DATATYPE_OVERLAY); DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_flag, cache->edit.data, CU_DATATYPE_OVERLAY); DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_flag, cache->edit.curves_nor, CU_DATATYPE_NORMAL); - DRW_ADD_FLAG_FROM_VBO_REQUEST(mr_flag, cache->edit.curves_weight, CU_DATATYPE_OVERLAY); DRW_ADD_FLAG_FROM_IBO_REQUEST(mr_flag, cache->ibo.edit_verts, CU_DATATYPE_OVERLAY); DRW_ADD_FLAG_FROM_IBO_REQUEST(mr_flag, cache->ibo.edit_lines, CU_DATATYPE_OVERLAY); - for (int i = 0; i < cache->mat_len; i++) { - DRW_ADD_FLAG_FROM_IBO_REQUEST(mr_flag, cache->surf_per_mat_tris[i], CU_DATATYPE_SURFACE); - } - #ifdef DRW_DEBUG_MESH_CACHE_REQUEST printf(" mr_flag %d\n\n", mr_flag); #endif CurveRenderData *rdata = curve_render_data_create(cu, ob->runtime.curve_cache, mr_flag); - /* The object's curve cache can be empty (in one case because we use #CurveEval's cache instead), - * If so, point to an empty DispList list to avoid the need to check for null in the following - * functions. */ - ListBase empty_lb = {nullptr, nullptr}; - ListBase *lb = rdata->ob_curve_cache == nullptr ? &empty_lb : &rdata->ob_curve_cache->disp; - /* Generate VBOs */ - if (DRW_vbo_requested(cache->ordered.pos_nor)) { - DRW_displist_vertbuf_create_pos_and_nor(lb, cache->ordered.pos_nor, scene); - } - if (DRW_vbo_requested(cache->ordered.edge_fac)) { - DRW_displist_vertbuf_create_wiredata(lb, cache->ordered.edge_fac); - } if (DRW_vbo_requested(cache->ordered.curves_pos)) { curve_create_curves_pos(rdata, cache->ordered.curves_pos); } - - if (DRW_vbo_requested(cache->ordered.loop_pos_nor) || - DRW_vbo_requested(cache->ordered.loop_uv) || DRW_vbo_requested(cache->ordered.loop_tan)) { - DRW_displist_vertbuf_create_loop_pos_and_nor_and_uv_and_tan( - lb, cache->ordered.loop_pos_nor, cache->ordered.loop_uv, cache->ordered.loop_tan, scene); - } - - if (DRW_ibo_requested(cache->surf_per_mat_tris[0])) { - DRW_displist_indexbuf_create_triangles_loop_split_by_material( - lb, cache->surf_per_mat_tris, cache->mat_len); - } - if (DRW_ibo_requested(cache->ibo.curves_lines)) { curve_create_curves_lines(rdata, cache->ibo.curves_lines); } - if (DRW_ibo_requested(cache->ibo.surfaces_tris)) { - DRW_displist_indexbuf_create_triangles_in_order(lb, cache->ibo.surfaces_tris); - } - if (DRW_ibo_requested(cache->ibo.surfaces_lines)) { - DRW_displist_indexbuf_create_lines_in_order(lb, cache->ibo.surfaces_lines); - } - if (DRW_ibo_requested(cache->ibo.edges_adj_lines)) { - DRW_displist_indexbuf_create_edges_adjacency_lines( - lb, cache->ibo.edges_adj_lines, &cache->is_manifold); - } - if (DRW_vbo_requested(cache->edit.pos) || DRW_vbo_requested(cache->edit.data) || DRW_ibo_requested(cache->ibo.edit_verts) || DRW_ibo_requested(cache->ibo.edit_lines)) { curve_create_edit_data_and_handles( diff --git a/source/blender/draw/intern/draw_cache_impl_displist.c b/source/blender/draw/intern/draw_cache_impl_displist.c index ee3d16b2830..96c088c3ee9 100644 --- a/source/blender/draw/intern/draw_cache_impl_displist.c +++ b/source/blender/draw/intern/draw_cache_impl_displist.c @@ -9,7 +9,6 @@ * \note DispList may be removed soon! This is a utility for object types that use render. */ -#include "BLI_alloca.h" #include "BLI_edgehash.h" #include "BLI_listbase.h" #include "BLI_math_vector.h" @@ -19,7 +18,6 @@ #include "DNA_scene_types.h" #include "BKE_displist.h" -#include "BKE_displist_tangent.h" #include "GPU_batch.h" #include "GPU_capabilities.h" @@ -112,53 +110,6 @@ static void displist_indexbufbuilder_set( } } -static int displist_indexbufbuilder_tess_set( - SetTriIndicesFn *set_tri_indices, - SetTriIndicesFn *set_quad_tri_indices, /* meh, find a better solution. */ - void *thunk, - const DispList *dl, - const int ofs) -{ - int v_idx = ofs; - if (ELEM(dl->type, DL_INDEX3, DL_INDEX4, DL_SURF)) { - if (dl->type == DL_INDEX3) { - for (int i = 0; i < dl->parts; i++) { - set_tri_indices(thunk, v_idx + 0, v_idx + 1, v_idx + 2); - v_idx += 3; - } - } - else if (dl->type == DL_SURF) { - for (int a = 0; a < dl->parts; a++) { - if ((dl->flag & DL_CYCL_V) == 0 && a == dl->parts - 1) { - break; - } - int b = (dl->flag & DL_CYCL_U) ? 0 : 1; - for (; b < dl->nr; b++) { - set_quad_tri_indices(thunk, v_idx + 0, v_idx + 1, v_idx + 2); - set_quad_tri_indices(thunk, v_idx + 3, v_idx + 4, v_idx + 5); - v_idx += 6; - } - } - } - else { - BLI_assert(dl->type == DL_INDEX4); - const int *idx = dl->index; - for (int i = 0; i < dl->parts; i++, idx += 4) { - if (idx[2] != idx[3]) { - set_quad_tri_indices(thunk, v_idx + 0, v_idx + 1, v_idx + 2); - set_quad_tri_indices(thunk, v_idx + 3, v_idx + 4, v_idx + 5); - v_idx += 6; - } - else { - set_tri_indices(thunk, v_idx + 0, v_idx + 1, v_idx + 2); - v_idx += 3; - } - } - } - } - return v_idx; -} - void DRW_displist_vertbuf_create_pos_and_nor(ListBase *lb, GPUVertBuf *vbo, const Scene *scene) { const bool do_hq_normals = (scene->r.perf_flag & SCE_PERF_HQ_NORMALS) != 0 || @@ -273,35 +224,6 @@ void DRW_displist_indexbuf_create_triangles_in_order(ListBase *lb, GPUIndexBuf * GPU_indexbuf_build_in_place(&elb, ibo); } -void DRW_displist_indexbuf_create_triangles_loop_split_by_material(ListBase *lb, - GPUIndexBuf **ibo_mats, - uint mat_len) -{ - GPUIndexBufBuilder *elb = BLI_array_alloca(elb, mat_len); - - const int tri_len = curve_render_surface_tri_len_get(lb); - - /* Init each index buffer builder */ - for (int i = 0; i < mat_len; i++) { - GPU_indexbuf_init(&elb[i], GPU_PRIM_TRIS, tri_len * 3, tri_len * 3); - } - - /* calc each index buffer builder */ - uint v_idx = 0; - LISTBASE_FOREACH (const DispList *, dl, lb) { - v_idx = displist_indexbufbuilder_tess_set((SetTriIndicesFn *)GPU_indexbuf_add_tri_verts, - (SetTriIndicesFn *)GPU_indexbuf_add_tri_verts, - &elb[dl->col], - dl, - v_idx); - } - - /* build each indexbuf */ - for (int i = 0; i < mat_len; i++) { - GPU_indexbuf_build_in_place(&elb[i], ibo_mats[i]); - } -} - static void set_overlay_wires_tri_indices(void *thunk, uint v1, uint v2, uint v3) { GPUIndexBufBuilder *eld = (GPUIndexBufBuilder *)thunk; @@ -335,433 +257,6 @@ void DRW_displist_indexbuf_create_lines_in_order(ListBase *lb, GPUIndexBuf *ibo) GPU_indexbuf_build_in_place(&elb, ibo); } -static void surf_uv_quad(const DispList *dl, const uint quad[4], float r_uv[4][2]) -{ - int orco_sizeu = dl->nr - 1; - int orco_sizev = dl->parts - 1; - - /* exception as handled in convertblender.c too */ - if (dl->flag & DL_CYCL_U) { - orco_sizeu++; - } - if (dl->flag & DL_CYCL_V) { - orco_sizev++; - } - - for (int i = 0; i < 4; i++) { - /* NOTE: For some reason the shading U and V are swapped compared to the - * one described in the surface format. */ - /* find uv based on vertex index into grid array */ - r_uv[i][0] = (quad[i] / dl->nr) / (float)orco_sizev; - r_uv[i][1] = (quad[i] % dl->nr) / (float)orco_sizeu; - - /* cyclic correction */ - if (ELEM(i, 1, 2) && r_uv[i][0] == 0.0f) { - r_uv[i][0] = 1.0f; - } - if (ELEM(i, 0, 1) && r_uv[i][1] == 0.0f) { - r_uv[i][1] = 1.0f; - } - } -} - -static void displist_vertbuf_attr_set_nor(GPUVertBufRaw *step, - const GPUNormal *n1, - const GPUNormal *n2, - const GPUNormal *n3, - const bool do_hq_normals) -{ - if (do_hq_normals) { - copy_v3_v3_short(GPU_vertbuf_raw_step(step), n1->high); - copy_v3_v3_short(GPU_vertbuf_raw_step(step), n2->high); - copy_v3_v3_short(GPU_vertbuf_raw_step(step), n3->high); - } - else { - *(GPUPackedNormal *)GPU_vertbuf_raw_step(step) = n1->low; - *(GPUPackedNormal *)GPU_vertbuf_raw_step(step) = n2->low; - *(GPUPackedNormal *)GPU_vertbuf_raw_step(step) = n3->low; - } -} - -static void displist_vertbuf_attr_set_tri_pos_nor_uv(GPUVertBufRaw *pos_step, - GPUVertBufRaw *nor_step, - GPUVertBufRaw *uv_step, - GPUVertBufRaw *tan_step, - const float v1[3], - const float v2[3], - const float v3[3], - const GPUNormal *n1, - const GPUNormal *n2, - const GPUNormal *n3, - const GPUNormal *t1, - const GPUNormal *t2, - const GPUNormal *t3, - const float uv1[2], - const float uv2[2], - const float uv3[2], - const bool do_hq_normals) -{ - if (pos_step->size != 0) { - copy_v3_v3(GPU_vertbuf_raw_step(pos_step), v1); - copy_v3_v3(GPU_vertbuf_raw_step(pos_step), v2); - copy_v3_v3(GPU_vertbuf_raw_step(pos_step), v3); - displist_vertbuf_attr_set_nor(nor_step, n1, n2, n3, do_hq_normals); - } - if (uv_step->size != 0) { - normal_float_to_short_v2(GPU_vertbuf_raw_step(uv_step), uv1); - normal_float_to_short_v2(GPU_vertbuf_raw_step(uv_step), uv2); - normal_float_to_short_v2(GPU_vertbuf_raw_step(uv_step), uv3); - } - if (tan_step->size != 0) { - displist_vertbuf_attr_set_nor(tan_step, t1, t2, t3, do_hq_normals); - } -} - -#define SURFACE_QUAD_ITER_BEGIN(dl) \ - { \ - uint quad[4]; \ - int quad_index = 0; \ - int max_v = (dl->flag & DL_CYCL_V) ? dl->parts : (dl->parts - 1); \ - int max_u = (dl->flag & DL_CYCL_U) ? dl->nr : (dl->nr - 1); \ - for (int v = 0; v < max_v; v++) { \ - quad[3] = dl->nr * v; \ - quad[0] = quad[3] + 1; \ - quad[2] = quad[3] + dl->nr; \ - quad[1] = quad[0] + dl->nr; \ - /* Cyclic wrap */ \ - if (v == dl->parts - 1) { \ - quad[1] -= dl->parts * dl->nr; \ - quad[2] -= dl->parts * dl->nr; \ - } \ - for (int u = 0; u < max_u; u++, quad_index++) { \ - /* Cyclic wrap */ \ - if (u == dl->nr - 1) { \ - quad[0] -= dl->nr; \ - quad[1] -= dl->nr; \ - } - -#define SURFACE_QUAD_ITER_END \ - quad[2] = quad[1]; \ - quad[1]++; \ - quad[3] = quad[0]; \ - quad[0]++; \ - } \ - } \ - } - -static void displist_surf_fnors_ensure(const DispList *dl, float (**fnors)[3]) -{ - int u_len = dl->nr - ((dl->flag & DL_CYCL_U) ? 0 : 1); - int v_len = dl->parts - ((dl->flag & DL_CYCL_V) ? 0 : 1); - const float(*verts)[3] = (const float(*)[3])dl->verts; - float(*nor_flat)[3] = MEM_mallocN(sizeof(float[3]) * u_len * v_len, __func__); - *fnors = nor_flat; - - SURFACE_QUAD_ITER_BEGIN (dl) { - normal_quad_v3(*nor_flat, verts[quad[0]], verts[quad[1]], verts[quad[2]], verts[quad[3]]); - nor_flat++; - } - SURFACE_QUAD_ITER_END -} - -void DRW_displist_vertbuf_create_loop_pos_and_nor_and_uv_and_tan(ListBase *lb, - GPUVertBuf *vbo_pos_nor, - GPUVertBuf *vbo_uv, - GPUVertBuf *vbo_tan, - const Scene *scene) -{ - const bool do_hq_normals = (scene->r.perf_flag & SCE_PERF_HQ_NORMALS) != 0 || - GPU_use_hq_normals_workaround(); - - static GPUVertFormat format_pos_nor = {0}; - static GPUVertFormat format_pos_nor_hq = {0}; - static GPUVertFormat format_uv = {0}; - static GPUVertFormat format_tan = {0}; - static GPUVertFormat format_tan_hq = {0}; - static struct { - uint pos, nor, uv, tan; - uint pos_hq, nor_hq, tan_hq; - } attr_id; - if (format_pos_nor.attr_len == 0) { - /* initialize vertex format */ - attr_id.pos = GPU_vertformat_attr_add( - &format_pos_nor, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); - attr_id.nor = GPU_vertformat_attr_add( - &format_pos_nor, "nor", GPU_COMP_I10, 3, GPU_FETCH_INT_TO_FLOAT_UNIT); - attr_id.pos_hq = GPU_vertformat_attr_add( - &format_pos_nor_hq, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); - attr_id.nor_hq = GPU_vertformat_attr_add( - &format_pos_nor_hq, "nor", GPU_COMP_I16, 3, GPU_FETCH_INT_TO_FLOAT_UNIT); - - /* UVs are in [0..1] range. We can compress them. */ - attr_id.uv = GPU_vertformat_attr_add( - &format_uv, "u", GPU_COMP_I16, 2, GPU_FETCH_INT_TO_FLOAT_UNIT); - GPU_vertformat_alias_add(&format_uv, "au"); - - attr_id.tan = GPU_vertformat_attr_add( - &format_tan, "t", GPU_COMP_I10, 4, GPU_FETCH_INT_TO_FLOAT_UNIT); - GPU_vertformat_alias_add(&format_tan, "at"); - attr_id.tan_hq = GPU_vertformat_attr_add( - &format_tan_hq, "t", GPU_COMP_I16, 3, GPU_FETCH_INT_TO_FLOAT_UNIT); - GPU_vertformat_alias_add(&format_tan_hq, "at"); - } - uint pos_id = do_hq_normals ? attr_id.pos_hq : attr_id.pos; - uint nor_id = do_hq_normals ? attr_id.nor_hq : attr_id.nor; - uint tan_id = do_hq_normals ? attr_id.tan_hq : attr_id.tan; - - int vbo_len_capacity = curve_render_surface_tri_len_get(lb) * 3; - - GPUVertBufRaw pos_step = {0}; - GPUVertBufRaw nor_step = {0}; - GPUVertBufRaw uv_step = {0}; - GPUVertBufRaw tan_step = {0}; - -#define DRW_TEST_ASSIGN_VBO(v) (v = (DRW_vbo_requested(v) ? (v) : NULL)) - - if (DRW_TEST_ASSIGN_VBO(vbo_pos_nor)) { - GPU_vertbuf_init_with_format(vbo_pos_nor, - do_hq_normals ? &format_pos_nor_hq : &format_pos_nor); - GPU_vertbuf_data_alloc(vbo_pos_nor, vbo_len_capacity); - GPU_vertbuf_attr_get_raw_data(vbo_pos_nor, pos_id, &pos_step); - GPU_vertbuf_attr_get_raw_data(vbo_pos_nor, nor_id, &nor_step); - } - if (DRW_TEST_ASSIGN_VBO(vbo_uv)) { - GPU_vertbuf_init_with_format(vbo_uv, &format_uv); - GPU_vertbuf_data_alloc(vbo_uv, vbo_len_capacity); - GPU_vertbuf_attr_get_raw_data(vbo_uv, attr_id.uv, &uv_step); - } - if (DRW_TEST_ASSIGN_VBO(vbo_tan)) { - GPU_vertbuf_init_with_format(vbo_tan, do_hq_normals ? &format_tan_hq : &format_tan); - GPU_vertbuf_data_alloc(vbo_tan, vbo_len_capacity); - GPU_vertbuf_attr_get_raw_data(vbo_tan, tan_id, &tan_step); - } - -#undef DRW_TEST_ASSIGN_VBO - - BKE_displist_normals_add(lb); - - LISTBASE_FOREACH (const DispList *, dl, lb) { - const bool is_smooth = (dl->rt & CU_SMOOTH) != 0; - if (ELEM(dl->type, DL_INDEX3, DL_INDEX4, DL_SURF)) { - const float(*verts)[3] = (const float(*)[3])dl->verts; - const float(*nors)[3] = (const float(*)[3])dl->nors; - const int *idx = dl->index; - float uv[4][2]; - - if (dl->type == DL_INDEX3) { - /* Currently 'DL_INDEX3' is always a flat surface with a single normal. */ - GPUNormal tangent_packed; - GPUNormal normal_packed; - GPU_normal_convert_v3(&normal_packed, dl->nors, do_hq_normals); - if (vbo_tan) { - float tan[4]; - float(*tan_ptr)[4] = &tan; - BKE_displist_tangent_calc(dl, NULL, &tan_ptr); - GPU_normal_convert_v3(&tangent_packed, tan, do_hq_normals); - normal_float_to_short_v3(tangent_packed.high, tan); - } - else { - if (do_hq_normals) { - tangent_packed.high[0] = 0; - tangent_packed.high[1] = 0; - tangent_packed.high[2] = 0; - } - else { - tangent_packed.low = (GPUPackedNormal){0, 0, 0, 1}; - } - } - - const float x_max = (float)(dl->nr - 1); - uv[0][1] = uv[1][1] = uv[2][1] = 0.0f; - const int i_end = dl->parts; - for (int i = 0; i < i_end; i++, idx += 3) { - if (vbo_uv) { - uv[0][0] = idx[0] / x_max; - uv[1][0] = idx[1] / x_max; - uv[2][0] = idx[2] / x_max; - } - - displist_vertbuf_attr_set_tri_pos_nor_uv(&pos_step, - &nor_step, - &uv_step, - &tan_step, - verts[idx[0]], - verts[idx[2]], - verts[idx[1]], - &normal_packed, - &normal_packed, - &normal_packed, - &tangent_packed, - &tangent_packed, - &tangent_packed, - uv[0], - uv[2], - uv[1], - do_hq_normals); - } - } - else if (dl->type == DL_SURF) { - float(*tangents)[4] = NULL; - float(*fnors)[3] = NULL; - - if (!is_smooth) { - displist_surf_fnors_ensure(dl, &fnors); - } - - if (vbo_tan) { - BKE_displist_tangent_calc(dl, fnors, &tangents); - } - - SURFACE_QUAD_ITER_BEGIN (dl) { - if (vbo_uv) { - surf_uv_quad(dl, quad, uv); - } - GPUNormal pnors_quad[4]; - GPUNormal ptans_quad[4]; - - if (is_smooth) { - for (int j = 0; j < 4; j++) { - GPU_normal_convert_v3(&pnors_quad[j], nors[quad[j]], do_hq_normals); - } - } - else { - GPU_normal_convert_v3(&pnors_quad[0], fnors[quad_index], do_hq_normals); - pnors_quad[1] = pnors_quad[2] = pnors_quad[3] = pnors_quad[0]; - } - - if (vbo_tan) { - for (int j = 0; j < 4; j++) { - float *tan = tangents[quad_index * 4 + j]; - GPU_normal_convert_v3(&ptans_quad[j], tan, do_hq_normals); - } - } - - displist_vertbuf_attr_set_tri_pos_nor_uv(&pos_step, - &nor_step, - &uv_step, - &tan_step, - verts[quad[2]], - verts[quad[0]], - verts[quad[1]], - &pnors_quad[2], - &pnors_quad[0], - &pnors_quad[1], - &ptans_quad[2], - &ptans_quad[0], - &ptans_quad[1], - uv[2], - uv[0], - uv[1], - do_hq_normals); - - displist_vertbuf_attr_set_tri_pos_nor_uv(&pos_step, - &nor_step, - &uv_step, - &tan_step, - verts[quad[0]], - verts[quad[2]], - verts[quad[3]], - &pnors_quad[0], - &pnors_quad[2], - &pnors_quad[3], - &ptans_quad[0], - &ptans_quad[2], - &ptans_quad[3], - uv[0], - uv[2], - uv[3], - do_hq_normals); - } - SURFACE_QUAD_ITER_END - - MEM_SAFE_FREE(tangents); - MEM_SAFE_FREE(fnors); - } - else { - BLI_assert(dl->type == DL_INDEX4); - uv[0][0] = uv[0][1] = uv[1][0] = uv[3][1] = 0.0f; - uv[1][1] = uv[2][0] = uv[2][1] = uv[3][0] = 1.0f; - - const int i_end = dl->parts; - for (int i = 0; i < i_end; i++, idx += 4) { - const bool is_tri = idx[2] != idx[3]; - - GPUNormal ptan = {0}; - GPUNormal pnors_idx[4]; - if (is_smooth) { - int idx_len = is_tri ? 3 : 4; - for (int j = 0; j < idx_len; j++) { - GPU_normal_convert_v3(&pnors_idx[j], nors[idx[j]], do_hq_normals); - } - } - else { - float nor_flat[3]; - if (is_tri) { - normal_tri_v3(nor_flat, verts[idx[0]], verts[idx[1]], verts[idx[2]]); - } - else { - normal_quad_v3(nor_flat, verts[idx[0]], verts[idx[1]], verts[idx[2]], verts[idx[3]]); - } - GPU_normal_convert_v3(&pnors_idx[0], nor_flat, do_hq_normals); - pnors_idx[1] = pnors_idx[2] = pnors_idx[3] = pnors_idx[0]; - } - - displist_vertbuf_attr_set_tri_pos_nor_uv(&pos_step, - &nor_step, - &uv_step, - &tan_step, - verts[idx[0]], - verts[idx[2]], - verts[idx[1]], - &pnors_idx[0], - &pnors_idx[2], - &pnors_idx[1], - &ptan, - &ptan, - &ptan, - uv[0], - uv[2], - uv[1], - do_hq_normals); - - if (is_tri) { - displist_vertbuf_attr_set_tri_pos_nor_uv(&pos_step, - &nor_step, - &uv_step, - &tan_step, - verts[idx[2]], - verts[idx[0]], - verts[idx[3]], - &pnors_idx[2], - &pnors_idx[0], - &pnors_idx[3], - &ptan, - &ptan, - &ptan, - uv[2], - uv[0], - uv[3], - do_hq_normals); - } - } - } - } - } - /* Resize and finish. */ - if (pos_step.size != 0) { - int vbo_len_used = GPU_vertbuf_raw_used(&pos_step); - if (vbo_len_used < vbo_len_capacity) { - GPU_vertbuf_data_resize(vbo_pos_nor, vbo_len_used); - } - } - if (uv_step.size != 0) { - int vbo_len_used = GPU_vertbuf_raw_used(&uv_step); - if (vbo_len_used < vbo_len_capacity) { - GPU_vertbuf_data_resize(vbo_uv, vbo_len_used); - } - } -} - /* Edge detection/adjacency. */ #define NO_EDGE INT_MAX static void set_edge_adjacency_lines_indices( diff --git a/source/blender/draw/intern/draw_common.c b/source/blender/draw/intern/draw_common.c index 462ae6f7cf1..0f330dbb519 100644 --- a/source/blender/draw/intern/draw_common.c +++ b/source/blender/draw/intern/draw_common.c @@ -40,154 +40,155 @@ void DRW_globals_update(void) { GlobalsUboStorage *gb = &G_draw.block; - UI_GetThemeColor4fv(TH_WIRE, gb->colorWire); - UI_GetThemeColor4fv(TH_WIRE_EDIT, gb->colorWireEdit); - UI_GetThemeColor4fv(TH_ACTIVE, gb->colorActive); - UI_GetThemeColor4fv(TH_SELECT, gb->colorSelect); - UI_COLOR_RGBA_FROM_U8(0x88, 0xFF, 0xFF, 155, gb->colorLibrarySelect); - UI_COLOR_RGBA_FROM_U8(0x55, 0xCC, 0xCC, 155, gb->colorLibrary); - UI_GetThemeColor4fv(TH_TRANSFORM, gb->colorTransform); - UI_GetThemeColor4fv(TH_LIGHT, gb->colorLight); - UI_GetThemeColor4fv(TH_SPEAKER, gb->colorSpeaker); - UI_GetThemeColor4fv(TH_CAMERA, gb->colorCamera); - UI_GetThemeColor4fv(TH_CAMERA_PATH, gb->colorCameraPath); - UI_GetThemeColor4fv(TH_EMPTY, gb->colorEmpty); - UI_GetThemeColor4fv(TH_VERTEX, gb->colorVertex); - UI_GetThemeColor4fv(TH_VERTEX_SELECT, gb->colorVertexSelect); - UI_GetThemeColor4fv(TH_VERTEX_UNREFERENCED, gb->colorVertexUnreferenced); - UI_COLOR_RGBA_FROM_U8(0xB0, 0x00, 0xB0, 0xFF, gb->colorVertexMissingData); - UI_GetThemeColor4fv(TH_EDITMESH_ACTIVE, gb->colorEditMeshActive); - UI_GetThemeColor4fv(TH_EDGE_SELECT, gb->colorEdgeSelect); - UI_GetThemeColor4fv(TH_GP_VERTEX, gb->colorGpencilVertex); - UI_GetThemeColor4fv(TH_GP_VERTEX_SELECT, gb->colorGpencilVertexSelect); - - UI_GetThemeColor4fv(TH_EDGE_SEAM, gb->colorEdgeSeam); - UI_GetThemeColor4fv(TH_EDGE_SHARP, gb->colorEdgeSharp); - UI_GetThemeColor4fv(TH_EDGE_CREASE, gb->colorEdgeCrease); - UI_GetThemeColor4fv(TH_EDGE_BEVEL, gb->colorEdgeBWeight); - UI_GetThemeColor4fv(TH_EDGE_FACESEL, gb->colorEdgeFaceSelect); - UI_GetThemeColor4fv(TH_FACE, gb->colorFace); - UI_GetThemeColor4fv(TH_FACE_SELECT, gb->colorFaceSelect); - UI_GetThemeColor4fv(TH_FACE_BACK, gb->colorFaceBack); - UI_GetThemeColor4fv(TH_FACE_FRONT, gb->colorFaceFront); - UI_GetThemeColor4fv(TH_NORMAL, gb->colorNormal); - UI_GetThemeColor4fv(TH_VNORMAL, gb->colorVNormal); - UI_GetThemeColor4fv(TH_LNORMAL, gb->colorLNormal); - UI_GetThemeColor4fv(TH_FACE_DOT, gb->colorFaceDot); - UI_GetThemeColor4fv(TH_SKIN_ROOT, gb->colorSkinRoot); - UI_GetThemeColor4fv(TH_BACK, gb->colorBackground); - UI_GetThemeColor4fv(TH_BACK_GRAD, gb->colorBackgroundGradient); - UI_GetThemeColor4fv(TH_TRANSPARENT_CHECKER_PRIMARY, gb->colorCheckerPrimary); - UI_GetThemeColor4fv(TH_TRANSPARENT_CHECKER_SECONDARY, gb->colorCheckerSecondary); - gb->sizeChecker = UI_GetThemeValuef(TH_TRANSPARENT_CHECKER_SIZE); - UI_GetThemeColor4fv(TH_V3D_CLIPPING_BORDER, gb->colorClippingBorder); + UI_GetThemeColor4fv(TH_WIRE, gb->color_wire); + UI_GetThemeColor4fv(TH_WIRE_EDIT, gb->color_wire_edit); + UI_GetThemeColor4fv(TH_ACTIVE, gb->color_active); + UI_GetThemeColor4fv(TH_SELECT, gb->color_select); + UI_COLOR_RGBA_FROM_U8(0x88, 0xFF, 0xFF, 155, gb->color_library_select); + UI_COLOR_RGBA_FROM_U8(0x55, 0xCC, 0xCC, 155, gb->color_library); + UI_GetThemeColor4fv(TH_TRANSFORM, gb->color_transform); + UI_GetThemeColor4fv(TH_LIGHT, gb->color_light); + UI_GetThemeColor4fv(TH_SPEAKER, gb->color_speaker); + UI_GetThemeColor4fv(TH_CAMERA, gb->color_camera); + UI_GetThemeColor4fv(TH_CAMERA_PATH, gb->color_camera_path); + UI_GetThemeColor4fv(TH_EMPTY, gb->color_empty); + UI_GetThemeColor4fv(TH_VERTEX, gb->color_vertex); + UI_GetThemeColor4fv(TH_VERTEX_SELECT, gb->color_vertex_select); + UI_GetThemeColor4fv(TH_VERTEX_UNREFERENCED, gb->color_vertex_unreferenced); + UI_COLOR_RGBA_FROM_U8(0xB0, 0x00, 0xB0, 0xFF, gb->color_vertex_missing_data); + UI_GetThemeColor4fv(TH_EDITMESH_ACTIVE, gb->color_edit_mesh_active); + UI_GetThemeColor4fv(TH_EDGE_SELECT, gb->color_edge_select); + UI_GetThemeColor4fv(TH_GP_VERTEX, gb->color_gpencil_vertex); + UI_GetThemeColor4fv(TH_GP_VERTEX_SELECT, gb->color_gpencil_vertex_select); + + UI_GetThemeColor4fv(TH_EDGE_SEAM, gb->color_edge_seam); + UI_GetThemeColor4fv(TH_EDGE_SHARP, gb->color_edge_sharp); + UI_GetThemeColor4fv(TH_EDGE_CREASE, gb->color_edge_crease); + UI_GetThemeColor4fv(TH_EDGE_BEVEL, gb->color_edge_bweight); + UI_GetThemeColor4fv(TH_EDGE_FACESEL, gb->color_edge_face_select); + UI_GetThemeColor4fv(TH_FACE, gb->color_face); + UI_GetThemeColor4fv(TH_FACE_SELECT, gb->color_face_select); + UI_GetThemeColor4fv(TH_FACE_BACK, gb->color_face_back); + UI_GetThemeColor4fv(TH_FACE_FRONT, gb->color_face_front); + UI_GetThemeColor4fv(TH_NORMAL, gb->color_normal); + UI_GetThemeColor4fv(TH_VNORMAL, gb->color_vnormal); + UI_GetThemeColor4fv(TH_LNORMAL, gb->color_lnormal); + UI_GetThemeColor4fv(TH_FACE_DOT, gb->color_facedot); + UI_GetThemeColor4fv(TH_SKIN_ROOT, gb->color_skinroot); + UI_GetThemeColor4fv(TH_BACK, gb->color_background); + UI_GetThemeColor4fv(TH_BACK_GRAD, gb->color_background_gradient); + UI_GetThemeColor4fv(TH_TRANSPARENT_CHECKER_PRIMARY, gb->color_checker_primary); + UI_GetThemeColor4fv(TH_TRANSPARENT_CHECKER_SECONDARY, gb->color_checker_secondary); + gb->size_checker = UI_GetThemeValuef(TH_TRANSPARENT_CHECKER_SIZE); + UI_GetThemeColor4fv(TH_V3D_CLIPPING_BORDER, gb->color_clipping_border); /* Custom median color to slightly affect the edit mesh colors. */ - interp_v4_v4v4(gb->colorEditMeshMiddle, gb->colorVertexSelect, gb->colorWireEdit, 0.35f); - copy_v3_fl( - gb->colorEditMeshMiddle, - dot_v3v3(gb->colorEditMeshMiddle, (float[3]){0.3333f, 0.3333f, 0.3333f})); /* Desaturate */ + interp_v4_v4v4(gb->color_edit_mesh_middle, gb->color_vertex_select, gb->color_wire_edit, 0.35f); + copy_v3_fl(gb->color_edit_mesh_middle, + dot_v3v3(gb->color_edit_mesh_middle, + (float[3]){0.3333f, 0.3333f, 0.3333f})); /* Desaturate */ #ifdef WITH_FREESTYLE - UI_GetThemeColor4fv(TH_FREESTYLE_EDGE_MARK, gb->colorEdgeFreestyle); - UI_GetThemeColor4fv(TH_FREESTYLE_FACE_MARK, gb->colorFaceFreestyle); + UI_GetThemeColor4fv(TH_FREESTYLE_EDGE_MARK, gb->color_edge_freestyle); + UI_GetThemeColor4fv(TH_FREESTYLE_FACE_MARK, gb->color_face_freestyle); #else - zero_v4(gb->colorEdgeFreestyle); - zero_v4(gb->colorFaceFreestyle); + zero_v4(gb->color_edge_freestyle); + zero_v4(gb->color_face_freestyle); #endif - UI_GetThemeColor4fv(TH_TEXT, gb->colorText); - UI_GetThemeColor4fv(TH_TEXT_HI, gb->colorTextHi); + UI_GetThemeColor4fv(TH_TEXT, gb->color_text); + UI_GetThemeColor4fv(TH_TEXT_HI, gb->color_text_hi); /* Bone colors */ - UI_GetThemeColor4fv(TH_BONE_POSE, gb->colorBonePose); - UI_GetThemeColor4fv(TH_BONE_POSE_ACTIVE, gb->colorBonePoseActive); - UI_GetThemeColorShade4fv(TH_EDGE_SELECT, 60, gb->colorBoneActive); - UI_GetThemeColorShade4fv(TH_EDGE_SELECT, -20, gb->colorBoneSelect); - UI_GetThemeColorBlendShade4fv(TH_WIRE, TH_BONE_POSE, 0.15f, 0, gb->colorBonePoseActiveUnsel); - UI_GetThemeColorBlendShade3fv(TH_WIRE_EDIT, TH_EDGE_SELECT, 0.15f, 0, gb->colorBoneActiveUnsel); - UI_COLOR_RGBA_FROM_U8(255, 150, 0, 80, gb->colorBonePoseTarget); - UI_COLOR_RGBA_FROM_U8(255, 255, 0, 80, gb->colorBonePoseIK); - UI_COLOR_RGBA_FROM_U8(200, 255, 0, 80, gb->colorBonePoseSplineIK); - UI_COLOR_RGBA_FROM_U8(0, 255, 120, 80, gb->colorBonePoseConstraint); - UI_GetThemeColor4fv(TH_BONE_SOLID, gb->colorBoneSolid); - UI_GetThemeColor4fv(TH_BONE_LOCKED_WEIGHT, gb->colorBoneLocked); - copy_v4_fl4(gb->colorBoneIKLine, 0.8f, 0.5f, 0.0f, 1.0f); - copy_v4_fl4(gb->colorBoneIKLineNoTarget, 0.8f, 0.8f, 0.2f, 1.0f); - copy_v4_fl4(gb->colorBoneIKLineSpline, 0.8f, 0.8f, 0.2f, 1.0f); + UI_GetThemeColor4fv(TH_BONE_POSE, gb->color_bone_pose); + UI_GetThemeColor4fv(TH_BONE_POSE_ACTIVE, gb->color_bone_pose_active); + UI_GetThemeColorShade4fv(TH_EDGE_SELECT, 60, gb->color_bone_active); + UI_GetThemeColorShade4fv(TH_EDGE_SELECT, -20, gb->color_bone_select); + UI_GetThemeColorBlendShade4fv(TH_WIRE, TH_BONE_POSE, 0.15f, 0, gb->color_bone_pose_active_unsel); + UI_GetThemeColorBlendShade3fv( + TH_WIRE_EDIT, TH_EDGE_SELECT, 0.15f, 0, gb->color_bone_active_unsel); + UI_COLOR_RGBA_FROM_U8(255, 150, 0, 80, gb->color_bone_pose_target); + UI_COLOR_RGBA_FROM_U8(255, 255, 0, 80, gb->color_bone_pose_ik); + UI_COLOR_RGBA_FROM_U8(200, 255, 0, 80, gb->color_bone_pose_spline_ik); + UI_COLOR_RGBA_FROM_U8(0, 255, 120, 80, gb->color_bone_pose_constraint); + UI_GetThemeColor4fv(TH_BONE_SOLID, gb->color_bone_solid); + UI_GetThemeColor4fv(TH_BONE_LOCKED_WEIGHT, gb->color_bone_locked); + copy_v4_fl4(gb->color_bone_ik_line, 0.8f, 0.5f, 0.0f, 1.0f); + copy_v4_fl4(gb->color_bone_ik_line_no_target, 0.8f, 0.8f, 0.2f, 1.0f); + copy_v4_fl4(gb->color_bone_ik_line_spline, 0.8f, 0.8f, 0.2f, 1.0f); /* Curve */ - UI_GetThemeColor4fv(TH_HANDLE_FREE, gb->colorHandleFree); - UI_GetThemeColor4fv(TH_HANDLE_AUTO, gb->colorHandleAuto); - UI_GetThemeColor4fv(TH_HANDLE_VECT, gb->colorHandleVect); - UI_GetThemeColor4fv(TH_HANDLE_ALIGN, gb->colorHandleAlign); - UI_GetThemeColor4fv(TH_HANDLE_AUTOCLAMP, gb->colorHandleAutoclamp); - UI_GetThemeColor4fv(TH_HANDLE_SEL_FREE, gb->colorHandleSelFree); - UI_GetThemeColor4fv(TH_HANDLE_SEL_AUTO, gb->colorHandleSelAuto); - UI_GetThemeColor4fv(TH_HANDLE_SEL_VECT, gb->colorHandleSelVect); - UI_GetThemeColor4fv(TH_HANDLE_SEL_ALIGN, gb->colorHandleSelAlign); - UI_GetThemeColor4fv(TH_HANDLE_SEL_AUTOCLAMP, gb->colorHandleSelAutoclamp); - UI_GetThemeColor4fv(TH_NURB_ULINE, gb->colorNurbUline); - UI_GetThemeColor4fv(TH_NURB_VLINE, gb->colorNurbVline); - UI_GetThemeColor4fv(TH_NURB_SEL_ULINE, gb->colorNurbSelUline); - UI_GetThemeColor4fv(TH_NURB_SEL_VLINE, gb->colorNurbSelVline); - UI_GetThemeColor4fv(TH_ACTIVE_SPLINE, gb->colorActiveSpline); - - UI_GetThemeColor4fv(TH_CFRAME, gb->colorCurrentFrame); + UI_GetThemeColor4fv(TH_HANDLE_FREE, gb->color_handle_free); + UI_GetThemeColor4fv(TH_HANDLE_AUTO, gb->color_handle_auto); + UI_GetThemeColor4fv(TH_HANDLE_VECT, gb->color_handle_vect); + UI_GetThemeColor4fv(TH_HANDLE_ALIGN, gb->color_handle_align); + UI_GetThemeColor4fv(TH_HANDLE_AUTOCLAMP, gb->color_handle_autoclamp); + UI_GetThemeColor4fv(TH_HANDLE_SEL_FREE, gb->color_handle_sel_free); + UI_GetThemeColor4fv(TH_HANDLE_SEL_AUTO, gb->color_handle_sel_auto); + UI_GetThemeColor4fv(TH_HANDLE_SEL_VECT, gb->color_handle_sel_vect); + UI_GetThemeColor4fv(TH_HANDLE_SEL_ALIGN, gb->color_handle_sel_align); + UI_GetThemeColor4fv(TH_HANDLE_SEL_AUTOCLAMP, gb->color_handle_sel_autoclamp); + UI_GetThemeColor4fv(TH_NURB_ULINE, gb->color_nurb_uline); + UI_GetThemeColor4fv(TH_NURB_VLINE, gb->color_nurb_vline); + UI_GetThemeColor4fv(TH_NURB_SEL_ULINE, gb->color_nurb_sel_uline); + UI_GetThemeColor4fv(TH_NURB_SEL_VLINE, gb->color_nurb_sel_vline); + UI_GetThemeColor4fv(TH_ACTIVE_SPLINE, gb->color_active_spline); + + UI_GetThemeColor4fv(TH_CFRAME, gb->color_current_frame); /* Meta-ball. */ - UI_COLOR_RGBA_FROM_U8(0xA0, 0x30, 0x30, 0xFF, gb->colorMballRadius); - UI_COLOR_RGBA_FROM_U8(0xF0, 0xA0, 0xA0, 0xFF, gb->colorMballRadiusSelect); - UI_COLOR_RGBA_FROM_U8(0x30, 0xA0, 0x30, 0xFF, gb->colorMballStiffness); - UI_COLOR_RGBA_FROM_U8(0xA0, 0xF0, 0xA0, 0xFF, gb->colorMballStiffnessSelect); + UI_COLOR_RGBA_FROM_U8(0xA0, 0x30, 0x30, 0xFF, gb->color_mball_radius); + UI_COLOR_RGBA_FROM_U8(0xF0, 0xA0, 0xA0, 0xFF, gb->color_mball_radius_select); + UI_COLOR_RGBA_FROM_U8(0x30, 0xA0, 0x30, 0xFF, gb->color_mball_stiffness); + UI_COLOR_RGBA_FROM_U8(0xA0, 0xF0, 0xA0, 0xFF, gb->color_mball_stiffness_select); /* Grid */ - UI_GetThemeColorShade4fv(TH_GRID, 10, gb->colorGrid); + UI_GetThemeColorShade4fv(TH_GRID, 10, gb->color_grid); /* Emphasize division lines lighter instead of darker, if background is darker than grid. */ UI_GetThemeColorShade4fv( TH_GRID, - (gb->colorGrid[0] + gb->colorGrid[1] + gb->colorGrid[2] + 0.12f > - gb->colorBackground[0] + gb->colorBackground[1] + gb->colorBackground[2]) ? + (gb->color_grid[0] + gb->color_grid[1] + gb->color_grid[2] + 0.12f > + gb->color_background[0] + gb->color_background[1] + gb->color_background[2]) ? 20 : -10, - gb->colorGridEmphasis); + gb->color_grid_emphasis); /* Grid Axis */ - UI_GetThemeColorBlendShade4fv(TH_GRID, TH_AXIS_X, 0.5f, -10, gb->colorGridAxisX); - UI_GetThemeColorBlendShade4fv(TH_GRID, TH_AXIS_Y, 0.5f, -10, gb->colorGridAxisY); - UI_GetThemeColorBlendShade4fv(TH_GRID, TH_AXIS_Z, 0.5f, -10, gb->colorGridAxisZ); + UI_GetThemeColorBlendShade4fv(TH_GRID, TH_AXIS_X, 0.5f, -10, gb->color_grid_axis_x); + UI_GetThemeColorBlendShade4fv(TH_GRID, TH_AXIS_Y, 0.5f, -10, gb->color_grid_axis_y); + UI_GetThemeColorBlendShade4fv(TH_GRID, TH_AXIS_Z, 0.5f, -10, gb->color_grid_axis_z); - UI_GetThemeColorShadeAlpha4fv(TH_TRANSFORM, 0, -80, gb->colorDeselect); - UI_GetThemeColorShadeAlpha4fv(TH_WIRE, 0, -30, gb->colorOutline); - UI_GetThemeColorShadeAlpha4fv(TH_LIGHT, 0, 255, gb->colorLightNoAlpha); + UI_GetThemeColorShadeAlpha4fv(TH_TRANSFORM, 0, -80, gb->color_deselect); + UI_GetThemeColorShadeAlpha4fv(TH_WIRE, 0, -30, gb->color_outline); + UI_GetThemeColorShadeAlpha4fv(TH_LIGHT, 0, 255, gb->color_light_no_alpha); /* UV colors */ - UI_GetThemeColor4fv(TH_UV_SHADOW, gb->colorUVShadow); + UI_GetThemeColor4fv(TH_UV_SHADOW, gb->color_uv_shadow); - gb->sizePixel = U.pixelsize; - gb->sizeObjectCenter = (UI_GetThemeValuef(TH_OBCENTER_DIA) + 1.0f) * U.pixelsize; - gb->sizeLightCenter = (UI_GetThemeValuef(TH_OBCENTER_DIA) + 1.5f) * U.pixelsize; - gb->sizeLightCircle = U.pixelsize * 9.0f; - gb->sizeLightCircleShadow = gb->sizeLightCircle + U.pixelsize * 3.0f; + gb->size_pixel = U.pixelsize; + gb->size_object_center = (UI_GetThemeValuef(TH_OBCENTER_DIA) + 1.0f) * U.pixelsize; + gb->size_light_center = (UI_GetThemeValuef(TH_OBCENTER_DIA) + 1.5f) * U.pixelsize; + gb->size_light_circle = U.pixelsize * 9.0f; + gb->size_light_circle_shadow = gb->size_light_circle + U.pixelsize * 3.0f; /* M_SQRT2 to be at least the same size of the old square */ - gb->sizeVertex = U.pixelsize * - (max_ff(1.0f, UI_GetThemeValuef(TH_VERTEX_SIZE) * (float)M_SQRT2 / 2.0f)); - gb->sizeVertexGpencil = U.pixelsize * UI_GetThemeValuef(TH_GP_VERTEX_SIZE); - gb->sizeFaceDot = U.pixelsize * UI_GetThemeValuef(TH_FACEDOT_SIZE); - gb->sizeEdge = U.pixelsize * (1.0f / 2.0f); /* TODO: Theme. */ - gb->sizeEdgeFix = U.pixelsize * (0.5f + 2.0f * (2.0f * (gb->sizeEdge * (float)M_SQRT1_2))); + gb->size_vertex = U.pixelsize * + (max_ff(1.0f, UI_GetThemeValuef(TH_VERTEX_SIZE) * (float)M_SQRT2 / 2.0f)); + gb->size_vertex_gpencil = U.pixelsize * UI_GetThemeValuef(TH_GP_VERTEX_SIZE); + gb->size_face_dot = U.pixelsize * UI_GetThemeValuef(TH_FACEDOT_SIZE); + gb->size_edge = U.pixelsize * (1.0f / 2.0f); /* TODO: Theme. */ + gb->size_edge_fix = U.pixelsize * (0.5f + 2.0f * (2.0f * (gb->size_edge * (float)M_SQRT1_2))); const float(*screen_vecs)[3] = (float(*)[3])DRW_viewport_screenvecs_get(); for (int i = 0; i < 2; i++) { - copy_v3_v3(gb->screenVecs[i], screen_vecs[i]); + copy_v3_v3(gb->screen_vecs[i], screen_vecs[i]); } - gb->pixelFac = *DRW_viewport_pixelsize_get(); + gb->pixel_fac = *DRW_viewport_pixelsize_get(); /* Deprecated, use drw_view.viewport_size instead */ - copy_v2_v2(&gb->sizeViewport[0], DRW_viewport_size_get()); - copy_v2_v2(&gb->sizeViewport[2], &gb->sizeViewport[0]); - invert_v2(&gb->sizeViewport[2]); + copy_v2_v2(&gb->size_viewport[0], DRW_viewport_size_get()); + copy_v2_v2(&gb->size_viewport[2], &gb->size_viewport[0]); + invert_v2(&gb->size_viewport[2]); /* Color management. */ { @@ -328,36 +329,36 @@ int DRW_object_wire_theme_get(Object *ob, ViewLayer *view_layer, float **r_color if (r_color != NULL) { if (UNLIKELY(ob->base_flag & BASE_FROM_SET)) { - *r_color = G_draw.block.colorWire; + *r_color = G_draw.block.color_wire; } else { switch (theme_id) { case TH_WIRE_EDIT: - *r_color = G_draw.block.colorWireEdit; + *r_color = G_draw.block.color_wire_edit; break; case TH_ACTIVE: - *r_color = G_draw.block.colorActive; + *r_color = G_draw.block.color_active; break; case TH_SELECT: - *r_color = G_draw.block.colorSelect; + *r_color = G_draw.block.color_select; break; case TH_TRANSFORM: - *r_color = G_draw.block.colorTransform; + *r_color = G_draw.block.color_transform; break; case TH_SPEAKER: - *r_color = G_draw.block.colorSpeaker; + *r_color = G_draw.block.color_speaker; break; case TH_CAMERA: - *r_color = G_draw.block.colorCamera; + *r_color = G_draw.block.color_camera; break; case TH_EMPTY: - *r_color = G_draw.block.colorEmpty; + *r_color = G_draw.block.color_empty; break; case TH_LIGHT: - *r_color = G_draw.block.colorLight; + *r_color = G_draw.block.color_light; break; default: - *r_color = G_draw.block.colorWire; + *r_color = G_draw.block.color_wire; break; } } diff --git a/source/blender/draw/intern/draw_common_shader_shared.h b/source/blender/draw/intern/draw_common_shader_shared.h index ecddddded78..52e0917ae5a 100644 --- a/source/blender/draw/intern/draw_common_shader_shared.h +++ b/source/blender/draw/intern/draw_common_shader_shared.h @@ -15,233 +15,233 @@ typedef struct GlobalsUboStorage GlobalsUboStorage; * have been merged into one engine, there is no reasons to keep these globals out of the overlay * engine. */ -#define UBO_FIRST_COLOR colorWire -#define UBO_LAST_COLOR colorUVShadow +#define UBO_FIRST_COLOR color_wire +#define UBO_LAST_COLOR color_uv_shadow /* Used as ubo but colors can be directly referenced as well */ /* NOTE: Also keep all color as vec4 and between #UBO_FIRST_COLOR and #UBO_LAST_COLOR. */ struct GlobalsUboStorage { /* UBOs data needs to be 16 byte aligned (size of vec4) */ - float4 colorWire; - float4 colorWireEdit; - float4 colorActive; - float4 colorSelect; - float4 colorLibrarySelect; - float4 colorLibrary; - float4 colorTransform; - float4 colorLight; - float4 colorSpeaker; - float4 colorCamera; - float4 colorCameraPath; - float4 colorEmpty; - float4 colorVertex; - float4 colorVertexSelect; - float4 colorVertexUnreferenced; - float4 colorVertexMissingData; - float4 colorEditMeshActive; - float4 colorEdgeSelect; - float4 colorEdgeSeam; - float4 colorEdgeSharp; - float4 colorEdgeCrease; - float4 colorEdgeBWeight; - float4 colorEdgeFaceSelect; - float4 colorEdgeFreestyle; - float4 colorFace; - float4 colorFaceSelect; - float4 colorFaceFreestyle; - float4 colorGpencilVertex; - float4 colorGpencilVertexSelect; - float4 colorNormal; - float4 colorVNormal; - float4 colorLNormal; - float4 colorFaceDot; - float4 colorSkinRoot; + float4 color_wire; + float4 color_wire_edit; + float4 color_active; + float4 color_select; + float4 color_library_select; + float4 color_library; + float4 color_transform; + float4 color_light; + float4 color_speaker; + float4 color_camera; + float4 color_camera_path; + float4 color_empty; + float4 color_vertex; + float4 color_vertex_select; + float4 color_vertex_unreferenced; + float4 color_vertex_missing_data; + float4 color_edit_mesh_active; + float4 color_edge_select; + float4 color_edge_seam; + float4 color_edge_sharp; + float4 color_edge_crease; + float4 color_edge_bweight; + float4 color_edge_face_select; + float4 color_edge_freestyle; + float4 color_face; + float4 color_face_select; + float4 color_face_freestyle; + float4 color_gpencil_vertex; + float4 color_gpencil_vertex_select; + float4 color_normal; + float4 color_vnormal; + float4 color_lnormal; + float4 color_facedot; + float4 color_skinroot; - float4 colorDeselect; - float4 colorOutline; - float4 colorLightNoAlpha; + float4 color_deselect; + float4 color_outline; + float4 color_light_no_alpha; - float4 colorBackground; - float4 colorBackgroundGradient; - float4 colorCheckerPrimary; - float4 colorCheckerSecondary; - float4 colorClippingBorder; - float4 colorEditMeshMiddle; + float4 color_background; + float4 color_background_gradient; + float4 color_checker_primary; + float4 color_checker_secondary; + float4 color_clipping_border; + float4 color_edit_mesh_middle; - float4 colorHandleFree; - float4 colorHandleAuto; - float4 colorHandleVect; - float4 colorHandleAlign; - float4 colorHandleAutoclamp; - float4 colorHandleSelFree; - float4 colorHandleSelAuto; - float4 colorHandleSelVect; - float4 colorHandleSelAlign; - float4 colorHandleSelAutoclamp; - float4 colorNurbUline; - float4 colorNurbVline; - float4 colorNurbSelUline; - float4 colorNurbSelVline; - float4 colorActiveSpline; + float4 color_handle_free; + float4 color_handle_auto; + float4 color_handle_vect; + float4 color_handle_align; + float4 color_handle_autoclamp; + float4 color_handle_sel_free; + float4 color_handle_sel_auto; + float4 color_handle_sel_vect; + float4 color_handle_sel_align; + float4 color_handle_sel_autoclamp; + float4 color_nurb_uline; + float4 color_nurb_vline; + float4 color_nurb_sel_uline; + float4 color_nurb_sel_vline; + float4 color_active_spline; - float4 colorBonePose; - float4 colorBonePoseActive; - float4 colorBonePoseActiveUnsel; - float4 colorBonePoseConstraint; - float4 colorBonePoseIK; - float4 colorBonePoseSplineIK; - float4 colorBonePoseTarget; - float4 colorBoneSolid; - float4 colorBoneLocked; - float4 colorBoneActive; - float4 colorBoneActiveUnsel; - float4 colorBoneSelect; - float4 colorBoneIKLine; - float4 colorBoneIKLineNoTarget; - float4 colorBoneIKLineSpline; + float4 color_bone_pose; + float4 color_bone_pose_active; + float4 color_bone_pose_active_unsel; + float4 color_bone_pose_constraint; + float4 color_bone_pose_ik; + float4 color_bone_pose_spline_ik; + float4 color_bone_pose_target; + float4 color_bone_solid; + float4 color_bone_locked; + float4 color_bone_active; + float4 color_bone_active_unsel; + float4 color_bone_select; + float4 color_bone_ik_line; + float4 color_bone_ik_line_no_target; + float4 color_bone_ik_line_spline; - float4 colorText; - float4 colorTextHi; + float4 color_text; + float4 color_text_hi; - float4 colorBundleSolid; + float4 color_bundle_solid; - float4 colorMballRadius; - float4 colorMballRadiusSelect; - float4 colorMballStiffness; - float4 colorMballStiffnessSelect; + float4 color_mball_radius; + float4 color_mball_radius_select; + float4 color_mball_stiffness; + float4 color_mball_stiffness_select; - float4 colorCurrentFrame; + float4 color_current_frame; - float4 colorGrid; - float4 colorGridEmphasis; - float4 colorGridAxisX; - float4 colorGridAxisY; - float4 colorGridAxisZ; + float4 color_grid; + float4 color_grid_emphasis; + float4 color_grid_axis_x; + float4 color_grid_axis_y; + float4 color_grid_axis_z; - float4 colorFaceBack; - float4 colorFaceFront; + float4 color_face_back; + float4 color_face_front; - float4 colorUVShadow; + float4 color_uv_shadow; /* NOTE: Put all color before #UBO_LAST_COLOR. */ - float4 screenVecs[2]; /* Padded as vec4. */ - float4 sizeViewport; /* Packed as vec4. */ + float4 screen_vecs[2]; /* Padded as vec4. */ + float4 size_viewport; /* Packed as vec4. */ /* Pack individual float at the end of the buffer to avoid alignment errors */ - float sizePixel, pixelFac; - float sizeObjectCenter, sizeLightCenter, sizeLightCircle, sizeLightCircleShadow; - float sizeVertex, sizeEdge, sizeEdgeFix, sizeFaceDot; - float sizeChecker; - float sizeVertexGpencil; + float size_pixel, pixel_fac; + float size_object_center, size_light_center, size_light_circle, size_light_circle_shadow; + float size_vertex, size_edge, size_edge_fix, size_face_dot; + float size_checker; + float size_vertex_gpencil; }; BLI_STATIC_ASSERT_ALIGN(GlobalsUboStorage, 16) #ifdef GPU_SHADER /* Keep compatibility_with old global scope syntax. */ /* TODO(@fclem) Mass rename and remove the camel case. */ -# define colorWire globalsBlock.colorWire -# define colorWireEdit globalsBlock.colorWireEdit -# define colorActive globalsBlock.colorActive -# define colorSelect globalsBlock.colorSelect -# define colorLibrarySelect globalsBlock.colorLibrarySelect -# define colorLibrary globalsBlock.colorLibrary -# define colorTransform globalsBlock.colorTransform -# define colorLight globalsBlock.colorLight -# define colorSpeaker globalsBlock.colorSpeaker -# define colorCamera globalsBlock.colorCamera -# define colorCameraPath globalsBlock.colorCameraPath -# define colorEmpty globalsBlock.colorEmpty -# define colorVertex globalsBlock.colorVertex -# define colorVertexSelect globalsBlock.colorVertexSelect -# define colorVertexUnreferenced globalsBlock.colorVertexUnreferenced -# define colorVertexMissingData globalsBlock.colorVertexMissingData -# define colorEditMeshActive globalsBlock.colorEditMeshActive -# define colorEdgeSelect globalsBlock.colorEdgeSelect -# define colorEdgeSeam globalsBlock.colorEdgeSeam -# define colorEdgeSharp globalsBlock.colorEdgeSharp -# define colorEdgeCrease globalsBlock.colorEdgeCrease -# define colorEdgeBWeight globalsBlock.colorEdgeBWeight -# define colorEdgeFaceSelect globalsBlock.colorEdgeFaceSelect -# define colorEdgeFreestyle globalsBlock.colorEdgeFreestyle -# define colorFace globalsBlock.colorFace -# define colorFaceSelect globalsBlock.colorFaceSelect -# define colorFaceFreestyle globalsBlock.colorFaceFreestyle -# define colorGpencilVertex globalsBlock.colorGpencilVertex -# define colorGpencilVertexSelect globalsBlock.colorGpencilVertexSelect -# define colorNormal globalsBlock.colorNormal -# define colorVNormal globalsBlock.colorVNormal -# define colorLNormal globalsBlock.colorLNormal -# define colorFaceDot globalsBlock.colorFaceDot -# define colorSkinRoot globalsBlock.colorSkinRoot -# define colorDeselect globalsBlock.colorDeselect -# define colorOutline globalsBlock.colorOutline -# define colorLightNoAlpha globalsBlock.colorLightNoAlpha -# define colorBackground globalsBlock.colorBackground -# define colorBackgroundGradient globalsBlock.colorBackgroundGradient -# define colorCheckerPrimary globalsBlock.colorCheckerPrimary -# define colorCheckerSecondary globalsBlock.colorCheckerSecondary -# define colorClippingBorder globalsBlock.colorClippingBorder -# define colorEditMeshMiddle globalsBlock.colorEditMeshMiddle -# define colorHandleFree globalsBlock.colorHandleFree -# define colorHandleAuto globalsBlock.colorHandleAuto -# define colorHandleVect globalsBlock.colorHandleVect -# define colorHandleAlign globalsBlock.colorHandleAlign -# define colorHandleAutoclamp globalsBlock.colorHandleAutoclamp -# define colorHandleSelFree globalsBlock.colorHandleSelFree -# define colorHandleSelAuto globalsBlock.colorHandleSelAuto -# define colorHandleSelVect globalsBlock.colorHandleSelVect -# define colorHandleSelAlign globalsBlock.colorHandleSelAlign -# define colorHandleSelAutoclamp globalsBlock.colorHandleSelAutoclamp -# define colorNurbUline globalsBlock.colorNurbUline -# define colorNurbVline globalsBlock.colorNurbVline -# define colorNurbSelUline globalsBlock.colorNurbSelUline -# define colorNurbSelVline globalsBlock.colorNurbSelVline -# define colorActiveSpline globalsBlock.colorActiveSpline -# define colorBonePose globalsBlock.colorBonePose -# define colorBonePoseActive globalsBlock.colorBonePoseActive -# define colorBonePoseActiveUnsel globalsBlock.colorBonePoseActiveUnsel -# define colorBonePoseConstraint globalsBlock.colorBonePoseConstraint -# define colorBonePoseIK globalsBlock.colorBonePoseIK -# define colorBonePoseSplineIK globalsBlock.colorBonePoseSplineIK -# define colorBonePoseTarget globalsBlock.colorBonePoseTarget -# define colorBoneSolid globalsBlock.colorBoneSolid -# define colorBoneLocked globalsBlock.colorBoneLocked -# define colorBoneActive globalsBlock.colorBoneActive -# define colorBoneActiveUnsel globalsBlock.colorBoneActiveUnsel -# define colorBoneSelect globalsBlock.colorBoneSelect -# define colorBoneIKLine globalsBlock.colorBoneIKLine -# define colorBoneIKLineNoTarget globalsBlock.colorBoneIKLineNoTarget -# define colorBoneIKLineSpline globalsBlock.colorBoneIKLineSpline -# define colorText globalsBlock.colorText -# define colorTextHi globalsBlock.colorTextHi -# define colorBundleSolid globalsBlock.colorBundleSolid -# define colorMballRadius globalsBlock.colorMballRadius -# define colorMballRadiusSelect globalsBlock.colorMballRadiusSelect -# define colorMballStiffness globalsBlock.colorMballStiffness -# define colorMballStiffnessSelect globalsBlock.colorMballStiffnessSelect -# define colorCurrentFrame globalsBlock.colorCurrentFrame -# define colorGrid globalsBlock.colorGrid -# define colorGridEmphasis globalsBlock.colorGridEmphasis -# define colorGridAxisX globalsBlock.colorGridAxisX -# define colorGridAxisY globalsBlock.colorGridAxisY -# define colorGridAxisZ globalsBlock.colorGridAxisZ -# define colorFaceBack globalsBlock.colorFaceBack -# define colorFaceFront globalsBlock.colorFaceFront -# define colorUVShadow globalsBlock.colorUVShadow -# define screenVecs globalsBlock.screenVecs -# define sizeViewport globalsBlock.sizeViewport.xy -# define sizePixel globalsBlock.sizePixel -# define pixelFac globalsBlock.pixelFac -# define sizeObjectCenter globalsBlock.sizeObjectCenter -# define sizeLightCenter globalsBlock.sizeLightCenter -# define sizeLightCircle globalsBlock.sizeLightCircle -# define sizeLightCircleShadow globalsBlock.sizeLightCircleShadow -# define sizeVertex globalsBlock.sizeVertex -# define sizeEdge globalsBlock.sizeEdge -# define sizeEdgeFix globalsBlock.sizeEdgeFix -# define sizeFaceDot globalsBlock.sizeFaceDot -# define sizeChecker globalsBlock.sizeChecker -# define sizeVertexGpencil globalsBlock.sizeVertexGpencil +# define colorWire globalsBlock.color_wire +# define colorWireEdit globalsBlock.color_wire_edit +# define colorActive globalsBlock.color_active +# define colorSelect globalsBlock.color_select +# define colorLibrarySelect globalsBlock.color_library_select +# define colorLibrary globalsBlock.color_library +# define colorTransform globalsBlock.color_transform +# define colorLight globalsBlock.color_light +# define colorSpeaker globalsBlock.color_speaker +# define colorCamera globalsBlock.color_camera +# define colorCameraPath globalsBlock.color_camera_path +# define colorEmpty globalsBlock.color_empty +# define colorVertex globalsBlock.color_vertex +# define colorVertexSelect globalsBlock.color_vertex_select +# define colorVertexUnreferenced globalsBlock.color_vertex_unreferenced +# define colorVertexMissingData globalsBlock.color_vertex_missing_data +# define colorEditMeshActive globalsBlock.color_edit_mesh_active +# define colorEdgeSelect globalsBlock.color_edge_select +# define colorEdgeSeam globalsBlock.color_edge_seam +# define colorEdgeSharp globalsBlock.color_edge_sharp +# define colorEdgeCrease globalsBlock.color_edge_crease +# define colorEdgeBWeight globalsBlock.color_edge_bweight +# define colorEdgeFaceSelect globalsBlock.color_edge_face_select +# define colorEdgeFreestyle globalsBlock.color_edge_freestyle +# define colorFace globalsBlock.color_face +# define colorFaceSelect globalsBlock.color_face_select +# define colorFaceFreestyle globalsBlock.color_face_freestyle +# define colorGpencilVertex globalsBlock.color_gpencil_vertex +# define colorGpencilVertexSelect globalsBlock.color_gpencil_vertex_select +# define colorNormal globalsBlock.color_normal +# define colorVNormal globalsBlock.color_vnormal +# define colorLNormal globalsBlock.color_lnormal +# define colorFaceDot globalsBlock.color_face_dot +# define colorSkinRoot globalsBlock.color_skin_root +# define colorDeselect globalsBlock.color_deselect +# define colorOutline globalsBlock.color_outline +# define colorLightNoAlpha globalsBlock.color_light_no_alpha +# define colorBackground globalsBlock.color_background +# define colorBackgroundGradient globalsBlock.color_background_gradient +# define colorCheckerPrimary globalsBlock.color_checker_primary +# define colorCheckerSecondary globalsBlock.color_checker_secondary +# define colorClippingBorder globalsBlock.color_clipping_border +# define colorEditMeshMiddle globalsBlock.color_edit_mesh_middle +# define colorHandleFree globalsBlock.color_handle_free +# define colorHandleAuto globalsBlock.color_handle_auto +# define colorHandleVect globalsBlock.color_handle_vect +# define colorHandleAlign globalsBlock.color_handle_align +# define colorHandleAutoclamp globalsBlock.color_handle_autoclamp +# define colorHandleSelFree globalsBlock.color_handle_sel_free +# define colorHandleSelAuto globalsBlock.color_handle_sel_auto +# define colorHandleSelVect globalsBlock.color_handle_sel_vect +# define colorHandleSelAlign globalsBlock.color_handle_sel_align +# define colorHandleSelAutoclamp globalsBlock.color_handle_sel_autoclamp +# define colorNurbUline globalsBlock.color_nurb_uline +# define colorNurbVline globalsBlock.color_nurb_vline +# define colorNurbSelUline globalsBlock.color_nurb_sel_uline +# define colorNurbSelVline globalsBlock.color_nurb_sel_vline +# define colorActiveSpline globalsBlock.color_active_spline +# define colorBonePose globalsBlock.color_bone_pose +# define colorBonePoseActive globalsBlock.color_bone_pose_active +# define colorBonePoseActiveUnsel globalsBlock.color_bone_pose_active_unsel +# define colorBonePoseConstraint globalsBlock.color_bone_pose_constraint +# define colorBonePoseIK globalsBlock.color_bone_pose_ik +# define colorBonePoseSplineIK globalsBlock.color_bone_pose_spline_ik +# define colorBonePoseTarget globalsBlock.color_bone_pose_target +# define colorBoneSolid globalsBlock.color_bone_solid +# define colorBoneLocked globalsBlock.color_bone_locked +# define colorBoneActive globalsBlock.color_bone_active +# define colorBoneActiveUnsel globalsBlock.color_bone_active_unsel +# define colorBoneSelect globalsBlock.color_bone_select +# define colorBoneIKLine globalsBlock.color_bone_ik_line +# define colorBoneIKLineNoTarget globalsBlock.color_bone_ik_line_no_target +# define colorBoneIKLineSpline globalsBlock.color_bone_ik_line_spline +# define colorText globalsBlock.color_text +# define colorTextHi globalsBlock.color_text_hi +# define colorBundleSolid globalsBlock.color_bundle_solid +# define colorMballRadius globalsBlock.color_mball_radius +# define colorMballRadiusSelect globalsBlock.color_mball_radius_select +# define colorMballStiffness globalsBlock.color_mball_stiffness +# define colorMballStiffnessSelect globalsBlock.color_mball_stiffness_select +# define colorCurrentFrame globalsBlock.color_current_frame +# define colorGrid globalsBlock.color_grid +# define colorGridEmphasis globalsBlock.color_grid_emphasis +# define colorGridAxisX globalsBlock.color_grid_axis_x +# define colorGridAxisY globalsBlock.color_grid_axis_y +# define colorGridAxisZ globalsBlock.color_grid_axis_z +# define colorFaceBack globalsBlock.color_face_back +# define colorFaceFront globalsBlock.color_face_front +# define colorUVShadow globalsBlock.color_uv_shadow +# define screenVecs globalsBlock.screen_vecs +# define sizeViewport globalsBlock.size_viewport.xy +# define sizePixel globalsBlock.size_pixel +# define pixelFac globalsBlock.pixel_fac +# define sizeObjectCenter globalsBlock.size_object_center +# define sizeLightCenter globalsBlock.size_light_center +# define sizeLightCircle globalsBlock.size_light_circle +# define sizeLightCircleShadow globalsBlock.size_light_circle_shadow +# define sizeVertex globalsBlock.size_vertex +# define sizeEdge globalsBlock.size_edge +# define sizeEdgeFix globalsBlock.size_edge_fix +# define sizeFaceDot globalsBlock.size_face_dot +# define sizeChecker globalsBlock.size_checker +# define sizeVertexGpencil globalsBlock.size_vertex_gpencil #endif /* See: 'draw_cache_impl.h' for matching includes. */ |