Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_vcol.cc
| Show First 20 Lines • Show All 84 Lines • ▼ Show 20 Lines | static void init_vcol_format(GPUVertFormat *format, | ||||
| blender::Vector<VColRef> refs = get_vcol_refs(cd_vdata, cd_ldata, vcol_layers); | blender::Vector<VColRef> refs = get_vcol_refs(cd_vdata, cd_ldata, vcol_layers); | ||||
| for (const VColRef &ref : refs) { | for (const VColRef &ref : refs) { | ||||
| char attr_name[32], attr_safe_name[GPU_MAX_SAFE_ATTR_NAME]; | char attr_name[32], attr_safe_name[GPU_MAX_SAFE_ATTR_NAME]; | ||||
| GPU_vertformat_safe_attr_name(ref.layer->name, attr_safe_name, GPU_MAX_SAFE_ATTR_NAME); | GPU_vertformat_safe_attr_name(ref.layer->name, attr_safe_name, GPU_MAX_SAFE_ATTR_NAME); | ||||
| /* VCol layer name. */ | /* VCol layer name. */ | ||||
| BLI_snprintf(attr_name, sizeof(attr_name), "c%s", attr_safe_name); | BLI_snprintf(attr_name, sizeof(attr_name), "a%s", attr_safe_name); | ||||
| GPU_vertformat_attr_add(format, attr_name, GPU_COMP_U16, 4, GPU_FETCH_INT_TO_FLOAT_UNIT); | GPU_vertformat_attr_add(format, attr_name, GPU_COMP_U16, 4, GPU_FETCH_INT_TO_FLOAT_UNIT); | ||||
| /* Active layer name. */ | /* Active layer name. */ | ||||
| if (ref.layer == active) { | if (ref.layer == active) { | ||||
| GPU_vertformat_alias_add(format, "ac"); | GPU_vertformat_alias_add(format, "ac"); | ||||
| } | } | ||||
| /* Active render layer name. */ | /* Active render layer name. */ | ||||
| if (ref.layer == render) { | if (ref.layer == render) { | ||||
| GPU_vertformat_alias_add(format, "c"); | GPU_vertformat_alias_add(format, "c"); | ||||
| } | } | ||||
| /* Gather number of auto layers. */ | |||||
| /* We only do `vcols` that are not overridden by `uvs`. */ | |||||
| bool bad = ref.domain == ATTR_DOMAIN_CORNER; | |||||
| bad = bad && CustomData_get_named_layer_index(cd_ldata, CD_MLOOPUV, ref.layer->name) != -1; | |||||
| if (!bad) { | |||||
| BLI_snprintf(attr_name, sizeof(attr_name), "a%s", attr_safe_name); | |||||
| GPU_vertformat_alias_add(format, attr_name); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| /* Vertex format for vertex colors, only used during the coarse data upload for the subdivision | /* Vertex format for vertex colors, only used during the coarse data upload for the subdivision | ||||
| * case. */ | * case. */ | ||||
| static GPUVertFormat *get_coarse_vcol_format() | static GPUVertFormat *get_coarse_vcol_format() | ||||
| { | { | ||||
| static GPUVertFormat format = {0}; | static GPUVertFormat format = {0}; | ||||
| ▲ Show 20 Lines • Show All 272 Lines • Show Last 20 Lines | |||||