The material (OpenFrames' setMaterial; each optional): ambient, diffuse, specular and emission colors ([r, g, b] or [r, g, b, a], 0 to 1) and shininess (0 to 128: the specular highlight's sharpness; 0 for none). The ambient and diffuse colors scale the body's color or texture (VSG's Phong); the specular color is reflected from the lights' specular parts. Defaults: ambient and diffuse white, no specular reflection or emission.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(Sphere), | intent(inout) | :: | self | |||
| real(kind=wp), | intent(in), | optional | :: | ambient(:) |
[r, g, b(, a)], 0 to 1 |
|
| real(kind=wp), | intent(in), | optional | :: | diffuse(:) |
[r, g, b(, a)], 0 to 1 |
|
| real(kind=wp), | intent(in), | optional | :: | specular(:) |
[r, g, b(, a)], 0 to 1 |
|
| real(kind=wp), | intent(in), | optional | :: | emission(:) |
[r, g, b(, a)], 0 to 1 |
|
| real(kind=wp), | intent(in), | optional | :: | shininess |
0 to 128 (< 0: 0) |
subroutine set_material(self, ambient, diffuse, specular, emission, shininess) class(Sphere), intent(inout) :: self real(wp), intent(in), optional :: ambient(:), diffuse(:), specular(:), emission(:) !! [r, g, b(, a)], 0 to 1 real(wp), intent(in), optional :: shininess !! 0 to 128 (< 0: 0) if (present(ambient)) self%ambient_(1:min(4, size(ambient))) = ambient(1:min(4, size(ambient))) if (present(diffuse)) self%diffuse_(1:min(4, size(diffuse))) = diffuse(1:min(4, size(diffuse))) if (present(specular)) self%specular_(1:min(4, size(specular))) = specular(1:min(4, size(specular))) if (present(emission)) self%emission_(1:min(4, size(emission))) = emission(1:min(4, size(emission))) if (present(shininess)) self%shininess_ = max(0.0_wp, shininess) call apply_material(self) end subroutine set_material