Set a lit mesh's material: ambient, diffuse, specular and emissive colors (rgba) and shininess (VSG's Phong: the ambient color scales the diffuse color reflected from ambient light). Returns 0, or -1 on failure (e.g. a mesh without a material).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(c_ptr), | intent(in) | :: | mesh |
mesh handle (vkf_mesh_create) |
||
| real(kind=c_float), | intent(in), | dimension(4) | :: | ambient |
colors (rgba, 0 to 1) |
|
| real(kind=c_float), | intent(in), | dimension(4) | :: | diffuse |
colors (rgba, 0 to 1) |
|
| real(kind=c_float), | intent(in), | dimension(4) | :: | specular |
colors (rgba, 0 to 1) |
|
| real(kind=c_float), | intent(in), | dimension(4) | :: | emissive |
colors (rgba, 0 to 1) |
|
| real(kind=c_float), | intent(in) | :: | shininess |
Phong exponent |
integer(c_int) function mesh_set_material(mesh, ambient, diffuse, specular, emissive, shininess) result(status) type(c_ptr), intent(in) :: mesh !! mesh handle (vkf_mesh_create) real(c_float), dimension(4), intent(in) :: ambient, diffuse, specular, emissive !! colors (rgba, 0 to 1) real(c_float), intent(in) :: shininess !! Phong exponent real(c_float), dimension(:), pointer :: m type(c_ptr) :: buffer buffer = vkf_mesh_material(mesh) if (.not. c_associated(buffer)) then status = -1 return end if call c_f_pointer(buffer, m, [19]) m(1:4) = ambient m(5:8) = diffuse m(9:12) = specular m(13:16) = emissive m(17) = shininess status = vkf_mesh_material_changed(mesh) end function mesh_set_material