Welcome to mirror list, hosted at ThFree Co, Russian Federation.

workbench_material_lib.glsl « shaders « workbench « engines « draw « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b6dc26ecc6591cf3ec1b0d44baed598428522121 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13

void workbench_material_data_get(
    int handle, out vec3 color, out float alpha, out float roughness, out float metallic)
{
  handle = (materialIndex != -1) ? materialIndex : handle;
  vec4 data = materials_data[uint(handle) & 0xFFFu];
  color = data.rgb;

  uint encoded_data = floatBitsToUint(data.w);
  alpha = float((encoded_data >> 16u) & 0xFFu) * (1.0 / 255.0);
  roughness = float((encoded_data >> 8u) & 0xFFu) * (1.0 / 255.0);
  metallic = float(encoded_data & 0xFFu) * (1.0 / 255.0);
}