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 43 Lines • ▼ Show 20 Lines | static void init_vcol_format(GPUVertFormat *format, | ||||
| const uint32_t vcol_layers = cache->cd_used.vcol; | const uint32_t vcol_layers = cache->cd_used.vcol; | ||||
| for (int i = 0; i < MAX_MCOL; i++) { | for (int i = 0; i < MAX_MCOL; i++) { | ||||
| if (vcol_layers & (1 << i)) { | if (vcol_layers & (1 << i)) { | ||||
| char attr_name[32], attr_safe_name[GPU_MAX_SAFE_ATTR_NAME]; | char attr_name[32], attr_safe_name[GPU_MAX_SAFE_ATTR_NAME]; | ||||
| const char *layer_name = CustomData_get_layer_name(cd_ldata, CD_MLOOPCOL, i); | const char *layer_name = CustomData_get_layer_name(cd_ldata, CD_MLOOPCOL, i); | ||||
| GPU_vertformat_safe_attr_name(layer_name, attr_safe_name, GPU_MAX_SAFE_ATTR_NAME); | GPU_vertformat_safe_attr_name(layer_name, attr_safe_name, GPU_MAX_SAFE_ATTR_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); | ||||
| if (i == CustomData_get_render_layer(cd_ldata, CD_MLOOPCOL)) { | if (i == CustomData_get_render_layer(cd_ldata, CD_MLOOPCOL)) { | ||||
| GPU_vertformat_alias_add(format, "c"); | GPU_vertformat_alias_add(format, "c"); | ||||
| } | } | ||||
| if (i == CustomData_get_active_layer(cd_ldata, CD_MLOOPCOL)) { | if (i == CustomData_get_active_layer(cd_ldata, CD_MLOOPCOL)) { | ||||
| GPU_vertformat_alias_add(format, "ac"); | GPU_vertformat_alias_add(format, "ac"); | ||||
| } | } | ||||
| /* Gather number of auto layers. */ | |||||
| /* We only do `vcols` that are not overridden by `uvs`. */ | |||||
| if (CustomData_get_named_layer_index(cd_ldata, CD_MLOOPUV, layer_name) == -1) { | |||||
| 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() | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 133 Lines • Show Last 20 Lines | |||||