Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/intern/draw_cache_impl_mesh.cc
| Show First 20 Lines • Show All 246 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| static void mesh_cd_calc_active_uv_layer(const Object *object, | static void mesh_cd_calc_active_uv_layer(const Object *object, | ||||
| const Mesh *me, | const Mesh *me, | ||||
| DRW_MeshCDMask *cd_used) | DRW_MeshCDMask *cd_used) | ||||
| { | { | ||||
| const Mesh *me_final = editmesh_final_or_this(object, me); | const Mesh *me_final = editmesh_final_or_this(object, me); | ||||
| const CustomData *cd_ldata = mesh_cd_ldata_get_from_mesh(me_final); | const CustomData *cd_ldata = mesh_cd_ldata_get_from_mesh(me_final); | ||||
| int layer = CustomData_get_active_layer(cd_ldata, CD_MLOOPUV); | int layer = CustomData_get_active_layer(cd_ldata, CD_PROP_FLOAT2); | ||||
| if (layer != -1) { | if (layer != -1) { | ||||
| cd_used->uv |= (1 << layer); | cd_used->uv |= (1 << layer); | ||||
| } | } | ||||
| } | } | ||||
| static void mesh_cd_calc_active_mask_uv_layer(const Object *object, | static void mesh_cd_calc_active_mask_uv_layer(const Object *object, | ||||
| const Mesh *me, | const Mesh *me, | ||||
| DRW_MeshCDMask *cd_used) | DRW_MeshCDMask *cd_used) | ||||
| { | { | ||||
| const Mesh *me_final = editmesh_final_or_this(object, me); | const Mesh *me_final = editmesh_final_or_this(object, me); | ||||
| const CustomData *cd_ldata = mesh_cd_ldata_get_from_mesh(me_final); | const CustomData *cd_ldata = mesh_cd_ldata_get_from_mesh(me_final); | ||||
| int layer = CustomData_get_stencil_layer(cd_ldata, CD_MLOOPUV); | int layer = CustomData_get_stencil_layer(cd_ldata, CD_PROP_FLOAT2); | ||||
| if (layer != -1) { | if (layer != -1) { | ||||
| cd_used->uv |= (1 << layer); | cd_used->uv |= (1 << layer); | ||||
| } | } | ||||
| } | } | ||||
| static DRW_MeshCDMask mesh_cd_calc_used_gpu_layers(const Object *object, | static DRW_MeshCDMask mesh_cd_calc_used_gpu_layers(const Object *object, | ||||
| const Mesh *me, | const Mesh *me, | ||||
| struct GPUMaterial **gpumat_array, | struct GPUMaterial **gpumat_array, | ||||
| Show All 31 Lines | LISTBASE_FOREACH (GPUMaterialAttribute *, gpu_attr, &gpu_attrs) { | ||||
| } | } | ||||
| if (type == CD_AUTO_FROM_NAME) { | if (type == CD_AUTO_FROM_NAME) { | ||||
| /* We need to deduce what exact layer is used. | /* We need to deduce what exact layer is used. | ||||
| * | * | ||||
| * We do it based on the specified name. | * We do it based on the specified name. | ||||
| */ | */ | ||||
| if (name[0] != '\0') { | if (name[0] != '\0') { | ||||
| layer = CustomData_get_named_layer(cd_ldata, CD_MLOOPUV, name); | layer = CustomData_get_named_layer(cd_ldata, CD_PROP_FLOAT2, name); | ||||
| type = CD_MTFACE; | type = CD_MTFACE; | ||||
| #if 0 /* Tangents are always from UV's - this will never happen. */ | #if 0 /* Tangents are always from UV's - this will never happen. */ | ||||
| if (layer == -1) { | if (layer == -1) { | ||||
| layer = CustomData_get_named_layer(cd_ldata, CD_TANGENT, name); | layer = CustomData_get_named_layer(cd_ldata, CD_TANGENT, name); | ||||
| type = CD_TANGENT; | type = CD_TANGENT; | ||||
| } | } | ||||
| #endif | #endif | ||||
| Show All 25 Lines | #endif | ||||
| /* Fall back to the UV layer, which matches old behavior. */ | /* Fall back to the UV layer, which matches old behavior. */ | ||||
| type = CD_MTFACE; | type = CD_MTFACE; | ||||
| } | } | ||||
| } | } | ||||
| switch (type) { | switch (type) { | ||||
| case CD_MTFACE: { | case CD_MTFACE: { | ||||
| if (layer == -1) { | if (layer == -1) { | ||||
| layer = (name[0] != '\0') ? CustomData_get_named_layer(cd_ldata, CD_MLOOPUV, name) : | layer = (name[0] != '\0') ? | ||||
| CustomData_get_render_layer(cd_ldata, CD_MLOOPUV); | CustomData_get_named_layer(cd_ldata, CD_PROP_FLOAT2, name) : | ||||
| CustomData_get_render_layer(cd_ldata, CD_PROP_FLOAT2); | |||||
| } | } | ||||
| if (layer != -1) { | if (layer != -1) { | ||||
| cd_used.uv |= (1 << layer); | cd_used.uv |= (1 << layer); | ||||
| } | } | ||||
| break; | break; | ||||
| } | } | ||||
| case CD_TANGENT: { | case CD_TANGENT: { | ||||
| if (layer == -1) { | if (layer == -1) { | ||||
| layer = (name[0] != '\0') ? CustomData_get_named_layer(cd_ldata, CD_MLOOPUV, name) : | layer = (name[0] != '\0') ? | ||||
| CustomData_get_render_layer(cd_ldata, CD_MLOOPUV); | CustomData_get_named_layer(cd_ldata, CD_PROP_FLOAT2, name) : | ||||
| CustomData_get_render_layer(cd_ldata, CD_PROP_FLOAT2); | |||||
| /* Only fallback to orco (below) when we have no UV layers, see: T56545 */ | /* Only fallback to orco (below) when we have no UV layers, see: T56545 */ | ||||
| if (layer == -1 && name[0] != '\0') { | if (layer == -1 && name[0] != '\0') { | ||||
| layer = CustomData_get_render_layer(cd_ldata, CD_MLOOPUV); | layer = CustomData_get_render_layer(cd_ldata, CD_PROP_FLOAT2); | ||||
| } | } | ||||
| } | } | ||||
| if (layer != -1) { | if (layer != -1) { | ||||
| cd_used.tan |= (1 << layer); | cd_used.tan |= (1 << layer); | ||||
| } | } | ||||
| else { | else { | ||||
| /* no UV layers at all => requesting orco */ | /* no UV layers at all => requesting orco */ | ||||
| cd_used.tan_orco = 1; | cd_used.tan_orco = 1; | ||||
| ▲ Show 20 Lines • Show All 1,573 Lines • Show Last 20 Lines | |||||