diff options
Diffstat (limited to 'source/blender/draw/intern/mesh_extractors')
5 files changed, 21 insertions, 18 deletions
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh.h b/source/blender/draw/intern/mesh_extractors/extract_mesh.h index bb55d0c5b2c..37eb4f80442 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh.h +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh.h @@ -281,7 +281,8 @@ typedef struct MeshExtract { * \param is_mode_active: When true, use the modifiers from the edit-data, * otherwise don't use modifiers as they are not from this object. */ -MeshRenderData *mesh_render_data_create(Mesh *me, +MeshRenderData *mesh_render_data_create(Object *object, + Mesh *me, bool is_editmode, bool is_paint_mode, bool is_mode_active, diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_points.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_points.cc index 3ea3e67a8da..c3f89ab96ee 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_points.cc +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_points.cc @@ -157,7 +157,7 @@ static void extract_points_finish(const MeshRenderData *UNUSED(mr), } static void extract_points_init_subdiv(const DRWSubdivCache *subdiv_cache, - const MeshRenderData *UNUSED(mr), + const MeshRenderData *mr, struct MeshBatchCache *UNUSED(cache), void *UNUSED(buffer), void *data) @@ -165,9 +165,9 @@ static void extract_points_init_subdiv(const DRWSubdivCache *subdiv_cache, GPUIndexBufBuilder *elb = static_cast<GPUIndexBufBuilder *>(data); /* Copy the points as the data upload will free them. */ elb->data = (uint *)MEM_dupallocN(subdiv_cache->point_indices); - elb->index_len = subdiv_cache->num_subdiv_verts; + elb->index_len = mr->vert_len; elb->index_min = 0; - elb->index_max = subdiv_cache->num_subdiv_loops - 1; + elb->index_max = subdiv_cache->num_subdiv_loops + mr->loop_loose_len; elb->prim_type = GPU_PRIM_POINTS; } @@ -184,9 +184,6 @@ static void extract_points_loose_geom_subdiv(const DRWSubdivCache *subdiv_cache, GPUIndexBufBuilder *elb = static_cast<GPUIndexBufBuilder *>(data); - elb->data = static_cast<uint32_t *>( - MEM_reallocN(elb->data, sizeof(uint) * (subdiv_cache->num_subdiv_loops + loop_loose_len))); - const Mesh *coarse_mesh = subdiv_cache->mesh; const MEdge *coarse_edges = coarse_mesh->medge; @@ -195,22 +192,18 @@ static void extract_points_loose_geom_subdiv(const DRWSubdivCache *subdiv_cache, for (int i = 0; i < loose_geom->edge_len; i++) { const MEdge *loose_edge = &coarse_edges[loose_geom->edges[i]]; if (elb->data[loose_edge->v1] == -1u) { - elb->data[loose_edge->v1] = offset; + GPU_indexbuf_set_point_vert(elb, loose_edge->v1, offset); } if (elb->data[loose_edge->v2] == -1u) { - elb->data[loose_edge->v2] = offset + 1; + GPU_indexbuf_set_point_vert(elb, loose_edge->v2, offset + 1); } - elb->index_max += 2; - elb->index_len += 2; offset += 2; } for (int i = 0; i < loose_geom->vert_len; i++) { if (elb->data[loose_geom->verts[i]] == -1u) { - elb->data[loose_geom->verts[i]] = offset; + GPU_indexbuf_set_point_vert(elb, loose_geom->verts[i], offset); } - elb->index_max += 1; - elb->index_len += 1; offset += 1; } } diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_attributes.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_attributes.cc index b846da3f016..b27633405b9 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_attributes.cc +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_attributes.cc @@ -99,9 +99,10 @@ static uint gpu_component_size_for_attribute_type(CustomDataType type) { switch (type) { case CD_PROP_BOOL: + case CD_PROP_INT8: case CD_PROP_INT32: case CD_PROP_FLOAT: { - /* TODO(kevindietrich) : should be 1 when scalar attributes conversion is handled by us. See + /* TODO(@kevindietrich): should be 1 when scalar attributes conversion is handled by us. See * comment #extract_attr_init. */ return 3; } @@ -317,7 +318,7 @@ static void extract_attr_init(const MeshRenderData *mr, init_vbo_for_attribute(mr, vbo, request, false, static_cast<uint32_t>(mr->loop_len)); - /* TODO(kevindietrich) : float3 is used for scalar attributes as the implicit conversion done by + /* TODO(@kevindietrich): float3 is used for scalar attributes as the implicit conversion done by * OpenGL to vec4 for a scalar `s` will produce a `vec4(s, 0, 0, 1)`. However, following the * Blender convention, it should be `vec4(s, s, s, 1)`. This could be resolved using a similar * texture as for volume attribute, so we can control the conversion ourselves. */ @@ -326,6 +327,10 @@ static void extract_attr_init(const MeshRenderData *mr, extract_attr_generic<bool, float3>(mr, vbo, request); break; } + case CD_PROP_INT8: { + extract_attr_generic<int8_t, float3>(mr, vbo, request); + break; + } case CD_PROP_INT32: { extract_attr_generic<int32_t, float3>(mr, vbo, request); break; @@ -378,6 +383,10 @@ static void extract_attr_init_subdiv(const DRWSubdivCache *subdiv_cache, extract_attr_generic<bool, float3>(mr, src_data, request); break; } + case CD_PROP_INT8: { + extract_attr_generic<int8_t, float3>(mr, src_data, request); + break; + } case CD_PROP_INT32: { extract_attr_generic<int32_t, float3>(mr, src_data, request); break; diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edge_fac.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edge_fac.cc index 8470a71059f..4185f2f84a2 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edge_fac.cc +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edge_fac.cc @@ -78,7 +78,7 @@ static void extract_edge_fac_init(const MeshRenderData *mr, data->edge_loop_count = static_cast<uchar *>( MEM_callocN(sizeof(uint32_t) * mr->edge_len, __func__)); - /* HACK(fclem) Detecting the need for edge render. + /* HACK(@fclem): Detecting the need for edge render. * We could have a flag in the mesh instead or check the modifier stack. */ const MEdge *med = mr->medge; for (int e_index = 0; e_index < mr->edge_len; e_index++, med++) { diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_pos_nor.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_pos_nor.cc index 5d2ea923658..11f1515275c 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_pos_nor.cc +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_pos_nor.cc @@ -270,7 +270,7 @@ static void extract_pos_nor_loose_geom_subdiv(const DRWSubdivCache *subdiv_cache const MVert *coarse_verts = coarse_mesh->mvert; uint offset = subdiv_cache->num_subdiv_loops; - /* TODO(kevindietrich) : replace this when compressed normals are supported. */ + /* TODO(@kevindietrich): replace this when compressed normals are supported. */ struct SubdivPosNorLoop { float pos[3]; float nor[3]; |