Changeset View
Standalone View
source/blender/blenkernel/intern/pbvh_pixels.cc
| Show First 20 Lines • Show All 141 Lines • ▼ Show 20 Lines | struct UVPrimitiveLookup { | ||||
| } | } | ||||
| }; | }; | ||||
| struct EncodePixelsUserData { | struct EncodePixelsUserData { | ||||
| Image *image; | Image *image; | ||||
| ImageUser *image_user; | ImageUser *image_user; | ||||
| PBVH *pbvh; | PBVH *pbvh; | ||||
| Vector<PBVHNode *> *nodes; | Vector<PBVHNode *> *nodes; | ||||
| const MLoopUV *ldata_uv; | const float2 *ldata_uv; | ||||
| const uv_islands::UVIslandsMask *uv_masks; | const uv_islands::UVIslandsMask *uv_masks; | ||||
| /** Lookup to retrieve the UV primitives based on the primitive index. */ | /** Lookup to retrieve the UV primitives based on the primitive index. */ | ||||
| const UVPrimitiveLookup *uv_primitive_lookup; | const UVPrimitiveLookup *uv_primitive_lookup; | ||||
jbakker: Why not use float2 here. Much more readable. | |||||
Done Inline ActionsI *think* float2 is only defined in source/blender/gpu/GPU_shader_shared_utils.h whete it is defined as a vec2 vec2 is C++ only. this particular file happens to be C++, so I *could* use float2 here. I just chose to do it consistently everywhere for my own sanity. I could pass over all C++ files and switch those to float2. Or better yet, we should have a C compatible float2 so I could use it everywhere! Baardaap: I *think* float2 is only defined in source/blender/gpu/GPU_shader_shared_utils.h whete it is… | |||||
Done Inline ActionsCheck BLI_math_vec_types.hh for where it is defined. jbakker: Check `BLI_math_vec_types.hh` for where it is defined. | |||||
Done Inline ActionsThat's a C++ header. So my point still stands. the float2 type can only be used in C++ code. This particular file is C++, but the same change happens in lots of places and not all of them are C++. When the patch is functionally correct I can go over all C++ files to move to float2 in those. For now I prefer to keep the code the same in C/C++ files. Baardaap: That's a C++ header. So my point still stands. the float2 type can only be used in C++ code. | |||||
| }; | }; | ||||
| static void do_encode_pixels(void *__restrict userdata, | static void do_encode_pixels(void *__restrict userdata, | ||||
| const int n, | const int n, | ||||
| const TaskParallelTLS *__restrict /*tls*/) | const TaskParallelTLS *__restrict /*tls*/) | ||||
| { | { | ||||
| EncodePixelsUserData *data = static_cast<EncodePixelsUserData *>(userdata); | EncodePixelsUserData *data = static_cast<EncodePixelsUserData *>(userdata); | ||||
| Image *image = data->image; | Image *image = data->image; | ||||
| ▲ Show 20 Lines • Show All 188 Lines • ▼ Show 20 Lines | |||||
| static void update_pixels(PBVH *pbvh, Mesh *mesh, Image *image, ImageUser *image_user) | static void update_pixels(PBVH *pbvh, Mesh *mesh, Image *image, ImageUser *image_user) | ||||
| { | { | ||||
| Vector<PBVHNode *> nodes_to_update; | Vector<PBVHNode *> nodes_to_update; | ||||
| if (!find_nodes_to_update(pbvh, nodes_to_update)) { | if (!find_nodes_to_update(pbvh, nodes_to_update)) { | ||||
| return; | return; | ||||
| } | } | ||||
| const MLoopUV *ldata_uv = static_cast<const MLoopUV *>( | const float2 *ldata_uv = static_cast<const float2 *>( | ||||
| CustomData_get_layer(&mesh->ldata, CD_MLOOPUV)); | CustomData_get_layer(&mesh->ldata, CD_PROP_FLOAT2)); | ||||
| if (ldata_uv == nullptr) { | if (ldata_uv == nullptr) { | ||||
| return; | return; | ||||
| } | } | ||||
| uv_islands::MeshData mesh_data({pbvh->looptri, pbvh->totprim}, | uv_islands::MeshData mesh_data({pbvh->looptri, pbvh->totprim}, | ||||
| {pbvh->mloop, mesh->totloop}, | {pbvh->mloop, mesh->totloop}, | ||||
| pbvh->totvert, | pbvh->totvert, | ||||
| {ldata_uv, mesh->totloop}); | {ldata_uv, mesh->totloop}); | ||||
| ▲ Show 20 Lines • Show All 138 Lines • Show Last 20 Lines | |||||
Why not use float2 here. Much more readable.