Changeset View
Standalone View
source/blender/draw/intern/draw_pbvh.cc
| Show First 20 Lines • Show All 715 Lines • ▼ Show 20 Lines | switch (vbo.type) { | ||||
| color[1] = unit_float_to_ushort_clamp(BLI_color_from_srgb_table[col->g]); | color[1] = unit_float_to_ushort_clamp(BLI_color_from_srgb_table[col->g]); | ||||
| color[2] = unit_float_to_ushort_clamp(BLI_color_from_srgb_table[col->b]); | color[2] = unit_float_to_ushort_clamp(BLI_color_from_srgb_table[col->b]); | ||||
| color[3] = col->a * 257; | color[3] = col->a * 257; | ||||
| *static_cast<ushort4 *>(GPU_vertbuf_raw_step(&access)) = color; | *static_cast<ushort4 *>(GPU_vertbuf_raw_step(&access)) = color; | ||||
| }); | }); | ||||
| } | } | ||||
| break; | break; | ||||
| case CD_PROP_FLOAT2: { | |||||
| float2 *mloopuv = static_cast<float2 *>( | |||||
| CustomData_get_layer_named(args->ldata, CD_PROP_FLOAT2, vbo.name.c_str())); | |||||
| foreach_faces([&](int /*buffer_i*/, int tri_i, int /*vertex_i*/, const MLoopTri *tri) { | |||||
| *static_cast<float2 *>(GPU_vertbuf_raw_step(&access)) = mloopuv[tri->tri[tri_i]]; | |||||
| }); | |||||
| break; | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| void gpu_flush() | void gpu_flush() | ||||
| { | { | ||||
| for (PBVHVbo &vbo : vbos) { | for (PBVHVbo &vbo : vbos) { | ||||
| if (vbo.vert_buf && GPU_vertbuf_get_data(vbo.vert_buf)) { | if (vbo.vert_buf && GPU_vertbuf_get_data(vbo.vert_buf)) { | ||||
| GPU_vertbuf_use(vbo.vert_buf); | GPU_vertbuf_use(vbo.vert_buf); | ||||
| ▲ Show 20 Lines • Show All 131 Lines • ▼ Show 20 Lines | switch (type) { | ||||
| break; | break; | ||||
| case CD_PROP_FLOAT3: | case CD_PROP_FLOAT3: | ||||
| GPU_vertformat_attr_add(&format, "a", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); | GPU_vertformat_attr_add(&format, "a", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); | ||||
| need_aliases = true; | need_aliases = true; | ||||
| break; | break; | ||||
| case CD_PBVH_NO_TYPE: | case CD_PBVH_NO_TYPE: | ||||
| GPU_vertformat_attr_add(&format, "nor", GPU_COMP_I16, 3, GPU_FETCH_INT_TO_FLOAT_UNIT); | GPU_vertformat_attr_add(&format, "nor", GPU_COMP_I16, 3, GPU_FETCH_INT_TO_FLOAT_UNIT); | ||||
| break; | break; | ||||
| case CD_PROP_FLOAT2: | case CD_PROP_FLOAT2: | ||||
| GPU_vertformat_attr_add(&format, "a", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | GPU_vertformat_attr_add(&format, "a", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | ||||
Baardaap: I'm actually not sure what is better. For consistency rename this one to "uvs" , or everywhere… | |||||
Not Done Inline ActionsIMO "a" is incorrect and should be "au", although not really used. This change also doesn't do anything so perhaps we should not do it in this change. Would use au abbreviation for active uv. I didn't see an effect, but to keep it consistent. Note that some areas actually use "uvs" but that tells more about its data format, and less about it usage. Will check with our @Joseph Eagar (joeedh) if it makes sense to change this. jbakker: IMO "a" is incorrect and should be "au", although not really used. This change also doesn't do… | |||||
Done Inline ActionsMaking that a separate patch is better. I'll remove the "a" -> "uvs" renaming from this patch.
the "au" for 'active uv' is added to the list of aliases a bit below, though, sothat's already there. The "a" is used on all "generic attribute" types (i.e. CD_PROP* ). I think the whole change is unnecessary now that I've slept on it. I don't think the "uvs" name is used on the GPU side at all. extract_mesh_vbo_uv.cc doesn't use it at all I think. Baardaap: Making that a separate patch is better.
I'll remove the "a" -> "uvs" renaming from this… | |||||
| need_aliases = true; | need_aliases = true; | ||||
| break; | break; | ||||
| case CD_PBVH_FSET_TYPE: | case CD_PBVH_FSET_TYPE: | ||||
| GPU_vertformat_attr_add(&format, "fset", GPU_COMP_U8, 3, GPU_FETCH_INT_TO_FLOAT_UNIT); | GPU_vertformat_attr_add(&format, "fset", GPU_COMP_U8, 3, GPU_FETCH_INT_TO_FLOAT_UNIT); | ||||
| break; | break; | ||||
| case CD_PBVH_MASK_TYPE: | case CD_PBVH_MASK_TYPE: | ||||
| GPU_vertformat_attr_add(&format, "msk", GPU_COMP_U8, 1, GPU_FETCH_INT_TO_FLOAT_UNIT); | GPU_vertformat_attr_add(&format, "msk", GPU_COMP_U8, 1, GPU_FETCH_INT_TO_FLOAT_UNIT); | ||||
| break; | break; | ||||
| ▲ Show 20 Lines • Show All 489 Lines • Show Last 20 Lines | |||||
I'm actually not sure what is better. For consistency rename this one to "uvs" , or everywhere CD_PROP_FLOAT2 it uploaded to the gpu change it to "a", which is more correct in a way (It is a general purpose attribute now, after all.)