The material, with the diffuse color times the body's color (without a
texture), and the twilight, on mesh mesh (if not null).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(Sphere), | intent(in) | :: | self | |||
| type(c_ptr), | intent(in) | :: | mesh |
a mesh handle (null: nothing done) |
subroutine apply_material_to(self, mesh) type(Sphere), intent(in) :: self type(c_ptr), intent(in) :: mesh !! a mesh handle (null: nothing done) real(wp) :: diffuse(4) if (.not. c_associated(mesh)) return diffuse = self%diffuse_ if (.not. self%textured) diffuse = diffuse * self%color() if (self%translucent) diffuse(4) = diffuse(4) * self%opacity_ ! (the shader's alpha: the diffuse color's) if (mesh_set_material(mesh, real(self%ambient_, c_float), real(diffuse, c_float), & real(self%specular_, c_float), real(self%emission_, c_float), & real(self%shininess_, c_float)) /= 0) & write(*, '(a)') 'vkframes: Sphere '//self%name()//': could not set the material' if (vkf_mesh_set_twilight(mesh, real(self%twilight_, c_float)) /= 0) & write(*, '(a)') 'vkframes: Sphere '//self%name()//': could not set the twilight' end subroutine apply_material_to