Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/workbench/workbench_materials.c
| Show First 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | void workbench_material_ubo_data(WORKBENCH_PrivateData *wpd, | ||||
| uint32_t packed_roughness = unit_float_to_uchar_clamp(roughness); | uint32_t packed_roughness = unit_float_to_uchar_clamp(roughness); | ||||
| uint32_t packed_alpha = unit_float_to_uchar_clamp(alpha); | uint32_t packed_alpha = unit_float_to_uchar_clamp(alpha); | ||||
| data->packed_data = (packed_alpha << 16u) | (packed_roughness << 8u) | packed_metallic; | data->packed_data = (packed_alpha << 16u) | (packed_roughness << 8u) | packed_metallic; | ||||
| } | } | ||||
| /* Return correct material or empty default material if slot is empty. */ | /* Return correct material or empty default material if slot is empty. */ | ||||
| BLI_INLINE Material *workbench_object_material_get(Object *ob, int mat_nr) | BLI_INLINE Material *workbench_object_material_get(Object *ob, int mat_nr) | ||||
| { | { | ||||
| Material *ma = BKE_object_material_get(ob, mat_nr); | Material *ma = BKE_object_material_get_eval(ob, mat_nr); | ||||
| if (ma == NULL) { | if (ma == NULL) { | ||||
| ma = BKE_material_default_empty(); | ma = BKE_material_default_empty(); | ||||
| } | } | ||||
| return ma; | return ma; | ||||
| } | } | ||||
| BLI_INLINE void workbench_material_get_image( | BLI_INLINE void workbench_material_get_image( | ||||
| Object *ob, int mat_nr, Image **r_image, ImageUser **r_iuser, eGPUSamplerState *r_sampler) | Object *ob, int mat_nr, Image **r_image, ImageUser **r_iuser, eGPUSamplerState *r_sampler) | ||||
| ▲ Show 20 Lines • Show All 194 Lines • Show Last 20 Lines | |||||