| 181 | } |
| 182 | |
| 183 | void MaterialBase::updateBuiltInMaterial(MaterialBase& mtl) |
| 184 | { |
| 185 | // A built-in material is considered opaque if all the opacity components are 1.0, there is no |
| 186 | // opacity image, and transmission is zero. |
| 187 | static vec3 kOpaque(1.0f); |
| 188 | vec3 opacity = mtl.uniformBuffer().get<vec3>("opacity"); |
| 189 | bool hasOpacityImage = mtl.textures().getTexture("opacity_image") ? 1 : 0; |
| 190 | float transmission = mtl.uniformBuffer().get<float>("transmission"); |
| 191 | mtl.setIsOpaque(opacity == kOpaque && !hasOpacityImage && transmission == 0.0f); |
| 192 | |
| 193 | // Set the image flags used by built-in materials. |
| 194 | mtl.uniformBuffer().set( |
| 195 | "has_base_color_image", mtl.textures().getTexture("base_color_image") ? true : false); |
| 196 | mtl.uniformBuffer().set("has_specular_roughness_image", |
| 197 | mtl.textures().getTexture("specular_roughness_image") ? true : false); |
| 198 | mtl.uniformBuffer().set("has_emission_color_image", |
| 199 | mtl.textures().getTexture("emission_color_image") ? true : false); |
| 200 | mtl.uniformBuffer().set( |
| 201 | "has_opacity_image", mtl.textures().getTexture("opacity_image") ? true : false); |
| 202 | mtl.uniformBuffer().set( |
| 203 | "has_normal_image", mtl.textures().getTexture("normal_image") ? true : false); |
| 204 | } |
| 205 | |
| 206 | END_AURORA |
nothing calls this directly
no test coverage detected