Maintainer | diagrams-discuss@googlegroups.com |
---|---|
Safe Haskell | None |
Diagrams may have attributes which affect the way they are rendered. This module defines some common attributes relevant in 3D; particular backends may also define more backend-specific attributes.
Every attribute type must have a semigroup structure, that is, an
associative binary operation for combining two attributes into one.
Unless otherwise noted, all the attributes defined here use the
Last
structure, that is, combining two attributes simply keeps
the second one and throws away the first. This means that child
attributes always override parent attributes.
- newtype SurfaceColor = SurfaceColor (Last (Colour Double))
- surfaceColor :: Iso' SurfaceColor (Colour Double)
- sc :: HasStyle d => Colour Double -> d -> d
- newtype Diffuse = Diffuse (Last Double)
- _Diffuse :: Iso' Diffuse Double
- diffuse :: HasStyle d => Double -> d -> d
- newtype Ambient = Ambient (Last Double)
- _Ambient :: Iso' Ambient Double
- ambient :: HasStyle d => Double -> d -> d
- data Specular = Specular {}
- specularSize :: Lens' Specular Double
- specularIntensity :: Lens' Specular Double
- newtype Highlight = Highlight (Last Specular)
- _Highlight :: Iso' Highlight Specular
- highlight :: HasStyle d => Specular -> d -> d
Documentation
newtype SurfaceColor Source
SurfaceColor
is the inherent pigment of an object, assumed to
be opaque.
SurfaceColor (Last (Colour Double)) |
Diffuse
is the fraction of incident light reflected diffusely,
that is, in all directions. The actual light reflected is the
product of this value, the incident light, and the SurfaceColor
Attribute. For physical reasonableness, Diffuse
should have a
value between 0 and 1; this is not checked.
Ambient
is an ad-hoc representation of indirect lighting. The
product of Ambient
and SurfaceColor
is added to the light
leaving an object due to diffuse and specular terms. Ambient
can
be set per-object, and can be loosely thought of as the product of
indirect lighting incident on that object and the diffuse
reflectance.
A specular highlight has two terms, the intensity, between 0 and
1, and the size. The highlight size is assumed to be the exponent
in a Phong shading model (though Backends are free to use a
different shading model). In this model, reasonable values are
between 1 and 50 or so, with higher values for shinier objects.
Physically, the intensity and the value of Diffuse
must add up to
less than 1; this is not enforced.